Source for "Google Anonymizer"

By Aquilax
Has 11 other scripts.


Add Syntax Highlighting (this will take a few seconds, probably freezing your browser while it works)

// ==UserScript==
// @name           Google Anonymizer
// @namespace      http://userscripts.org/users/28612
// @version        1.08.00
// @description   Anonymizes search requests to google and removes tracking systems on the results page. It transforms you into a ghost for google.
// @include        http://*.google.*
// ==/UserScript==

var ScriptInfos={
	name: "Google Anonymizer",
	version: "1.08.00",
	newVersionDays: 1,
	newVersionHandler: null,
	newVersionValueName: "NewVersionLastCheck",
	newVersionXPath: "//td[input[@name='q']]",
	newVersionStyle: "font-size: 12px; text-align: left;",
	newVersionHtmlId: "ScriptInfosNewVersion",
	homepageUrl: "http://userscripts.org/scripts/show/10448",
	sourceUrl: "http://userscripts.org/scripts/review/10448",
	installUrl: "http://userscripts.org/scripts/source/10448.user.js"};

anonymizeGoogle();

function anonymizeGoogle()
{
	GM_registerMenuCommand(ScriptInfos.name+" - Options",showOptions);
	
	try{
		//adding options to ScriptInfos
		ScriptInfos.options=new Object();
		Array.forEach(getAnonymizerOptions().split("&"),function(param){if (param.match(/(.*?)=(.*)/gmi)) ScriptInfos.options[RegExp.$1]=RegExp.$2=="on"?true:RegExp.$2;});
		
		//To do it only on the results page or to do it always? That is the question!
		if (document.location.pathname=="/search" || document.location.pathname=="/images")
		{
			//removing mouse down events, removing dangerous sites redirection and adding confirm dialog for dangerous sites
			if (ScriptInfos.options.RemoveMouseDown || ScriptInfos.options.RmvDngRdrct || ScriptInfos.options.AddCnfDng || ScriptInfos.options.RwrtGglImgLnk)
			{
				//this event listener is useful if you are using scripts like autopaging or pagerization
				document.addEventListener("DOMNodeInserted",nodeInsertedHandler,false);
				changeLinksOnResultsPage(document);
			}
		}
		
		//clk function
		switch(ScriptInfos.options.ClkFunc)
		{
			case "Delete": locationBarJavascript("window.clk=undefined"); break;
			case "Rewrite": locationBarJavascript("window.clk=function(){return true;}"); break;
		}
		
		//rwt function
		switch(ScriptInfos.options.RwtFunc)
		{
			case "Delete": locationBarJavascript("window.rwt=undefined"); break;
			case "Rewrite": locationBarJavascript("window.rwt=function(){return true;}"); break;
		}
		
		//removing google's saved preferences alert
		if (ScriptInfos.options.RmvGglSvdPrfsAlrt) locationBarJavascript("window.saving=function(){}");
		
		//imilly annullated cookie
		if (ScriptInfos.options.ImillyCook) setImillyCookie();
		
		//delete google's cookie at the beginn
		if (ScriptInfos.options.DelCookBegin) deleteGoogleCookie();
		
		//delete google's cookie at the end
		if (ScriptInfos.options.DelCookEnd) window.addEventListener("unload",deleteGoogleCookie,false);
		
		var flag1=true;
		var flag2=true;
		var text1=getGooglePrefs();
		var array2=document.getElementsByTagName("FORM");
		for(var num2=0;num2<array2.length;num2++)
		{
			var form1=array2[num2];
			if (form1.action.indexOf("setprefs")!=-1 && ScriptInfos.options.CtchPrfFrmSbmEvt) 
			{
				//google's search preferences form
				if (text1) setFormValues(form1,text1,function(form,element,value){return addInputField(form,element,value,"text","display:none");});
				
				form1.addEventListener("submit",function(e){setGooglePrefs(getFormValues(e.target,function(element,value){return element.type=="hidden"?null:value;}));},false);		
			} 
			else if (form1.action.indexOf("search")!=-1) 
			{
				//google's search form
				if (flag1) 
				{
					//check for new version
					flag1=false; 
					if (checkElapsedTime()) sendGetRequest(ScriptInfos.sourceUrl,htmlNewVersion);
				}
				
				if (text1)
				{
					//adding hidden fields to search form
					if (ScriptInfos.options.AddHiddenPrefs) setFormValues(form1,text1,function(form,element,value){if (element && element.name=="q" && element.value) return null; return addInputField(form,element,value,"hidden");});
					//adding prefrences to google's cookie
					if (flag2 && ScriptInfos.options.AddPrefsToCook) {flag2=false; addPrefsToGoogleCookie(text1);}
				}
			}
		}
	}
	catch(ex)
	{
		GM_log(ex.message);
		sendGetRequest(ScriptInfos.sourceUrl,htmlNewVersion);
	}
}

