mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 19:51:07 +02:00
fix: theme change when giscus not loaded
This commit is contained in:
parent
491cf212e8
commit
81ca27689f
1 changed files with 5 additions and 1 deletions
|
@ -62,7 +62,11 @@ const {
|
||||||
|
|
||||||
function changeGiscusTheme() {
|
function changeGiscusTheme() {
|
||||||
const iframe = document.querySelector("iframe.giscus-frame");
|
const iframe = document.querySelector("iframe.giscus-frame");
|
||||||
if (!iframe) return;
|
if (!iframe || iframe.classList.contains("giscus-frame--loading")) {
|
||||||
|
// 脚本未加载场景
|
||||||
|
loadGiscus();
|
||||||
|
return;
|
||||||
|
};
|
||||||
const theme = document.documentElement.classList.contains("dark")
|
const theme = document.documentElement.classList.contains("dark")
|
||||||
? host + "/css/giscus_dark.css"
|
? host + "/css/giscus_dark.css"
|
||||||
: host + "/css/giscus_light.css";
|
: host + "/css/giscus_light.css";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue