Craigslist Hover

Show posts in a popup upon hover.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

// ==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;});
})();