mirror of
https://github.com/Rainyy21/Rainyy21.github.io.git
synced 2026-10-10 23:40:18 -04:00
commitig all before branching
This commit is contained in:
+13
-11
@@ -1,19 +1,21 @@
|
||||
let darkmode = localStorage.getItem('dark')
|
||||
const switch_button = document.getElementById("theme_switch")
|
||||
let darkmode = localStorage.getItem('dark');
|
||||
const switch_button = document.getElementById("theme_switch");
|
||||
|
||||
const enableDarkmode = () => {
|
||||
document.body.classList.add('dark')
|
||||
localStorage.setItem('darkmode' , 'active')
|
||||
document.body.classList.add('dark');
|
||||
localStorage.setItem('dark' , 'active');
|
||||
}
|
||||
|
||||
const disableDarkmode = () => {
|
||||
document.body.classList.remove('dark')
|
||||
localStorage.setItem('darkmode', null)
|
||||
}
|
||||
document.body.classList.remove('dark');
|
||||
localStorage.removeItem('dark');
|
||||
};
|
||||
|
||||
if(darkmode === 'avtive') enableDarkmode()
|
||||
if (darkmode === 'active') enableDarkmode();
|
||||
|
||||
switch_button.addEventListener("click", () => {
|
||||
darkmode = localStorage.getItem('darkmode')
|
||||
darkmode !== "active" ? enableDarkmode() : disableDarkmode()
|
||||
})
|
||||
darkmode = localStorage.getItem('dark');
|
||||
darkmode !== "active" ? enableDarkmode() : disableDarkmode();
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user