@majeanson/lac 3.4.3 → 3.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -21381,13 +21381,23 @@ function showPage(id) {
|
|
|
21381
21381
|
}
|
|
21382
21382
|
// init
|
|
21383
21383
|
document.querySelectorAll('.feature-page').forEach(p => p.classList.add('hidden'));
|
|
21384
|
-
//
|
|
21384
|
+
// Navigate to feature on page load if hash is present
|
|
21385
21385
|
(function() {
|
|
21386
21386
|
var hash = window.location.hash.slice(1);
|
|
21387
21387
|
if (hash) { showPage(hash); }
|
|
21388
21388
|
})();
|
|
21389
|
-
//
|
|
21390
|
-
|
|
21389
|
+
// Click delegation — catch clicks on any element with data-id (nav items, TOC cards)
|
|
21390
|
+
document.addEventListener('click', function(e) {
|
|
21391
|
+
var el = e.target.closest('[data-id]');
|
|
21392
|
+
if (!el) return;
|
|
21393
|
+
var id = el.dataset.id;
|
|
21394
|
+
if (!id) return;
|
|
21395
|
+
e.preventDefault();
|
|
21396
|
+
showPage(id);
|
|
21397
|
+
history.pushState(null, '', '#' + id);
|
|
21398
|
+
});
|
|
21399
|
+
// Browser back/forward navigation
|
|
21400
|
+
window.addEventListener('popstate', function() {
|
|
21391
21401
|
var hash = window.location.hash.slice(1);
|
|
21392
21402
|
showPage(hash || 'home');
|
|
21393
21403
|
});
|