// ==UserScript==
// @name IMDb Face Cake - get a better look at actor images
// @namespace driver8.net
// @description Make people's faces larger when you hover over their names on IMDb title pages
// @match *://*.imdb.com/title/tt*/reference
// @match *://*.imdb.com/title/tt*/
// @version 0.2.1
// @grant GM_addStyle
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @downloadURL none
// ==/UserScript==
var MULT = 8;
var IMG_WIDTH = 23 * MULT;
var IMG_HEIGHT = 30 * MULT;
var OFFSET_TOP = -40;
var OFFSET_LEFT = -6;
var LEFT_SIDE = true;
var LOGGING = false;
var AND_BUTTS = false;
function log(msg) {
if (LOGGING) console.log(msg);
}
AND_BUTTS && $('#tn15title > h1 > span:first').before($('
and Butts
').css({'display': 'inline'}));
var bigImages = [];
var bigDivs = [];
//var $rows = $('table.cast tr.odd, table.cast tr.even');
var $rows = $('table.cast, table.cast_list').find('tr.odd, tr.even');
function setUp() {
$rows.each(function(idx) {
var $hovaImg, $hovaDiv;
var $el = $(this);
var $hsImg = $el.find('td.hs img, td.primary_photo img');
var hsSrc = $hsImg.attr('src');
hsSrc = hsSrc.replace(/http:\/\/ia\.media-imdb\.com\/images\/([a-zA-Z0-9@]\/[a-zA-Z0-9@]+)\._V[0-9].+\.jpg/,
'http://ia.media-imdb.com/images/$1._SX' + IMG_WIDTH + '_.jpg');
$hovaImg = $('
').attr('src', hsSrc);
$hovaDiv = $('');
$hovaDiv.append($hovaImg);
$hovaDiv.attr('id', 'hova' + idx);
$hovaDiv.addClass('hovaImg');
var pos = $el.offset();
var newPos = { 'top': pos.top + OFFSET_TOP, 'left': pos.left + OFFSET_LEFT - IMG_WIDTH };
if (!LEFT_SIDE) {
var trWidth = $el.outerWidth();
newPos = { 'top': pos.top + OFFSET_TOP, 'left': pos.left - OFFSET_LEFT + trWidth };
}
$hovaDiv.offset(newPos);
$hovaDiv.hide();
$('body').append($hovaDiv);
bigDivs[idx] = $hovaDiv;
});
}
$rows.each(function(idx) {
var $el = $(this);
$el.mouseenter(function rowMOver() {
$el.addClass('trHova');
if (!bigDivs[idx]) {
setUp();
}
bigDivs[idx].show();
});
$el.mouseleave(function rowMOut() {
$el.removeClass('trHova');
bigDivs[idx].hide();
});
});
// @match *://*.imdb.com/title/tt*/reference
var userStyles =
".hovaImg { " +
"position: absolute;" +
"padding: 0px;" +
"border-style: solid;" +
"border-width: 2px;" +
// "border-color: #00FF00;" +
"border-color: #AAAAFF;" +
"}" +
".hovaImg img {" +
"width: " + IMG_WIDTH + "px;" +
"display: block;" +
"}" +
"img.hovaHide {" +
"display: none;" +
"}" +
"tr.trHova {" +
"background-color: #AAAAFF !important;" +
"}" +
"div#tn15content div.info div.info-content.block {" +
//"width: 90% !important;" +
"}" +
"td.hs img {" +
"height: auto !important;" +
"width: auto !important;" +
"max-width: 23px !important;" +
"max-height: 32px !important;" +
"}" +
"";
GM_addStyle(userStyles);