summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-10-28 10:47:21 +0800
committerEltrac <hi@guhub.cn>2025-10-28 10:47:21 +0800
commite6d19b87c97c59b52452a7d3e6d914929b254405 (patch)
treec267d9bab88dff60ae74e962af50a7e3880137b0
parent2f249b8b2e876fa424d66624da751f31e80de27a (diff)
perf: load giscus on DOMContentLoaded Used to be loaded with an
observer, but this caused users to be waiting for a unnecessarily long time when needing to comment. Former-commit-id: 22c3e1795d987d2fec000ca0ba68c57b5e4bfca2
-rw-r--r--layouts/_partials/posts/comment.html9
1 files changed, 1 insertions, 8 deletions
diff --git a/layouts/_partials/posts/comment.html b/layouts/_partials/posts/comment.html
index 6e178e5e..8a08e816 100644
--- a/layouts/_partials/posts/comment.html
+++ b/layouts/_partials/posts/comment.html
@@ -56,12 +56,5 @@ function loadGiscus() {
document.body.appendChild(script);
}
-const observer = new IntersectionObserver((entries, obs) => {
- if (entries[0].isIntersecting) {
- loadGiscus();
- obs.disconnect();
- }
-});
-
-observer.observe(document.getElementById("action-menu"));
+document.addEventListener('DOMContentLoaded', loadGiscus);
</script>