summaryrefslogtreecommitdiff
path: root/layouts/_partials
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
commit22c3e1795d987d2fec000ca0ba68c57b5e4bfca2 (patch)
treef9381b67216b8c259839dde86168a70b42aae08a /layouts/_partials
parent313a701eb6116b5a826e9ff8350a086ce0a45d3c (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.
Diffstat (limited to 'layouts/_partials')
-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>