This commit is contained in:
Thomas Chartron 2021-11-12 20:29:35 +01:00
parent dcd157bc8c
commit d376209b0f

View file

@ -1 +1 @@
function switchTheme(){"dark"==([...document.documentElement.classList].includes("dark")?"dark":"light")?(localStorage.theme="light",document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden"),document.getElementById("dark").classList.remove("hidden")):(localStorage.theme="dark",document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden"),document.getElementById("light").classList.remove("hidden"))}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelector("#nav-links").children;let t=window.location.href,d=[...e].find(e=>e.href===t);void 0!==d&&(d.className="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium"),"dark"===localStorage.theme||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden")):(document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden")),document.getElementById("switch-theme").addEventListener("click",switchTheme)});
function switchTheme(){"dark"==([...document.documentElement.classList].includes("dark")?"dark":"light")?(localStorage.theme="light",document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden"),document.getElementById("dark").classList.remove("hidden")):(localStorage.theme="dark",document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden"),document.getElementById("light").classList.remove("hidden"))}function toggleSidebar(){[...document.getElementById("sidebar").classList].includes("translate-x-0")?console.log("visible"):console.log("not visible")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelector("#nav-links").children;let t=window.location.href,d=[...e].find(e=>e.href===t);void 0!==d&&(d.className="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium"),"dark"===localStorage.theme||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden")):(document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden")),document.getElementById("switch-theme").addEventListener("click",switchTheme),document.getElementById("toggle-sidebar").addEventListener("click",toggleSidebar)});