// ==UserScript== // @name diff from Google Cache // @namespace http://labs.cybozu.co.jp/blog/nakatani/ // @author Nakatani Shuyo / Cybozu Labs, Inc. // @include * // ==/UserScript== $=function(id){return document.getElementById(id);} var CacheDiff = { init:function(){ GM_addStyle([ "#difftext_area{position:absolute;left:5%;width:90%;background-color:#ccc;opacity:0.8;z-index:100;}", "#difftext_mes{border:2px solid black;text-align:center;}", ".diff_head{width:50%;text-align:center;border:2px solid #fff;background-color:#ccc;}", ".diff_text{text-align:left;border:2px solid #fff;background-color:#ccc;}", ".diff_ins{background-color:#f80;}", ".diff_del{background-color:#ff0;}", ].join(' ')); GM_registerMenuCommand("diff from Google Cache",CacheDiff.proc); }, proc: function(){ CacheDiff.current_text = document.body.innerHTML.replace(/\s+/g,' ') var url = escape(location.href.replace(/^https?:\/\//,'')) GM_xmlhttpRequest({ method: 'GET', url: "http://www.google.com/search?q=cache:"+url+"&strip=1", onload: function(res){ if(res.status==200){ var html = res.responseText; if (html.match(/