mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-24 15:05:42 -05:00
Evaluate image theme on page load as well
This commit is contained in:
parent
6867034ec9
commit
0011e85e75
@ -37,7 +37,8 @@ export function getUserPreferredColorScheme() {
|
|||||||
|
|
||||||
// Have SVG images in the article adhere to the correct color scheme.
|
// Have SVG images in the article adhere to the correct color scheme.
|
||||||
document.addEventListener("nav", (e) => {
|
document.addEventListener("nav", (e) => {
|
||||||
let theme = localStorage.getItem("theme") ?? getUserPreferredColorScheme()
|
let theme: "dark" | "light" =
|
||||||
|
(localStorage.getItem("theme") as "dark" | "light" | null) ?? getUserPreferredColorScheme()
|
||||||
Object.values(document.getElementsByTagName("article")[0].getElementsByTagName("a")).forEach(
|
Object.values(document.getElementsByTagName("article")[0].getElementsByTagName("a")).forEach(
|
||||||
(a) => {
|
(a) => {
|
||||||
if (a.href.endsWith(".excalidraw")) {
|
if (a.href.endsWith(".excalidraw")) {
|
||||||
@ -47,6 +48,7 @@ document.addEventListener("nav", (e) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
renderThemedLinks(theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
export function removeAllChildren(node: HTMLElement) {
|
export function removeAllChildren(node: HTMLElement) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user