-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
21 lines (20 loc) · 1.13 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
if (document.cookie != "") {
const themeCookieValue = document.cookie.split('; ').find(row => row.startsWith('theme=')).split('=')[1];
document.getElementById("stylesheet-link").href = themeCookieValue;
} else {
document.cookie = "theme=style-lightmode.css; SameSite=Strict;";
const themeCookieValue = document.cookie.split('; ').find(row => row.startsWith('theme=')).split('=')[1];
}
function switchLights(){
const themeCookieValue = document.cookie.split('; ').find(row => row.startsWith('theme=')).split('=')[1];
if (themeCookieValue == "style-lightmode.css") {
document.cookie = "theme=style-darkmode.css; SameSite=Strict;";
document.getElementById("stylesheet-link").href = "style-darkmode.css";
} else if (themeCookieValue == "style-darkmode.css") {
document.cookie = "theme=style-lightmode.css; SameSite=Strict;";
document.getElementById("stylesheet-link").href = "style-lightmode.css";
} else {
document.cookie = "theme=style-darkmode.css;";
document.getElementById("stylesheet-link").href = "theme=style-lightmode.css SameSite=Strict;";
}
}