aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-30 22:16:47 +0300
committerGravatar Vitaly Takmazov2016-07-30 22:16:47 +0300
commitabc13e3a14dd6565064cea76ff32b4da1f9e2f12 (patch)
tree2b7dcfdb8ebeeb96ca5ee540e214e284917d7ea2
parent1a0bbe1ccd1f53276efa7228f1befcf0f2fa13bb (diff)
www: various wsIncomingReply fixes
-rw-r--r--juick-www/src/main/static/scripts.js12
1 files changed, 6 insertions, 6 deletions
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;
}
}