From abc13e3a14dd6565064cea76ff32b4da1f9e2f12 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 30 Jul 2016 22:16:47 +0300 Subject: www: various wsIncomingReply fixes --- juick-www/src/main/static/scripts.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'juick-www/src/main/static/scripts.js') diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js index 1c6e764e..6088da97 100644 --- a/juick-www/src/main/static/scripts.js +++ b/juick-www/src/main/static/scripts.js @@ -140,10 +140,10 @@ function wsIncomingReply(msg) { if (msg.replyto > 0) { var p = document.getElementById(msg.replyto); - li.style.marginLeft = p.style.marginLeft + '20px'; + li.style.marginLeft = parseInt(p.style.marginLeft) + 20 + 'px'; p.parentNode.insertBefore(li, p.nextSibling); } else { - document.querySelector('#replies').appendChild(li); + document.getElementById('replies').appendChild(li); } updateRepliesCounter(); @@ -158,8 +158,8 @@ function newReply(e) { } function nextReply() { - var li = document.querySelector('#replies>li.reply-new:first'); - if (li.length) { + var li = document.querySelector('#replies>li.reply-new'); + if (li) { li.classList.remove('reply-new'); li.removeEventListener('click', this); li.childNodes[0].scrollIntoView(); @@ -169,13 +169,13 @@ function nextReply() { function updateRepliesCounter() { var replies = document.querySelectorAll('#replies>li.reply-new').length; + var wsthread = document.getElementById('wsthread'); if (replies) { - var wsthread = document.querySelector('#wsthread'); wsthread.textContent = replies; wsthread.style.display = 'block'; document.title = '[' + replies + '] ' + pageTitle; } else { - document.querySelector('#wsthread').style.display = 'none'; + wsthread.style.display = 'none'; document.title = pageTitle; } } -- cgit v1.2.3