Created
January 8, 2011 05:50
-
-
Save javajosh/770588 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name capiche | |
// @namespace http://capiche.org/greasemonkey | |
// @description Developer tool for RESTful APIs | |
// @author Josh | |
// @homepage http://capiche.org | |
// @include http://localhost:8080/* | |
// ==/UserScript== | |
var p = unsafeWindow.XMLHttpRequest.prototype; | |
var log = unsafeWindow.console.log; | |
if (typeof p.oldsend != 'function') { | |
p.oldsend = p.send; | |
p.send = function() { | |
p.oldsend.apply(this, arguments); | |
this.addEventListener('readystatechange', function() { | |
if (this.readyState == 2) {/* LOADED */ | |
log('xhr loaded'); | |
} else if (this.readyState == 4) { /* COMPLETED */ | |
log('xhr completed'); | |
} | |
}, false); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment