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; 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;url=url.replace(/&/g,'&'); 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 if(sText.substring(0,3)!='[ {'){var idx=sText.indexOf('[ {');sText=sText.substr(idx);} 114 var result;try {result=eval(sText);}catch(e){} 115 if ('undefined' == typeof result) {return false;} 116 117 var cmd, id, property, data, obj = null; 118 119 for (var i=0;i<result.length;i++) { 120 cmd = result[i]['n']; 121 id = result[i]['t']; 122 property = result[i]['p']; 123 data = result[i]['d']; 124 obj = this.$(id); 125 126 switch(cmd) { 127 case 'as': if(obj){eval("obj."+property+"=data;");} break; 128 case 'al': if(data){alert(data);} break; 129 case 'js': if(data){eval(data);} break; 130 default: this.error('Unknown command: ' + cmd);break; 131 } 132 } 133 134 delete result; 135 delete cmd; 136 delete id; 137 delete property; 138 delete data; 139 delete obj; 140 return true; 141 }; 142 143 this.error = function(){}; 144} 145var jtajax = new jtAJAX(); 146}
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.