mirror of
https://github.com/wisplite/BLE-mesh-sim.git
synced 2026-10-30 13:32:21 -05:00
update to use localStorage for theme because CHROME doesn't SAVE the CHECKBOX STATE!!
This commit is contained in:
@@ -562,15 +562,19 @@ document.getElementById('createRandomGraphConfirm').addEventListener('click', fu
|
|||||||
document.getElementById('darkMode').addEventListener('change', function() {
|
document.getElementById('darkMode').addEventListener('change', function() {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
document.getElementById('styleSheet').href = 'style-dark.css';
|
document.getElementById('styleSheet').href = 'style-dark.css';
|
||||||
|
localStorage.setItem('darkMode', 'true');
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('styleSheet').href = 'style.css';
|
document.getElementById('styleSheet').href = 'style.css';
|
||||||
|
localStorage.setItem('darkMode', 'false');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
if (document.getElementById('darkMode').checked) {
|
if (localStorage.getItem('darkMode') === 'true') {
|
||||||
|
document.getElementById('darkMode').checked = true;
|
||||||
document.getElementById('styleSheet').href = 'style-dark.css';
|
document.getElementById('styleSheet').href = 'style-dark.css';
|
||||||
} else {
|
} else {
|
||||||
|
document.getElementById('darkMode').checked = false;
|
||||||
document.getElementById('styleSheet').href = 'style.css';
|
document.getElementById('styleSheet').href = 'style.css';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user