mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-09-02 11:42:39 +00:00
🐛 Fix: giscus default theme maybe set error
This commit is contained in:
+14
-3
@@ -955,13 +955,24 @@ class FixIt {
|
||||
document.querySelector('.giscus-frame')?.contentWindow.postMessage({ giscus: message }, giscusConfig.origin);
|
||||
});
|
||||
this.switchThemeEventSet.add(this._giscusOnSwitchTheme);
|
||||
this.giscus2parentMsg = window.addEventListener('message', (event) => {
|
||||
// gicuss to parent message
|
||||
this._messageListener = (event) => {
|
||||
if (event.origin !== giscusConfig.origin) return;
|
||||
const $script = document.querySelector('#giscus>script');
|
||||
if ($script){
|
||||
this._giscusOnSwitchTheme();
|
||||
$script.parentElement.removeChild($script);
|
||||
}
|
||||
}, { once: true });
|
||||
const frame = document.querySelector('.giscus-frame');
|
||||
if (frame.getAttribute('loading') === 'lazy') {
|
||||
frame.addEventListener('load', (e) => {
|
||||
this._giscusOnSwitchTheme();
|
||||
}, { once: true });
|
||||
} else {
|
||||
this._giscusOnSwitchTheme();
|
||||
}
|
||||
window.removeEventListener('message', this._messageListener, false);
|
||||
};
|
||||
window.addEventListener('message', this._messageListener, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- .Scratch.Set "version" "v0.3.17-03b3bfbd" -}}
|
||||
{{- .Scratch.Set "version" "v0.3.17-c0b9a51d" -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
|
||||
Reference in New Issue
Block a user