tt25 (owner)

Revisions

gist: 38602 Download_button fork
public
Public Clone URL: git://gist.github.com/38602.git
Embed All Files: show embed
JavaScript #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(function(){
  var xhr=new XMLHttpRequest();
  xhr.open("HEAD",location.href);
  xhr.onreadystatechange=function(){
    if(this.readyState==4 && this.status > 400 && this.status < 500){ // return HTTP 4xx status
      var url=location.href;
      var links={
        "google": "http://www.google.com/search?q=cache:"+url,
        "gyotaku": "http://megalodon.jp/fish.php?url="+url,
        "wayback machine":"http://web.archive.org/web/*/"+url
      };
      var a=[];
      for(var name in links){
        a.push([
          '<a href="',links[name],'">',name,'</a>'
        ].join(""));
      }
      document.body.innerHTML+=[
        '<div style="position:fixed;top:0;left:0;background:#ddd;">',a.join("<br/>"),'</div>'
      ].join("");
    }
  }
  xhr.send(null);
 
})();