Created
April 7, 2010 17:11
-
-
Save bga/359141 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 404cache | |
// @author Bga | |
// @version 0.11 | |
// @description improve 404 default opera page by adding links to google and yandex cache | |
// ==/UserScript== | |
document.addEventListener("DOMContentLoaded",function(){ | |
var $d = document, $h, v, vs, s, cs, c; | |
var is404 = (vs = $d.getElementsByTagName('head')).length > 0 && ($h = vs[0]) && (vs = $h.getElementsByTagName('link')).length === 1 && (v = vs[0]) && v.getAttribute('rel') === 'stylesheet' && v.href && v.href.substr(0, 17) === 'file://localhost/' && v.href.slice(-9) === 'error.css' /* && (s = v.sheet) && (cs = s.cssRules).length > 1 && (c = cs.item(1)) && c.type === CSSRule.IMPORT_RULE && c.href === 'opera.css'*/; | |
if(!is404) | |
return; | |
var $b = $d.body, ul = $b.getElementsByTagName('ul')[0]; | |
var li = $d.createElement('li'); | |
li.innerHTML = 'Try load from cache <a href="http://webcache.googleusercontent.com/search?q=cache%3A' + encodeURIComponent("" + location) + '">Google</a>, <a href="http://hghltd.yandex.net/yandbtm?url=' + encodeURIComponent("" + location) + '" >Yandex</a>'; | |
ul.insertBefore(li, ul.firstChild); | |
},true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment