aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar makc2016-09-14 13:40:49 +0200
committerGravatar makc2016-09-14 13:40:49 +0200
commit5a14a313d6bc70f821e1bd513d025109a5c15906 (patch)
tree88f99615287a4d427b23ed83e68615c1080539e4
parent927f90b43e89ed7ec74a3d228ec70faf822304f9 (diff)
try to skip existing replies when inserting a comment in tree mode
-rw-r--r--juick-www/src/main/static/scripts.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index 94b6ba65..a5f7c4c0 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -156,7 +156,9 @@ function wsIncomingReply(msg) {
if (isTreeMode() && (msg.replyto > 0)) {
var p = document.getElementById(msg.replyto);
- li.style.marginLeft = parseInt(p.style.marginLeft) + 20 + 'px';
+ var m = parseInt(p.style.marginLeft) + 20;
+ while (p.nextElementSibling && (parseInt(p.nextElementSibling.style.marginLeft) == m)) p = p.nextElementSibling;
+ li.style.marginLeft = m + 'px';
p.parentNode.insertBefore(li, p.nextSibling);
} else {
document.getElementById('replies').appendChild(li);