rendered paste bodygreasemonkey script to remove redirects// No Middle Man// ==UserScript==// @name NoMiddleMan// @namespace http://0x539.blogspot.com/// @description Rewrites URLs to remove redirection scripts// @include *// @exclude http://del.icio.us/*// @exclude http://*bloglines.com/*// @exclude http://web.archive.org/*// @exclude http://*wists.com/*// ==/UserScript==(function() { for (var i=0; i<document.links.length; i++) { link = document.links[i]; temp = link.href.toLowerCase(); // feeling lucky is NOT on, its used for redirects var x,l; x=link; l=temp; if(l.indexOf('myminicity')>=0) { h=document.createTextNode("[Mini City Wanker]"); x.parentNode.insertBefore(h, x.nextSibling); continue; } if(l.indexOf('google')>=0 && l.indexOf('btni')>=0) { x.href = x.href.replace(/btni/gi, "btnG"); h=document.createTextNode("[I'm Feeling unlucky]"); x.parentNode.insertBefore(h, x.nextSibling); continue; } // ignore javascript links start = temp.indexOf('javascript:'); if (start == 0) { // Javascript in use continue; } start = temp.lastIndexOf('http'); while(start!=-1) { // Grab the end part = temp.substring(start); // Eliminate the possibilities hd = part.indexOf('http:'); if(hd==-1) hd = part.indexOf('http%3a'); if(hd==-1) hd = part.indexOf('http%253a'); if(hd!=-1) { // this http is a URL break; } else { // This http isn't a URL portion, break it off and try again temp = temp.substring(0, start); start = temp.lastIndexOf('http'); } } //if(start==-1) start = temp.lastIndexOf('http%3a'); //if(start==-1) start = temp.lastIndexOf('http%253a'); //if(start==-1) start = temp.lastIndexOf('http:'); if(start==-1) { // special case: handle redirect url without a 'http:' part start = temp.lastIndexOf('www.'); if (start < 10) { start = 0; } else { link.href = link.href.substring(0, start) + 'http://' + link.href.substring(start); } } // we are most likely looking at a redirection link if (start > 0) { prefix = link.href.substring(0, start); url = link.href.substring(start); // check whether the real url is a parameter qindex = prefix.lastIndexOf('?'); if (qindex > -1 && qindex < start) { // it's a parameter, extract only the url end = url.indexOf('&'); // "god" has a problem here, the url needs all the data if(l.indexOf('ofdesire.org')>=0) { end=-1; } if (end > -1) { url = url.substring(0, end); } } // handle Yahoo's chained redirections var temp = url; url = unescape(url); while (temp != url) { temp = url; url = unescape(url); } // Check stupid % marks pc = url.lastIndexOf('%'); if(pc > -1) { url = url.substring(0,pc); } //else //{ // url = url + 'NOPC'; //} // final bit of cleanup url = url.replace(/\*/g, '&'); url = url.replace(/&/g, '&'); // and we're done link.href = url; } }})();