aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/ThreadItem.php6
-rw-r--r--include/js_strings.php2
-rw-r--r--view/js/main.js17
-rw-r--r--view/tpl/conv_item.tpl4
-rw-r--r--view/tpl/js_strings.tpl2
5 files changed, 13 insertions, 18 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 2c66aa785..3564d9b9f 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -484,7 +484,9 @@ class ThreadItem {
'attendmaybe' => intval($item['observer_tentativelyaccepted'] ?? 0)
],
'threaded' => $this->threaded,
- 'blog_mode' => $this->get_display_mode() === 'list'
+ 'blog_mode' => $this->get_display_mode() === 'list',
+ 'collapse_comments' => t('show less'),
+ 'expand_comments' => $this->threaded ? t('show more') : t('show all')
);
$arr = array('item' => $item, 'output' => $tmp_item);
@@ -506,7 +508,7 @@ class ThreadItem {
if($thread_level === 1 && $nb_children > $visible_comments) {
$result['children'][0]['comment_firstcollapsed'] = true;
$result['children'][0]['num_comments'] = $comment_count_txt['label'];
- $result['children'][0]['hide_text'] = t('show all');
+// $result['children'][0]['hide_text'] = t('show all');
// if($thread_level > 1) {
// $result['children'][$nb_children - 1]['comment_lastcollapsed'] = false;
// }
diff --git a/include/js_strings.php b/include/js_strings.php
index b41c34508..1772cb66b 100644
--- a/include/js_strings.php
+++ b/include/js_strings.php
@@ -5,8 +5,6 @@ function js_strings() {
'$delitem' => t('Delete this item?'),
'$itemdel' => t('Item deleted'),
'$comment' => t('Comment'),
- '$showmore' => t('show all'),
- '$showfewer' => t('show less'),
'$divgrowmore' => t('expand'),
'$divgrowless' => t('collapse'),
'$pwshort' => t("Password too short"),
diff --git a/view/js/main.js b/view/js/main.js
index 9a2a72d5c..b6ea41325 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -502,8 +502,11 @@ function showHideComments(id) {
let isCollapsed = collapsedComments.style.display === 'none';
collapsedComments.style.display = isCollapsed ? '' : 'none';
- hideCommentsLabel.textContent = isCollapsed ? aStr.showfewer : aStr.showmore;
- hideCommentsTotal.style.display = isCollapsed ? 'none' : '';
+ hideCommentsLabel.textContent = isCollapsed ? hideCommentsLabel.dataset.expanded : hideCommentsLabel.dataset.collapsed;
+
+ if (hideCommentsTotal) {
+ hideCommentsTotal.style.display = isCollapsed ? 'none' : '';
+ }
let oldClass = isCollapsed ? 'bi-chevron-down' : 'bi-chevron-up';
let newClass = isCollapsed ? 'bi-chevron-up' : 'bi-chevron-down';
@@ -960,14 +963,8 @@ function scrollToItem() {
// Handle collapsed comments if any
let collapsedComments = document.querySelectorAll('.collapsed-comments');
if (collapsedComments.length) {
- let scrolltoid = collapsedComments[0].id.substring(19);
- let collapsedComment = document.getElementById('collapsed-comments-' + scrolltoid);
- let hideCommentsLabel = document.getElementById('hide-comments-label-' + scrolltoid);
- let hideCommentsTotal = document.getElementById('hide-comments-total-' + scrolltoid);
-
- if (collapsedComment) collapsedComment.style.display = 'block';
- if (hideCommentsLabel) hideCommentsLabel.innerHTML = aStr.showfewer;
- if (hideCommentsTotal) hideCommentsTotal.style.display = 'none';
+ let scrollToId = collapsedComments[0].id.substring(19);
+ showHideComments(scrollToId);
}
// Scroll to the target element
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index d30cf5998..2f39ae675 100644
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -1,10 +1,10 @@
{{if $item.comment_firstcollapsed}}
<div id="hide-comments-outer-{{$item.parent}}" class="hide-comments-outer fakelink small" onclick="showHideComments({{$item.id}});">
- <i id="hide-comments-icon-{{$item.id}}" class="bi bi-chevron-down align-middle hide-comments-icon"></i> <span id="hide-comments-label-{{$item.id}}" class="hide-comments-label align-middle">{{$item.hide_text}}</span>&nbsp;<span id="hide-comments-total-{{$item.id}}" class="hide-comments-label align-middle">{{$item.num_comments}}</span>
+ <i id="hide-comments-icon-{{$item.id}}" class="bi bi-chevron-down align-middle hide-comments-icon"></i> <span id="hide-comments-label-{{$item.id}}" class="hide-comments-label align-middle" data-expanded="{{$item.collapse_comments}}" data-collapsed="{{$item.expand_comments}}">{{$item.expand_comments}}</span>{{if !$item.threaded}}&nbsp;<span id="hide-comments-total-{{$item.id}}" class="hide-comments-label align-middle">{{$item.num_comments}}</span>{{/if}}
</div>
<div id="collapsed-comments-{{$item.id}}" class="collapsed-comments" style="display: none;">
{{/if}}
- <div id="thread-wrapper-{{$item.id}}" class="thread-wrapper{{if $item.toplevel}} {{$item.toplevel}} generic-content-wrapper h-entry {{else}} u-comment h-cite{{/if}} clearfix{{if $item.is_contained}} is-contained{{/if}}{{if $item.is_new && !$item.event && !$item.photo && !$item.title && !$item.is_comment}} is-new{{/if}}" data-b64mids='{{$item.mids}}'>
+ <div id="thread-wrapper-{{$item.id}}" class="thread-wrapper{{if $item.toplevel}} {{$item.toplevel}} generic-content-wrapper h-entry{{else}} u-comment h-cite{{/if}} clearfix{{if $item.is_contained}} is-contained{{/if}}{{if $item.is_new && !$item.event && !$item.photo && !$item.title && !$item.is_comment}} is-new{{/if}}" data-b64mids='{{$item.mids}}'>
<a name="item_{{$item.id}}" ></a>
<div class="wall-item-outside-wrapper{{if $item.is_comment}} comment{{/if}}{{if $item.previewing}} preview{{/if}}" id="wall-item-outside-wrapper-{{$item.id}}" >
<div class="rounded wall-item-content-wrapper{{if $item.is_comment}} comment{{/if}}" id="wall-item-content-wrapper-{{$item.id}}">
diff --git a/view/tpl/js_strings.tpl b/view/tpl/js_strings.tpl
index 38168ccfe..2a374fdf8 100644
--- a/view/tpl/js_strings.tpl
+++ b/view/tpl/js_strings.tpl
@@ -5,8 +5,6 @@
'delitem' : "{{$delitem}}",
'itemdel' : "{{$itemdel}}",
'comment' : "{{$comment}}",
- 'showmore' : "{{$showmore}}",
- 'showfewer' : "{{$showfewer}}",
'divgrowmore' : "{{$divgrowmore}}",
'divgrowless' : "{{$divgrowless}}",
'pwshort' : "{{$pwshort}}",