aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2025-03-23 14:14:19 +0000
committerMario <mario@mariovavti.com>2025-03-23 14:14:19 +0000
commitafd811a875d296a298014273173c530e4e323908 (patch)
treea8aa3c7bb9d9b41df3bfe26ee58a77c3803230f4 /view/js
parent122d46b79bdd3ebea14482681c88c6c87191d807 (diff)
downloadvolse-hubzilla-afd811a875d296a298014273173c530e4e323908.tar.gz
volse-hubzilla-afd811a875d296a298014273173c530e4e323908.tar.bz2
volse-hubzilla-afd811a875d296a298014273173c530e4e323908.zip
more deprercate jquery
Diffstat (limited to 'view/js')
-rw-r--r--view/js/main.js25
1 files changed, 13 insertions, 12 deletions
diff --git a/view/js/main.js b/view/js/main.js
index ce1d71596..e1a97dde0 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -493,18 +493,19 @@ function viewsrc(id) {
}
function showHideComments(id) {
- if($('#collapsed-comments-' + id).is(':visible')) {
- $('#collapsed-comments-' + id).hide();
- $('#hide-comments-label-' + id).html(aStr.showmore);
- $('#hide-comments-total-' + id).show();
- $('#hide-comments-icon-' + id).toggleClass('bi-chevron-down bi-chevron-up');
-
- } else {
- $('#collapsed-comments-' + id).show();
- $('#hide-comments-label-' + id).html(aStr.showfewer);
- $('#hide-comments-total-' + id).hide();
- $('#hide-comments-icon-' + id).toggleClass('bi-chevron-down bi-chevron-up');
- }
+ let collapsedComments = document.getElementById('collapsed-comments-' + id);
+ let hideCommentsLabel = document.getElementById('hide-comments-label-' + id);
+ let hideCommentsTotal = document.getElementById('hide-comments-total-' + id);
+ let hideCommentsIcon = document.getElementById('hide-comments-icon-' + id);
+ let isCollapsed = collapsedComments.style.display === 'none';
+
+ collapsedComments.style.display = isCollapsed ? '' : 'none';
+ hideCommentsLabel.textContent = isCollapsed ? aStr.showfewer : aStr.showmore;
+ hideCommentsTotal.style.display = isCollapsed ? 'none' : '';
+
+ let oldClass = isCollapsed ? 'bi-chevron-down' : 'bi-chevron-up';
+ let newClass = isCollapsed ? 'bi-chevron-up' : 'bi-chevron-down';
+ hideCommentsIcon.classList.replace(oldClass, newClass);
}
function openClose(theID, display) {