From 5afc101ce7e1bb6eb2064bb75c8980e32986fe2b Mon Sep 17 00:00:00 2001 From: PJ568 Date: Wed, 10 Apr 2024 09:53:28 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/giscus.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/js/giscus.js b/js/giscus.js index e205970..900b708 100644 --- a/js/giscus.js +++ b/js/giscus.js @@ -31,28 +31,29 @@ const getCurrentLanguage = function () { }; var SetupGiscus = function (giscus_lang) { - const script = document.createElement("script"); - script.type = "text/javascript"; - script.src = "https://giscus.app/client.js"; + if (document.getElementById("giscus-container") != null) { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.src = "https://giscus.app/client.js"; - script.setAttribute("data-repo", "Hamud-Lang/Hamud_Book"); - script.setAttribute("data-repo-id", "R_kgDOKAX-uw"); - script.setAttribute("data-category", "Announcements"); - script.setAttribute("data-category-id", "DIC_kwDOKAX-u84CYRSk"); + script.setAttribute("data-repo", "Hamud-Lang/Hamud_Book"); + script.setAttribute("data-repo-id", "R_kgDOKAX-uw"); + script.setAttribute("data-category", "Announcements"); + script.setAttribute("data-category-id", "DIC_kwDOKAX-u84CYRSk"); - script.setAttribute("data-mapping", "title"); - script.setAttribute("data-strict", "1"); - script.setAttribute("data-reactions-enabled", "1"); - script.setAttribute("data-emit-metadata", "0"); - script.setAttribute("data-input-position", "top"); - script.setAttribute("data-theme", "light_high_contrast"); - script.setAttribute("data-lang", giscus_lang); - // script.setAttribute("data-loading", "lazy"); + script.setAttribute("data-mapping", "title"); + script.setAttribute("data-strict", "1"); + script.setAttribute("data-reactions-enabled", "1"); + script.setAttribute("data-emit-metadata", "0"); + script.setAttribute("data-input-position", "top"); + script.setAttribute("data-theme", "light_high_contrast"); + script.setAttribute("data-lang", giscus_lang); + // script.setAttribute("data-loading", "lazy"); + + script.crossOrigin = "anonymous"; + script.async = true; - script.crossOrigin = "anonymous"; - script.async = true; - if (document.getElementById("giscus-container") != null) { document.getElementById("giscus-container").appendChild(script); } };