Uncle Henry's Thumbnails in Search

By JoeSimmons Last update Aug 20, 2009 — Installed 62 times.

There are 1 previous version of this script.

// ==UserScript==
// @name           Uncle Henry's Thumbnails in Search
// @namespace      http://userscripts.org/users/23652
// @description    Shows thumbnails beside search results
// @include        http://www.unclehenrys.com/Classifieds/Search/Results.aspx?*
// @copyright      JoeSimmons
// @version        1.0.0
// @license        Creative Commons Attribution-Noncommercial 3.0 United States License
// @require        http://userscripts.org/scripts/source/51532.user.js
// ==/UserScript==

// get() function by JoeSimmons
// Syntax: get('http://www.google.com/', handleResponse);
function get(url, i, cb) {
GM_xmlhttpRequest({
	img: i,
    method: 'GET',
    url: url,
    //headers: {'Accept': 'application/atom+xml,application/xml,text/xml,text/html'},
    onload: function(r) {cb(r, this.img);}
});
}

(function(){
var imgs = $g("//a[@title='Picture Attachments' and contains(@href,'ExhibitDetail')]/img[@alt='Picture Attachments']/.."),
	img_re = /\/Images\/Uploads\/AdAttachments\/Picture\/\d+\.jpg/,
	protocol = window.location.protocol,
	host = window.location.host;
for(var i=imgs.snapshotLength-1,item; (item=imgs.snapshotItem(i)); i--) {
get(item.href, item.firstChild, function(r, img) {
img.parentNode.setAttribute("target", "_blank");
img.setAttribute("src", "http://www.unclehenrys.com"+(r.responseText.indexOf("/Images/Uploads/AdAttachments/Picture/")!=-1?r.responseText.match(img_re)[0]:"/images/camera.gif"));
img.setAttribute("style", "max-width:120px !important; max-height:"+(img.parentNode.parentNode.offsetHeight*.95)+"px !important;");
});
}
})();