There are 4 previous versions of this script.
// ==UserScript==
// @name googlePrivacy
// @namespace download
// @description Gets rid of almost every google tracking device including tracking cookies without killing your preferences.
// @include http://*.google.com/search?*
// @include http://www.google.com/*
// @include http://www.google.*
// @include http://google.com/*
// @include http://google.*
// ==/UserScript==
/*
Replaces Search-Session cookies with garbage data.
Replaces Prefence-based tracking cookies with made up ones that give false data, while keeping your preferences intact.
Removes the code that has all links bounce off of google's servers before going to your destination.
Translates the google search results urls so they don't redirect through the google loggers.
*/
if(!unsafeWindow.google) return;
delete unsafeWindow.google;
delete unsafeWindow.clk;
unsafeWindow.gbar.tg=function(a)
{
var c=0,d=document.getElementById("gbi"),e=a.target||a.srcElement;
a.cancelBubble=true;
if(e.className!="gb3") e=e.parentNode;
do c+=e.offsetLeft;
while(e=e.offsetParent);
d.style.left=c+"px";
d.style.visibility="visible";
return false;
}
function closeDrop(e)
{
var d=document.getElementById("gbi");
d.style.left="0px";
d.style.visibility="hidden";
return false;
}
document.addEventListener("click",closeDrop,false);
function genHexStr(len)
{
var str='';
for(i=0;i<len;i++) str+=Math.floor(Math.random()*16).toString(16);
return str;
}
function getCookie(name)
{
var cookies=document.cookie.split("; ");
for(i in cookies)
{
if(cookies[i].indexOf(name+"=")==0) return cookies[i].split(name+"=")[1];
}
}
function getGooglePref(name)
{
var cookies=getCookie("PREF").split(":");
for(i in cookies)
{
if(cookies[i].indexOf(name+"=")==0) return cookies[i].split(name+"=")[1];
}
}
var pref="";
pref+=getGooglePref("NR")?":NR="+getGooglePref("NR"):"";
pref+=getGooglePref("NW")?":NW="+getGooglePref("NW"):"";
pref+=getGooglePref("LD")?":LD="+getGooglePref("LD"):"";
pref+=getGooglePref("LR")?":LR="+getGooglePref("LR"):"";
pref+=getGooglePref("FF")?":FF="+getGooglePref("FF"):"";
unsafeWindow.document.cookie="SNID=27="+genHexStr(58)+"; path=/verify; domain=.google.com";
unsafeWindow.document.cookie="NID=27="+genHexStr(129)+"; path=/; domain=.google.com";
unsafeWindow.document.cookie="id=OPT_OUT; path=/; domain=.doubleclick.net; expires=Wednesday, 09-Nov-2030 23:59:00 GMT";
unsafeWindow.document.cookie="SS="+genHexStr(16)+"; path=/search";
var t=Math.floor(new Date().getTime()/1000)
var TM=Math.floor(t-(Math.random()*5000));
var LM=Math.floor(t-(Math.random()*5000));
unsafeWindow.document.cookie="PREF=ID="+genHexStr(16)+":TM="+TM+":LM="+LM+":S="+genHexStr(16)+pref+"; path=/; domain=.google.com";
var p=document.getElementById('tads');
try{p.parentNode.removeChild(p)}catch(e){};
var e=document.evaluate("//table[@class='ra']",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
if(e) e.parentNode.removeChild(e); //remove the ads table
var e=document.getElementsByTagName("a");
var e=document.evaluate("//a[starts-with(@href,'/url?q=')]",document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
for(i=0;i<e.snapshotLength;i++)
{
var ce=e.snapshotItem(i);
var url=ce.getAttribute("href");
ce.setAttribute("href",decodeURI(url.substr(7,url.indexOf("&")-7)));
}
var e=document.evaluate("//a[starts-with(@onmousedown,'return') or starts-with(@onmouseup,'return') or starts-with(@onclick,'return')]",document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
for(i=0;i<e.snapshotLength;i++)
{
var ce=e.snapshotItem(i);
ce.removeAttribute("onclick");
ce.removeAttribute("onmouseup");
ce.removeAttribute("onmousedown");
}
document.evaluate("//input[@type='text' and @name='q']",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue.focus();
