WordPress/wp-includes/js/tw-sack.min.js
desrosj 28683975c9 Build/Test Tools: Support NodeJS 14.x in the 5.0 branch.
This updates the 5.0 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy.

In addition to backporting the package updates that happened after branching 5.0, dependencies that were removed in future releases have also been updated to their latest versions.

Props desrosj, dd32, netweb, jorbin.
Merges [44233,44728,45321,45765,45826,46403-46404,46408,46409,47404,47867-47869,47872-47873,48705,49636,49933,49937,49939,49940,49983,49989,50017,50126,50176,50185,50192] to the 5.0 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/5.0@50201


git-svn-id: http://core.svn.wordpress.org/branches/5.0@49875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-05 04:05:04 +00:00

1 line
3.2 KiB
JavaScript

function sack(file){this.xmlhttp=null,this.resetData=function(){this.method="POST",this.queryStringSeparator="?",this.argumentSeparator="&",this.URLString="",this.encodeURIString=!0,this.execute=!1,this.element=null,this.elementObj=null,this.requestFile=file,this.vars=new Object,this.responseStatus=new Array(2)},this.resetFunctions=function(){this.onLoading=function(){},this.onLoaded=function(){},this.onInteractive=function(){},this.onCompletion=function(){},this.onError=function(){},this.onFail=function(){}},this.reset=function(){this.resetFunctions(),this.resetData()},this.createAJAX=function(){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){this.xmlhttp=null}}this.xmlhttp||("undefined"!=typeof XMLHttpRequest?this.xmlhttp=new XMLHttpRequest:this.failed=!0)},this.setVar=function(t,e){this.vars[t]=Array(e,!1)},this.encVar=function(t,e,n){if(1==n)return Array(encodeURIComponent(t),encodeURIComponent(e));this.vars[encodeURIComponent(t)]=Array(encodeURIComponent(e),!0)},this.processURLString=function(t,e){for(encoded=encodeURIComponent(this.argumentSeparator),regexp=new RegExp(this.argumentSeparator+"|"+encoded),varArray=t.split(regexp),i=0;i<varArray.length;i++)urlVars=varArray[i].split("="),1==e?this.encVar(urlVars[0],urlVars[1]):this.setVar(urlVars[0],urlVars[1])},this.createURLString=function(t){for(key in this.encodeURIString&&this.URLString.length&&this.processURLString(this.URLString,!0),t&&(this.URLString.length?this.URLString+=this.argumentSeparator+t:this.URLString=t),this.setVar("rndval",(new Date).getTime()),urlstringtemp=new Array,this.vars)0==this.vars[key][1]&&1==this.encodeURIString&&(encoded=this.encVar(key,this.vars[key][0],!0),delete this.vars[key],this.vars[encoded[0]]=Array(encoded[1],!0),key=encoded[0]),urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0];this.URLString+=t?this.argumentSeparator+urlstringtemp.join(this.argumentSeparator):urlstringtemp.join(this.argumentSeparator)},this.runResponse=function(){eval(this.response)},this.runAJAX=function(t){if(this.failed)this.onFail();else if(this.createURLString(t),this.element&&(this.elementObj=document.getElementById(this.element)),this.xmlhttp){var e=this;if("GET"==this.method)totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString,this.xmlhttp.open(this.method,totalurlstring,!0);else{this.xmlhttp.open(this.method,this.requestFile,!0);try{this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(t){}}this.xmlhttp.onreadystatechange=function(){switch(e.xmlhttp.readyState){case 1:e.onLoading();break;case 2:e.onLoaded();break;case 3:e.onInteractive();break;case 4:e.response=e.xmlhttp.responseText,e.responseXML=e.xmlhttp.responseXML,e.responseStatus[0]=e.xmlhttp.status,e.responseStatus[1]=e.xmlhttp.statusText,e.execute&&e.runResponse(),e.elementObj&&(elemNodeName=e.elementObj.nodeName,elemNodeName.toLowerCase(),"input"==elemNodeName||"select"==elemNodeName||"option"==elemNodeName||"textarea"==elemNodeName?e.elementObj.value=e.response:e.elementObj.innerHTML=e.response),"200"==e.responseStatus[0]?e.onCompletion():e.onError(),e.URLString=""}},this.xmlhttp.send(this.URLString)}},this.reset(),this.createAJAX()}