From 48722ac855c79944285cbe8958fe5ed03bd835ed Mon Sep 17 00:00:00 2001
From: Anika Henke <anika@selfthinker.org>
Date: Sun, 22 Apr 2012 21:19:59 +0100
Subject: [PATCH] improved toc changes and sidebar toggling

---
 inc/html.php                    |  2 +-
 lib/scripts/page.js             | 11 ++++-----
 lib/tpl/default/design.css      | 10 ++++----
 lib/tpl/default/rtl.css         |  3 +--
 lib/tpl/dokuwiki/css/_toc.css   |  8 +++----
 lib/tpl/dokuwiki/css/design.css | 13 ++++++-----
 lib/tpl/dokuwiki/css/mobile.css | 41 +++++++++++++++------------------
 lib/tpl/dokuwiki/css/print.css  |  1 +
 lib/tpl/dokuwiki/main.php       |  4 ++--
 lib/tpl/dokuwiki/script.js      |  7 +++---
 10 files changed, 47 insertions(+), 53 deletions(-)

diff --git a/inc/html.php b/inc/html.php
index c3e345cb0..0b297a347 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1717,7 +1717,7 @@ function html_TOC($toc){
     global $lang;
     $out  = '<!-- TOC START -->'.DOKU_LF;
     $out .= '<div id="dw__toc">'.DOKU_LF;
-    $out .= '<h3>';
+    $out .= '<h3 class="toggle">';
     $out .= $lang['toc'];
     $out .= '</h3>'.DOKU_LF;
     $out .= '<div>'.DOKU_LF;
diff --git a/lib/scripts/page.js b/lib/scripts/page.js
index 84af1f18b..74dec37fb 100644
--- a/lib/scripts/page.js
+++ b/lib/scripts/page.js
@@ -116,18 +116,17 @@ dw_page = {
         setClicky = function(hiding){
             if(hiding){
                 $clicky.html('<span>+</span>');
-                $handle.addClass('toggle_open');
-                $handle.removeClass('toggle_close');
+                $handle.addClass('closed');
+                $handle.removeClass('open');
             }else{
                 $clicky.html('<span>&minus;</span>');
-                $handle.addClass('toggle_close');
-                $handle.removeClass('toggle_open');
+                $handle.addClass('open');
+                $handle.removeClass('closed');
             }
         };
 
         // the state indicator
-        $clicky = jQuery(document.createElement('strong'))
-                        .addClass('toggle');
+        $clicky = jQuery(document.createElement('strong'));
 
         // click function
         $handle.css('cursor','pointer')
diff --git a/lib/tpl/default/design.css b/lib/tpl/default/design.css
index 44ccc0343..3405ec258 100644
--- a/lib/tpl/default/design.css
+++ b/lib/tpl/default/design.css
@@ -565,25 +565,23 @@ div.dokuwiki #dw__toc h3 {
   font-size: 1em;
 }
 
-div.dokuwiki .toggle_close .toggle,
-div.dokuwiki .toggle_open .toggle {
+div.dokuwiki .toggle strong {
     border: 0.4em solid __background_alt__;
     float: right;
     display: block;
     margin: 0.4em 3px 0 0;
 }
 
-div.dokuwiki .toggle_open .toggle span,
-div.dokuwiki .toggle_close .toggle span {
+div.dokuwiki .toggle span {
     display: none;
 }
 
-div.dokuwiki .toggle_close .toggle {
+div.dokuwiki .toggle.closed strong {
     margin-top: 0.4em;
     border-top: 0.4em solid __text__;
 }
 
-div.dokuwiki .toggle_open .toggle {
+div.dokuwiki .toggle.open strong {
     margin-top: 0;
     border-bottom: 0.4em solid __text__;
 }
diff --git a/lib/tpl/default/rtl.css b/lib/tpl/default/rtl.css
index b9dd82902..8b2837874 100644
--- a/lib/tpl/default/rtl.css
+++ b/lib/tpl/default/rtl.css
@@ -98,8 +98,7 @@ div.dokuwiki #dw__toc h3 {
   text-align: right;
 }
 
-div.dokuwiki .toggle_close .toggle,
-div.dokuwiki .toggle_open .toggle {
+div.dokuwiki .toggle strong {
     float: left;
     margin: 0.4em 0 0 3px;
 }
diff --git a/lib/tpl/dokuwiki/css/_toc.css b/lib/tpl/dokuwiki/css/_toc.css
index 71cc4096a..0d1b976d1 100644
--- a/lib/tpl/dokuwiki/css/_toc.css
+++ b/lib/tpl/dokuwiki/css/_toc.css
@@ -21,18 +21,16 @@
 
 /*____________ toc header ____________*/
 
-#dw__toc h3 {
+.dokuwiki h3.toggle {
     padding: .2em .5em;
     font-weight: bold;
 }
 
-.toggle_open .toggle,
-.toggle_close .toggle {
+.dokuwiki .toggle strong {
     float: right;
     margin: 0 .2em;
 }
-[dir=rtl] .toggle_open .toggle,
-[dir=rtl] .toggle_close .toggle {
+[dir=rtl] .dokuwiki .toggle strong {
     float: left;
 }
 
diff --git a/lib/tpl/dokuwiki/css/design.css b/lib/tpl/dokuwiki/css/design.css
index 2d0af6ad1..1bc667fb5 100644
--- a/lib/tpl/dokuwiki/css/design.css
+++ b/lib/tpl/dokuwiki/css/design.css
@@ -405,26 +405,27 @@
     border-right: 1px solid __border__;
 }
 
-#dw__toc h3 {
+.dokuwiki h3.toggle {
     padding: .5em 1em;
     margin-bottom: 0;
     font-size: .875em;
     letter-spacing: .1em;
 }
+#dokuwiki__aside h3.toggle {
+    display: none;
+}
 
-.toggle_open .toggle,
-.toggle_close .toggle {
+.dokuwiki .toggle strong {
     background: transparent url(images/toc-arrows.png) 0 0;
     width: 8px;
     height: 5px;
     margin: .4em 0 0;
 }
-.toggle_close .toggle {
+.dokuwiki .toggle.closed strong {
     background-position: 0 -5px;
 }
 
-.toggle_open .toggle span,
-.toggle_close .toggle span {
+.dokuwiki .toggle strong span {
     display: none;
 }
 
diff --git a/lib/tpl/dokuwiki/css/mobile.css b/lib/tpl/dokuwiki/css/mobile.css
index 31a0a87c8..b57b60e9b 100644
--- a/lib/tpl/dokuwiki/css/mobile.css
+++ b/lib/tpl/dokuwiki/css/mobile.css
@@ -15,10 +15,10 @@
     float: none;
 }
 
-#dokuwiki__aside > .pad {
+#dokuwiki__aside > .pad,
+[dir=rtl] #dokuwiki__aside > .pad {
     margin: 0 0 .5em;
-
-    /* style like the page */
+    /* style like .page */
     background: __background__;
     color: inherit;
     border: 1px solid #eee;
@@ -26,18 +26,8 @@
     border-radius: 2px;
     padding: 1em;
     margin-bottom: .5em;
-    overflow: hidden;
-    word-wrap: break-word;
 }
 
-#dokuwiki__aside h3.aside {
-    padding: 0 0 .5em;
-    font-size: .875em;
-    letter-spacing: .1em;
-    border-bottom: 1px solid __border__;
-}
-
-
 .hasSidebar #dokuwiki__content {
     float: none;
     margin-left: 0;
@@ -66,10 +56,11 @@
     border-right-width: 0;
 }
 
-#dw__toc h3 {
-    padding: 0 0 .5em;
+.dokuwiki h3.toggle {
+    padding: 0 .5em .5em 0;
 }
-#dw__toc > div {
+#dw__toc > div,
+#dokuwiki__aside div.content {
     padding: .2em 0 .5em;
 }
 
@@ -77,12 +68,6 @@
 .dokuwiki div.page {
     padding: 1em;
 }
-.dokuwiki .pageId span {
-    border-width: 0;
-    background-color: __background_site__;
-    color: __text_alt__;
-    box-shadow: 0 0 0;
-}
 
 /* _edit */
 .dokuwiki div.section_highlight {
@@ -123,6 +108,18 @@
     padding: .5em 0;
 }
 
+#dokuwiki__aside h3.toggle {
+    font-size: 1em;
+}
+#dokuwiki__aside h3.toggle.closed {
+    margin-bottom: 0;
+    padding-bottom: 0;
+}
+#dokuwiki__aside h3.toggle.open {
+    border-bottom: 1px solid __border__;
+}
+
+
 /*____________ header ____________*/
 
 #dokuwiki__header ul.a11y.skip {
