Refactor org web content and simplify shared UI
All checks were successful
Build Org Website / build (push) Successful in 44s

This commit is contained in:
gitea-actions
2026-07-29 15:17:17 +01:00
parent db90e9f452
commit 7afc554f5d
31 changed files with 1156 additions and 2198 deletions

View File

@@ -1,11 +1,11 @@
/* Event listener for scrolling and changing the active label on the TOC */
document.addEventListener("DOMContentLoaded", () => {
const toc = document.querySelector("#text-table-of-contents");
if (!toc) { console.warn("No #text-table-of-contents found"); return; }
if (!toc) return;
const links = toc.querySelectorAll('a[href^="#"]'); // '^=' is a starts with operator.
// <a href="#introduction">Intro</a> matches
if (!links.length) { console.warn("No ToC links found"); return; }
if (!links.length) return;
// Map: id -> link
const linkById = new Map();
@@ -14,7 +14,7 @@ document.addEventListener("DOMContentLoaded", () => {
const el = document.getElementById(id);
if (el) linkById.set(id, a);
});
if (!linkById.size) { console.warn("No matching headings with IDs"); return; }
if (!linkById.size) return;
// Headings to observe (h2h4 usually)
const headings = [...document.querySelectorAll("h2[id], h3[id], h4[id]")]