PageSourceSearch

https://www.concept2.co.nz/process/x_lv/1.4/mv_display/ajax.js

js concept2.co.nz collected 2026-10-02 21:06:44 UTC 6,603 bytes, 240 lines download raw bytes

1if ( !document.IncludedFiles ) document.IncludedFiles = [];
2document.IncludedFiles['https://www.concept2.co.nz/process/x_lv/1%2e4/mv_display/ajax.js'] = 1;
3//Included: logic/javascript/ajax.js
4// remote scripting library
5// (c) copyright 2005 modernmethod, inc
6// (c) copyright 2006 Zeald.com
7var rs_debug_mode = 0;
8var rs_obj = false;
9var rs_callback = false;
10var rs_is_activex = false;
11AJAX_LOADING = '<img style="vertical-align:middle; margin: 5px;" src="/interchange-5/en_US/throbber.gif" class="throbber"><em>Loading</em>';
12function rs_debug(text) {
13	if (rs_debug_mode)
14		alert("RSD: " + text)
15}
16
17function rs_result_wrapper(x, callback) {
18	if (x.readyState != 4) { return; }
19	var status;
20	var data;
21    var error;
22	status = x.responseText.charAt(0);
23	data = x.responseText.substring(2);
24	if (status == "-") {
25        alert("Error: " + callback_n);
26        error = 1;
27    }
28    else if (status != "+") data = x.responseText;
29	if (!error)   {
30		try {
31			callback(data);
32		}
33	    catch(e) {
34	    }
35	}
36	if (typeof(GoogleTools) != 'undefined' ) {
37		window.setTimeout(function() {
38   			GoogleTools.fixLinks();
39		},300);
40	}
41}
42
43function rs_init_object(method, url, args, url_args, a, callback) {
44	rs_debug("rs_init_object() called..")
45	var i, x, n;
46	if ( a.length == 1 && a[0].constructor.toString().indexOf('Array') != -1 ) {
47		a = a[0];
48	}
49	for (i = 0; i < a.length; i++) { args += "&rsargs=" + escape(a[i]); }
50   // count args; build URL
51   url = url.replace( /[\\+]/g, '%2B'); // fix the unescaped plus signs
52   args = args.replace( /[\\+]/g, '%2B'); // fix the unescaped plus signs
53   url_args = url_args.replace( /[\\+]/g, '%2B'); // fix the unescaped plus signs
54	if ( method != 'POST' ) {
55		var joiner = ( url.indexOf( '?') == -1 ) ? '?' : '&';
56			url += joiner + args;
57			args = null;
58		}
59		if ( url_args ) {
60			var joiner = (url.indexOf( '?') == -1 ) ? '?' : '&';
61			url += joiner + url_args;
62			url_args = null;
63		}
64	if ( x ) rs_is_activex = true;
65	if(!x && typeof XMLHttpRequest != "undefined") 	x = new XMLHttpRequest();
66	if(!x) {
67		try {
68			x = new ActiveXObject("Msxml2.XMLHTTP");
69		} catch (e) {
70			try {
71				x = new ActiveXObject("Microsoft.XMLHTTP");
72			} catch (oc) {
73				x = null;
74			}
75		}
76	}
77	if (!x) {
78        x = new ifXMLHttpRequest();
79    }
80    if (!x) {
81		rs_debug("Could not create connection object.");
82    }
83	x.open( method, url, ( !rs_is_activex || method != 'POST' ) );
84	if ( method == 'POST' ) x.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
85	x.onreadystatechange = function() {
86		       rs_result_wrapper(x, callback);
87	}
88	x.send( args );
89	return x;
90}
91
92/*
93coded by Kae - http://verens.com/
94use this code as you wish, but retain this notice
95
96largely rewritten by Brent Kelly (http://www.zeald.com) - 15 June, 2006
97
98*/
99
100var kXHR_instances=0;
101var kXHR_objs=[];
102function ifXMLHttpRequest() {
103
104    var i=0;
105    var url='';
106    var responseText='';
107
108    this.onreadystatechange = function() {
109
110        return false;
111
112    }
113
114    this.open = function( method, url ) {
115
116		// id number of this request
117		this.i=++kXHR_instances;
118
119		if ( method.toUpperCase() != 'POST' ) method = 'GET';
120
121		// if there are arguements, split the arguements off
122		var parts;
123		var args = '';
124		if ( url.indexOf( '?' ) != -1 ) {
125
126			var parts = url.split( '?' );
127			url = parts[0];
128			args = parts[1];
129
130		}
131
132		// lets try and determine a url for mv_display - default to about:blank but this throws IE security warning
133		// assumes a standard ZES url https://secure.zeald.com/zeald/process or /zeald/process or http://www.zeald.com/process
134		var frame_url = 'about:blank';
135		if ( url.indexOf( 'process' ) != -1 ) frame_url = url + '?mv_display=ajax_blank';
136		var matches = url.match( /(https?:\/\/[^\/]*\/([^\/]*\/)?)/ );
137		if ( !matches ) matches = url.match( /(\/?[^\/]*\/)/ );
138		if ( matches && matches[0] ) frame_url = matches[0] + 'blank.html';
139
140		// create an invisible iframe loading the blank page (stop IE security warning)
141		this.div = document.createElement( 'div' );
142		this.div.innerHTML = '<iframe style="width:0px;height:0px;" name="kXHR_iframe_' + this.i + '" type="text/plain" src="' + frame_url + '"></iframe>';
143		document.body.appendChild( this.div );
144
145		// store a reference to the iframe for future use
146		this.iframe = document.getElementById( 'kXHR_iframe_' + this.i );
147
148		// now create a form that is ready to submit to the iframe
149		this.form = document.createElement( 'form' );
150		this.form.target = 'kXHR_iframe_' + this.i;
151		this.form.action = url;
152		this.form.method = method;
153
154		// store any arguements as hidden inputs on the form
155		if ( args ) this.appendFormElements( args );
156
157		// append the form to the document body
158		document.body.appendChild( this.form );
159
160    }
161
162	this.appendFormElements = function( argstr ) {
163
164		// split the args string into each var=val combination
165		var args = argstr.split( '&' );
166
167		// loop through and create an input for each arg
168		for ( var i=0; i < args.length; i++ ) {
169
170			var parts = args[i].split( '=' );
171
172			var input = document.createElement( 'input' );
173			input.name = unescape( parts[0] );
174			input.type = 'hidden';
175			input.value = unescape( parts[1] );
176
177			this.form.appendChild( input );
178
179		}
180
181	}
182
183	// blank function to prevent errors being thrown on post
184	this.setRequestHeader = function () { }
185
186    this.send = function( postdata ) {
187
188		if ( postdata ) this.appendFormElements( postdata );
189
190		this.form.submit();
191
192        kXHR_objs[this.i]=this;
193        setTimeout( 'ifXMLHttpRequest_checkState(' + this.i + ')', 500 );
194
195    }
196
197    return true;
198
199}
200function ifXMLHttpRequest_checkState( inst ) {
201
202	var obj = kXHR_objs[inst];
203
204    var frame = window.frames['kXHR_iframe_'+inst];
205
206	// if the frame has finished loading
207	if ( ( obj.iframe.readyState && obj.iframe.readyState == 'complete' ) || ( obj.iframe.contentDocument && obj.iframe.contentDocument.body ) ) {
208
209		var responseText;
210
211		// try & find the document content in the frame
212		try {
213
214			responseText = window.frames['kXHR_iframe_'+inst].document.body.childNodes[0].data;
215
216		} catch (e) {
217
218			responseText = obj.iframe.contentDocument.body.innerHTML;
219
220		}
221
222		// update the various state fields and call onreadystatechange
223		obj.responseText = responseText;
224		obj.readyState = 4;
225		obj.status = 200;
226		obj.onreadystatechange();
227
228		// remove the html elements that were created
229		obj.iframe.parentNode.removeChild( obj.iframe );
230		obj.div.parentNode.removeChild( obj.div );
231		obj.form.parentNode.removeChild( obj.form );
232
233	// otherwise check again in half a second
234	} else {
235
236		setTimeout( 'ifXMLHttpRequest_checkState(' + inst + ')', 500 );
237
238	}
239
240}

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.