summaryrefslogtreecommitdiff
path: root/lib/exe/js.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2005-12-10 20:37:09 +0100
committerAndreas Gohr <andi@splitbrain.org>2005-12-10 20:37:09 +0100
commit00540a38be97858e71163f53dddf8dee53185b1d (patch)
treeb59b8c1c5943804090e4f07eed708e658d78805b /lib/exe/js.php
parent0a6ead412a67d6ce56895e3c5e8dd6612acac398 (diff)
downloadrpg-00540a38be97858e71163f53dddf8dee53185b1d.tar.gz
rpg-00540a38be97858e71163f53dddf8dee53185b1d.tar.bz2
unobstrusive JS for TOC, better onload handling
This path adds more unobstrusive JavaScript for the TOC handling. It also loads JavaScript initialiezers as soon as the DOM is parsed for Mozilla-based Browsers as described at http://dean.edwards.name/weblog/2005/09/busted/ - a IE solution was not chosen yet. darcs-hash:20051210193709-7ad00-771461e56d9661caf9ca733a6d617f009e24d0b7.gz
Diffstat (limited to 'lib/exe/js.php')
-rw-r--r--lib/exe/js.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/exe/js.php b/lib/exe/js.php
index ca1d83948..b776f957b 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -77,6 +77,7 @@ function js_out(){
// init stuff
js_runonstart("ajax_qsearch.init('qsearch_in','qsearch_out')");
js_runonstart("addEvent(document,'click',closePopups)");
+ js_runonstart('addTocToggle()');
if($edit){
// size controls
@@ -114,6 +115,13 @@ function js_out(){
// load user script
@readfile(DOKU_CONF.'userscript.js');
+
+ // initialize init pseudo event
+ echo 'if (document.addEventListener) {';
+ echo ' document.addEventListener("DOMContentLoaded", window.fireoninit, null);';
+ echo '}';
+ echo 'addEvent(window,"load",window.fireoninit);';
+
// end output buffering and get contents
$js = ob_get_contents();
ob_end_clean();
@@ -184,7 +192,7 @@ function js_escape($string){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function js_runonstart($func){
- print "addEvent(window,'load',function(){ $func; });";
+ echo "addInitEvent(function(){ $func; });";
}
/**