1/* based on xajax Javascript library (http://www.xajaxproject.org) */ 2if (!window.jtajax) { 3 4function jtAJAX() 5{ 6 this.options = {url: '',type: 'post',nocache: true,data: ''}; 7 8 this.$ = function(id) {if(!id){return null;}var o=document.getElementById(id);if(!o&&document.all){o=document.all[id];}return o;}; 9 this.extend = function(o, e){for(var k in (e||{}))o[k]=e[k];return o;}; 10 this.encode = function(t){return encodeURIComponent(t);}; 11 this.setup = function(options) {this.options = this.extend(this.options, options);}; 12 13 this.xhr = function() 14 { 15 var xhr = null; 16 if ('undefined' != typeof XMLHttpRequest) xhr = new XMLHttpRequest(); 17 if (!xhr && 'undefined' != typeof ActiveXObject) { 18 var msxmlhttp = new Array('Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP'); 19 for (var i=0;i<msxmlhttp.length;i++){try{xhr=new ActiveXObject(msxmlhttp[i]);}catch(e){xhr=null;}} 20 } 21 return xhr; 22 }; 23 24 this.form2query = function(sId) 25 { 26 var frm = this.$(sId); 27 if (frm && frm.tagName.toUpperCase() == 'FORM') { 28 var e = frm.elements, query = []; 29 for (var i=0; i < e.length; i++) { 30 var name = e[i].name, value; 31 if (!name) continue; 32 if (e[i].type && ('radio' == e[i].type || 'checkbox' == e[i].type) && false === e[i].checked) continue; 33 if ('select-multiple' == e[i].type) { 34 for (var j = 0; j < e[i].length; j++) { 35 if (true === e[i].options[j].selected) 36 query.push(name+"="+this.encode(e[i].options[j].value)); 37 } 38 } else { query.push(name+"="+this.encode(e[i].value)); 39 } 40 } 41 return query.join('&'); 42 } 43 return ''; 44 }; 45 46 this.startLoading = function(){}; 47 this.finishLoading = function(){}; 48 49 this.ajax = function(options) 50 { 51 var xhr = this.xhr(); 52 if (!xhr) return false; 53 var o = this.extend(this.options, options); 54 var url = o.url, jtx = this; 55 var r=url;var h=location.hostname,d,i1,i2;i1=r.indexOf('://');if(i1!=-1){i2=r.indexOf('/',i1+3);if(i2!=-1){d=r.substring(i1+3,i2);if(d!=h){if(location.port!=''){h=h+':'+location.port;}r=r.replace(d,h);url=r;}}} 56 57 if ('get' == o.type) { 58 if (true === o.nocache) { 59 var ts=new Date().getTime(); 60 url += (url.indexOf("?")==-1 ? '?' : '&') + '_jtxr_' + ts; 61 } 62 if (o.data) { 63 url += (url.indexOf("?")==-1 ? '?' : '&') + o.data; 64 o.data = null; 65 } 66 } 67 68 xhr.open(o.type.toUpperCase(), url, true); 69 70 if ('post' == o.type) 71 try {xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");}catch(e){} 72 if (true === o.nocache) 73 xhr.setRequestHeader('If-Modified-Since', 'Thu, 01 Jan 1970 00:00:00 GMT'); 74 75 xhr.onreadystatechange = function() { 76 if (xhr.readyState != 4) return; 77 jtx.finishLoading(); 78 if (xhr.status==200) { 79 jtx.processResponse(xhr.responseText); 80 } 81 delete xhr; 82 xhr = null; 83 }; 84 try { 85 jtx.startLoading(); 86 xhr.send(o.data); 87 } catch(e) { jtx.finishLoading(); } 88 89 delete jtx; 90 delete xhr; 91 delete o; 92 return true; 93 }; 94 95 this.call = function(sFunction, aArgs, sType, sForm) 96 { 97 var params = 'jtxf=' + this.encode(sFunction); 98 if (aArgs) { 99 for (var i=0;i<aArgs.length;i++) { 100 params += '&jtxa[]=' + this.encode(aArgs[i]); 101 } 102 } else if (sForm) { 103 params += '&' + this.form2query(sForm); 104 } 105 106 this.ajax({type: sType, data: params}); 107 return true; 108 }; 109 110 this.processResponse = function(sText) 111 { 112 if(sText==='') return false; 113 114 if(sText.substring(0,3)!='[ {'){ 115 var idx=sText.indexOf('[ {'); 116 sText=sText.substr(idx); 117 } 118 var result; 119 try { 120 result=eval(sText); 121 }catch(e){} 122 123 if ('undefined' == typeof result) {return false;} 124 125 var cmd, id, property, data, obj = null; 126 for (var i=0;i<result.length;i++) { 127 cmd = result[i]['n']; 128 id = result[i]['t']; 129 property = result[i]['p']; 130 data = result[i]['d']; 131 obj = this.$(id); 132 133 switch(cmd) { 134 case 'as': if(obj){eval("obj."+property+"=data;");} break; 135 case 'al': if(data){alert(data);} break; 136 case 'js': if(data){eval(data);} break; 137 default: this.error('Unknown command: ' + cmd);break; 138 } 139 } 140 141 delete result; 142 delete cmd; 143 delete id; 144 delete property; 145 delete data; 146 delete obj; 147 return true; 148 }; 149 150 this.error = function(){}; 151} 152var jtajax = new jtAJAX(); 153}
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.