IMDb enlarge actor pictures on hover

By Henrik N Last update Jun 21, 2009 — Installed 12,603 times. Daily Installs: 5, 10, 8, 10, 11, 9, 6, 5, 8, 10, 9, 10, 8, 6, 2, 6, 3, 4, 9, 2, 11, 6, 6, 7, 6, 4, 8, 9, 9, 4, 6, 14

There are 5 previous versions of this script.

// ==UserScript==
// @name           IMDb enlarge actor pictures on hover
// @namespace      http://henrik.nyh.se
// @description    Enlarges actor pictures in IMDb cast lists when you hover over that table row. Compatible with Greasemonkey and GreaseKit.
// @include        http://*.imdb.com/title/*
// @include        http://imdb.com/title/*
// ==/UserScript==

function jQueryIsReady($) {
  
  GM_addStyle(
    // Since we replace thumbs with medium images and removed width/height, keep them small this way
    "img.GM_actorPicture { height:32px; width:22px; }" +
    // Enlarge on hover
    "tr:hover a img.GM_actorPicture { height:auto; width:100px; position:absolute; margin-left:-77px; margin-top:-51px; }"
  );
  
  $("a[onclick*=tinyhead] img").each(function() {
    $(this).addClass('GM_actorPicture');
    this.src = this.src.replace(/_SY\d+_SX\d+_/, "_SX100_SY150_");  // Replace thumbs with larger images
    this.height = this.width = null;
  });
  
}


// ----------------------------------------------------------------------
// Greasemonkey/GreaseKit compatibility
// ----------------------------------------------------------------------

if (typeof(unsafeWindow) === 'undefined') {
 unsafeWindow = window;
}

// Based on http://userscripts.org/topics/1912
if (typeof(GM_addStyle) === "undefined") {
  GM_addStyle = function(styles) {
    var oStyle = document.createElement("style");
    oStyle.setAttribute("type", "text/css");
    oStyle.appendChild(document.createTextNode(styles));
    document.getElementsByTagName("head")[0].appendChild(oStyle);
  }
}


// ----------------------------------------------------------------------
// jQuery
// ----------------------------------------------------------------------

var script = document.createElement('script');
script.src = 'http://jquery.com/src/jquery-latest.js';
script.type = 'text/javascript';
script.addEventListener("load", function() {
  jQueryIsReady(unsafeWindow.jQuery);
}, false);
document.getElementsByTagName('head')[0].appendChild(script);