ajax-heavy_sites_can_go_eff_themselves.user.js

ajax-heavy_sites_can_go_eff_themselves.user.js
// Greasemonkey script for murdering AJAX and making sure it's really dead. I
// am mostly using it for Google searches so I don't have to set wacky
// preferences every time I wipe cookies or use a different computer. It's
// useful in lots of places for just totally murdering XHR.
// My usual strategy is to either block hosts at the DNS resolution level
// (PowerDNS and abusing /etc/hosts: these are for the win) and to block Flash
// by default. This piece is for when I want to use a site and its bad
// behavior isn't a result of Flash.
var f = function() {
this.open = this.send = function() {
// alert(arguments.toString());
};
return this;
};
if(window.XMLHttpRequest)
window.XMLHttpRequest = f;
if(XMLHttpRequest)
XMLHttpRequest = f;
if(unsafeWindow) {
unsafeWindow.XMLHttpRequest = f;
if(unsafeWindow.google) {
unsafeWindow.google = {};
}
var inputs = unsafeWindow.document.getElementsByTagName('input');
// alert(inputs);
for(var i in inputs) {
if(i.name == "q") {
i.onkeydown = i.onkeyup = i.onkeypress = function(e) {
// alert(e);
e.stopPropagation();
};
}
}
}