diff --git a/lib/tpl/dokuwiki/css/print.css b/lib/tpl/dokuwiki/css/print.css
index f6bf64dd9..9f43f5131 100644
--- a/lib/tpl/dokuwiki/css/print.css
+++ b/lib/tpl/dokuwiki/css/print.css
@@ -22,6 +22,7 @@ div.error,
 #dokuwiki__aside,
 .dokuwiki .breadcrumbs,
 #dw__toc,
+h3.toggle,
 .dokuwiki .secedit,
 #dokuwiki__pagetools,
 #dokuwiki__footer {
diff --git a/lib/tpl/dokuwiki/main.php b/lib/tpl/dokuwiki/main.php
index 4883cc5f0..d8e85850f 100644
--- a/lib/tpl/dokuwiki/main.php
+++ b/lib/tpl/dokuwiki/main.php
@@ -37,8 +37,8 @@ $showSidebar = $conf['sidebar'] && page_exists($conf['sidebar']) && ($ACT=='show
             <?php if($showSidebar): ?>
                 <!-- ********** ASIDE ********** -->
                 <div id="dokuwiki__aside"><div class="pad include group">
-                    <h3 class="aside a11y"><?php echo hsc(ucfirst($conf['sidebar'])) ?></h3>
-                    <div class="aside group">
+                    <h3 class="toggle"><?php echo hsc(ucfirst($conf['sidebar'])) ?></h3>
+                    <div class="content">
                         <?php tpl_flush() ?>
                         <?php tpl_includeFile('sidebarheader.html') ?>
                         <?php tpl_include_page($conf['sidebar']) ?>
diff --git a/lib/tpl/dokuwiki/script.js b/lib/tpl/dokuwiki/script.js
index dd9c17561..b31d3dc08 100644
--- a/lib/tpl/dokuwiki/script.js
+++ b/lib/tpl/dokuwiki/script.js
@@ -3,7 +3,8 @@ jQuery(function(){
     if(jQuery('div.mobileTools').css('display') == 'none') return;
 
     // toc and sidebar hiding
-    dw_page.makeToggle('#dokuwiki__aside h3.aside','#dokuwiki__aside div.aside');
-    jQuery('#dw__toc > h3').click();
-    jQuery('#dokuwiki__aside h3.aside').removeClass('a11y').click();
+    dw_page.makeToggle('#dokuwiki__aside h3.toggle','#dokuwiki__aside div.content');
+
+    jQuery('#dw__toc h3.toggle').click();
+    jQuery('#dokuwiki__aside h3.toggle').show().click();
 });
-- 
GitLab