layerloader.min.js
957 字节
var lazyloader=function(e,t){function n(e){e=e.toLowerCase();var t=e.indexOf("js"),n=e.indexOf("css");return-1==t&&-1==n?!1:t>n?"js":"css"}function s(e){var t=document.createElement("link");t.href=e,t.rel="stylesheet",t.type="text/css",t.onload=c,t.onreadystatechange=function(){("loaded"==this.readyState||"complete"==this.readyState)&&c()},document.getElementsByTagName("head")[0].appendChild(t)}function a(e){try{document.styleSheets[e].cssRules?c():document.styleSheets[e].rules&&document.styleSheets[e].rules.length?c():setTimeout(function(){a(e)},250)}catch(t){setTimeout(function(){a(e)},250)}}function o(e){var t=document.createElement("script");t.type="text/javascript",t.src=e,t.onload=c,document.getElementsByTagName("head")[0].appendChild(t)}function c(){d--,0==d&&t()}var r,d=0,i=document.styleSheets.length-1;for(var l in e){d++;var r=e[l];"css"==n(r)&&(s(r),i++,window.opera||-1!=navigator.userAgent.indexOf("MSIE")||a(i)),"js"==n(r)&&o(r)}};