X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/18806fa6b0f2afab703d558a499da8918214a1c7..b6666f5ac81ef4c8646a6290cf5c885adf0e385f:/underlays/javascript/ikiwiki.js?ds=inline diff --git a/underlays/javascript/ikiwiki.js b/underlays/javascript/ikiwiki.js index 14ddd0745..aebc5cf7e 100644 --- a/underlays/javascript/ikiwiki.js +++ b/underlays/javascript/ikiwiki.js @@ -1,9 +1,23 @@ // ikiwiki's javascript utility function library var hooks; + +// Run onload as soon as the DOM is ready, if possible. +// gecko, opera 9 +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", run_hooks_onload, false); +} +// other browsers window.onload = run_hooks_onload; +var onload_done = 0; + function run_hooks_onload() { + // avoid firing twice + if (onload_done) + return; + onload_done = true; + run_hooks("onload"); }