(function(){"use strict";var a=document,b=a.getElementsByTagName("head")[0],c=30,d={version:"0.1.0",maxAttempts:10,_jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},_getIEVersion:function(){var a=-1;if(navigator.appName==="Microsoft Internet Explorer"){var b=navigator.userAgent,c=new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");c.exec(b)!==null&&(a=parseFloat(RegExp.$1))}return a},_checkIeLimitWorkaround:function(b,d){var e=!1,f=this._getIEVersion(),g=f!==-1&&f<=9?!0:!1;try{if(a.createStyleSheet&&a.styleSheets&&a.styleSheets.length>c){var h=a.styleSheets[a.styleSheets.length-1];h.addImport(b,a.styleSheets.length-1),e=!0,d()}}catch(i){this._onerror(d,i),e=!1}return e},_getUniqueId:function(){return"cssPreloader_"+Math.round(Math.random()*9999999999)},_createLink:function(b){var c=a.createElement("link");return c.rel="stylesheet",c.type="text/css",c.id=this._getUniqueId(),c.href=b,c},_isEventSupported:function(a,b){var c=document.createElement(a);b="on"+b;var d=b in c;return d||(c.setAttribute(b,"return;"),d=typeof c[b]=="function",c=null),d},_loadNative:function(a,c){var d=this._createLink(a);d.onload=function(){c()};var e=this;d.onerror=function(){e._onerror(c)},b.appendChild(d)},_onerror:function(a,b){if(Object.prototype.toString.call(a.error)==="[object Function]"){var c={message:"Failed to load stylesheet",innerException:b};a.error(c)}},_loadWhenNotSupported:function(a,c){var d=function(a,b,c){try{if(!(c<this.maxAttempts)){this._onerror(b);return}var e=document.styleSheets;for(var f=0;f<e.length;f++){var g=e[f],h=g.ownerNode?g.ownerNode:g.owningElement;if(h&&h.id===a.id){var i=!0,j=null;try{g.cssRules?j=g.cssRules:g.rules?j=g.rules:i=!1}catch(k){i=!1}if(i){if(j&&j.length&&j.length>0){b();return}this._onerror(b);return}b()}}var l=this;setTimeout(function(){d.call(l,a,b,++c)},100)}catch(k){this._onerror(b,k);return}},e=this._createLink(a);b.appendChild(e);var f=this,g=0;setTimeout(function(){d.call(f,e,c,g)},100)},loadStylesheet:function(a,b){var c=this._checkIeLimitWorkaround(a,b);c||(this._isEventSupported("link","load")?this._loadNative(a,b):this._loadWhenNotSupported(a,b))},load:function(a,b,c,d,e){try{var f=b.toUrl(a.search(/\.(css)$/i)===-1?a+".css":a);this.loadStylesheet(f,c)}catch(g){c()}}};typeof define=="function"?define(["module"],function(){return d}):window.css=d})();
|