Update Comment.astro

This commit is contained in:
2026-06-16 23:26:47 +08:00
committed by GitHub
parent a1733921d6
commit 9859bc6ad6
+10 -17
View File
@@ -9,25 +9,18 @@
<script is:inline> <script is:inline>
function initTwikoo() { function initTwikoo() {
if (window.tw) { if (window.tw) {
const el = document.getElementById('Comments'); if (document.getElementById("Comments")) {
if (el) el.innerHTML = ''; document.getElementById("Comments").innerHTML = "";
}
window.tw = null; window.tw = null;
} }
var tw = twikoo.init({
const el = document.getElementById('Comments'); el: "#Comments",
if (!el) return; envId: "http://47.108.235.131:40063/",
lang: "zh-CN",
try {
window.tw = twikoo.init({
el: '#Comments',
envId: 'http://47.108.235.131:40063/',
lang: 'zh-CN',
}); });
} catch (e) { window.tw = tw;
console.error('Twikoo 初始化失败:', e);
} }
} window.addEventListener("load", initTwikoo);
document.addEventListener("astro:page-load", initTwikoo);
window.addEventListener('load', initTwikoo);
document.addEventListener('astro:page-load', initTwikoo);
</script> </script>