From 87aca610df7ef1eeb8fa345363de8d156c8026d1 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Mon, 26 Jan 2015 21:19:52 +0000 Subject: [PATCH] chat: update notice instead of appending a new one everytime --- public/javascripts/chat.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/javascripts/chat.js b/public/javascripts/chat.js index f41cac3..0dda218 100644 --- a/public/javascripts/chat.js +++ b/public/javascripts/chat.js @@ -488,7 +488,11 @@ jQuery(function($) { show_notice: function(jid_id, msg) { var tab_id = '#' + Jabber.conversation_prefix + jid_id; - $(tab_id).find('.history').append("" + msg + ""); + var notice = $(tab_id).find('.history .notice'); + if (notice.length > 0) + notice.html(msg) + else + $(tab_id).find('.history').append("" + msg + ""); } }; @@ -515,6 +519,7 @@ jQuery(function($) { $('#chat').bind('opengroup', function(ev, anchor) { var full_jid = anchor.replace('#', ''); var jid = Strophe.getBareJidFromJid(full_jid); + console.log('>>>> '+jid); var name = Strophe.getResourceFromJid(full_jid); var jid_id = Jabber.jid_to_id(full_jid); if (full_jid) { -- libgit2 0.21.2