aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/static
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/main/static')
-rw-r--r--juick-www/src/main/static/scripts.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index 22a75fac..25e65731 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -125,18 +125,13 @@ var ws,
pageTitle;
function initWS() {
- var content = document.getElementById('content');
- if (!content) { return; }
- var pageMID = content.getAttribute('data-mid');
- if (!pageMID) { return; }
-
- var url = (window.location.protocol === 'https:' ? 'wss' : 'ws') + ':'
- + (typeof juickDebug !== 'undefined' ?
- '//ws.juick.com/_replies' : ('//ws.juick.com/' + pageMID)),
- hash = document.getElementById('body').getAttribute('data-hash');
-
+ let url = (window.location.protocol === 'https:' ? 'wss' : 'ws') + ':'
+ + '//ws.juick.com/';
+ let hash = document.getElementById('body').getAttribute('data-hash');
if (hash) {
url += '?hash=' + hash;
+ } else {
+ url += pageMID;
}
ws = new WebSocket(url);
@@ -192,6 +187,10 @@ function isTreeMode() {
}
function wsIncomingReply(msg) {
+ let content = document.getElementById('content');
+ if (!content) { return; }
+ let pageMID = content.getAttribute('data-mid');
+ if (!pageMID || pageMID != msg.mid) { return; }
let msgNum = '/' + msg.rid;
if (msg.replyto > 0) {
msgNum += ` ${i18n('message.inReplyTo')} <a href="#${msg.replyto}">/${msg.replyto}</a>`;