PageSourceSearch

https://arnoia.com/js/xmlHttp.js?v=230c923287c7ae3e54a2973e560b3b5b

js arnoia.com collected 2026-09-26 09:17:12 UTC 8,272 bytes, 302 lines download raw bytes

1var req;
2var req2;
3var capaAjax1 = 'contenido';
4var urlMuestra;
5var busquedaLanzada = false; // para controlar se se ha hecho ya la petición de buscar o es un boton atrás
6var sinHistorial = false;
7
8function loadXMLDoc(url, objFunction, formulario) {
9	req = false;
10	var cadena = '';
11	urlMuestra = url;
12
13	// branch for native XMLHttpRequest object
14	if (window.XMLHttpRequest) {
15		// La version 7 de IE entra por aqui
16		try {
17			req = new XMLHttpRequest();
18		} catch (e) {
19			req = false;
20		}
21		// branch for IE/Windows ActiveX version
22	} else if (window.ActiveXObject) {
23		try {
24			req = new ActiveXObject('Msxml2.XMLHTTP');
25		} catch (e) {
26			try {
27				req = new ActiveXObject('Microsoft.XMLHTTP');
28			} catch (e) {
29				req = false;
30			}
31		}
32	}
33
34	if (req) {
35		req.onload = objFunction;
36
37		if (typeof(formulario) == 'undefined' || formulario == null || formulario == '') {
38			if (url.indexOf('fr_AJAX') == -1) {
39				if (url.indexOf('?') == -1 )
40					url += '?fr_AJAX=S';
41				else
42					url += '&fr_AJAX=S';
43			}
44
45			url = url + '&c='+Math.random(); // Evitar cache Ajax
46
47			req.open('GET', url, true);
48			req.send('');
49		} else {
50			cadena = formToStringBase(formulario);
51			url = document.forms[formulario].action;
52			req.open('POST', url, true);
53			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
54			if (cadena.indexOf('fr_AJAX') == -1) {
55				if (cadena.indexOf('?') == -1 )
56					cadena += 'fr_AJAX=S';
57				else
58					cadena += '&fr_AJAX=S';
59			}
60			req.send(cadena);
61		}
62	}
63}
64
65function loadDoc(pagina, objFunction, formulario) {
66	try {
67		loadXMLDoc(pagina, objFunction, formulario);
68	} catch (e) {
69		var msg = (typeof e == 'string') ? e : ((e.message) ? e.message : 'Error desconocido');
70		mostrarModal('Error', 'Imposible obtener datos XML:<br>'+msg+'<br>'+pagina);
71		return;
72	}
73}
74
75function loadXMLDoc2(url, objFunction, formulario) {
76	req2 = false;
77	var cadena = '';
78	urlMuestra = url;
79
80	// branch for native XMLHttpRequest object
81	if (window.XMLHttpRequest) {
82		// La version 7 de IE entra por aqui
83		try {
84			req2 = new XMLHttpRequest();
85		} catch (e) {
86			req2 = false;
87		}
88	// branch for IE/Windows ActiveX version
89	} else if (window.ActiveXObject) {
90		try {
91			req2 = new ActiveXObject('Msxml2.XMLHTTP');
92		} catch (e) {
93			try {
94				req2 = new ActiveXObject('Microsoft.XMLHTTP');
95			} catch (e) {
96				req2 = false;
97			}
98		}
99	}
100
101	if (req2) {
102		req2.onload = objFunction;
103		req2.timeout = 180000; // Set timeout to 180 seconds (180000 milliseconds)
104		req2.ontimeout = function() { console.log('Timed out XMLHttpRequest'); }
105
106		if (typeof(formulario) == 'undefined' || formulario == null || formulario == '') {
107			if (url.indexOf('fr_AJAX') == -1) {
108				if (url.indexOf('?') == -1)
109					url += '?fr_AJAX=S';
110				else {
111					if (url.slice(-1) != '&')
112						url += '&';
113					url += 'fr_AJAX=S';
114				}
115			}
116			req2.open('GET', url, true);
117			req2.send('');
118		} else {
119			cadena = formToStringBase(formulario);
120			req2.open('POST', url, true);
121			req2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
122			req2.send(cadena);
123		}
124	}
125}
126
127function loadDoc2(pagina, objFunction, formulario) {
128	try {
129		loadXMLDoc2(pagina, objFunction, formulario);
130	} catch (e) {
131		var msg = (typeof e == 'string') ? e : ((e.message) ? e.message : 'Error desconocido');
132		mostrarModal('Error', 'Imposible obtener datos XML:<br>'+msg+'<br>'+pagina);
133		return;
134	}
135}
136
137function getElementTextNS(prefix, local, parentElem, index) {
138	var result = '';
139
140	if (parentElem != null)
141			result = parentElem.getElementsByTagName(prefix + ':' + local)[index];
142	if (typeof(result) == 'undefined') {
143		if (parentElem != null)
144			result = parentElem.getElementsByTagName(local)[index];
145	}
146	if (result) {
147		// get text, accounting for possible
148		// whitespace (carriage return) text nodes
149		if (result.childNodes.length > 1) {
150			return result.childNodes[1].nodeValue;
151		} else {
152			return result.firstChild.nodeValue;
153		}
154	}
155	else {
156		return 'Error interno';
157	}
158}
159
160function formToStringBase(formulario) {
161	formu = document.forms[formulario];
162	salida = '';
163
164	for (i = 0; i < formu.elements.length; i++) {
165		if (formu.elements[i].name == '' || formu.elements[i].value == '')
166			continue;
167
168		if ((formu.elements[i].type == 'checkbox' || formu.elements[i].type == 'radio') && formu.elements[i].checked == false)
169			continue;
170		else
171			// salida += formu.elements[i].name+'='+escape(formu.elements[i].value)+'&';
172			salida += formu.elements[i].name+'='+encodeURIComponent(formu.elements[i].value)+'&';
173	}
174
175	return salida;
176}
177
178function formToString(formulario) {
179	formu = document.forms[formulario];
180
181	salida = formu.action+'?'+formToStringBase(formulario);
182
183	return salida;
184}
185
186function cambiaPagina() {
187	busquedaLanzada = false;
188
189	if (req.readyState == 4) {
190		if (req.status == 200) {
191			if (req.responseXML != null) {
192				var item = req.responseXML.getElementsByTagName('item')[0];
193				var content = getElementTextNS('content', 'encoded', item, 0);
194			} else
195				var content = 'Error';
196
197			var div = document.getElementById(capaAjax1);
198			var scs = content.extractScript();
199			div.innerHTML = content.stripScript();
200			scs.evalScript();
201			ocultarSuggester();
202			cerrarCargando();
203		} else
204			alert("There was a problem retrieving the XML data:\n" + req.statusText+' '+urlMuestra);
205	}
206}
207
208function cambiaPagina2() {
209	if (req2.readyState == 4) {
210		if (req2.status == 200) {
211			if (req2.responseXML != null) {
212				var item = req2.responseXML.getElementsByTagName('item')[0];
213				var content = getElementTextNS('content', 'encoded', item, 0);
214			} else
215				var content = 'Error';
216
217			var div = document.getElementById(capaAjax2);
218			var scs = content.extractScript();
219			div.innerHTML = content.stripScript();
220			scs.evalScript();
221			cerrarCargando();
222			if (ventanaModalCargando !== undefined && ventanaModalCargando != null)
223				ventanaModalCargando.close();
224		} else
225			alert("There was a problem retrieving the XML data:\n" + req.statusText+' '+urlMuestra);
226	}
227}
228
229function irCapa1(pagina, ajax, formulario, cargarHistorial) {
230	if (busquedaLanzada)
231		return;
232	mostrarCargando();
233
234	if (typeof ajax == 'undefined' || ajax == null || ajax == '')
235		ajax = AJAX;
236
237	if (ajax == 'S') {
238		window.scroll(0, 0); // Subir la página arriba del todo
239
240		if (typeof(cargarHistorial) == 'undefined')
241			cargarHistorial = true;
242
243		// console.log('cargarHistorial: '+cargarHistorial);
244
245		if ((typeof(formulario) == 'undefined' || formulario == null || formulario == '')) {
246			if (cargarHistorial)
247				cargaHistorial(pagina);
248			else {
249				var paginaHistorial = limpiarUrlHistorial(pagina);
250				history.replaceState({path: paginaHistorial}, null, paginaHistorial);
251			}
252		}
253
254		loadDoc(pagina, cambiaPagina, formulario);
255	} else {
256		if (typeof(formulario) == 'undefined' || formulario == null || formulario == '')
257			window.location.href = pagina;
258		else
259			document.forms[formulario].submit();
260	}
261}
262
263function irCapa2(pagina, formulario, idCapa) {
264	if (idCapa == undefined || idCapa == null || idCapa == '')
265		idCapa = capaAjax2;
266	else
267		capaAjax2 = idCapa;
268
269	if ($('#'+idCapa).length) {
270		var width = $('#'+idCapa).width();
271		$('#'+idCapa).html('<div class="text-center" style="font-size: 1.5em; width: '+width+'px">'+htmlCargando+'</div>');
272	}
273
274	loadDoc2(pagina, cambiaPagina2, formulario);
275}
276
277/**
278 * Carga el history del navegador
279 */
280function cargaHistorial(url) {
281	if (sinHistorial)
282		return;
283
284	url = limpiarUrlHistorial(url);
285
286	// (ÁRL, 27/02/19) Se modifica la forma de guardar las páginas en el historial
287	history.pushState({path: url}, null, url);
288	busquedaLanzada = true; // indica al guardianURL que esta peticion se ha realizado ya.
289}
290
291function loadDoc3(url) {
292	var xhttp = new XMLHttpRequest();
293	// xhttp.onreadystatechange = function() {
294	// 	if (xhttp.readyState == 4 && xhttp.status == 200) {
295	// 		document.getElementById('demo').innerHTML = xhttp.responseText;
296	// 		alert(xhttp.responseText);
297	// 	}
298	// };
299	xhttp.open('GET', url, false);
300	xhttp.send();
301	return xhttp.responseText;
302}

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.