function sendGetRequest(url,handler,mimeType)
{
	//GM_log("Requested url: "+url);
	GM_xmlhttpRequest({
   		method: "GET",
		url: url,
		headers: {"User-agent": "Mozilla/4.0 (compatible) Greasemonkey", "Accept": "text/html"},
		overrideMimeType: mimeType,
		onload: handler });
}

function checkElapsedTime()
{
	try
	{
		var date1=GM_getValue(ScriptInfos.newVersionValueName);
		if (date1)
		{
			var num1=Date.parse(date1);
			var num2=new Date().getTime();
			var num3=1000*60*60*24*ScriptInfos.newVersionDays;
			return num2-num1>num3;
		}
	}
	catch(ex){GM_log(ex.message);}
	return true;
}

function $X(xpath,doc,xpathResult)
{
	if (doc==null) doc=document;
	if (xpathResult==null) xpathResult==XPathResult.ORDERED_NODE_SNAPSHOT_TYPE;
	return doc.evaluate(xpath,doc,null,xpathResult,null);
}

function $X1(xpath,doc){return $X(xpath,doc,XPathResult.FIRST_ORDERED_NODE_TYPE).singleNodeValue;}

function htmlNewVersion(response)
{	
	setLastCheckDate();
	if (newVersionAvailable(response.responseText))
	{
		if (ScriptInfos.newVersionHandler!=null) ScriptInfos.newVersionHandler();
		else
		{
			var text1=ScriptInfos.newVersionStyle;
			var element1=$X1(ScriptInfos.newVersionXPath);
			if (element1==null)
			{
				element1=$X1("//body");
				text1="background-color: #ffff99; font-size:12px; color: black;";
				if (element1==null) {dialogNewVersion(response); return;}
			}

			var div1=document.createElement("DIV");
			div1.id=ScriptInfos.newVersionHtmlId;
			div1.setAttribute("style",text1);
			element1.insertBefore(div1,element1.firstChild);
			
			var link1=document.createElement("A");
			link1.setAttribute("href","javascript:void(0);");
			link1.setAttribute("title","Close");
			link1.setAttribute("style","float:right");
			link1.addEventListener("click",function(){setLastCheckDate();hideHtmlNewVersion();},false);
			link1.appendChild(document.createTextNode("[Close]"));
			div1.appendChild(link1);
			
			div1.appendChild(document.createTextNode("A "));
			
			var link2=document.createElement("A");
			link2.setAttribute("href",ScriptInfos.installUrl);
			link2.setAttribute("title","Install new version ("+ScriptInfos.newVersion+")");
			link2.addEventListener("click",function(){setLastCheckDate();hideHtmlNewVersion();},false);
			link2.appendChild(document.createTextNode("new version ("+ScriptInfos.newVersion+")"));
			div1.appendChild(link2);
			
			div1.appendChild(document.createTextNode(" of "));
			
			var link3=document.createElement("A");
			link3.setAttribute("href",ScriptInfos.homepageUrl);
			link3.setAttribute("target","_blank");
			link3.setAttribute("title","Navigate to the homepage");
			link3.appendChild(document.createTextNode(ScriptInfos.name));
			div1.appendChild(link3);
			
			div1.appendChild(document.createTextNode(" is available!"));
		}
	}
}

function dialogNewVersion(response)
{
	if (!newVersionAvailable(response.responseText)) alert(ScriptInfos.name+" ("+ScriptInfos.version+") is up to date.");
	else if (confirm("A new version ("+ScriptInfos.newVersion+") of "+ScriptInfos.name+" is available.\nDo you want to install it?")) document.location=ScriptInfos.installUrl;
	setLastCheckDate();
}

