1function IwAjax() { 2 this.window=window; 3 this.debugReqNotReady=false; 4 this.debugReqError=false; 5 this.debugReqOk=false; 6} 7IwAjax.prototype.newRequest = function() { 8 var req = null; 9 // branch for native XMLHttpRequest object 10 if (this.window.XMLHttpRequest) { 11 try { 12 req = new XMLHttpRequest(); 13 } catch(e) { 14 req = null; 15 } 16 // branch for IE/Windows ActiveX version 17 } else if (this.window.ActiveXObject) { 18 try { 19 req = new ActiveXObject("Msxml2.XMLHTTP"); 20 } catch(e) { 21 try { 22 req = new ActiveXObject("Microsoft.XMLHTTP"); 23 } catch(e) { 24 req = null; 25 } 26 } 27 } 28 return req; 29} 30IwAjax.prototype.loadXmlDoc = function(url,listener) { 31 var ajax=this; 32 var req=this.newRequest() 33 if (req!=null) { 34 if (listener!=null) { 35 req.onreadystatechange = function() { 36 listener.processReqChange(req); 37 } 38 } else { 39 req.onreadystatechange = function() { 40 ajax.processReqChange(req); 41 } 42 } 43 req.open("GET", url, true); 44 req.send(""); 45 } 46} 47IwAjax.prototype.processReqChange = function(req) { 48 if (req.readyState==4) { 49 if (req.status==200) { 50 this.processReqOk(req); 51 } else { 52 this.processReqError(req); 53 } 54 } else { 55 this.processReqNotReady(req); 56 } 57} 58IwAjax.prototype.processReqNotReady = function(req) { 59 if (this.debugReqNotReady) { 60 alert("req.readyState="+req.readyState); 61 } 62} 63IwAjax.prototype.processReqError = function(req) { 64 if (this.debugReqError) { 65 var s=""; 66 s+="req.readyState="+req.readyState+"\n"; 67 s+="req.status="+req.status+"\n"; 68 s+="req.statusText="+req.statusText+"\n"; 69 alert(s); 70 } 71} 72IwAjax.prototype.processReqOk = function(req) { 73 if (this.debugReqOk) { 74 var s=""; 75 s+="req.readyState="+req.readyState+"\n"; 76 s+="req.status="+req.status+"\n"; 77 s+="req.statusText="+req.statusText+"\n"; 78 s+="req.responseXML="+req.responseXML+"\n"; 79 s+="req.responseText="+req.responseText+"\n"; 80 alert(s); 81 } 82} 83IwAjax.prototype.newReqListener = function(reqOk,reqError,reqNotReady) { 84 return new IwAjaxReqListener(this,reqOk,reqError,reqNotReady); 85} 86// listener 87function IwAjaxReqListener(ajax,reqOk,reqError,reqNotReady) { 88 this.ajax=ajax; 89 this.processReqOk=reqOk; 90 this.processReqError=reqError; 91 this.processReqNotReady=reqNotReady; 92} 93IwAjaxReqListener.prototype.processReqChange = function(req) { 94 if (req.readyState==4) { 95 if (req.status==200) { 96 if (this.processReqOk!=null) { 97 this.processReqOk(req,this); 98 } else { 99 this.ajax.processReqOk(req); 100 } 101 } else { 102 if (this.processReqError!=null) { 103 this.processReqError(req,this); 104 } else { 105 this.ajax.processReqError(req); 106 } 107 } 108 } else { 109 if (this.processReqNotReady!=null) { 110 this.processReqNotReady(req,this); 111 } else { 112 this.ajax.processReqNotReady(req); 113 } 114 } 115}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.