/ajax/scripts/signal.js

http://showslow.googlecode.com/ · JavaScript · 43 lines · 33 code · 2 blank · 8 comment · 17 complexity · cb4b26852f1b5736440c1d3c5364cb2d MD5 · raw file

  1. /*==================================================
  2. * This file is used to detect that all outstanding
  3. * javascript files have been loaded. You can put
  4. * a function reference into SimileAjax_onLoad
  5. * to have it executed once all javascript files
  6. * have loaded.
  7. *==================================================
  8. */
  9. (function() {
  10. var substring = SimileAjax.urlPrefix + "scripts/signal.js";
  11. var heads = document.documentElement.getElementsByTagName("head");
  12. for (var h = 0; h < heads.length; h++) {
  13. var node = heads[h].firstChild;
  14. while (node != null) {
  15. if (node.nodeType == 1 && node.tagName.toLowerCase() == "script") {
  16. var url = node.src;
  17. var i = url.indexOf(substring);
  18. if (i >= 0) {
  19. heads[h].removeChild(node); // remove it so we won't hit it again
  20. var count = parseInt(url.substr(url.indexOf(substring) + substring.length + 1));
  21. SimileAjax.loadingScriptsCount -= count;
  22. if (SimileAjax.loadingScriptsCount == 0) {
  23. var f = null;
  24. if (typeof SimileAjax_onLoad == "string") {
  25. f = eval(SimileAjax_onLoad);
  26. SimileAjax_onLoad = null;
  27. } else if (typeof SimileAjax_onLoad == "function") {
  28. f = SimileAjax_onLoad;
  29. SimileAjax_onLoad = null;
  30. }
  31. if (f != null) {
  32. f();
  33. }
  34. }
  35. return;
  36. }
  37. }
  38. node = node.nextSibling;
  39. }
  40. }
  41. })();