From 5875347966ec080ad0a13f7cb83cea06b6e2e0a2 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Wed, 6 Jul 2016 07:59:13 -0400 Subject: [PATCH] focus on new threads in liveui --- contrib/js/livechan.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/contrib/js/livechan.js b/contrib/js/livechan.js index 25d5358..08c900e 100644 --- a/contrib/js/livechan.js +++ b/contrib/js/livechan.js @@ -857,6 +857,7 @@ function Chat(domElem, channel, options) { var self = this; this.name = channel.toLowerCase(); this.domElem = domElem; + this.lastOp = null; if (options) { this.options = options; } else { @@ -1098,6 +1099,13 @@ Chat.prototype.handleMessage = function (data) { // captcha challenge self.login(); } + } else if (mtype == "posted" ) { + // user posted something + if ( data.OP ) { + // they made a new thread, focus on it once it comes up + self.lastOp = data.Msgid + console.log("made new thread: "+data.Msgid) + } } else if (mtype == "post" ) { self.insertChat(self.generateChat(data), data); } else if (mtype == "count" ) { @@ -1178,6 +1186,11 @@ Chat.prototype.insertChat = function(chat, data) { // scroll to end self.scroll(); self.rollover(); + // show new thread + if (self.lastOp) { + self.chatElems.convobar.show(self.lastOp); + self.lastOp = null; + } }