document.querySelectorAll(".copy-btn").forEach((btn) => { btn.addEventListener("click", async () => { const text = btn.getAttribute("data-copy") || ""; try { await navigator.clipboard.writeText(text); } catch { return; } const original = btn.textContent; btn.textContent = "Copied"; btn.classList.add("copied"); setTimeout(() => { btn.textContent = original; btn.classList.remove("copied"); }, 1500); }); }); // The FAQ used to be a section of the home page. Keep old /#faq links working. if (document.body.dataset.page === "home" && location.hash === "#faq") { location.replace("faq/"); }