const navigation = document.querySelector("#navigation"); const menuButton = document.querySelector(".menu-button"); const themeButton = document.querySelector(".theme-button"); const currentFile = window.location.pathname.split("/").pop() || "index.html"; document.querySelectorAll(".navigation a").forEach((link) => { if (link.getAttribute("href") === currentFile) link.setAttribute("aria-current", "page"); }); menuButton?.addEventListener("click", () => { const open = navigation.classList.toggle("open"); menuButton.setAttribute("aria-expanded", String(open)); }); const savedTheme = localStorage.getItem("pdf-extractor-docs-theme"); if (savedTheme) document.documentElement.dataset.theme = savedTheme; themeButton?.addEventListener("click", () => { const nextTheme = document.documentElement.dataset.theme === "dark" ? "light" : "dark"; document.documentElement.dataset.theme = nextTheme; localStorage.setItem("pdf-extractor-docs-theme", nextTheme); }); document.querySelectorAll(".copy-button").forEach((button) => { button.addEventListener("click", async () => { await navigator.clipboard.writeText(button.dataset.copy || ""); const label = button.textContent; button.textContent = "Copied"; setTimeout(() => { button.textContent = label; }, 1500); }); });