I think I'm onto something here

This commit is contained in:
clashofclanselixircollector 2024-12-11 17:56:13 -08:00
parent 63ac392dd0
commit 5fe986e78f

View File

@ -1,5 +1,5 @@
$(document).ready(function() { $(document).ready(function() {
function updateDarkMode() { function updateDarkMode(isChecked) {
var isChecked = $("#darkModeCheckbox").is(":checked"); var isChecked = $("#darkModeCheckbox").is(":checked");
if (isChecked) { if (isChecked) {
const body = document.querySelector('body'); const body = document.querySelector('body');
@ -34,6 +34,7 @@ $(document).ready(function() {
dZone.style.color = '#ff6847'; dZone.style.color = '#ff6847';
const dZoneText = document.querySelector('.modal'); const dZoneText = document.querySelector('.modal');
dZoneText.style.color = '#ff3c00'; dZoneText.style.color = '#ff3c00';
localStorage.setItem('darkModeOn', true);
} else { } else {
const body = document.querySelector('body'); const body = document.querySelector('body');
body.style.backgroundColor = '#f1f1f1'; body.style.backgroundColor = '#f1f1f1';
@ -67,10 +68,12 @@ $(document).ready(function() {
dZone.style.color = '#010101'; dZone.style.color = '#010101';
const dZoneText = document.querySelector('.modal'); const dZoneText = document.querySelector('.modal');
dZoneText.style.color = '#010101'; dZoneText.style.color = '#010101';
localStorage.setItem('darkModeOn', false);
} }
} }
$("#darkModeCheckbox").on("change", function() { $("#darkModeCheckbox").on("change", function() {
updateDarkMode(); var checked = $("#darkModeCheckbox").is(":checked");
updateDarkMode(checked);
}); });
updateDarkMode(); updateDarkMode();
}); });