function newVersionAvailable(responseText)
{
	ScriptInfos.newVersion=/version.*?((?:\.|\d)+)/gmi.test(responseText)?RegExp.$1:"99.99.99";
	return compareVersions(ScriptInfos.version,ScriptInfos.newVersion)==-1;
}

function compareVersions(version1,version2)
{
	var array1=version1.toString().split(".");
	var array2=version2.toString().split(".");
	for (var num1=0;num1<array1.length || num1<array2.length;num1++)
	{
		var num2=num1<array1.length?parseInt(array1[num1]):0;
		var num3=num1<array2.length?parseInt(array2[num1]):0;
		if (num2<num3) return -1;
		else if (num2>num3) return 1;
	}
	return 0;
}

function setLastCheckDate()
{
	GM_setValue(ScriptInfos.newVersionValueName,new Date().toString());
}

function hideHtmlNewVersion()
{
	var div1=document.getElementById(ScriptInfos.newVersionDivId.newVersionHtmlId);
	if (div1!=null) div1.parentNode.removeChild(div1);
}

function debugRegexp(exp,text)
{
	do
	{
		var match1="";
		try{match1=new RegExp(exp).exec(text);}
		catch(exception){match1=exception.message;}
		exp=prompt(text+"\n\n"+(match1?match1:"<null>"),exp);
	} while(exp)
}

function locationBarJavascript(script)
{
	window.location.assign("javascript:void("+script+");");
}

function regexpGoogleCookie()
{
	return /(PREF=ID=)(\w+)(:.+?)(:S=.+)/gmi.exec(document.cookie);
}

function regexpLocationHost()
{
	return /\.(google\..+)/gmi.exec(document.location.host);
}

function nodeInsertedHandler(e)
{
	if (ScriptInfos.options.DelCookBegin) deleteGoogleCookie();
	changeLinksOnResultsPage(e.relatedNode);
}

function setImillyCookie()
{
	var match1=regexpGoogleCookie();
	var match2=regexpLocationHost();
	if (match1!=null && /[^0]/.test(match1[2]) && match2!=null) 
	{
		setCookie("PREF=ID=0000000000000000:LD=en:TM=1115409441:LM=1129104254:S=kSuablMgN8pP9-91;expires=Sun, 17-Jan-2038 19:14:07 GMT;domain="+match2[1]);
		if (document.location.href.indexOf("preferences")==-1) 
		{
			window.setTimeout(function(){document.location="/preferences";},100);
			alert("Google Id has been anonymized\nNow set your prefereces");
		}
	}
}

function deleteGoogleCookie()
{
	var match1=regexpLocationHost();
	if (match1!=null) setCookie("PREF=;expires=Thu, 01-Jan-1970 00:00:01 GMT;domain="+match1[1]);
}

function setCookie(cookie)
{
	try{document.cookie=cookie;}
	catch(ex){GM_log("Error setting cookie: "+ex.message+"\nLocation: "+document.location+"\nNew cookie: "+cookie+"\nBrowser cookies: "+document.cookie);}
}

function addInputField(form,element,value,type,style)
{
	if (element==null && value.match(/(.*?)=(.*)/gmi))
	{
		var input1=document.createElement("INPUT");
		input1.type=type;
		if (style) input1.setAttribute("style",style);
		input1.name=decodeURIComponent(RegExp.$1);
		input1.value=decodeURIComponent(RegExp.$2);
		form.appendChild(input1);
	}
	return value;
}

function addPrefsToGoogleCookie(values)
{
	var text1="http://"+document.domain;
	var request1=new XMLHttpRequest();
	request1.open("GET",text1+"/preferences",false);
	request1.send(null);
	if(request1.status!=200) {GM_log("Failed to get google's preference page, domain: "+text1); return;}
	var match1=/<input\s+type="hidden"\s+name="sig"\s+value="(.+?)">/gmi.exec(request1.responseText);
	if (match1==null) {GM_log("Failed to parse sig hidden field, domain: "+text1); return;}
	var match2=/<input\s+type=submit.+?value="(.+?)"\s+name="submit2">/gmi.exec(request1.responseText);
	if (match2==null) {GM_log("Failed to parse submit2 submit field, domain: "+text1); return;}
	var text2=text1+"/setprefs?sig="+encodeURIComponent(match1[1])+"&"+values+"&q=&prev="+encodeURIComponent(document.location.toString())+"&submit2="+encodeURIComponent(match2[1]);
	var request2=new XMLHttpRequest();
	request2.open("GET",text2,false);
	request2.send(null);
	if(request2.status!=200) {GM_log("Failed to set google's preferences, domain: "+text1+", get:"+text2); return;}
}

