Detangle src/readtheorg_theme/js/readtheorg.js

This commit is contained in:
Fabrice Niessen 2022-02-06 18:20:34 +01:00
parent 116d473b25
commit 10ecfa4ce2
1 changed files with 50 additions and 30 deletions

View File

@ -1432,6 +1432,26 @@ for nice yellow or orange boxes.
:END:
#+begin_src js
function collapse_toc_elements_on_click (nav_li_a){
/*
When an `a' element in the TOC is clicked, its parent
`li' element's active attribute is toggled. This causes
the element to toggle between minimized and maximized
states. The active attribute is documented in bootstrap.
https://getbootstrap.com/docs/4.0/components/navbar/#nav
*/
$(nav_li_a).parent().toggleClass("active");
}
$( document ).ready(function() {
// When the document is loaded and ready, bind the
// function `collapse_toc_elements_on_click' to the
// `a' elements in the table of contents.
$("#text-table-of-contents a").click(function() {
collapse_toc_elements_on_click(this);
});
});
$(function() {
$('.note').before("<p class='admonition-title note'>Note</p>");
$('.seealso').before("<p class='admonition-title seealso'>See also</p>");