Skip to content

Commit

Permalink
Remove in-line script from header (#1004)
Browse files Browse the repository at this point in the history
* remove in-line script from header

* oops!

* Set script in-line with integrity hash

Signed-off-by: Emruz Hossain <[email protected]>

---------

Signed-off-by: Emruz Hossain <[email protected]>
Co-authored-by: Emruz Hossain <[email protected]>
  • Loading branch information
davidgs and hossainemruz authored Dec 1, 2024
1 parent 3be5a58 commit 4e4acdb
Show file tree
Hide file tree
Showing 7 changed files with 371 additions and 70 deletions.
9 changes: 9 additions & 0 deletions assets/scripts/core/theme-scheme.js
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions exampleSite/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ go 1.21
replace github.com/hugo-toha/toha/v4 => ../

require (
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20240510202502-b4192719c87f // indirect
github.com/hugo-toha/toha/v4 v4.5.0 // indirect
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20241018183051-dd13c36f46b4 // indirect
github.com/hugo-toha/toha/v4 v4.7.0 // indirect
)
4 changes: 2 additions & 2 deletions exampleSite/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20240510202502-b4192719c87f h1:EpJlxR6ruHtcBIHLVlmfgpoPGAjpAvopGq8h1wscEwY=
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20240510202502-b4192719c87f/go.mod h1:0gXAIE/H9B3kwsNvyqXXP0gTLCzi/DKwoIOz8Bb9j9c=
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20241018183051-dd13c36f46b4 h1:Yc5SJ5NJx1xu3YO2gQZPeADXqhGdJgUGWiDxgEDuUrQ=
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20241018183051-dd13c36f46b4/go.mod h1:3N7k1DSQGy5Zn5IVp5nQ3QJ/VWh5dSxXO6stUS7txrg=
Loading

0 comments on commit 4e4acdb

Please sign in to comment.