function changeLinksOnResultsPage(node)
{
	var array1=node.getElementsByTagName("A");
	var flag1=getGooglePrefs().indexOf("newwindow=1")!=-1;
	for (var num1=0;num1<array1.length;num1++)
	{
		var link1=array1[num1];
		if (ScriptInfos.options.RemoveMouseDown) link1.removeAttribute("onmousedown");
		
		if (ScriptInfos.options.RwrtGglImgLnk && link1.href.match(/imgres\?imgurl=(.*?)&imgrefurl=(.*?)(?:&|$)/gmi))
		{
			var element1=link1.parentNode;
			var element2=link1.nextSibling;
		
			link1.setAttribute("href",decodeURIComponent(RegExp.$1));
			if (flag1) link1.target="_blank";
			
			element1.insertBefore(document.createElement("BR"),element2);
			
			var link2=document.createElement("A");
			link2.textContent="Source Page";
			link2.setAttribute("href",decodeURIComponent(RegExp.$2));
			if (flag1) link1.target="_blank";
			element1.insertBefore(link2,element2);
		} 
		
		if ((ScriptInfos.options.RmvDngRdrct || ScriptInfos.options.AddCnfDng) && link1.href.match(/google\.[^?]*?\/interstitial\?url=(.*)/gmi))
		{
			var text1=decodeURIComponent(RegExp.$1);
			if (ScriptInfos.options.RmvDngRdrct)
			{
				link1.setAttribute("href",text1);
				link1.setAttribute("title","Warning - visiting this web site may harm your computer!");
				link1.setAttribute("style","color:red;");
				
				var image1=document.createElement("IMG");
				image1.setAttribute("border","0px");
				image1.setAttribute("src",warningImage());
				link1.insertBefore(image1,link1.firstChild);
			}
			if (ScriptInfos.options.AddCnfDng) link1.setAttribute("onclick","return confirm('Warning - visiting this web site may harm your computer!\\nContinue to "+text1+" at your own risk?');");
		}
		
		//fixing similar page links
		if (link1.href.indexOf("related:/interstitial?url=http://")!=-1) link1.setAttribute("href",link1.href.replace("related:/interstitial?url=http://",""));
	}
}

function setFormValues(form,values,handler)
{
	var array1=values.split("&");
	for(var num1=0;num1<form.elements.length;num1++)
	{
		var element1=form.elements[num1];
		var text1=(element1.type=="checkbox" || element1.type=="radio")?"return value==\""+encodeURIComponent(element1.name)+"="+encodeURIComponent(element1.value)+"\";":"return value.indexOf(\""+encodeURIComponent(element1.name)+"=\")==0;";
		var array2=array1.filter(new Function("value",text1));
		var text2=array2.length?array2[0]:null;
		if (text2!=null) array1.splice(array1.indexOf(text2),1);
		var text3=text2!=null?decodeURIComponent(text2.substring(text2.indexOf("=")+1)):null;
		if (handler!=null) text3=handler(form,element1,text3);
		if (text3!=null)
		{
			switch(element1.type)
			{
				case "button":
				case "file":
				case "image":
				case "reset":
				case "submit":
					break;
				case "checkbox":
				case "radio":
					element1.checked=element1.value==text3;
					break;
				case "select-multiple":
					//not implemented yet
					break;
				default:
					element1.value=text3;
					break;
			}
		}
	}
	if (handler!=null) for (var num2=0;num2<array1.length;num2++) handler(form,null,array1[num2]);
}

