From d5d30893e566a69408901900b3994b1a23724d9d Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Tue, 5 Jul 2016 10:11:58 -0400 Subject: [PATCH] livechan fixes --- contrib/js/livechan.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/js/livechan.js b/contrib/js/livechan.js index 36330f1..0b8601d 100644 --- a/contrib/js/livechan.js +++ b/contrib/js/livechan.js @@ -684,8 +684,9 @@ ConvoBar.prototype.update = function(msgid, data) { // remove oldest from convo tracker var child_data = self.holder[msgid].posts.shift(); var child = document.getElementById("livechan_chat_"+child_data.ShortHash); - // remove element from main chat element - self.parent.chatElems.output.removeChild(child.parentNode.parentElement); + if(child) { + child.remove(); + } } } @@ -710,6 +711,7 @@ ConvoBar.prototype.registerConvo = function(msgid, data) { msgid: data.Message_id, id: max_id + 1, posts: [], + ShortHash: data.ShortHash, select: function() { console.log("selected convo "+msgid); if ( self.active !== msgid ) { @@ -1107,12 +1109,14 @@ Chat.prototype.scroll = function() { /** @brief roll over old posts, remove them from ui */ Chat.prototype.rollover = function() { + /* var self = this; var chatSize = self.options.scrollback || 50; var e = self.chatElems.output; while ( e.childNodes.length > chatSize ) { e.childNodes[0].remove(); } +*/ } /* @brief Inserts the chat into the DOM, overwriting if need be.