Skip to content

Instantly share code, notes, and snippets.

@uu59
Created August 24, 2011 12:17
Show Gist options
  • Save uu59/1167934 to your computer and use it in GitHub Desktop.
Save uu59/1167934 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Auto-terminate google instant search
// @namespace http://uu59.org/
// @version 1.0.0
// @include http://*.google.*/search*
// ==/UserScript==
(function(){
if(! location.hostname.match(/^www\.google\.[a-z]{2,3}(?:\.[a-z]{2})?$/)){
return ;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', '/preferences?hl=en', true);
xhr.onreadystatechange = function(){
if(xhr.readyState == 4) {
if(! xhr.responseText.match(/name=suggon value=2 checked/)){
// already enabled
var setprefs = document.querySelectorAll('a[href^="/setprefs"]')[0].href;
window.location.replace(setprefs);
}
}
}
xhr.send(null);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment