readywaitloader.js 722 B

12345678910111213141516171819202122232425
  1. // Simple script loader that uses jQuery.readyWait via jQuery.holdReady()
  2. //Hold on jQuery!
  3. jQuery.holdReady(true);
  4. var readyRegExp = /^(complete|loaded)$/;
  5. function assetLoaded( evt ){
  6. var node = evt.currentTarget || evt.srcElement;
  7. if ( evt.type === "load" || readyRegExp.test(node.readyState) ) {
  8. jQuery.holdReady(false);
  9. }
  10. }
  11. setTimeout( function() {
  12. var script = document.createElement("script");
  13. script.type = "text/javascript";
  14. if ( script.addEventListener ) {
  15. script.addEventListener( "load", assetLoaded, false );
  16. } else {
  17. script.attachEvent( "onreadystatechange", assetLoaded );
  18. }
  19. script.src = "data/readywaitasset.js";
  20. document.getElementsByTagName("head")[0].appendChild(script);
  21. }, 2000 );