index.js 7.58 KB
var LS=function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var o=r(1),i=n(o),s=window.LS||{};s.load=function(){function e(e){var i=e.arr[e.index];if(window.localStorage){var s=window.localStorage.getItem(i.name+i.type+i.url),a=window.localStorage.getItem(i.name+i.type+i.url+"?v");o||null==s||0==s.length||a!==i.version?n(e):(e.arr[e.index].text=s,t(e))}else r(e)}function t(t){var r,n=t.arr[t.index],o=document.head||document.getElementsByTagName("head")[0]||document.documentElement.firstElementChild,i=document.body||document.getElementsByTagName("body")[0];if("css"==n.type?(r=document.createElement("style"),r.type="text/css",r.innerHTML=n.text,o.appendChild(r)):"js"==n.type&&(r=document.createElement("script"),r.charset="utf-8",r.type="text/javascript",r.innerHTML=n.text,i.appendChild(r)),"fastclick"==n.name&&FastClick.attach(document.body),t.index<t.arr.length-1){var s=t.index;t.index=s+1,e(t)}}function r(e){var t,n=e.arr[e.index],o=document.head||document.getElementsByTagName("head")[0]||document.documentElement.firstElementChild,i=document.body||document.getElementsByTagName("body")[0];if("css"==n.type?(t=document.createElement("link"),t.rel="stylesheet",t.type="text/css",t.href=n.url,o.appendChild(t)):"js"==n.type&&(t=document.createElement("script"),t.charset="utf-8",t.type="text/javascript",t.src=n.url,i.appendChild(t)),e.index<e.arr.length-1){var s=e.index;e.index=s+1,r(e)}}function n(r){var n=r.arr[r.index],o=n.url+"?"+Math.random();fetch(o,{method:"get",mode:"no-cors",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=utf-8","Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},credentials:"include"}).then(function(e){if(e.ok)return e.text()}).then(function(o){if(o)r.arr[r.index].text=o,window.localStorage.setItem(n.name+n.type+n.url,r.arr[r.index].text),window.localStorage.setItem(n.name+n.type+n.url+"?v",n.version),t(r);else if(console.log("服务器繁忙,请稍后再试"),r.index<r.arr.length-1){var i=r.index;r.index=i+1,e(r)}})["catch"](function(e){console.log(e)})}var o=!1,s=function(){var t=[{name:"fastclick",type:"js",version:"v1.0.6",url:"/cloudstore/resource/mobile/fastclick/fastclick.js"},{name:"react-with-addons.min",type:"js",version:"v15.3.1",url:"/cloudstore/resource/mobile/react/react-with-addons.min.js"},{name:"react.dom.min",type:"js",version:"v15.3.1",url:"/cloudstore/resource/mobile/react/react-dom.min.js"}],r={arr:arguments[0]?t.concat(arguments[0]):t,index:0};o=!!arguments[1],e(r)};return s}(),e.exports=s},function(e,t){!function(){"use strict";function e(e){if("string"!=typeof e&&(e=e.toString()),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function t(e){return"string"!=typeof e&&(e=e.toString()),e}function r(e){this.map={};var t=this;e instanceof r?e.forEach(function(e,r){r.forEach(function(r){t.append(e,r)})}):e&&Object.getOwnPropertyNames(e).forEach(function(r){t.append(r,e[r])})}function n(e){return e.bodyUsed?fetch.Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function o(e){return new fetch.Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function i(e){var t=new FileReader;return t.readAsArrayBuffer(e),o(t)}function s(e){var t=new FileReader;return t.readAsText(e),o(t)}function a(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,"string"==typeof e)this._bodyText=e;else if(p.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(p.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else{if(e)throw new Error("unsupported BodyInit type");this._bodyText=""}},p.blob?(this.blob=function(){var e=n(this);if(e)return e;if(this._bodyBlob)return fetch.Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return fetch.Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(i)},this.text=function(){var e=n(this);if(e)return e;if(this._bodyBlob)return s(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as text");return fetch.Promise.resolve(this._bodyText)}):this.text=function(){var e=n(this);return e?e:fetch.Promise.resolve(this._bodyText)},p.formData&&(this.formData=function(){return this.text().then(u)}),this.json=function(){return this.text().then(function(e){return JSON.parse(e)})},this}function c(e){var t=e.toUpperCase();return m.indexOf(t)>-1?t:e}function d(e,t){if(t=t||{},this.url=e,this.credentials=t.credentials||"omit",this.headers=new r(t.headers),this.method=c(t.method||"GET"),this.mode=t.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&t.body)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(t.body)}function u(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}}),t}function l(e){var t=new r,n=e.getAllResponseHeaders().trim().split("\n");return n.forEach(function(e){var r=e.trim().split(":"),n=r.shift().trim(),o=r.join(":").trim();t.append(n,o)}),t}function f(){return y&&!/^(get|post|head|put|delete|options)$/i.test(this.method)?(this.usingActiveXhr=!0,new ActiveXObject("Microsoft.XMLHTTP")):new XMLHttpRequest}function h(e,t){t||(t={}),this._initBody(e),this.type="default",this.url=null,this.status=t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText,this.headers=t.headers instanceof r?t.headers:new r(t.headers),this.url=t.url||""}if(!self.fetch){r.prototype.append=function(r,n){r=e(r),n=t(n);var o=this.map[r];o||(o=[],this.map[r]=o),o.push(n)},r.prototype["delete"]=function(t){delete this.map[e(t)]},r.prototype.get=function(t){var r=this.map[e(t)];return r?r[0]:null},r.prototype.getAll=function(t){return this.map[e(t)]||[]},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.set=function(r,n){this.map[e(r)]=[t(n)]},r.prototype.forEach=function(e){var t=this;Object.getOwnPropertyNames(this.map).forEach(function(r){e(r,t.map[r])})};var p={blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in self},m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"],y=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);a.call(d.prototype),a.call(h.prototype),self.Headers=r,self.Request=d,self.Response=h,self.fetch=function(e,t){var r;return r=d.prototype.isPrototypeOf(e)&&!t?e:new d(e,t),new fetch.Promise(function(e,t){function n(){return"responseURL"in i?i.responseURL:/^X-Request-URL:/m.test(i.getAllResponseHeaders())?i.getResponseHeader("X-Request-URL"):void 0}function o(){if(4===i.readyState){var r=1223===i.status?204:i.status;if(r<100||r>599)return void t(new TypeError("Network request failed"));var o={status:r,statusText:i.statusText,headers:l(i),url:n()},s="response"in i?i.response:i.responseText;e(new h(s,o))}}var i=f();"cors"===r.credentials&&(i.withCredentials=!0),i.onreadystatechange=o,self.usingActiveXhr||(i.onload=o,i.onerror=function(){t(new TypeError("Network request failed"))}),i.open(r.method,r.url,!0),"responseType"in i&&p.blob&&(i.responseType="blob"),r.headers.forEach(function(e,t){t.forEach(function(t){i.setRequestHeader(e,t)})}),i.send("undefined"==typeof r._bodyInit?null:r._bodyInit)})},fetch.Promise=self.Promise,self.fetch.polyfill=!0}}()}]);