Facebook photo magnifier

By Tim McCormack Last update Dec 14, 2006 — Installed 20,995 times.
// ==UserScript==
// @name            Facebook photo magnifier
// @namespace       tag:brainonfire.net,2006-12-14:facebookphotozoom
// @description     Magnifies photos in Facebook search results that the user would not ordinarily be allowed to see. Currently, nothing fancy, just makes the photo thumbnail of each off-limits profile clickable for the normal-sized version.
// @include         http://*.facebook.com/*
// ==/UserScript==

var rez = document.getElementById("search_results");
if(rez)
{
	var imgs = rez.getElementsByTagName('img');
	if(imgs.length)
	{
		var img = undefined;
		var link = undefined;
		var par = undefined;
		var href = undefined;
		for(var i=0; i<imgs.length; i++)
		{
			img = imgs[i];
			par = img.parentNode;
			if(par.tagName.toLowerCase() === 'div')
			{
				href = img.getAttribute('src');
				href = href.replace(/\/s([0-9_]+)\.jpg$/, "/n$1.jpg");
				link = document.createElement('a');
				link.setAttribute('title', "Larger version, courtesy of facebook-photo-magnifier-0.1.user.js");
				link.setAttribute('href', href);
				par.removeChild(img);
				par.appendChild(link);
				link.appendChild(img);
			}
		}
	}
}