Hopefully fix indentation
This commit is contained in:
parent
266d996237
commit
c9195bd11d
@ -6,9 +6,9 @@ function restoreDarkmode() {
|
||||
elem.classList.add("dark-mode");
|
||||
}
|
||||
}
|
||||
if (elem && document.cookie.includes("dark-mode=on")) {
|
||||
if (elem && document.cookie.includes("dark-mode=on")) {
|
||||
elem.classList.add("dark-mode");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleDarkmode() {
|
||||
@ -16,10 +16,10 @@ function toggleDarkmode() {
|
||||
if (elem) {
|
||||
const state = elem.classList.toggle('dark-mode');
|
||||
if (state) {
|
||||
// 31536000 = 1 year; not setting max-age would make it session bound
|
||||
// 31536000 = 1 year; not setting max-age would make it session bound
|
||||
document.cookie = 'dark-mode=on; path=/; max-age=31536000; secure; samesite=strict';
|
||||
} else {
|
||||
// We have to set the off preference as well, so it can override the OS setting
|
||||
// We have to set the off preference as well, so it can override the OS setting
|
||||
document.cookie = 'dark-mode=off; path=/; max-age=31536000; secure; samesite=strict';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user