X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/6d8df8c1149cfb202cc11ed77f0013b6dced81ba..61415acfb84480d4fe4f0952b559deabe12883c6:/underlays/javascript/ikiwiki.js?ds=sidebyside diff --git a/underlays/javascript/ikiwiki.js b/underlays/javascript/ikiwiki.js index 14ddd0745..1252f244f 100644 --- a/underlays/javascript/ikiwiki.js +++ b/underlays/javascript/ikiwiki.js @@ -1,9 +1,21 @@ // 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; function run_hooks_onload() { + // avoid firing twice + if (arguments.callee.done) + return; + arguments.callee.done = true; + run_hooks("onload"); }