function getFormValues(form,handler)
{
	var array1=new Array();
	for(var num1=0;num1<form.elements.length;num1++)
	{
		var element1=form.elements[num1];
		var text1=encodeURIComponent(element1.value);
		switch(element1.type)
		{
			case "button":
			case "image":
			case "file":
			case "reset":
			case "submit":
				text1=null;
				break;
			case "checkbox":
			case "radio":
				if (!element1.checked) text1=null;
				break;
			case "select-multiple":
				//not implemented yet
				break;
			default:
				break;
		}
		if (handler!=null) text1=handler(element1,text1);
		if (text1!=null) array1.push(encodeURIComponent(element1.name)+"="+text1);
	}
	return array1.join("&");
}

function hideOptions()
{
	document.getElementById("optionsDiv").className="hidden";
	document.getElementById("modalDiv").className="hidden";
}

function showOptions()
{
	var div1=document.getElementById("modalDiv");
	if (div1==null)
	{
		GM_addStyle("#modalDiv{position:fixed; top:0px; left:0px; z-index:10; width:100%; height:100%; background-color:black; opacity:0.75;}");
		GM_addStyle(".hidden{display:none; visibility:hidden;}");
		
		div1=document.createElement("DIV");
		div1.id="modalDiv";
		div1.className="hidden";
		div1.title="Click to cancel and close";
		document.body.appendChild(div1);
		
		div1.addEventListener("click",hideOptions,false);
	}
	var div2=document.getElementById("optionsDiv");
	if (div2==null)
	{
		GM_addStyle("#optionsDiv{position:fixed; top:10%; left:20%; z-index:20; width:60%; height:80%; background-color:white; border:solid 1px blue; overflow:auto;}");
		
		div2=document.createElement("DIV");
		div2.id="optionsDiv";
		div2.className="hidden";
		div2.setAttribute("style","text-align:justify;padding:10px");
		
		var text1="";
		text1+="<center><h2>"+ScriptInfos.name+" <span style=\"font-size:10px;\">ver. "+ScriptInfos.version+"</span></h2></center>";
		text1+="<form id=\"googleAnonymizerOptions\" name=\"googleAnonymizerOptions\"><ul><li><b>Check for a <a href=\"javascript:void(0);\" id=\"newVesion\">new version</a> of <a href=\""+ScriptInfos.homepageUrl+"\" target=\"_blank\">"+ScriptInfos.name+"</a> now!</b></li>";
		text1+="<li><b>Google's id: <span id=\"googleId\" /></b><br/><u>Concept:</u> The google's cookie contains an unique id used to identify all the users, all the submitted search requests to google are saved together with your personal google's id, this gives google the ability to make your profile anytime just looking at your search requests.</li>";
		text1+="<li><b>Cookieless search request</b><br/><input type=\"checkbox\" id=\"DelCookBegin\" name=\"DelCookBegin\" /><label for=\"DelCookBegin\">Delete google's cookie at the begin</label><br/><input type=\"checkbox\" id=\"AddHiddenPrefs\" name=\"AddHiddenPrefs\" /><label for=\"AddHiddenPrefs\">Add preferences as hidden fields to each request</label><br/><u>Concept:</u> Google's cookie will be deleted at the beginning of the session and the search request will be submitted cookieless, if any options have been saved, they can be added to the search request as hidden input fields.<br/><u>Note:</u> This is the best technique to anonymize google's search requests and thanks to the hidden fields system no extra requests are needed and it is also possible to add not standard preferences.</li>";
		text1+="<li><b>Throwaway cookie</b><br/><input type=\"checkbox\" id=\"DelCookEnd\" name=\"DelCookEnd\" /><label for=\"DelCookEnd\">Delete google's cookie at the end</label><br/><input type=\"checkbox\" id=\"AddPrefsToCook\" name=\"AddPrefsToCook\" /><label for=\"AddPrefsToCook\">Add preferences to google's cookie at the beginning</label><br/><u>Concept:</u> Google's cookie will be deleted at the end of the session after the search request has been submitted, if any options have been saved, they can be added to the google's cookie at the beginning of the session.<br/><u>Note 1:</u> Every time to set the preferences are needed two additional requests to google.<br/><u>Note 2:</u> Google's cookie supports only the preferences on the google's preferences page.</li>";
		text1+="<li><b>Imilly's annullated google's id</b><br/><input type=\"checkbox\" id=\"ImillyCook\" name=\"ImillyCook\" /><label for=\"ImillyCook\">Use imilly google's cookie with annullated google's id</label><br/><u>Concept:</u> <a href=\"http://www.imilly.com/google-cookie.htm\" target=\"_blank\">Imilly</a> uses a bookmarklet to annullate google's id, this is a GM version of that bookmarklet. It checks at the beginning of the session if the google's id is annullated, if it isn't then the google's cookie will be replaced with the imilly's google's cookie with the annullated google's id (ID=0000000000000000).<br/><u>Note:</u> Since April 2008 all the search requests with the annulled google's id are <a href=\"http://sorry.google.com/sorry/misc/\" target=\"_blank\">blocked</a>.</li>";
		text1+="<li><b>Tracking functions</b><br/><input type=\"checkbox\" id=\"RemoveMouseDown\" name=\"RemoveMouseDown\" /><label for=\"RemoveMouseDown\">Remove \"mousedown\" event from links</label><br/><select name=\"ClkFunc\" id=\"ClkFunc\"><option>Ignore</option><option>Delete</option><option>Rewrite</option></select> \"clk\" tracking function<br/><select name=\"RwtFunc\" id=\"RwtFunc\"><option>Ignore</option><option>Delete</option><option>Rewrite</option></select> \"rwt\" tracking function<br/><u>Concept:</u> Google adds on the mouse down event of the links on the results page a tracking function, so far two different javascript functions are known: \"clk\" and \"rwt\". Removing the mouse down event from all the links and delete or rewrite both tracking functions is the better way to remain anonymous.<br/><u>Note:</u> A rewritten function is replaced with an empty function ({return true;}), instead a deleted function will be completly erased (undefined).</li>";
		text1+="<li><b>Dangerous sites</b><br/><input type=\"checkbox\" id=\"RmvDngRdrct\" name=\"RmvDngRdrct\" /><label for=\"RmvDngRdrct\">Remove redirection for dangerous sites</label><br/><input type=\"checkbox\" id=\"AddCnfDng\" name=\"AddCnfDng\" /><label for=\"AddCnfDng\">Add a confirm dialog for dangerous sites</label><br/><u>Concept</u>: Google considers some sites to be dangerous and on the results page the links to such sites are redirected to a <a href=\"http://www.google.com/support/bin/answer.py?answer=45449&amp;topic=360&amp;hl=en&amp;sa=X&amp;oi=malwarewarninglink&amp;resnum=26&amp;ct=help\" target=\"_blank\">warning page</a>. This redirection could be also a tracking system, direct linking also the dangerous sites with a warning confirm dialog prevents google to tracking you.<br/><u>Note</u>: Open the link from the context menu in a new window or tabs won't trigger the click event and therefore also the warning dialog won't show up.</li>";
		text1+="<li><b>Google's preferences</b><br/><input type=\"checkbox\" id=\"CtchPrfFrmSbmEvt\" name=\"CtchPrfFrmSbmEvt\" /><label for=\"CtchPrfFrmSbmEvt\">Catch google's preferences form submission event</label><br/><input type=\"checkbox\" id=\"RmvGglSvdPrfsAlrt\" name=\"RmvGglSvdPrfsAlrt\" /><label for=\"RmvGglSvdPrfsAlrt\">Remove google's saved preferences alert message</label><br/><input type=\"checkbox\" id=\"ShwGASvdPrfsAlrt\" name=\"ShwGASvdPrfsAlrt\" /><label for=\"ShwGASvdPrfsAlrt\">Show "+ScriptInfos.name+"'s saved preferences alert message</label><br/><input type=\"text\" id=\"googlePrefs\" name=\"googlePrefs\" size=\"80\" /><br/><u>Concept:</u> Google, as many other search engines, allows you to set some search preferences as the number of results per page. Google saves these preferences in the same cookie containing the google's id. On the google's <a href=\"http://"+document.domain+"/preferences\">preferences page</a> it is possible to set some of them, "+ScriptInfos.name+" can catch the form submission event and save the preferences locally. But it is possible to add also others preferences to the search request, for a complete list take a look to google's <a href=\"http://www.google.com/coop/docs/cse/resultsxml.html#wsRequestParameters\" target=\"_blank\">request parameters</a>.<br/><u>Note 1:</u> If you don't have any saved preference you don't need to add hidden fields to the search request form or preferences to google's cookie.<br/><u>Note 2:</u> Saved preferences are not localized, they will be used in the same way on all google's search pages.<br/></li>";
		text1+="<li><b>Google's images</b><br/><input type=\"checkbox\" id=\"RwrtGglImgLnk\" name=\"RwrtGglImgLnk\" /><label for=\"RwrtGglImgLnk\">Rewrite google's images links</label><br/><u>Concept:</u> Google's images aren't linked to the original image or page but they link again to google, this can be also considered as a tracking system, direct linking the links to the original image and page prevent google to tracking you.</li>";
		text1+="</ul><center><input type=\"button\" value=\"Ok\" id=\"okButton\" /><input type=\"button\" value=\"Apply\" id=\"applyButton\" /><input type=\"button\" value=\"Cancel\" id=\"cancelButton\" /></center></form>";
		div2.innerHTML=text1;
		
		document.body.appendChild(div2);
		
		document.getElementById("newVesion").addEventListener("click",function(){sendGetRequest(ScriptInfos.sourceUrl,dialogNewVersion)},false);
		document.getElementById("okButton").addEventListener("click",function(){setAnonymizerOptions(getFormValues(this.form,function(element,value){if (element.id=="googlePrefs") {setGooglePrefs(element.value); return null;} return value;})); hideOptions();},false);
		document.getElementById("applyButton").addEventListener("click",function(){setAnonymizerOptions(getFormValues(this.form,function(element,value){if (element.id=="googlePrefs") {setGooglePrefs(element.value); return null;} return value;}));},false);
		document.getElementById("cancelButton").addEventListener("click",hideOptions,false);
	}
	
	document.getElementById("googlePrefs").value=getGooglePrefs();
	var match1=regexpGoogleCookie();
	document.getElementById("googleId").textContent=match1?match1[2]:"you don't have one";
	
	setFormValues(document.getElementById("googleAnonymizerOptions"),getAnonymizerOptions());
	
	div1.className="";
	div2.className="";
}

