Skip to content

Commit

Permalink
[优化] 评论加载效率
Browse files Browse the repository at this point in the history
  • Loading branch information
PJ-568 committed Apr 10, 2024
1 parent aa53a5e commit 5afc101
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions js/giscus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down

0 comments on commit 5afc101

Please sign in to comment.