Image Preview hack

By treas0n Last update Jul 28, 2010 — Installed 649 times.

There are 12 previous versions of this script.

// ==UserScript==
// @name           Image Preview hack
// @namespace      http://nowhere.man
// @description    Image Preview No Mouse over
// @include        http://*rip.to/*
// @include        http://*rip-productions.net/*
// ==/UserScript==


window.addEventListener("load", init, false);

function init() {
	var xpath = "//a[@onmouseout='return nd();']";
	var threads =document.evaluate(xpath,document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
	for (var i = 0; i < threads.snapshotLength; i++)
		{
			var entireRow = threads.snapshotItem(i);
			
			var str = entireRow.getAttribute("onmouseover")
			var tid = entireRow.getAttribute("ID")
			tid = tid.substr(tid.lastIndexOf("_"));
			entireRow.setAttribute("onmouseoout", "javascript:void(0)")
			entireRow.setAttribute("onmouseover", "javascript:void(0)")
			
			//re = /http:\/\/img\d{2,5}.imagevenue.com\/loc\d{2,5}\/th_\w+.JPG/gim; OLD
			re = /http:\/\/img\d{2,5}.imagevenue.com+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?/gim //From http://regexlib.com/REDetails.aspx?regexp_id=96
			re2 = /imagevenue.com\/loc(\d){2,5}\/th_/gi;
			IB = /http:\/\/thumbnails\d{1,5}.imagebam\.com\/\d{1,9}.\/\w+.\w+/gim;  
			
			if (re.test(str)) {
				
				var tn = str.match(re);
				var newstr='';
				for (var x=0; x<tn.length; x++){
					newstr=newstr+'<a href='+tn[x].replace(re2,'imagevenue.com/img.php?image=')+' target=_blank><img style="border: 1px solid #CFCFCF; margin-left:3px; float:left;min-height:135px; max-height:135px; max-width:130px; padding: 3px; background-color:#F5F5FF;" src='+tn[x]+'></a>'
				}

				str=newstr;
				var prev = document.createElement("iframe");
				prev.setAttribute("src", "javascript:document.innerHTML='" + str + "';");
	 			prev.setAttribute("frameborder", "no");
	 			prev.setAttribute("scrolling", "no");
	 			prev.setAttribute("width", "100%");
	 			prev.setAttribute("style", "margin-left: 50px;padding-bottom: 10px");
				prev.setAttribute("height", "160px");
				var cDiv = document.createElement("div");
				cDiv.setAttribute("class", "nonsticky");
				cDiv.appendChild(prev);
 				entireRow.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(cDiv);

			} else {
				if (IB.test(str)) {
					//GM_log(str);
					var tn = str.match(IB);
					var newstr='';
					for (var x=0; x<tn.length; x++){
						//GM_log(tn[x]);
						newstr=newstr+'<a href=http://www.imagebam.com/image'+ tn[x].substring(tn[x].lastIndexOf("/"), tn[x].lastIndexOf("."))  +' target=_blank><img style="border: 1px solid #CFCFCF; margin-left:3px; float:left;min-height:135px; max-height:135px; max-width:130px; padding: 3px; background-color:#F5F5FF;" src='+tn[x]+'></a>'
					}
					str=newstr;
					var prev = document.createElement("iframe");
					prev.setAttribute("src", "javascript:document.innerHTML='" + str + "';");
		 			prev.setAttribute("frameborder", "no");
		 			prev.setAttribute("scrolling", "no");
		 			prev.setAttribute("width", "100%");
					prev.setAttribute("height", "160px");
					prev.setAttribute("style", "margin-left: 50px;padding-bottom: 10px");
					var cDiv = document.createElement("div");
					cDiv.setAttribute("class", "nonsticky")
					cDiv.appendChild(prev);
	 				entireRow.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(cDiv);
					
				} else {
					//GM_log(str);
					str = str.replace(/\'/g,"'");
					str = str.replace(/style/g, "foobar");
					str = str.replace(/resizeimage/g, "border: none; min-height:135px; max-height:135px; max-width:130px; padding: 5px; float:left;background-color:#F5F5FF;");
					str = str.replace(/class/g, "style");
					str = str.replace(/onload/g, "foobar");
					str = str.substr(27);
					str = str.substr(0, str.length-3);
					//GM_log(str);
					
					var prev = document.createElement("iframe");
					prev.setAttribute("src", "javascript:document.innerHTML=\"" + str + "\";");
		 			prev.setAttribute("frameborder", "no");
		 			prev.setAttribute("scrolling", "no");
		 			prev.setAttribute("width", "100%");
					prev.setAttribute("height", "160px");
					prev.setAttribute("style", "margin-left: 50px;padding-bottom: 10px");
					var cDiv = document.createElement("div");
					cDiv.setAttribute("class", "nonsticky")
					cDiv.appendChild(prev);
	 				entireRow.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(cDiv);
				}
			}
			
		}
	
}