From d0ef2feba55c04345c75316bf48e1ddd0101e677 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 25 Mar 2024 15:25:04 +0000 Subject: [PATCH] v1.30.0 fix: fix giscus theme issue. ed2844e8e8c77550e18b492b9c28007055e290ef --- index.html | 6 ------ js/giscus.js | 17 +++++++++++------ sitemap.txt | 8 ++++---- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/index.html b/index.html index 7377f4ce..c462a647 100644 --- a/index.html +++ b/index.html @@ -195,12 +195,6 @@

Preview Website - - Awesome ChatGPT - Github Stars - GitHub last commit - Preview Website - Awesome UIKit Github Stars diff --git a/js/giscus.js b/js/giscus.js index e32865c0..36f8efd9 100644 --- a/js/giscus.js +++ b/js/giscus.js @@ -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) } } @@ -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'); } } })(); diff --git a/sitemap.txt b/sitemap.txt index e987c269..af4dd3e9 100644 --- a/sitemap.txt +++ b/sitemap.txt @@ -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 \ No newline at end of file