/** * PreloadJS * Visit http://createjs.com/ for documentation, updates and examples. * * Copyright (c) 2011 gskinner.com, inc. * * Distributed under the terms of the MIT license. * http://www.opensource.org/licenses/mit-license.html * * This notice shall be included in all copies or substantial portions of the Software. **/(function(){var c=this.createjs=this.createjs||{},c=c.PreloadJS=c.PreloadJS||{};c.version="0.3.1";c.buildDate="Thu, 09 May 2013 22:04:32 GMT"})();this.createjs=this.createjs||{}; (function(){var c=function(){this.initialize()},a=c.prototype;c.initialize=function(d){d.addEventListener=a.addEventListener;d.removeEventListener=a.removeEventListener;d.removeAllEventListeners=a.removeAllEventListeners;d.hasEventListener=a.hasEventListener;d.dispatchEvent=a.dispatchEvent};a._listeners=null;a.initialize=function(){};a.addEventListener=function(d,b){var e=this._listeners;e?this.removeEventListener(d,b):e=this._listeners={};var a=e[d];a||(a=e[d]=[]);a.push(b);return b};a.removeEventListener= function(d,b){var e=this._listeners;if(e){var a=e[d];if(a)for(var f=0,c=a.length;f=0;c--)if(h=this._loadQueue[c].getItem(),h.id==a|| h.src==a){this._loadQueue.splice(c,1)[0].cancel();break}for(c=this._loadQueueBackup.length-1;c>=0;c--)if(h=this._loadQueueBackup[c].getItem(),h.id==a||h.src==a){this._loadQueueBackup.splice(c,1)[0].cancel();break}if(d)delete this._loadItemsById[d.id],delete this._loadItemsBySrc[d.src],this._disposeItem(d);else for(var c=this._currentLoads.length-1;c>=0;c--){var h=this._currentLoads[c].getItem();if(h.id==a||h.src==a){this._currentLoads.splice(c,1)[0].cancel();b=true;break}}}b&&this._loadNext()}else{this.close(); for(a in this._loadItemsById)this._disposeItem(this._loadItemsById[a]);this.init(this.useXHR)}};a.reset=function(){this.close();for(var b in this._loadItemsById)this._disposeItem(this._loadItemsById[b]);b=[];for(i=0,l=this._loadQueueBackup.length;i0&&this._loadNext()};a.loadFile=function(b,a,d){b==null?this._sendError({text:"PRELOAD_NO_FILE"}):(this._addItem(b,d),a!==false?this.setPaused(false):this.setPaused(true))}; a.loadManifest=function(b,a,d){var c=null;if(b instanceof Array){if(b.length==0){this._sendError({text:"PRELOAD_MANIFEST_EMPTY"});return}c=b}else{if(b==null){this._sendError({text:"PRELOAD_MANIFEST_NULL"});return}c=[b]}for(var b=0,o=c.length;b=this._maxConnections)break;var c=this._loadQueue[a];if(this.maintainScriptOrder&& c instanceof createjs.TagLoader&&c.getItem().type==createjs.LoadQueue.JAVASCRIPT){if(this._currentlyLoadingScript)continue;this._currentlyLoadingScript=true}this._loadQueue.splice(a,1);a--;d--;this._loadItem(c)}}};a._loadItem=function(a){a.addEventListener("progress",createjs.proxy(this._handleProgress,this));a.addEventListener("complete",createjs.proxy(this._handleFileComplete,this));a.addEventListener("error",createjs.proxy(this._handleFileError,this));this._currentLoads.push(a);this._sendFileStart(a.getItem()); a.load()};a._handleFileError=function(a){var d=a.target;this._numItemsLoaded++;this._updateProgress();a={item:d.getItem()};this._sendError(a);this.stopOnError||(this._removeLoadItem(d),this._loadNext())};a._handleFileComplete=function(a){var a=a.target,d=a.getItem();this._loadedResults[d.id]=a.getResult();a instanceof createjs.XHRLoader&&(this._loadedRawResults[d.id]=a.getResult(true));this._removeLoadItem(a);if(this.maintainScriptOrder&&d.type==createjs.LoadQueue.JAVASCRIPT)if(a instanceof createjs.TagLoader)this._currentlyLoadingScript= false;else{this._loadedScripts[this._scriptOrder.indexOf(d)]=d;this._checkScriptLoadOrder(a);return}this._processFinishedLoad(d,a)};a._processFinishedLoad=function(a,d){this._numItemsLoaded++;this._updateProgress();this._sendFileComplete(a,d);this._loadNext()};a._checkScriptLoadOrder=function(){for(var a=this._loadedScripts.length,d=0;d0){for(var c=0,f=0,o=this._currentLoads.length;f-1;d.isOpera=window.opera!=null;d.isChrome=a.indexOf("Chrome")>-1;d.isIOS=a.indexOf("iPod")>-1||a.indexOf("iPhone")>-1||a.indexOf("iPad")>-1};d.init();createjs.LoadQueue.BrowserDetect=d;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a){if(this==null)throw new TypeError;var d=Object(this),c=d.length>>>0;if(c===0)return-1;var f=0;arguments.length> 1&&(f=Number(arguments[1]),f!=f?f=0:f!=0&&f!=Infinity&&f!=-Infinity&&(f=(f>0||-1)*Math.floor(Math.abs(f))));if(f>=c)return-1;for(f=f>=0?f:Math.max(c-Math.abs(f),0);f0&&a.total==0||this._sendProgress({loaded:a.loaded,total:a.total})};a._handleLoadStart=function(){clearTimeout(this._loadTimeout);this._sendLoadStart()};a._handleAbort=function(){this._clean();this._sendError()};a._handleError=function(){this._clean();this._sendError()};a._handleReadyStateChange=function(){this._request.readyState==4&&this._handleLoad()};a._handleLoad=function(){if(!this.loaded)this.loaded=true, this._checkError()?(this._response=this._getResponse(),this._clean(),this._generateTag()&&this._sendComplete()):this._handleError()};a._handleTimeout=function(){this._clean();this._sendError({reason:"PRELOAD_TIMEOUT"})};a._checkError=function(){switch(parseInt(this._request.status)){case 404:case 0:return false}return true};a._getResponse=function(){if(this._response!=null)return this._response;if(this._request.response!=null)return this._request.response;try{if(this._request.responseText!=null)return this._request.responseText}catch(a){}try{if(this._request.responseXML!= null)return this._request.responseXML}catch(b){}return null};a._createXHR=function(a){var b=document.createElement("a");b.href=this.buildPath(a.src,this._basePath);var c=document.createElement("a");c.href=location.href;b=b.hostname!=""&&(b.port!=c.port||b.protocol!=c.protocol||b.hostname!=c.hostname);c=null;if(b&&window.XDomainRequest)c=new XDomainRequest;else if(window.XMLHttpRequest)c=new XMLHttpRequest;else try{c=new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(j){try{c=new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(f){try{c= new ActiveXObject("Msxml2.XMLHTTP")}catch(o){return false}}}a.type==createjs.LoadQueue.TEXT&&c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined");this._xhrLevel=typeof c.responseType==="string"?2:1;var h=null,h=a.method==createjs.LoadQueue.GET?this.buildPath(a.src,this._basePath,a.values):this.buildPath(a.src,this._basePath);c.open(a.method||createjs.LoadQueue.GET,h,true);b&&c instanceof XMLHttpRequest&&this._xhrLevel==1&&c.setRequestHeader("Origin",location.origin);a.values&& a.method==createjs.LoadQueue.POST&&c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");if(createjs.LoadQueue.isBinary(a.type))c.responseType="arraybuffer";this._request=c;return true};a._clean=function(){clearTimeout(this._loadTimeout);var a=this._request;a.onloadstart=null;a.onprogress=null;a.onabort=null;a.onerror=null;a.onload=null;a.ontimeout=null;a.onloadend=null;a.onreadystatechange=null};a._generateTag=function(){var a=this._item.tag;switch(this._item.type){case createjs.LoadQueue.IMAGE:return a.onload= createjs.proxy(this._handleTagReady,this),a.src=this.buildPath(this._item.src,this._basePath,this._item.values),this._rawResponse=this._response,this._response=a,false;case createjs.LoadQueue.JAVASCRIPT:a=document.createElement("script");this._rawResponse=a.text=this._response;this._response=a;break;case createjs.LoadQueue.CSS:document.getElementsByTagName("head")[0].appendChild(a);if(a.styleSheet)a.styleSheet.cssText=this._response;else{var b=document.createTextNode(this._response);a.appendChild(b)}this._rawResponse= this._response;this._response=a;break;case createjs.LoadQueue.XML:this._response=b=this._parseXML(this._response,"text/xml");break;case createjs.LoadQueue.SVG:b=this._parseXML(this._response,"image/svg+xml");this._rawResponse=this._response;b.documentElement!=null?(a.appendChild(b.documentElement),this._response=a):this._response=b;break;case createjs.LoadQueue.JSON:a={};try{a=JSON.parse(this._response)}catch(c){a=c}this._rawResponse=this._response;this._response=a}return true};a._parseXML=function(a, b){var c=null;window.DOMParser?c=(new DOMParser).parseFromString(a,b):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async=false,c.loadXML(a));return c};a._handleTagReady=function(){this._sendComplete()};a.toString=function(){return"[PreloadJS XHRLoader]"};createjs.XHRLoader=c})();typeof JSON!=="object"&&(JSON={}); (function(){function c(a){return a<10?"0"+a:a}function a(a){e.lastIndex=0;return e.test(a)?'"'+a.replace(e,function(a){var b=o[a];return typeof b==="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function d(b,c){var e,n,m,p,q=j,k,g=c[b];g&&typeof g==="object"&&typeof g.toJSON==="function"&&(g=g.toJSON(b));typeof h==="function"&&(g=h.call(c,b,g));switch(typeof g){case "string":return a(g);case "number":return isFinite(g)?String(g):"null";case "boolean":case "null":return String(g); case "object":if(!g)return"null";j+=f;k=[];if(Object.prototype.toString.apply(g)==="[object Array]"){p=g.length;for(e=0;e