mirror of
https://github.com/falsycat/ar.falsy.cat.git
synced 2024-12-26 00:14:51 +00:00
Merge branch 'hugo' of https://github.com/jackyzha0/quartz into hugo
This commit is contained in:
commit
cb38667c1d
@ -1,14 +1,8 @@
|
|||||||
// Darkmode toggle
|
|
||||||
const toggleSwitch = document.querySelector('#darkmode-toggle')
|
|
||||||
|
|
||||||
const userPref = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
|
const userPref = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
|
||||||
const currentTheme = localStorage.getItem('theme') ?? userPref
|
const currentTheme = localStorage.getItem('theme') ?? userPref
|
||||||
|
|
||||||
if (currentTheme) {
|
if (currentTheme) {
|
||||||
document.documentElement.setAttribute('saved-theme', currentTheme);
|
document.documentElement.setAttribute('saved-theme', currentTheme);
|
||||||
if (currentTheme === 'dark') {
|
|
||||||
toggleSwitch.checked = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const switchTheme = (e) => {
|
const switchTheme = (e) => {
|
||||||
@ -22,5 +16,14 @@ const switchTheme = (e) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
// Darkmode toggle
|
||||||
|
const toggleSwitch = document.querySelector('#darkmode-toggle')
|
||||||
|
|
||||||
// listen for toggle
|
// listen for toggle
|
||||||
toggleSwitch.addEventListener('change', switchTheme, false)
|
toggleSwitch.addEventListener('change', switchTheme, false)
|
||||||
|
|
||||||
|
if (currentTheme === 'dark') {
|
||||||
|
toggleSwitch.checked = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@ -10,5 +10,6 @@ Want to see what Quartz can do? Here are some cool community gardens :)
|
|||||||
- [Anson Yu's Garden](http://garden.ansonyu.me/)
|
- [Anson Yu's Garden](http://garden.ansonyu.me/)
|
||||||
- [Shihyu's PKM](https://shihyuho.github.io/pkm/)
|
- [Shihyu's PKM](https://shihyuho.github.io/pkm/)
|
||||||
- [Chloe's Garden](https://garden.chloeabrasada.online/)
|
- [Chloe's Garden](https://garden.chloeabrasada.online/)
|
||||||
|
- [SlRvb's Site](https://slrvb.github.io/Site/)
|
||||||
|
|
||||||
If you want to see your own on here, submit a [Pull Request adding yourself to this file](https://github.com/jackyzha0/quartz/blob/hugo/content/moc/showcase.md)!
|
If you want to see your own on here, submit a [Pull Request adding yourself to this file](https://github.com/jackyzha0/quartz/blob/hugo/content/moc/showcase.md)!
|
@ -11,12 +11,6 @@
|
|||||||
<a href="/">↳ Let's get you home.</a>
|
<a href="/">↳ Let's get you home.</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{- with resources.Get "darkmode.js" | minify -}}
|
|
||||||
<script>
|
|
||||||
{{.Content | safeJS }}
|
|
||||||
</script>
|
|
||||||
{{- end -}}
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -23,13 +23,6 @@
|
|||||||
</article>
|
</article>
|
||||||
{{partial "footer.html" .}}
|
{{partial "footer.html" .}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{- with resources.Get "darkmode.js" | minify -}}
|
|
||||||
<script>
|
|
||||||
{{.Content | safeJS }}
|
|
||||||
</script>
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -13,10 +13,4 @@
|
|||||||
{{partial "footer.html" .}}
|
{{partial "footer.html" .}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{- with resources.Get "darkmode.js" | minify -}}
|
|
||||||
<script>
|
|
||||||
{{.Content | safeJS }}
|
|
||||||
</script>
|
|
||||||
{{- end -}}
|
|
||||||
{{end}}
|
{{end}}
|
@ -17,5 +17,11 @@
|
|||||||
</style>
|
</style>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
{{- with resources.Get "darkmode.js" | minify -}}
|
||||||
|
<script>
|
||||||
|
{{.Content | safeJS }}
|
||||||
|
</script>
|
||||||
|
{{- end -}}
|
||||||
</head>
|
</head>
|
||||||
{{ template "_internal/google_analytics.html" . }}
|
{{ template "_internal/google_analytics.html" . }}
|
Loading…
Reference in New Issue
Block a user