-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.7.7 ci: update workflows config. a3e55a0
- Loading branch information
1 parent
badf6ce
commit 6937c0a
Showing
13 changed files
with
60 additions
and
26 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
;(() => { | ||
const targetElement = document.documentElement; | ||
const defaultTheme = targetElement.getAttribute("data-color-mode"); | ||
changeGiscusTheme(defaultTheme) | ||
const observer = new MutationObserver((mutationsList, observer) => { | ||
for(const mutation of mutationsList) { | ||
if (mutation.type === 'attributes') { | ||
const value = targetElement.getAttribute("data-color-mode"); | ||
changeGiscusTheme(value) | ||
} | ||
} | ||
}); | ||
|
||
observer.observe(targetElement, { | ||
attributes: true, | ||
attributeOldValue: true | ||
}); | ||
|
||
function changeGiscusTheme(theme = "light") { | ||
const iframe = document.querySelector('.giscus-frame'); | ||
if (iframe) { | ||
const config = { | ||
giscus: { | ||
setConfig: { | ||
theme: theme.toLocaleLowerCase(), | ||
}, | ||
} | ||
}; | ||
iframe.contentWindow.postMessage(config, 'https://giscus.app'); | ||
const script = document.querySelector("script[data-script-id=\"giscus\"]") | ||
script.setAttribute("data-theme", theme) | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters