1/* 2url-loading object and a request queue built on top of it 3*/ 4 5/* namespacing object */ 6var net=new Object(); 7 8net.READY_STATE_UNINITIALIZED=0; 9net.READY_STATE_LOADING=1; 10net.READY_STATE_LOADED=2; 11net.READY_STATE_INTERACTIVE=3; 12net.READY_STATE_COMPLETE=4; 13 14 15/*--- content loader object for cross-browser requests ---*/ 16net.ContentLoader=function(url,onload,onerror,method,params,contentType){ 17 this.req=null; 18 this.onload=onload; 19 this.onerror=(onerror) ? onerror : this.defaultError; 20 this.loadXMLDoc(url,method,params,contentType); 21} 22 23net.ContentLoader.prototype.loadXMLDoc=function(url,method,params,contentType){ 24 if (!method){ 25 method="GET"; 26 } 27 if (!contentType && method=="POST"){ 28 contentType='application/x-www-form-urlencoded'; 29 } 30 if (window.XMLHttpRequest){ 31 this.req=new XMLHttpRequest(); 32 } else if (window.ActiveXObject){ 33 this.req=new ActiveXObject("Microsoft.XMLHTTP"); 34 } 35 if (this.req){ 36 try{ 37 var loader=this; 38 this.req.onreadystatechange=function(){ 39 net.ContentLoader.onReadyState.call(loader); 40 } 41 this.req.open(method,url,true); 42 if (contentType){ 43 this.req.setRequestHeader('Content-Type', contentType); 44 } 45 this.req.send(params); 46 }catch (err){ 47 this.onerror.call(this); 48 } 49 } 50} 51 52 53net.ContentLoader.onReadyState=function(){ 54 var req=this.req; 55 var ready=req.readyState; 56 if (ready==net.READY_STATE_COMPLETE){ 57 var httpStatus=req.status; 58 if (httpStatus==200 || httpStatus==0){ 59 this.onload.call(this); 60 }else{ 61 this.onerror.call(this); 62 } 63 } 64} 65 66net.ContentLoader.prototype.defaultError=function(){ 67 alert("error fetching data!" 68 +"\n\nreadyState:"+this.req.readyState 69 +"\nstatus: "+this.req.status 70 +"\nheaders: "+this.req.getAllResponseHeaders()); 71}
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.