15 lines
1001 B
JavaScript
15 lines
1001 B
JavaScript
|
|
||
|
var readyListAeo=[];function onReadyAeo(handler){function executeHandlers(){for(var i=0;i<readyListAeo.length;i++){readyListAeo[i]();}}
|
||
|
if(!readyListAeo.length){bindReady(executeHandlers);}
|
||
|
readyListAeo.push(handler);}
|
||
|
function bindReady(handler){var called=false;function ready(){if(called)
|
||
|
return
|
||
|
called=true;handler();}
|
||
|
if(document.addEventListener){document.addEventListener("DOMContentLoaded",ready,false);}else if(document.attachEvent){try{var isFrame=window.frameElement!=null;}catch(e){}
|
||
|
if(document.documentElement.doScroll&&!isFrame){function tryScroll(){if(called)
|
||
|
return;try{document.documentElement.doScroll("left");ready();}catch(e){setTimeout(tryScroll,10);}}
|
||
|
tryScroll();}
|
||
|
document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){ready();}});}
|
||
|
if(window.addEventListener)
|
||
|
window.addEventListener('load',ready,false);else if(window.attachEvent)
|
||
|
window.attachEvent('onload',ready);else{var fn=window.onload;window.onload=function(){fn&&fn();ready();};}}
|