diff options
| author | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-05-30 02:31:03 +0100 |
|---|---|---|
| committer | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-05-30 02:31:03 +0100 |
| commit | 7f15098853adf480e87ce3df84b8e38114150581 (patch) | |
| tree | 9b9f339368b258f90e941aee1087701cd2e9b0fe /174bg | |
| parent | 509782e78ea50bdacacc82d68d0d1505bd8f956e (diff) | |
| download | unnamed-group-7f15098853adf480e87ce3df84b8e38114150581.tar unnamed-group-7f15098853adf480e87ce3df84b8e38114150581.tar.gz unnamed-group-7f15098853adf480e87ce3df84b8e38114150581.tar.bz2 unnamed-group-7f15098853adf480e87ce3df84b8e38114150581.tar.xz unnamed-group-7f15098853adf480e87ce3df84b8e38114150581.zip | |
remove unused styles and table of contents generation function from index.html
Diffstat (limited to '174bg')
| -rw-r--r-- | 174bg/handbook/public/index.html | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/174bg/handbook/public/index.html b/174bg/handbook/public/index.html index b262896..42a1443 100644 --- a/174bg/handbook/public/index.html +++ b/174bg/handbook/public/index.html @@ -4,86 +4,6 @@ <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>174th Battle Group Handbook</title> - <style> - /* table styles */ - table { - width: 100%; - border-collapse: collapse; - margin-bottom: 1em; - } - - th, - td { - border: 1px solid #ddd; - padding: 0.5em; - text-align: left; - } - - th { - background-color: #f4f4f4; - } - - body { - display: flex; - align-items: flex-start; - } - - /* table of contents styles */ - nav#table-of-contents { - width: 240px; - min-width: 180px; - flex-shrink: 0; - position: sticky; - top: 0; - max-height: 100vh; - overflow-y: auto; - margin: 0; - box-sizing: border-box; - } - - nav#table-of-contents ul { - margin: 0; - padding-left: 1em; - list-style: none; - } - - nav#table-of-contents ul:first-child { - padding-left: 0; - } - - nav#table-of-contents li { - margin: 0; - line-height: 1.4; - } - - nav#table-of-contents a { - font-size: 0.8em; - text-decoration: none; - } - - nav#table-of-contents .toc-toggle { - background: none; - border: none; - cursor: pointer; - font-size: 0.6em; - padding: 0 3px 0 0; - color: inherit; - vertical-align: middle; - line-height: 1; - } - - nav#table-of-contents li.toc-collapsed > ul { - display: none; - } - - main { - flex: 1; - padding: 1em 2em; - box-sizing: border-box; - min-width: 0; - text-align: justify; - } - </style> </head> <body style="margin: 0; font-family: sans-serif"> <nav id="table-of-contents"></nav> @@ -1608,83 +1528,9 @@ </body> <script> document.addEventListener("DOMContentLoaded", () => { - console.log("DOMContentLoaded"); - - generateTableOfContents(); - replaceWordsWithLinks(); }); - function generateTableOfContents() { - const headings = document.querySelectorAll("h1, h2, h3, h4, h5, h6"); - const toc = document.getElementById("table-of-contents"); - const rootList = document.createElement("ul"); - toc.appendChild(rootList); - - let currentList = rootList; - let currentLevel = 0; - const listStack = {}; - - headings.forEach((heading) => { - const level = parseInt(heading.tagName[1]); - if (!heading.id) { - heading.id = heading.textContent - .trim() - .toLowerCase() - .replace(/[^\w\s-]/g, "") - .replace(/\s+/g, "-"); - } - const tocLink = document.createElement("a"); - tocLink.textContent = heading.textContent; - tocLink.href = `#${heading.id}`; - const tocItem = document.createElement("li"); - tocItem.dataset.level = level; - tocItem.appendChild(tocLink); - - if (currentLevel === 0) { - rootList.appendChild(tocItem); - listStack[level] = rootList; - currentList = rootList; - currentLevel = level; - } else if (level === currentLevel) { - currentList.appendChild(tocItem); - } else if (level > currentLevel) { - const nestedList = document.createElement("ul"); - const lastItem = currentList.lastElementChild; - (lastItem || currentList).appendChild(nestedList); - listStack[level] = nestedList; - currentList = nestedList; - currentLevel = level; - nestedList.appendChild(tocItem); - } else { - currentList = listStack[level] || rootList; - currentList.appendChild(tocItem); - currentLevel = level; - } - }); - - // Add toggle buttons to items that have nested lists - toc.querySelectorAll("li").forEach((li) => { - const nested = li.querySelector(":scope > ul"); - if (nested) { - const toggle = document.createElement("button"); - const liLevel = parseInt(li.dataset.level); - const collapsed = liLevel >= 2; - toggle.className = "toc-toggle"; - toggle.textContent = collapsed ? "▶" : "▼"; - if (collapsed) li.classList.add("toc-collapsed"); - toggle.addEventListener("click", (e) => { - e.preventDefault(); - li.classList.toggle("toc-collapsed"); - toggle.textContent = li.classList.contains("toc-collapsed") - ? "▶" - : "▼"; - }); - li.insertBefore(toggle, li.firstChild); - } - }); - } - function replaceWordsWithLinks() { const linkMap = { "A2 Hercules Starlifter": |
