From bf920e515cd51d95bdbfc7f7584f329b4f0dd334 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 11 Nov 2024 18:33:45 +0200 Subject: [PATCH] make clicking on the collapse line uncollapse all messages --- files/assets/js/comments.js | 8 ++++++++ files/templates/comments.html | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/files/assets/js/comments.js b/files/assets/js/comments.js index 9ad5f88c4..699199f37 100644 --- a/files/assets/js/comments.js +++ b/files/assets/js/comments.js @@ -49,3 +49,11 @@ function collapse_comment(id) { document.getElementById(`children-count-${id}`).innerHTML = '' } }; + +function uncollapse_all_messages(t, id) { + for (const child of document.getElementById(`replies-of-c_${id}`).children) { + child.classList.remove("collapsed") + } + t.classList.add('d-none') + t.nextElementSibling.classList.remove('d-none') +}; diff --git a/files/templates/comments.html b/files/templates/comments.html index c54cf11df..a2fc9f57b 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -104,8 +104,12 @@ {% endif %}
+ {% set is_collapsing = (request.path.startswith('/notifications') or request.path == '/contact') and replies|length > 8 %} {% if not isreply %} - + {% if is_collapsing %} + + {% endif %} + {% endif %}
@@ -538,7 +542,7 @@ {% if render_replies %}
- {% if (request.path.startswith('/notifications') or request.path == '/contact') and replies|length > 8 %} + {% if is_collapsing %} {% for reply in replies %} {% if reply.parent_post %} {% set collapse = reply.collapse %}