1 line
1.8 KiB
JavaScript
1 line
1.8 KiB
JavaScript
(function(j){function k(a){var b=g[a.url||a];if(b)return b;if(typeof a=="object")for(var c in a){if(a[c])b={name:c,url:a[c]}}else b={name:a.substring(a.indexOf("/",10)+1,a.indexOf("?")),url:a};return g[b.url]=b}function e(a,b){if(a){if(typeof a=="object")a=[].slice.call(a);for(var c=0;c<a.length;c++)b.call(a,a[c],c)}}function h(a){return Object.prototype.toString.call(a)=="[object Function]"}function u(){e(arguments,function(a){h(a)||v(k(a))})}function n(a){a.state="preloaded";e(a.onpreload,function(b){b.call()})} function v(a){if(!a.state){a.state="preloading";a.onpreload=[];if(/Firefox/.test(navigator.userAgent)){var b=j.createElement("object");b.data=a.url;b.width=0;b.height=0;b.onload=function(){n(a);setTimeout(function(){i.removeChild(b)},1)};i.appendChild(b)}else o({src:a.url,type:"cache"},function(){n(a)})}}function l(a,b){if(a.state=="loaded")return b();if(a.state=="preloading")return a.onpreload.push(function(){l(a,b)});a.state="loading";o(a.url,function(){a.state="loaded";b&&b.call();e(m[a.name], function(f){f.call()});var c=true,p;for(p in g)if(g[p].state!="loaded")c=false;c&&e(q,function(f){f.done||f.call();f.done=true})})}function o(a,b){var c=j.createElement("script");c.type="text/"+(a.type||"javascript");c.src=a.src||a;c.onreadystatechange=c.onload=function(){if(!b.done){b.call();b.done=true}document.all||i.removeChild(c)};i.appendChild(c)}var i=j.documentElement,r=false,s=[],q=[],m={},g={},t=window.head_conf&&head_conf.head||"head",d=window[t]=window[t]||{};d.js=function(){var a=arguments, b=[].slice.call(a,1),c=b[0];if(!r){s.push(function(){d.js.apply(null,a)});return d}if(c){h(c)||u.apply(null,b);l(k(a[0]),h(c)?c:function(){d.js.apply(null,b)})}else l(k(a[0]));return d};d.ready=function(a,b){if(h(a))return q.push(a);var c=m[a];if(c)c.push(b);else m[a]=[b];return d};setTimeout(function(){r=true;e(s,function(a){a.call()})},200)})(document);
|