1// Theme toggle with localStorage persistence 2(function initTheme() { 3 const saved = localStorage.getItem("theme-preference") || "light"; 4 document.documentElement.setAttribute("data-theme", saved); 5})(); 6 7document.addEventListener("DOMContentLoaded", () => { 8 const toggle = document.querySelector(".theme-toggle"); 9 10 toggle.addEventListener("click", () => { 11 const current = document.documentElement.getAttribute("data-theme"); 12 const next = current === "light" ? "dark" : "light"; 13 document.documentElement.setAttribute("data-theme", next); 14 localStorage.setItem("theme-preference", next); 15 if (contribGraph.classList.contains("visible")) { 16 _renderCanvas(); 17 } 18 }); 19});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.