Run onload functions after content has loaded, not when onload fires (otherwise can...
authorTom Gilder <tomgilder@users.mediawiki.org>
Sun, 23 Oct 2005 23:59:48 +0000 (23:59 +0000)
committerTom Gilder <tomgilder@users.mediawiki.org>
Sun, 23 Oct 2005 23:59:48 +0000 (23:59 +0000)
skins/MonoBook.php
skins/common/wikibits.js

index 018ef9a..3eab60c 100644 (file)
@@ -227,6 +227,7 @@ class MonoBookTemplate extends QuickTemplate {
          <?php if($this->data['tagline']) { ?><li id="f-tagline"><?php echo $this->data['tagline'] ?></li><?php } ?>
        </ul>
       </div>
+    <script type="text/javascript"> if (window.onloadhook) onloadhook(); </script>
     </div>
     <?php $this->html('reporttime') ?>
   </body>
index 8773df9..bfb3ec1 100644 (file)
@@ -12,13 +12,17 @@ if (clientPC.indexOf('opera')!=-1) {
 }
 
 // add any onload functions in this hook (please don't hard-code any events in the xhtml source)
+
+var doneOnloadHook;
+
 function onloadhook () {
     // don't run anything below this for non-dom browsers
-    if(!(document.getElementById && document.getElementsByTagName)) return;
+    if (doneOnloadHook || !(document.getElementById && document.getElementsByTagName)) return;
     histrowinit();
     unhidetzbutton();
     tabbedprefs();
     akeytt();
+    doneOnloadHook = true;
 }
 if (window.addEventListener) window.addEventListener("load",onloadhook,false);
 else if (window.attachEvent) window.attachEvent("onload",onloadhook);