Use html details element for toc on top of help pages.

This allows us to get rid of some more unneccessary JavaScript that just
implements stuff that web browsers now do anyways.
This commit is contained in:
Harald Eilertsen
2024-07-24 15:32:16 +02:00
parent fb9464437e
commit 26ce231951
3 changed files with 12 additions and 19 deletions

View File

@@ -15,6 +15,14 @@
list-style-type: none;
}
#doco-top-toc-wrapper {
margin-bottom: 1em;
}
#doco-top-toc-wrapper > summary {
font-size: large;
}
.toc-content li,
#doco-top-toc li {
padding: 3px 0px;
@@ -23,4 +31,3 @@
#doco-side-toc li {
padding-left: 20px;
}

View File

@@ -1,14 +1,3 @@
function docoTocToggle() {
if ($('#doco-top-toc').is(':visible')) {
$('#doco-toc-toggle').removeClass('bi-gear').addClass('bi-caret-right');
} else {
$('#doco-toc-toggle').removeClass('bi-caret-right').addClass('bi-caret-down');
}
$('#doco-top-toc').toggle();
return false;
}
toc = {};
// Generate the table of contents in the side nav menu (see view/tpl/help.tpl)
$(document).ready(function () {

View File

@@ -8,13 +8,10 @@
</div>
{{/if}}
<div class="section-content-wrapper">
<h3 id="doco-top-toc-heading">
<span class="fakelink" onclick="docoTocToggle(); return false;">
<i class="bi bi-caret-right fakelink" id="doco-toc-toggle"></i>
{{$module->get_toc_heading()}}
</span>
</h3>
<ul id="doco-top-toc" style="margin-bottom: 1.5em; display: none;"></ul>
<details id="doco-top-toc-wrapper">
<summary id="doco-top-toc-heading">{{$module->get_toc_heading()}}</summary>
<ul id="doco-top-toc"></ul>
</details>
<div id="doco-content">
{{$module->render_content()}}
</div>