Skip to content

Commit

Permalink
remove in-line script from header
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgs committed Oct 21, 2024
1 parent aa9b49b commit 502aaa7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/scripts/core/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './device'
export * from './insertScript'
export * from './theme-scheme'
11 changes: 11 additions & 0 deletions assets/scripts/core/theme-scheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let theme = localStorage.getItem('theme-scheme') || localStorage.getItem('darkmode:color-scheme') || 'light'
const b = 'bollocks!';
console.log(b);
if (theme === 'system') {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = 'dark'
} else {
theme = 'light'
}
}
document.documentElement.setAttribute('data-theme', theme)

0 comments on commit 502aaa7

Please sign in to comment.