diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-10-29 21:08:12 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-10-29 21:08:12 -0700 |
commit | 3da51fab3d957c487c6b04e137d0d3d391038d95 (patch) | |
tree | aa722119bd93a08af5693297ca21fadb463c7364 /genman.txr | |
parent | c7b723a4e6533bdb0ae32fc21bd52ad081bd2dce (diff) | |
download | txr-3da51fab3d957c487c6b04e137d0d3d391038d95.tar.gz txr-3da51fab3d957c487c6b04e137d0d3d391038d95.tar.bz2 txr-3da51fab3d957c487c6b04e137d0d3d391038d95.zip |
html doc: "collapse all" shouldn't hide whole TOC.
* genman.txr: show the toggle as "expand all" initially.
Assign the sections of the TOC to the "tocsec" class,
and then select the elements by class rather than by the
dl element type. This avoids selecting the dl that wraps
the entire TOC.
(xpanded): New boolean variable.
(toggleall): Base toggle on boolean variable rather than
the state of the first section dl element.
Toggle the xpanded variable.
Diffstat (limited to 'genman.txr')
-rw-r--r-- | genman.txr | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -98,7 +98,7 @@ Content-type: text/html <noscript> <h3>Please turn on Javascript to use the collapsible contents.</h3> </noscript> -<a href="#/" onclick="toggleall(this)">@clpsall</a> +<a href="#/" onclick="toggleall(this)">@xpnall</a> @ (end) @ (or) @TOC @@ -123,7 +123,7 @@ Content-type: text/html `<a href="#/" onclick="toggle(this, '@id')" class="toggle">@(if closed closedtxt opentxt)</a>`)) @ (output :into TOC) @TOC -<dd><dl id="@id"@(if closed " style=\"display: none\"")> +<dd><dl id="@id" class="tocsec"@(if closed " style=\"display: none\"")> @ (end) @ (end) @(until) @@ -178,6 +178,7 @@ This document was created by .disambiguations dl { margin-bottom: 2048px; } </style> <script type="text/javascript"> +var xpanded = false; function toggle(link, id) { var e = document.getElementById(id); if (e.style.display == '') { @@ -190,11 +191,10 @@ function toggle(link, id) { } function toggleall(link) { var toc = document.getElementsByClassName("TOC"); - var dls = toc[0].getElementsByTagName("DL"); + var dls = toc[0].getElementsByClassName("tocsec"); var atoggles = toc[0].getElementsByClassName("toggle"); - var disp = dls[0].style.display; - var ndisp = (disp == '') ? 'none' : ''; - var nhtml = (disp == '') ? '@closedtxt' : '@opentxt' + var ndisp = xpanded ? 'none' : ''; + var nhtml = xpanded ? '@closedtxt' : '@opentxt' for (var i = 0; i < dls.length; i++) dls[i].style.display = ndisp; @@ -202,7 +202,9 @@ function toggleall(link) { for (var i = 0; i < atoggles.length; i++) atoggles[i].innerHTML = nhtml; - link.innerHTML = (disp == '') ? '@xpnall' : '@clpsall'; + link.innerHTML = xpanded ? '@xpnall' : '@clpsall'; + + xpanded = !xpanded; } function tocjump(hash) { var toc = document.getElementsByClassName("TOC"); |