From 046ecf832199bc0f1ea4bd101b14c5841a90bdd3 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sat, 23 May 2026 20:41:47 +0200 Subject: [PATCH] gjgjg --- views/settings.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/views/settings.html b/views/settings.html index 8b01926..ea0198e 100644 --- a/views/settings.html +++ b/views/settings.html @@ -79,11 +79,34 @@ setActive(firstLink.getAttribute('href')); } + // On load with a hash: highlight the target heading + if (initHash) { + var target = document.querySelector(initHash); + if (target) { + // Use rAF so the browser has scrolled to the target first + requestAnimationFrame(function() { + document.querySelectorAll('.comment-highlighted').forEach(function(el) { + el.classList.remove('comment-highlighted'); + }); + target.classList.add('comment-highlighted'); + }); + } + } + // Delegated click on the nav container — fires before document-level handlers nav.addEventListener('click', function(e) { var link = e.target.closest('a[href^="#"]'); if (!link) return; setActive(link.getAttribute('href')); + // Highlight the target section + var href = link.getAttribute('href'); + var el = document.querySelector(href); + if (el) { + document.querySelectorAll('.comment-highlighted').forEach(function(c) { + c.classList.remove('comment-highlighted'); + }); + el.classList.add('comment-highlighted'); + } }); })();