Skip to content

Instantly share code, notes, and snippets.

@ino46
Created January 20, 2011 02:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ino46/787280 to your computer and use it in GitHub Desktop.
Clear Highlight for Google Cache
// title : Clear Highlight for Google Cache
// description :
// uuid : 2b5baf09-434f-4036-9e4f-022476094531
//bookmarklet
/*
javascript:(function(){if(window.location.hostname.indexOf("webcache.googleusercontent.com")===0){var a=window.location,b=encodeURI(decodeURI(a.href)),c=encodeURI(decodeURI(a.search)).split("&"),d=c[0].indexOf("+");if(d!==-1){var e=c[0].slice(0,d);b=b.replace(c[0],e);a.assign(b)}};})();
*/
//main
(function(){
if(window.location.hostname.indexOf('webcache.googleusercontent.com') !== 0) return;
var l = window.location;
var strUrl = encodeURI(decodeURI(l.href));
var lstQuery = encodeURI(decodeURI(l.search)).split('&');
var intIndexAND = lstQuery[0].indexOf('+');
if(intIndexAND === -1) return;
var strMinSearch = lstQuery[0].slice(0, intIndexAND);
strUrl = strUrl.replace(lstQuery[0], strMinSearch);
//console.log(strUrl);
l.assign(strUrl);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment