From 91c8ccf200d1f9bad40f1a4495f005505a25a9e0 Mon Sep 17 00:00:00 2001 From: Christian Weber Date: Tue, 29 Jan 2008 19:20:24 +0000 Subject: rename loader to req upon popular request to avoid more confusion than necessary --- itjs/loader.js | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/itjs/loader.js b/itjs/loader.js index 90463a2..16a3deb 100644 --- a/itjs/loader.js +++ b/itjs/loader.js @@ -6,7 +6,7 @@ function it_loader(handler) { /* Clear cache etc. if completely new data */ - this.loader = null; + this.req = null; this.handler = handler; this.instance = it_loader.instances++; this.callid = 0; @@ -51,7 +51,7 @@ load: function(baseurl, pos, num, query_volatile, retry) this.num = num; this.query_volatile = query_volatile; - if (this.loader) + if (this.req) this.stop(); while ((num > 0) && this.entry[pos]) @@ -65,7 +65,7 @@ load: function(baseurl, pos, num, query_volatile, retry) if (num > 0) { - this.loader = null; + this.req = null; var samehost = (baseurl.indexOf('http://') < 0 || baseurl.indexOf(window.location.hostname) > 0); if (retry) @@ -76,7 +76,7 @@ load: function(baseurl, pos, num, query_volatile, retry) { try { - this.loader = new XMLHttpRequest(); + this.req = new XMLHttpRequest(); } catch (e) { @@ -86,7 +86,7 @@ load: function(baseurl, pos, num, query_volatile, retry) { try { - this.loader = new ActiveXObject(classnames[i]); + this.req = new ActiveXObject(classnames[i]); break; } catch (e) { } @@ -95,13 +95,13 @@ load: function(baseurl, pos, num, query_volatile, retry) try { - this.loader.open(this.method, baseurl + "&pos=" + pos + "&num=" + num + (query_volatile ? query_volatile : "")); + this.req.open(this.method, baseurl + "&pos=" + pos + "&num=" + num + (query_volatile ? query_volatile : "")); var me = this; - this.loader.onreadystatechange = function() { me.readyStateChanged(); } - var workingxmlhttp = this.loader.onreadystatechange; + this.req.onreadystatechange = function() { me.readyStateChanged(); } + var workingxmlhttp = this.req.onreadystatechange; if (!workingxmlhttp) /* Old Konqueror */ - this.loader = null; + this.req = null; } catch (e) { } } @@ -109,12 +109,12 @@ load: function(baseurl, pos, num, query_volatile, retry) this.starttime = new Date().getTime(); this.retry = retry; - if (this.loader) + if (this.req) { if (this.method == "POST") - this.loader.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + this.req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - this.loader.send(this.post_data); + this.req.send(this.post_data); } else { @@ -129,8 +129,8 @@ load: function(baseurl, pos, num, query_volatile, retry) else this.scrpt = document.createElement("script"); - it_loader['__inst'+this.instance] = this; - this.loader = { starttime: this.starttime, retry: retry }; + it_loader['__inst' + this.instance] = this; + this.req = { starttime: this.starttime, retry: retry }; try { if (!document.all) this.scrpt.src = req_url; @@ -167,17 +167,17 @@ post: function(baseurl, data) readyStateChanged: function() { - var loader = this.loader; // Avoid race conditions + var req = this.req; // Avoid race conditions it_loader.sequence += "r"; - if (loader && (loader.readyState == 4)) + if (req && (req.readyState == 4)) { var data = null; try { - if (loader.responseText != "") - data = eval("("+ loader.responseText + ")"); + if (req.responseText != "") + data = eval("(" + req.responseText + ")"); } catch (e) { @@ -186,7 +186,7 @@ readyStateChanged: function() if (retry < 10) it_timer({ object: this, method: "retryload", timeout: Math.pow(5, Math.min(retry, 5)), baseurl: this.baseurl, pos: this.pos, num: this.num, query_volatile: this.query_volatile, retry: retry }); else - ED(e, loader.responseText); + ED(e, req.responseText); } if (data) @@ -201,11 +201,11 @@ retryload: function(p) dataReady: function(data, callid) { - var fixkonqueror33gcbug = this.loader; + var fixkonqueror33gcbug = this.req; var loadtime = new Date().getTime() - this.starttime; it_loader.sequence += "e"; - this.loader = null; + this.req = null; if ((typeof data == "object") && (this.callid == callid)) { @@ -244,7 +244,7 @@ stop: function() { try { - this.loader.abort(); + this.req.abort(); } catch (e) { } @@ -253,11 +253,11 @@ stop: function() unlink: function() { - if (it_loader['__inst'+this.instance]) - it_loader['__inst'+this.instance] = null; + if (it_loader['__inst' + this.instance]) + it_loader['__inst' + this.instance] = null; - if (this.loader) - this.loader = null; + if (this.req) + this.req = null; if (this.scrpt) { -- cgit v1.2.3