1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
|
"use strict";var r=[];window.JSON||(r=["./json"]),define(r,function(){function serialize(t,e,o){var r;if(Array.isArray(e))e.forEach(function(e,i){r=t?t+"["+(Array.isArray(e)?i:"")+"]":i,"object"==typeof e?serialize(r,e,o):o(r,e)});else for(var i in e)r=t?t+"["+i+"]":i,"object"==typeof e[i]?serialize(r,e[i],o):o(r,e[i])}var _request=function(t,e){this.transport=!0,e=(e+"").trim().toUpperCase(),this.xhr=Xhr(),this.pool={url:(t+"").trim(),type:e||"GET",form:"",headers:{},uuid:Math.random().toString(16).substr(2)}},_requestp=_request.prototype,toS=Object.prototype.toString,win=window,doc=win.document,encode=encodeURIComponent,decode=decodeURIComponent,noop=function(t){if(t)throw new Error(t+"")},rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,isLocal=!1;try{isLocal=rlocalProtocol.test(location.protocol)}catch(e){}var rheaders=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm;!win.FormData,String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){var o,r;if(null===this)throw new TypeError("forEach is not a function of null");var i=Object(this),s=i.length>>>0;if("function"!=typeof t)throw new TypeError("callback is not a function");for(arguments.length>1&&(o=e),r=0;s>r;){var a;r in i&&(a=i[r],t.call(o,a,r,i)),r++}}),Array.isArray||(Array.isArray=function(t){return"[object Array]"===toS.call(t)});var IE=function(){if(window.VBArray){var t=document.documentMode;return t?t:window.XMLHttpRequest?7:6}return 0}();win.Xhr=function(){var obj=["XMLHttpRequest","ActiveXObject('MSXML2.XMLHTTP.6.0')","ActiveXObject('MSXML2.XMLHTTP.3.0')","ActiveXObject('MSXML2.XMLHTTP')","ActiveXObject('Microsoft.XMLHTTP')"];obj[0]=8>IE&&0!==IE&&isLocal?"!":obj[0];for(var i=0,a;a=obj[i++];)try{if(eval("new "+a))return new Function("return new "+a)}catch(e){}}();var supportCors="withCredentials"in Xhr(),Format=function(){this.tagHooks=new function(){this.option=doc.createElement("select"),this.thead=doc.createElement("table"),this.td=doc.createElement("tr"),this.area=doc.createElement("map"),this.tr=doc.createElement("tbody"),this.col=doc.createElement("colgroup"),this.legend=doc.createElement("fieldset"),this._default=doc.createElement("div"),this.g=doc.createElementNS("http://www.w3.org/2000/svg","svg"),this.optgroup=this.option,this.tbody=this.tfoot=this.colgroup=this.caption=this.thead,this.th=this.td};var t=this;"circle,defs,ellipse,image,line,path,polygon,polyline,rect,symbol,text,use".replace(/,/g,function(e){t.tagHooks[e]=t.tagHooks.g}),this.rtagName=/<([\w:]+)/,this.rxhtml=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,this.scriptTypes={"text/javascript":1,"text/ecmascript":1,"application/ecmascript":1,"application/javascript":1},this.rhtml=/<|&#?\w+;/};Format.prototype={parseJS:function(code){if(code=(code+"").trim())if(1===code.indexOf("use strict")){var script=doc.createElement("script");script.text=code,doc.head.appendChild(script).parentNode.removeChild(script)}else eval(code)},parseXML:function(t,e,o){try{var r=doc.documentMode;win.DOMParser&&(!r||r>8)?(o=new DOMParser,e=o.parseFromString(t,"text/xml")):(e=new ActiveXObject("Microsoft.XMLDOM"),e.async="false",e.loadXML(t))}catch(i){e=void 0}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length||console.error("Invalid XML: "+t),e},parseHTML:function(t){var e=doc.createDocumentFragment().cloneNode(!1);if("string"!=typeof t)return e;if(!this.rhtml.test(t))return e.appendChild(document.createTextNode(t)),e;t=t.replace(this.rxhtml,"<$1></$2>").trim();var o=(this.rtagName.exec(t)||["",""])[1].toLowerCase(),r=this.tagHooks[o]||this.tagHooks._default,i=null;r.innerHTML=t;var s=r.getElementsByTagName("script");if(s.length)for(var a,n=0;a=s[n++];)if(this.scriptTypes[a.type]){var p=doc.createElement("script").cloneNode(!1);a.attributes.forEach(function(t){p.setAttribute(t.name,t.value)}),p.text=a.text,a.parentNode.replaceChild(p,a)}for(;i=r.firstChild;)e.appendChild(i);return e},param:function(t){if(!t||"string"==typeof t
|