// // Copyright (c) 2005-2006 David Terrell // // ==UserScript== // @name Fix Yahoo Links // @namespace http://meat.net/ // @description Fix the ugly _yl=... junk in yahoo links. // @include http://*.yahoo.com/* // ==/UserScript== var url, re, re2; url = window.location.href; re = new RegExp(';_yl.=[^;?/]+','g'); re2 = new RegExp('http://(us.rd|us.ard|rds).yahoo.com/.*\\*-?http(%3A|:)','g'); url = url.replace(re, ''); // avoid infinite loop if (window.location.href != url) { window.location.href = url; } else { var allLinks, thisLink, href; allLinks = document.evaluate( '//a[@href]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < allLinks.snapshotLength; i++) { thisLink = allLinks.snapshotItem(i); href = thisLink.href; if (href.match(re2)) { thisLink.href = href.replace(re2, 'http:'); } else if (href.match(/http:\/\/[^\/]+\.yahoo\.com\/.*/i)) { url = href.replace(re, ''); if (url != href) { //GM_log("link change " + thisLink.href + " -> " + url); thisLink.href = url; } } } }