diff options
| author | eltrac <hi@eltr.ac> | 2026-02-18 22:32:15 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-02-18 22:32:15 +0800 |
| commit | b5294eb29b5bc5e9738eb683081459ff4721cce0 (patch) | |
| tree | e7cea8528d8212533f6abb2d1207c82d23d6bb07 /layouts | |
| parent | 57a660b4751a7a7ebf0046668d8249505fbf739d (diff) | |
perf: use <details> to toggle webmention display, remove JS
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_partials/posts/action-menu.html | 12 | ||||
| -rw-r--r-- | layouts/_partials/posts/webmention-summary.html (renamed from layouts/_partials/posts/webmention-likes.html) | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/layouts/_partials/posts/action-menu.html b/layouts/_partials/posts/action-menu.html index 9358ce0d..b5204bc2 100644 --- a/layouts/_partials/posts/action-menu.html +++ b/layouts/_partials/posts/action-menu.html @@ -14,17 +14,19 @@ {{ end }} {{ end }} -<div id="action-menu" class="my-4 mb-5"> - {{ partial "posts/webmention-likes" (dict +<details class="my-4 mb-5"> + <summary class="cursor-pointer"> + {{ partial "posts/webmention-summary" (dict "likes" $likes "page" . "othercount" (add (len $replies) (len $mentions)) - ) }} - <div id="webmention-collapse" class="hidden"> + ) }} + </summary> + <div id="webmention-details"> {{ partial "posts/webmention-replies" $replies }} {{ partial "posts/webmention-mentions" $mentions }} </div> <!-- kept for legacy pages --> {{ partial "posts/comment" . }} -</div> +</details> diff --git a/layouts/_partials/posts/webmention-likes.html b/layouts/_partials/posts/webmention-summary.html index 54fcef4a..65bd8b31 100644 --- a/layouts/_partials/posts/webmention-likes.html +++ b/layouts/_partials/posts/webmention-summary.html @@ -35,7 +35,7 @@ <div class="text-secondary m-0 text-sm inline ml-2"> {{ printf (T "webmention.likedBy") (len $likes ) }} {{ if gt $othercount 0 }} - <a id="toggle-webmentions" class="cursor-pointer" onclick="document.getElementById('webmention-collapse').classList.toggle('hidden')">{{ printf (T "webmention.repliedAndMentionedBy") $othercount }}</a> + {{ printf (T "webmention.repliedAndMentionedBy") $othercount }} {{ end }} </div> <div class="clear-left"></div> |
