summaryrefslogtreecommitdiff
path: root/lib/scripts/tw-sack.js
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2015-07-31 10:00:09 +0200
committerAndreas Gohr <andi@splitbrain.org>2015-07-31 10:00:09 +0200
commit767d16693c9df38a2f496d4ca2ba8559db5eba5d (patch)
tree6417fc6096e39e62b702f88dbab1ce9f083db0b3 /lib/scripts/tw-sack.js
parent8ad3f4e85f7cf470f5147fbf99f7c1c28f980ac2 (diff)
downloadrpg-767d16693c9df38a2f496d4ca2ba8559db5eba5d.tar.gz
rpg-767d16693c9df38a2f496d4ca2ba8559db5eba5d.tar.bz2
removed deprecated JavaScript
Diffstat (limited to 'lib/scripts/tw-sack.js')
-rw-r--r--lib/scripts/tw-sack.js140
1 files changed, 0 insertions, 140 deletions
diff --git a/lib/scripts/tw-sack.js b/lib/scripts/tw-sack.js
deleted file mode 100644
index b0e570151..000000000
--- a/lib/scripts/tw-sack.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Simple AJAX Code-Kit (SACK) */
-/* ©2005 Gregory Wild-Smith */
-/* www.twilightuniverse.com */
-/* Software licenced under a modified X11 licence, see documentation or authors website for more details */
-/* @deprecated */
-
-function sack(file){
- this.AjaxFailedAlert = "Your browser does not support the enhanced functionality of this website, and therefore you will have an experience that differs from the intended one.\n";
- this.requestFile = file;
- this.method = "POST";
- this.URLString = "";
- this.encodeURIString = true;
- this.execute = false;
- this.asynchronous = true;
-
- this.onLoading = function() { };
- this.onLoaded = function() { };
- this.onInteractive = function() { };
- this.onCompletion = function() { };
- this.afterCompletion = function() { };
-
- this.createAJAX = function() {
- try {
- this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (err) {
- this.xmlhttp = null;
- }
- }
- if(!this.xmlhttp && typeof XMLHttpRequest != "undefined"){
- this.xmlhttp = new XMLHttpRequest();
- }
- if (!this.xmlhttp){
- this.failed = true;
- }
- };
-
- this.setVar = function(name, value){
- if (this.URLString.length < 3){
- this.URLString = name + "=" + value;
- } else {
- 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++){
- urlVars = varArray[i].split('=');
- if (urlVars[0].indexOf('amp;') != -1){
- urlVars[0] = urlVars[0].substring(4);
- }
- varArray[i] = this.encVar(urlVars[0],urlVars[1]);
- }
- return varArray.join('&');
- };
-
- this.runResponse = function(){
- eval(this.response);
- };
-
- this.runAJAX = function(urlstring){
- DEPRECATED('Please use jQuery.post() or any other of jQuery\'s AJAX methods.');
-
- this.responseStatus = new Array(2);
- if(this.failed && this.AjaxFailedAlert){
- alert(this.AjaxFailedAlert);
- } else {
- if (urlstring){
- if (this.URLString.length){
- this.URLString = this.URLString + "&" + urlstring;
- } else {
- this.URLString = urlstring;
- }
- }
- if (this.encodeURIString){
- var timeval = new Date().getTime();
- this.URLString = this.encodeURLString(this.URLString);
- this.setVar("rndval", timeval);
- }
- if (this.element) { this.elementObj = document.getElementById(this.element); }
- if (this.xmlhttp) {
- var self = this;
- if (this.method == "GET") {
- var totalurlstring = this.requestFile + "?" + this.URLString;
- this.xmlhttp.open(this.method, totalurlstring, this.asynchronous);
- } else {
- this.xmlhttp.open(this.method, this.requestFile, this.asynchronous);
- }
- if (this.method == "POST"){
- try {
- this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
- } catch (e) {}
- }
-
- this.xmlhttp.onreadystatechange = function() {
- switch (self.xmlhttp.readyState){
- case 1:
- self.onLoading();
- break;
- case 2:
- self.onLoaded();
- break;
- case 3:
- self.onInteractive();
- break;
- case 4:
- self.response = self.xmlhttp.responseText;
- self.responseXML = self.xmlhttp.responseXML;
- self.responseStatus[0] = self.xmlhttp.status;
- self.responseStatus[1] = self.xmlhttp.statusText;
- self.onCompletion();
- if(self.execute){ self.runResponse(); }
- if (self.elementObj) {
- var elemNodeName = self.elementObj.nodeName;
- elemNodeName.toLowerCase();
- if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea"){
- self.elementObj.value = self.response;
- } else {
- self.elementObj.innerHTML = self.response;
- }
- }
- self.afterCompletion();
- self.URLString = "";
- break;
- }
- };
- this.xmlhttp.send(this.URLString);
- }
- }
- };
-this.createAJAX();
-}