From 1e729a0787540b70ce0fdb160230115a350b1836 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 28 Jul 2016 11:39:15 +0300 Subject: www: fix wsIncomingReply handlers --- juick-www/src/main/static/scripts.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'juick-www/src') diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js index ef1c40d8..cca9545f 100644 --- a/juick-www/src/main/static/scripts.js +++ b/juick-www/src/main/static/scripts.js @@ -74,14 +74,8 @@ function wsIncomingReply(msg) { var li = document.createElement('li'); li.setAttribute('class', 'msg reply-new'); li.setAttribute('id', msg.rid); - li.addEventListener('click', function (e) { - newReply(this); - e.preventDefault(); - }); - li.addEventListener('mouseover', function (e) { - newReply(this); - e.preventDefault(); - }); + li.addEventListener('click', newReply); + li.addEventListener('mouseover', newReply); var msgAvatar = document.createElement('div'); msgAvatar.setAttribute('class', 'msg-avatar'); var msgAvatarLink = document.createElement('a'); @@ -156,8 +150,8 @@ function wsIncomingReply(msg) { function newReply(li) { li.classList.remove('reply-new'); - li.removeEventListener('click'); - li.removeEventListener('mouseover'); + li.removeEventListener('click', this); + li.removeEventListener('mouseover', this); updateRepliesCounter(); } @@ -165,7 +159,7 @@ function onclickNextReply() { var li = document.querySelector('#replies>li.reply-new:first'); if (li.length) { li.classList.remove('reply-new'); - li.removeEventListener('click'); + li.removeEventListener('click', this); li.childNodes[0].scrollIntoView(); updateRepliesCounter(); } -- cgit v1.2.3