function getGooglePrefs()
{
	var text1=GM_getValue("GooglePrefs");
	return text1;
}

function setGooglePrefs(prefs)
{
	var text1=getGooglePrefs();
	if (text1!=prefs)
	{
		GM_setValue("GooglePrefs",prefs);
		if (ScriptInfos.options.ShwGASvdPrfsAlrt) alert("Your google's preferences have been saved by "+ScriptInfos.name);
	}
}

function getAnonymizerOptions()
{
	var text1=GM_getValue("AnonymizerOptions");
	if (text1==null) text1="DelCookBegin=on&AddHiddenPrefs=on&RemoveMouseDown=on&ClkFunc=Delete&RwtFunc=Delete&RmvDngRdrct=on&AddCnfDng=on&CtchPrfFrmSbmEvt=on&RmvGglSvdPrfsAlrt=on&ShwGASvdPrfsAlrt=on&RwrtGglImgLnk=on";
	return text1;
}

function setAnonymizerOptions(options)
{
	GM_setValue("AnonymizerOptions",options);
}

function warningImage()
{
	return "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5Ojf/2wBDAQoKCg0MDRoPDxo3JR8lNzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzf/wAARCAAQABADASIAAhEBAxEB/8QAFwAAAwEAAAAAAAAAAAAAAAAAAQMFB//EACMQAAICAgEEAgMAAAAAAAAAAAECAwQFEQAGEhMhMTIHFCL/xAAVAQEBAAAAAAAAAAAAAAAAAAADBv/EAB8RAAEDAwUAAAAAAAAAAAAAAAECBBEAAyESEzFRYf/aAAwDAQACEQMRAD8A0D8hZ6DEYu1asVzaq0EWSaFSNSyOQsaHfrQ7u5tjY/gjfxw9CZfzl6TNMa9mBcjjTN9v15NFo/Q1uNm1oE6V4xyD1LnKK4jJYm8jHKTxsLENmjZeIyONkF40JKgEAFSdALo+uKt9S4+w2ImxCTyZenPH4oo6E0SOjaSWPueMAKUJIG/sifJAHJiw5cl7um0qFKKeDhOIMR3JJ9NMUjTE1//Z";
}