Remove in-line script from header (#1004)
* remove in-line script from header * oops! * Set script in-line with integrity hash Signed-off-by: Emruz Hossain <hossainemruz@gmail.com> --------- Signed-off-by: Emruz Hossain <hossainemruz@gmail.com> Co-authored-by: Emruz Hossain <hossainemruz@gmail.com>
This commit is contained in:
parent
3be5a58a7c
commit
4e4acdbb6b
7 changed files with 371 additions and 70 deletions
9
assets/scripts/core/theme-scheme.js
Normal file
9
assets/scripts/core/theme-scheme.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
let theme = localStorage.getItem('theme-scheme') || localStorage.getItem('darkmode:color-scheme') || 'light'
|
||||
if (theme === 'system') {
|
||||
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
theme = 'dark'
|
||||
} else {
|
||||
theme = 'light'
|
||||
}
|
||||
}
|
||||
document.documentElement.setAttribute('data-theme', theme)
|
Loading…
Add table
Add a link
Reference in a new issue