diff options
Diffstat (limited to 'lib/scripts/tw-sack.js')
-rw-r--r-- | lib/scripts/tw-sack.js | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/scripts/tw-sack.js b/lib/scripts/tw-sack.js index 0c7e81bf1..cfcbe0ea9 100644 --- a/lib/scripts/tw-sack.js +++ b/lib/scripts/tw-sack.js @@ -15,6 +15,7 @@ function sack(file){ this.onLoaded = function() { }; this.onInteractive = function() { }; this.onCompletion = function() { }; + this.afterCompletion = function() { }; this.createAJAX = function() { try { @@ -30,10 +31,10 @@ function sack(file){ this.xmlhttp = new XMLHttpRequest(); } if (!this.xmlhttp){ - this.failed = true; + this.failed = true; } }; - + this.setVar = function(name, value){ if (this.URLString.length < 3){ this.URLString = name + "=" + value; @@ -41,12 +42,12 @@ function sack(file){ this.URLString += "&" + name + "=" + value; } }; - + this.encVar = function(name, value){ var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value); return varString; }; - + this.encodeURLString = function(string){ varArray = string.split('&'); for (i = 0; i < varArray.length; i++){ @@ -58,25 +59,25 @@ function sack(file){ } return varArray.join('&'); }; - + this.runResponse = function(){ eval(this.response); }; - + this.runAJAX = function(urlstring){ this.responseStatus = new Array(2); - if(this.failed && this.AjaxFailedAlert){ - alert(this.AjaxFailedAlert); + if(this.failed && this.AjaxFailedAlert){ + alert(this.AjaxFailedAlert); } else { - if (urlstring){ + if (urlstring){ if (this.URLString.length){ - this.URLString = this.URLString + "&" + urlstring; + this.URLString = this.URLString + "&" + urlstring; } else { - this.URLString = urlstring; + this.URLString = urlstring; } } if (this.encodeURIString){ - var timeval = new Date().getTime(); + var timeval = new Date().getTime(); this.URLString = this.encodeURLString(this.URLString); this.setVar("rndval", timeval); } @@ -93,7 +94,7 @@ function sack(file){ try { this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); } catch (e) {} - } + } this.xmlhttp.onreadystatechange = function() { switch (self.xmlhttp.readyState){ @@ -122,6 +123,7 @@ function sack(file){ self.elementObj.innerHTML = self.response; } } + self.afterCompletion(); self.URLString = ""; break; } |