From a9910a8ec9071e7e8e290aca1b86372656630b43 Mon Sep 17 00:00:00 2001 From: Asai Toshiya Date: Sat, 15 Mar 2025 05:11:57 +0900 Subject: [PATCH] Make it possible to link to page fragments Fixes #543 --- script.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index fac7462..2718f6a 100644 --- a/script.js +++ b/script.js @@ -200,7 +200,14 @@ document.addEventListener('DOMContentLoaded', () => { // If everything is working, proceed with main functionality parseAndDisplayContent() - .then(() => console.log('Content successfully parsed and displayed')) + .then(() => { + console.log("Content successfully parsed and displayed"); + + // Show section if page fragment exists + if (location.hash) { + document.querySelector(`a[href='${location.hash}']`).click(); + } + }) .catch(error => { console.error('Error in main content processing:', error); document.getElementById('resources-container').innerHTML = `