Fix repertoire column scrolling + admin TOC duplication

- repertoire.css: add min-height: 0 to column <ul> scroll containers so
  grid 1fr row shrinks below content and overflow-y: auto activates
- admin-toc.js: add __adminTocBuilt guard + nav.children check to prevent
  double population when loaded both via admin.min.js and direct <script>
- admin-toc.php: remove duplicate <script src="admin-toc.js"> tag —
  JS is already bundled in admin.min.js
This commit is contained in:
Pontoporeia
2026-06-24 13:18:14 +02:00
parent 9f8a4be84e
commit 82d3dcb084
3 changed files with 10 additions and 3 deletions

View File

@@ -4,14 +4,22 @@
*
* Renders nav links from section[aria-labelledby] headings inside #main-content.
* Hides the TOC aside if fewer than 2 sections exist.
*
* Guarded: only runs once even if loaded multiple times (e.g. via bundle + direct <script>).
*/
(function () {
if (window.__adminTocBuilt) return;
window.__adminTocBuilt = true;
function build() {
var main = document.getElementById('main-content');
var nav = document.getElementById('admin-toc-list');
var aside = document.getElementById('admin-toc');
if (!main || !nav || !aside) return;
// Guard against double population (nav already has children from a prior run)
if (nav.children.length > 0) return;
var sections = main.querySelectorAll('section[aria-labelledby]');
if (sections.length < 2) {
aside.hidden = true;