update script code
This commit is contained in:
parent
b9f899e1ef
commit
d46e0d8ba8
1 changed files with 5 additions and 5 deletions
|
@ -61,16 +61,16 @@
|
||||||
` $tag ("" | absURL) site.Title $tag | safeHTML }}
|
` $tag ("" | absURL) site.Title $tag | safeHTML }}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const bodyClass = document.body.classList;
|
let bodyClass = document.body.classList;
|
||||||
const schemeDark = window.matchMedia('(prefers-color-scheme: dark)');
|
let schemeDark = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
const buttonDark = document.querySelector('.btn-theme');
|
let buttonDark = document.querySelector('.btn-theme');
|
||||||
|
|
||||||
const setDark = () => {
|
let setDark = () => {
|
||||||
bodyClass.add('dark');
|
bodyClass.add('dark');
|
||||||
localStorage.setItem('dark', 'true');
|
localStorage.setItem('dark', 'true');
|
||||||
};
|
};
|
||||||
|
|
||||||
const setLight = () => {
|
let setLight = () => {
|
||||||
bodyClass.remove('dark');
|
bodyClass.remove('dark');
|
||||||
localStorage.removeItem('dark');
|
localStorage.removeItem('dark');
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue