reverse-shell-generator/js/light-mode-switch.min.js
2021-02-28 16:06:23 -05:00

1 line
646 B
JavaScript

var lightSwitch=document.getElementById("lightSwitch");function initTheme(){var t=null!==localStorage.getItem("lightSwitch")&&"light"===localStorage.getItem("lightSwitch");lightSwitch.checked=t,t?document.body.setAttribute("data-theme","light"):document.body.removeAttribute("data-theme")}function resetTheme(){lightSwitch.checked?(document.body.setAttribute("data-theme","light"),localStorage.setItem("lightSwitch","light")):(document.body.removeAttribute("data-theme"),localStorage.removeItem("lightSwitch"))}window.addEventListener("load",function(){lightSwitch&&(initTheme(),lightSwitch.addEventListener("change",function(){resetTheme()}))});