From 36102a094de700ee339f6eaeffb8ab16ba4f2f3b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 15 Mar 2014 14:42:50 -0300 Subject: Squashed 'mod/graphstats/' content from commit b5d0461 git-subtree-dir: mod/graphstats git-subtree-split: b5d046138c5841d55b4497618d5678cb8027c245 --- .../timeline_ajax/scripts/signal.js | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 vendors/simile-timeline/timeline_ajax/scripts/signal.js (limited to 'vendors/simile-timeline/timeline_ajax/scripts') diff --git a/vendors/simile-timeline/timeline_ajax/scripts/signal.js b/vendors/simile-timeline/timeline_ajax/scripts/signal.js new file mode 100644 index 000000000..7bfcf2a35 --- /dev/null +++ b/vendors/simile-timeline/timeline_ajax/scripts/signal.js @@ -0,0 +1,44 @@ +/*================================================== + * This file is used to detect that all outstanding + * javascript files have been loaded. You can put + * a function reference into SimileAjax_onLoad + * to have it executed once all javascript files + * have loaded. + *================================================== + */ +(function() { + var substring = SimileAjax.urlPrefix + "scripts/signal.js"; + var heads = document.documentElement.getElementsByTagName("head"); + for (var h = 0; h < heads.length; h++) { + var node = heads[h].firstChild; + while (node != null) { + if (node.nodeType == 1 && node.tagName.toLowerCase() == "script") { + var url = node.src; + var i = url.indexOf(substring); + if (i >= 0) { + heads[h].removeChild(node); // remove it so we won't hit it again + + var count = parseInt(url.substr(substring.length + 1)); + SimileAjax.loadingScriptsCount -= count; + + if (SimileAjax.loadingScriptsCount == 0) { + var f = null; + if (typeof SimileAjax_onLoad == "string") { + f = eval(SimileAjax_onLoad); + SimileAjax_onLoad = null; + } else if (typeof SimileAjax_onLoad == "function") { + f = SimileAjax_onLoad; + SimileAjax_onLoad = null; + } + + if (f != null) { + f(); + } + } + return; + } + } + node = node.nextSibling; + } + } +})(); \ No newline at end of file -- cgit v1.2.3