Skip to content

Commit

Permalink
v1.30.0 fix: fix giscus theme issue. ed2844e
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Mar 25, 2024
1 parent 22f25ff commit d0ef2fe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
6 changes: 0 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,6 @@ <h2 id="compiled-with-idoc"><a aria-hidden="true" tabindex="-1" href="#compiled-
<td><a href="https://github.com/jaywcjlove/awesome-mac/commits"><img src="https://img.shields.io/github/last-commit/jaywcjlove/awesome-mac?style=flat&#x26;label=last" alt="GitHub last commit"></a></td>
<td><a href="https://jaywcjlove.github.io/awesome-mac">Preview Website</a></td>
</tr>
<tr>
<td><a href="https://github.com/jaywcjlove/awesome-chatgpt">Awesome ChatGPT</a></td>
<td><a href="https://github.com/jaywcjlove/awesome-chatgpt/stargazers"><img src="https://img.shields.io/github/stars/jaywcjlove/awesome-chatgpt.svg" alt="Github Stars"></a></td>
<td><a href="https://github.com/jaywcjlove/awesome-chatgpt/commits"><img src="https://img.shields.io/github/last-commit/jaywcjlove/awesome-chatgpt?style=flat&#x26;label=last" alt="GitHub last commit"></a></td>
<td><a href="https://jaywcjlove.github.io/awesome-chatgpt">Preview Website</a></td>
</tr>
<tr>
<td><a href="https://github.com/jaywcjlove/shell-tutorialawesome-uikit">Awesome UIKit</a></td>
<td><a href="https://github.com/jaywcjlove/awesome-uikit/stargazers"><img src="https://img.shields.io/github/stars/jaywcjlove/awesome-uikit.svg" alt="Github Stars"></a></td>
Expand Down
17 changes: 11 additions & 6 deletions js/giscus.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
;(() => {
const targetElement = document.documentElement;
const defaultTheme = targetElement.getAttribute("data-color-mode").toLocaleLowerCase();
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").toLocaleLowerCase();
const value = targetElement.getAttribute("data-color-mode");
changeGiscusTheme(value)
}
}
Expand All @@ -16,12 +16,17 @@
attributeOldValue: true
});

function changeGiscusTheme(theme) {
function changeGiscusTheme(theme = "light") {
const iframe = document.querySelector('.giscus-frame');
if (iframe) {
iframe.contentWindow.postMessage({
giscus: { theme }
}, 'https://giscus.app');
const config = {
giscus: {
setConfig: {
theme: theme.toLocaleLowerCase(),
},
}
};
iframe.contentWindow.postMessage(config, 'https://giscus.app');
}
}
})();
8 changes: 4 additions & 4 deletions sitemap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ https://wangchujiang.com/idoc/about.html
https://wangchujiang.com/idoc/awesome.html
https://wangchujiang.com/idoc/markdown.html
https://wangchujiang.com/idoc/markdown/index.html
https://wangchujiang.com/idoc/markdown/extended-syntax.html
https://wangchujiang.com/idoc/markdown/basic-syntax.html
https://wangchujiang.com/idoc/markdown/extended-syntax.html
https://wangchujiang.com/idoc/markdown/insert-img.html
https://wangchujiang.com/idoc/markdown/line-html.html
https://wangchujiang.com/idoc/introduce/index.html
https://wangchujiang.com/idoc/introduce/api/command.html
https://wangchujiang.com/idoc/introduce/api/config.html
https://wangchujiang.com/idoc/introduce/theme/templates.html
https://wangchujiang.com/idoc/introduce/theme/theme-defalut.html
https://wangchujiang.com/idoc/introduce/theme/variables.html
https://wangchujiang.com/idoc/introduce/getting-started/home.html
https://wangchujiang.com/idoc/introduce/getting-started/installation.html
https://wangchujiang.com/idoc/introduce/getting-started/publish.html
https://wangchujiang.com/idoc/introduce/getting-started/site-add.html
https://wangchujiang.com/idoc/introduce/getting-started/site-creation.html
https://wangchujiang.com/idoc/introduce/getting-started/site-preparation.html
https://wangchujiang.com/idoc/introduce/theme/templates.html
https://wangchujiang.com/idoc/introduce/theme/theme-defalut.html
https://wangchujiang.com/idoc/introduce/theme/variables.html
https://wangchujiang.com/idoc/index.html

0 comments on commit d0ef2fe

Please sign in to comment.