fix: theme change when giscus not loaded

This commit is contained in:
shinya 2025-04-07 00:59:10 +08:00
parent 491cf212e8
commit 81ca27689f
No known key found for this signature in database
GPG key ID: A27DBCC544F50A01

View file

@ -62,7 +62,11 @@ const {
function changeGiscusTheme() {
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")
? host + "/css/giscus_dark.css"
: host + "/css/giscus_light.css";