mirror of
https://github.com/izzy2lost/izzy2lost.com.git
synced 2026-06-19 01:16:11 -07:00
looking better
This commit is contained in:
@@ -1,4 +1,18 @@
|
||||
document.getElementById("crtSwitch")?.addEventListener("change",e=>{
|
||||
document.body.classList.toggle("crt-on",e.target.checked);
|
||||
document.body.classList.toggle("crt-off",!e.target.checked);
|
||||
});
|
||||
// Load saved CRT preference
|
||||
const crtSwitch = document.getElementById("crtSwitch");
|
||||
const savedCrtState = localStorage.getItem("crtMode") === "true";
|
||||
|
||||
if (crtSwitch) {
|
||||
// Apply saved state on page load
|
||||
crtSwitch.checked = savedCrtState;
|
||||
document.body.classList.toggle("crt-on", savedCrtState);
|
||||
document.body.classList.toggle("crt-off", !savedCrtState);
|
||||
|
||||
// Save state when changed
|
||||
crtSwitch.addEventListener("change", e => {
|
||||
const isOn = e.target.checked;
|
||||
document.body.classList.toggle("crt-on", isOn);
|
||||
document.body.classList.toggle("crt-off", !isOn);
|
||||
localStorage.setItem("crtMode", isOn);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user