Sha256: bf4c37816f3f3c8b7c751023a082b2329ff4f711643be3cc87c7b9b15c902f81
Contents?: true
Size: 905 Bytes
Versions: 18
Compression:
Stored size: 905 Bytes
Contents
(function () { const themeSelector = document.getElementById("themeSelector"); const currentTheme = document.getElementById("currentTheme"); const themeOptions = document.getElementById("themeOptions"); const root = document.querySelector("html"); function clickHandler(color) { return (event) => { window.localStorage.setItem("theme", color); root.className = color; const selectedColor = event.target.getAttribute("data-color"); currentTheme.style.backgroundColor = selectedColor; }; } themeSelector.addEventListener("click", () => { themeOptions.style.maxWidth = !themeOptions.style.maxWidth ? "800px" : themeOptions.style.maxWidth === "0px" ? "800px" : "0px"; }); document.querySelectorAll(".theme-option").forEach((option) => { option.addEventListener("click", clickHandler(option.dataset.themeClass)); }); })();
Version data entries
18 entries across 18 versions & 2 rubygems