aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js/main.js')
-rw-r--r--view/js/main.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/view/js/main.js b/view/js/main.js
index b1cae8fb8..5bf7234aa 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -894,15 +894,22 @@ function updateConvItems(mode, data) {
let data_json = JSON.parse(elem.dataset.b64mids);
- // Also highlight the thread parent
- if (data_json.includes(bParam_mid) && elem.parentNode.classList.contains('wall-item-sub-thread-wrapper')) {
- if (!elem.parentNode.parentNode.classList.contains('toplevel_item')) {
+ if (elem.parentNode.classList.contains('wall-item-sub-thread-wrapper') && elem.parentNode.children.length) {
+ // Set the highlight state
+ if (data_json.includes(bParam_mid) && !elem.parentNode.parentNode.classList.contains('toplevel_item')) {
elem.parentNode.parentNode.classList.add('item-highlight');
document.documentElement.style.setProperty('--hz-item-highlight', stringToHslColor(JSON.parse(elem.parentNode.parentNode.dataset.b64mids)[0]));
- // Mark the comment button at the parent expanded
- // TODO: should do that for all comments that have replies expanded
- elem.parentNode.parentNode.querySelector('.wall-item-comment').classList.add('expanded');
}
+
+ let elemSubThreadWrapper = elem.querySelector('.wall-item-sub-thread-wrapper');
+ let elemCommentButton = elem.querySelector('.wall-item-comment');
+
+ // Set the button and sub-thread-wrapper state
+ if (elemCommentButton && elemSubThreadWrapper.children.length) {
+ elemCommentButton.classList.add('expanded');
+ }
+
+ elem.parentNode.classList.add('item-expanded');
}
b64mids.push(...data_json);