From 5a14a313d6bc70f821e1bd513d025109a5c15906 Mon Sep 17 00:00:00 2001 From: makc Date: Wed, 14 Sep 2016 13:40:49 +0200 Subject: try to skip existing replies when inserting a comment in tree mode --- juick-www/src/main/static/scripts.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3