summaryrefslogtreecommitdiff
path: root/lib/tpl/dokuwiki/script.js
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-06-30 12:03:59 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-06-30 12:03:59 +0200
commit688c5219ce1f6bf1dbda6e733bec881baaa24025 (patch)
treefa6440c1f772abb06e21c1a2fc4189347ec5c456 /lib/tpl/dokuwiki/script.js
parent0c06a181819249c6a4a2a6c60e13f739df1f2253 (diff)
downloadrpg-688c5219ce1f6bf1dbda6e733bec881baaa24025.tar.gz
rpg-688c5219ce1f6bf1dbda6e733bec881baaa24025.tar.bz2
fixed the toc/sidebar toggling script for real
Diffstat (limited to 'lib/tpl/dokuwiki/script.js')
-rw-r--r--lib/tpl/dokuwiki/script.js34
1 files changed, 26 insertions, 8 deletions
diff --git a/lib/tpl/dokuwiki/script.js b/lib/tpl/dokuwiki/script.js
index 75575608b..d32cf5cff 100644
--- a/lib/tpl/dokuwiki/script.js
+++ b/lib/tpl/dokuwiki/script.js
@@ -1,14 +1,32 @@
function tpl_dokuwiki_mobile(){
// check if we are in mobile or tablet mode be sure to adjust the number
// here when adjusting it in the css
- if(document.body.clientWidth > 979) return;
+ var $handle = jQuery('#dokuwiki__aside h3.toggle');
+ var $toc = jQuery('#dw__toc h3');
+ if(document.body.clientWidth > 979) {
+ console.log('desktop');
+ // reset for desktop mode
+ $handle[0].setState(1);
+ $handle.hide();
+ $toc[0].setState(1);
+ } else {
+ console.log('mobile');
+ // toc and sidebar hiding
+ $handle.show();
+ $handle[0].setState(-1);
+ $toc[0].setState(-1);
+ }
+}
- // toc and sidebar hiding
+jQuery(function(){
+ var resizeTimer;
dw_page.makeToggle('#dokuwiki__aside h3.toggle','#dokuwiki__aside div.content');
- jQuery('#dw__toc h3.toggle').click();
- jQuery('#dokuwiki__aside h3.toggle').show().click();
-}
-
-jQuery(tpl_dokuwiki_mobile);
-jQuery(window).bind('resize',tpl_dokuwiki_mobile);
+ tpl_dokuwiki_mobile();
+ jQuery(window).bind('resize',
+ function(){
+ if (resizeTimer) clearTimeout(resizeTimer);
+ resizeTimer = setTimeout(tpl_dokuwiki_mobile,200);
+ }
+ );
+});