PageSourceSearch

https://www.visegradgroup.eu/js/aitia/aitia_ajax.js

js visegradgroup.eu collected 2026-09-24 18:15:46 UTC 6,246 bytes, 214 lines download raw bytes

1/**
2 *
3 */
4
5// Függőségek
6if ("undefined" == typeof AITIA) {
7	alert("AITIA include missing!");
8}
9
10// Többszörös include
11if ("undefined" != typeof AITIA_AJAX) {
12	 alert("AITIA_AJAX multiple insert!");
13}
14
15AITIA_AJAX = 1;
16
17Aitia.Ajax = {
18	cache: {},
19	requestPool: [],
20	cacheTimeout: 30000,
21	
22	fingerprint: function(opt) {
23		var r = '';
24		for(var i in opt) {
25			r += i + '#' + opt[i].toString() + '@@';
26		}
27		return r;
28	},
29	
30	deleteCache: function() {
31		this.cache = {};
32	},
33	
34	// True-val tér vissza, ha a megadott nevű kérés létezik a sorban.
35	isNameInPool: function(name) {
36		var retVal = false;
37		
38		// A 0. az aktuális
39		for (var i=0; i<this.requestPool.length; i++) {
40			if(this.requestPool[i].name == name) {
41				retVal = true;
42				break;
43			}
44		}
45		
46		return retVal;
47	},
48	
49	//eredeti: addRequest(requestURL, callBack, postParams, callbackParams, name)
50	addRequest: function(params) {
51		if(params.name) { // a tobbi ilyet ki kell venni a poolbol
52			for (var i=0; i<this.requestPool.length; i++) {
53				if(this.requestPool[i].name == params.name) {
54					this.requestPool[i].name = "webra_deactivated";
55				}
56			}
57		} else {
58			params.name = '';
59		}
60
61		// A dupla & jel egyes proxy kiszolgálókon az url elnyelését okozhatja
62		if ( params.requestURL && params.requestURL.indexOf('?')>-1 ) {
63			var part1 = params.requestURL.replace(/^(.*\?).*$/gim,'$1');
64			var part2 = params.requestURL.replace(/^.*\?(.*)$/gim,'$1');
65			part2 = part2.replace(/\&+/gim,'&');
66			params.requestURL = part1 + part2;
67		}
68
69		var request = {
70			requestURL: params.requestURL?params.requestURL:'', 
71			callBack: params.callBack?params.callBack:'', 
72			postParams: params.postParams?params.postParams:[], 
73			callbackParams: params.callbackParams?params.callbackParams:[], 
74			name: params.name?params.name:'',
75			cache: params.cache?params.cache:false, // ez majd false lesz alapból
76			async: params.async?params.async:true,
77			queue: params.queue?params.queue:true
78		};
79		
80		if(false == params.queue) {
81			this.sendRequest(request);
82		} else {
83			request.async = true;
84			this.requestPool.push(request);
85			if (this.requestPool.length==1) {
86				this.processRequest();
87			}
88		}
89	},
90	
91	sendRequest: function(request) {
92		var f = this.fingerprint(request);
93		var cached = false;
94		if(request.cache && ('undefined' != typeof this.cache[f])) {
95			if((new Date()).getTime() - this.cache[f].timestamp < this.cacheTimeout) {
96				cached = true;
97			}
98		}
99		if(cached) {
100			this.run(request, this.cache[f].responseText);
101/*
102			if(typeof(request.callBack) == 'function') {
103				request.callBack(escape(this.cache[f].responseText),request.callbackParams);
104			} else if('' != request.callBack) {
105				eval("callbackExists = (window." + request.callBack + ");");
106				if (callbackExists) {
107					var s = request.callBack + "('" + escape(this.cache[f].responseText) + "', request.callbackParams);";
108					eval(s);
109				}
110			}
111*/
112			/*
113			var fn = window;
114			if('function' == typeof request.callBack.split) {
115				var tmp = request.callBack.split('.');
116				for(var k=0; k<tmp.length; k++) {
117					fn = fn[tmp[k]];
118				}
119				if('function' == typeof fn) {
120					fn(this.cache[f].responseText, request.callbackParams);
121				}
122			}
123			*/
124			/*
125			if('function' == typeof window[request.callBack]) {
126				//window[request.callBack](this.cache[f].responseText, request.callbackParams);
127			}
128			*/
129			Aitia.Ajax.requestPool.shift();
130			Aitia.Ajax.processRequest();
131		} else {
132			loadingIndicator(1);
133			var postData = '';
134			request.postParams.push(['webraRequestType', 'xmlhttp']);
135			for (var j=0; j<request.postParams.length; j++) {
136				postData += '&' + request.postParams[j][0] + '=' + encodeURIComponent(request.postParams[j][1]);
137			}
138			postData = postData.replace(/^&/, '?');
139			new Ajax.Request(request.requestURL, {
140				method: 'post',
141				asynchronous: request.async,
142				parameters: request.postParams.toObject(),
143				onSuccess: function(transport) {
144					if ("LOGIN_INSUFFICIENT_RIGHTS" == transport.getResponseHeader('X-Webra-loginerror')) {
145						top.location.reload();
146					} else {
147						transport.timestamp = (new Date()).getTime();
148						Aitia.Ajax.cache[f] = transport;
149Aitia.Ajax.run(request, transport.responseText);
150
151/*
152						if(typeof(request.callBack) == 'function') {
153							request.callBack(escape(transport.responseText),request.callbackParams);
154						} else if('' != request.callBack) {
155							eval("callbackExists = (window." + request.callBack + ");");
156							if (callbackExists) {
157								var s = request.callBack + "('" + escape(transport.responseText) + "', request.callbackParams);";
158								eval(s);
159							}
160						}
161*/
162						/*
163						var fn = window;
164						if('function' == typeof request.callBack.split) {
165							var tmp = request.callBack.split('.');
166							for(var k=0; k<tmp.length; k++) {
167								fn = fn[tmp[k]];
168							}
169							if('function' == typeof fn) {
170								fn(transport.responseText, request.callbackParams);
171							}
172						}
173						*/
174						loadingIndicator(0);
175						Aitia.Ajax.requestPool.shift();
176						Aitia.Ajax.processRequest();
177					}
178				},
179				onException: function(req, ex) {
180					loadingIndicator(0);
181					//console.info(req);
182					//console.info(ex);
183					Aitia.Ajax.requestPool.shift();
184					Aitia.Ajax.processRequest();
185				}
186			});
187		}
188	},
189	//callback futtatása
190		run: function(request, response) {
191			if(typeof(request.callBack) == 'function') {
192				request.callBack(escape(response), request.callbackParams);
193			} else if ('' != request.callBack) {
194		//stringként volt megadva a callback függvény
195		eval("callbackExists = (window." + request.callBack + ");");
196				if (callbackExists) {
197				var s = request.callBack + "('" + escape(response) + "', request.callbackParams);";
198				eval(s);
199				}
200			}  
201		},
202
203	processRequest: function() {
204		if(this.requestPool.length > 0 && this.requestPool[0].name != 'webra_deactivated') {
205			var r = this.requestPool[0];
206			this.sendRequest(r);
207		} else if(this.requestPool.length > 0) {
208			this.requestPool.shift();
209			this.processRequest();
210		}
211	},
212	
213	semmi: 0
214};

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.