// ==UserScript== // @name Google Cache Continue // @namespace htt://rephrase.net/box/user-js/ // @description Rewrite links in Google Cache pages to others within the cache. // @include http://\d+\.\d+\.\d+\.\d+\/search\?q=cache:* // ==/UserScript== (function() { var links = document.evaluate("//a[@href]", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); var link, i; for (link = null, i = 0; (link = links.snapshotItem(i)); i++) { if (link.href.substr(0, 5) == "http:") { link.href = getCacheURL(link.href); } } function getCacheURL(url) { if (url.match(/\d+\.\d+\.\d+\.\d+\/search\?q=cache:/)) { return url; } if (url.indexOf("#") > -1) { return document.location.href.split("#")[0] + "#" + url.split("#")[1]; } return 'http://www.google.com/search?q=cache:' + url; } })();