PageSourceSearch

https://docs.blackwall.com/js/hide_toc.js

js blackwall.com collected 2026-09-30 12:44:40 UTC 1,139 bytes, 29 lines download raw bytes

1function hideTocIfNeeded() {
2    let tocSidebar = document.querySelector(".md-sidebar--secondary");
3    let tocItems = document.querySelectorAll(".md-sidebar--secondary .md-nav__list > li");
4    let contentArea = document.querySelector(".md-content");
5
6    if (tocSidebar && tocItems.length <= 1) {
7        tocSidebar.style.display = "none";
8        if (contentArea) {
9            contentArea.style.borderRight = "none"; // Remove right border
10        }
11    } else if (tocSidebar) {
12        tocSidebar.style.display = ""; // Reset visibility on other pages
13        if (contentArea) {
14            contentArea.style.borderRight = ""; // Restore border if needed
15        }
16    }
17}
18
19// Run on initial page load
20document.addEventListener("DOMContentLoaded", hideTocIfNeeded);
21
22// Detect when MkDocs Material loads a new page dynamically
23if (typeof app !== "undefined" && app && app.register) {
24    app.register("page", hideTocIfNeeded);
25}
26
27// Extra safeguard: Observe page content changes (handles dynamic TOC updates)
28const observer = new MutationObserver(hideTocIfNeeded);
29observer.observe(document.body, { childList: true, subtree: true });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.