/** * */ // Függőségek if ("undefined" == typeof AITIA) { alert("AITIA include missing!"); } // Többszörös include if ("undefined" != typeof AITIA_AJAX) { alert("AITIA_AJAX multiple insert!"); } AITIA_AJAX = 1; Aitia.Ajax = { cache: {}, requestPool: [], cacheTimeout: 30000, fingerprint: function(opt) { var r = ''; for(var i in opt) { r += i + '#' + opt[i].toString() + '@@'; } return r; }, deleteCache: function() { this.cache = {}; }, // True-val tér vissza, ha a megadott nevű kérés létezik a sorban. isNameInPool: function(name) { var retVal = false; // A 0. az aktuális for (var i=0; i-1 ) { var part1 = params.requestURL.replace(/^(.*\?).*$/gim,'$1'); var part2 = params.requestURL.replace(/^.*\?(.*)$/gim,'$1'); part2 = part2.replace(/\&+/gim,'&'); params.requestURL = part1 + part2; } var request = { requestURL: params.requestURL?params.requestURL:'', callBack: params.callBack?params.callBack:'', postParams: params.postParams?params.postParams:[], callbackParams: params.callbackParams?params.callbackParams:[], name: params.name?params.name:'', cache: params.cache?params.cache:false, // ez majd false lesz alapból async: params.async?params.async:true, queue: params.queue?params.queue:true }; if(false == params.queue) { this.sendRequest(request); } else { request.async = true; this.requestPool.push(request); if (this.requestPool.length==1) { this.processRequest(); } } }, sendRequest: function(request) { var f = this.fingerprint(request); var cached = false; if(request.cache && ('undefined' != typeof this.cache[f])) { if((new Date()).getTime() - this.cache[f].timestamp < this.cacheTimeout) { cached = true; } } if(cached) { this.run(request, this.cache[f].responseText); /* if(typeof(request.callBack) == 'function') { request.callBack(escape(this.cache[f].responseText),request.callbackParams); } else if('' != request.callBack) { eval("callbackExists = (window." + request.callBack + ");"); if (callbackExists) { var s = request.callBack + "('" + escape(this.cache[f].responseText) + "', request.callbackParams);"; eval(s); } } */ /* var fn = window; if('function' == typeof request.callBack.split) { var tmp = request.callBack.split('.'); for(var k=0; k 0 && this.requestPool[0].name != 'webra_deactivated') { var r = this.requestPool[0]; this.sendRequest(r); } else if(this.requestPool.length > 0) { this.requestPool.shift(); this.processRequest(); } }, semmi: 0 };