diff options
| author | Eltrac <hi@guhub.cn> | 2025-10-28 10:47:21 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-10-28 10:47:21 +0800 |
| commit | 22c3e1795d987d2fec000ca0ba68c57b5e4bfca2 (patch) | |
| tree | f9381b67216b8c259839dde86168a70b42aae08a /layouts/_partials/posts/comment.html | |
| parent | 313a701eb6116b5a826e9ff8350a086ce0a45d3c (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/posts/comment.html')
| -rw-r--r-- | layouts/_partials/posts/comment.html | 9 |
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> |
