fork download
  1. (function(XHR) {
  2. "use strict";
  3.  
  4. var open = XHR.prototype.open;
  5. var send = XHR.prototype.send;
  6.  
  7. XHR.prototype.open = function(method, url, async, user, pass) {
  8. this._url = url;
  9. open.call(this, method, url, async, user, pass);
  10. };
  11.  
  12. XHR.prototype.send = function(data) {
  13. var self = this;
  14. var oldOnReadyStateChange;
  15. var url = this._url;
  16.  
  17. function onReadyStateChange() {
  18. if(self.readyState == 4 /* complete */) {
  19. /* This is where you can put code that you want to execute post-complete*/
  20. /* URL is kept in this._url */
  21. }
  22.  
  23. if(oldOnReadyStateChange) {
  24. oldOnReadyStateChange();
  25. }
  26. }
  27.  
  28. /* Set xhr.noIntercept to true to disable the interceptor for a particular call */
  29. if(!this.noIntercept) {
  30. if(this.addEventListener) {
  31. this.addEventListener("readystatechange", onReadyStateChange, false);
  32. } else {
  33. oldOnReadyStateChange = this.onreadystatechange;
  34. this.onreadystatechange = onReadyStateChange;
  35. }
  36. }
  37.  
  38. send.call(this, data);
  39. }
  40. })(XMLHttpRequest);
Runtime error #stdin #stdout #stderr 0s 107072KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.js:40:0 ReferenceError: XMLHttpRequest is not defined