PageSourceSearch

https://www.othervoice.org/htm-webaxy/javascript/ajax.js

js othervoice.org collected 2026-10-02 07:19:06 UTC 1,847 bytes, 94 lines download raw bytes

1function getAJAX(url,func,cookieName,expire,param) {
2	try {
3		if (func && cookieName) {
4			// var cvalue = get_cookie(cookieName);
5			var cvalue = sessionStorage.getItem(cookieName);
6			if (cvalue != null) {
7				func(cvalue,param);
8				return;
9			}
10		}
11	}
12	catch(e) {}
13	var xmlHttp;
14	try {  // Firefox, Opera 8.0+, Safari, IE 7+  
15		xmlHttp=new XMLHttpRequest(); 
16	}
17	catch (e) {  // Internet Explorer  
18		try {
19			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
20		}
21		catch (e) {   
22			try {
23				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
24			}
25	    	catch (e)  {
26	    	 	return false;
27			}
28		}
29	}
30	
31	try {
32		if (func) {
33			xmlHttp.onreadystatechange = function() {			
34				if ((xmlHttp.readyState == 4) && (xmlHttp.status == 200)) {
35					try {
36						if (cookieName) {
37							// set_cookie(cookieName,xmlHttp.responseText,expire);
38							sessionStorage.setItem(cookieName, xmlHttp.responseText);
39						}
40					}
41					catch(e) {}
42					func(xmlHttp.responseText,param);
43				}
44			}
45		}
46		if (url) {
47			xmlHttp.goUrl = new function() {
48				xmlHttp.open("GET",url,true);
49			  	xmlHttp.send();  
50			}
51		}
52	}
53	catch(e) {
54		return false;
55	}
56	return xmlHttp;
57}
58
59function parseAJAX(res) {
60	var ret = [];
61	var data = res.split('<D>');
62	var inTitle = true;
63	var tempArr = [];
64	var fids = 0;
65	for (var d = 0; d < data.length; d++) {
66		if (inTitle && data[d].indexOf("=") != -1) {
67			tempArr[tempArr.length] = data[d];
68			fids++;
69			continue;
70		}
71		if (inTitle) {
72			ret[0] = tempArr;
73			inTitle = false;
74		}
75		if (d % fids == 0) {
76			tempArr = [];
77		}
78		tempArr[tempArr.length] = data[d];
79		if (d % fids == fids - 1) {
80			ret[ret.length] = tempArr;
81			tempArr = [];
82		}
83	}
84	// last input was too short
85	if (tempArr.length) {
86		while (tempArr.length < fids) {
87			tempArr[tempArr.length] = '';
88		}
89		ret[ret.length] = tempArr;
90		tempArr = [];
91	}
92	return ret;
93}
94

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.