File size: 1,297 Bytes
a263bf4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
  });
});