Unsafe Google Suggestion

By vasyabelkin Last update Jan 26, 2008 — Installed 4,161 times.

Not working on "Firefox" search page

in
Subscribe to Not working on "Firefox" search page 2 posts, 1 voice



Richard Davies Scriptwright

This script isn't working for me on the Firefox search page:

http://www.google.com/firefox?client=firefox-a&...

 
Richard Davies Scriptwright

I've fixed the script so that it's now working on the Firefox search page. In addition, I've also modified it so that it doesn't require use of the "unsafeWindow" object:

(function() {
	function suggestScript() {
		var f = document.evaluate("//form[@action='/search']", document, null, XPathResult.   FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||
			document.evaluate("//form[@action='http://images.google.com/images']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||
			//document.evaluate("//form[@action='/news']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||
			document.evaluate("//form[@action='/books']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||
			//document.evaluate("//form[@action='/codesearch']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||
			document.evaluate("//form[@action='/patents']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||
			//document.evaluate("//form[@action='/products']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||
			//document.evaluate("//form[@action='/custom']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||
			document.evaluate("//form[@action='/unclesam']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;// ||
			//document.evaluate("//form[@action='/linux']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||
			//document.evaluate("//form[@action='/bsd']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ||		
			//document.evaluate("//form[@action='/microsoft']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
		if (!f) return; 
		if (!f.q || !f.btnG) return;
		if(!google) google={};
	    var s = document.createElement('script');
		s.setAttribute("src", "http://www.google.com/extern_js/f/CgJlbhICdXMrMAo4DSwrMA44AywrMBg4Ayw/AQ-hC7_2R8g.js");
		var ev = new Object();
	    ev.handleEvent = function (e) {
			if(google.ac){
				window.setTimeout('window.google.ac.i(f,f.q,"",false,"close",true)',100);
				f.q.setAttribute("autocomplete", "off");
				f.q.blur();
				f.q.focus();
			}
	    };
	    s.addEventListener('load', ev, true);
		s.removeEventListener('load', ev, false);
		document.getElementsByTagName('head')[0].appendChild(s);
	};

	document.body.appendChild(document.createElement("script")).innerHTML="(" + suggestScript + ")()";

})();

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel