Runtime module for the table-of-contents fold/unfold toggle.
Wikidot's [[toc]] block renders a #toc container with a
#toc-action-bar containing two links: one to fold (hide) the
list and one to unfold (show) it. The actual heading list lives
in #toc-list.
This module delegates click events from the root element to links
inside #toc-action-bar. When the list is visible, clicking folds
it (hides #toc-list, hides the fold link, shows the unfold link).
When folded, clicking unfolds it (the reverse).
DOM interactions:
Listens for click (bubble) on root, delegated to a inside #toc-action-bar
Toggles style.display on #toc-list and the two action links
The destroy() cleanup function removes the click listener.
Runtime module for the table-of-contents fold/unfold toggle.
Wikidot's
[[toc]]block renders a#toccontainer with a#toc-action-barcontaining two links: one to fold (hide) the list and one to unfold (show) it. The actual heading list lives in#toc-list.This module delegates click events from the root element to links inside
#toc-action-bar. When the list is visible, clicking folds it (hides#toc-list, hides the fold link, shows the unfold link). When folded, clicking unfolds it (the reverse).DOM interactions:
click(bubble) on root, delegated toainside#toc-action-barstyle.displayon#toc-listand the two action linksThe
destroy()cleanup function removes the click listener.