-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v2.0.0 ci: update workflows config. daf59ef
- Loading branch information
1 parent
7da22d4
commit a81cea3
Showing
12 changed files
with
978 additions
and
965 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.
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
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
Oops, something went wrong.