Craigslist Hover

Show posts in a popup upon hover.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        Craigslist Hover
// @namespace   clhover
// @description Show posts in a popup upon hover.
// @include     https://*.craigslist.tld/*search/*
// @include     https://*.craigslist.tld/*search/*
// @require     https://code.jquery.com/jquery-1.12.4.js
// @require     https://code.jquery.com/ui/1.12.1/jquery-ui.js
// @grant       none
// @version     0.1
// ==/UserScript==
(function() {
  var hovering = false;
  $('body').prepend(
    '<div id="d">' +
      '<iframe style="height:100%; width:100%" id="d_content" src=""></iframe>' +
    '</div>'
  );
  var d = $('#d');
  d.on('mouseleave', function() { d.dialog('close'); });
  d.dialog({
    'autoOpen': false,
    'width': 800,
    'modal': true,
    'height': 600,
    'closeText': '',
    'position': {my:'top', at:'top+50px', of: $('body')}
  });
  $('.ui-dialog').css({
    boxShadow: '0px 0px 8px 10px #aaa',
    zIndex: 9999
  });
  function popup(title, link) {
    if (hovering) {
      console.log("Hovering");
      var dif = $('#d_content').detach();
      dif.attr('src', link);
      dif.appendTo(d);
      d.dialog('option','title', title);
      d.dialog('open');
      hovering = false;
    }
  }
  $('.hdrlnk').hover(function(e) {
    hovering = true;
    var t = $(this);
    var p = t.closest('.result-info');
    setTimeout(function() {
      popup(p.find('.result-date').text() + ' - ' +
        p.find('.result-title').text() + ' - ' +
        p.find('.result-age').text() + ' - ' +
        p.find('.result-hood').text(),
        t.attr('href')
      );
    }, 1000);
  }, function() {hovering = false;});
})();