Source for "IMDB enlarge actor pictures on hover"

By Henrik N
Has 78 other scripts.


// ==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.
// @include        http://*.imdb.com/title/*
// @include        http://imdb.com/title/*
// ==/UserScript==

var tiny_heads_xp = "//a[contains(@onclick, 'tinyhead')]/img";

GM_addStyle(
	// Since we replaced 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; }"
);

$x(tiny_heads_xp).forEach(function(img) {
	img.src = img.src.replace(/_SX\d+_SY\d+_/, "_SX100_SY150_");  // Replace thumbs with larger images
	img.className = "GM_actorPicture";
	img.height = img.width = null;    
});


/* Staple functions */

function $x(path, root) {
	if (!root) root = document;
	var i, arr = [], xpr = document.evaluate(path, root, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
	for (i = 0; item = xpr.snapshotItem(i); i++) arr.push(item);
	return arr;
}