diff --git a/src/ember/chatview.js b/src/ember/chatview.js index 49e915e8..ed4d042b 100644 --- a/src/ember/chatview.js +++ b/src/ember/chatview.js @@ -379,7 +379,7 @@ FFZ.prototype.setup_chatview = function() { var total = this.get('invitedPrivateGroupRooms.length') || 0; - if ( ! f._chatv._ffz_tabs ) + if ( ! f._chatv._ffz_tabs && f._chatv.ffz_unread ) for(var room_id in f._chatv.ffz_unread) if ( f._chatv.ffz_unread[room_id] ) total++; @@ -389,7 +389,7 @@ FFZ.prototype.setup_chatview = function() { _kickUserFromRoomNoLongerInList: function() { // Remove an unread notice for any missing channels. - if ( f._chatv ) { + if ( f._chatv && f._chatv.ffz_unread ) { var updated = false; for(var room_id in f._chatv.ffz_unread) if ( f._chatv.ffz_unread[room_id] && (!f.rooms[room_id] || !f.rooms[room_id].room) ) { @@ -487,22 +487,26 @@ FFZ.prototype._modify_cview = function(view) { try { this.ffzInit(); } catch(err) { - f.error("ChatView didInsertElement: " + err); + f.error("view:chat ffzInit error: " + err); } }, + didUpdate: function() { + this._super(); + f.log("view:chat didUpdate", this) + }, + willClearRender: function() { try { this.ffzTeardown(); } catch(err) { - f.error("ChatView willClearRender: " + err); + f.error("view:chat ffzTeardown error: " + err); } this._super(); }, ffzInit: function() { - f._chatv = this; - this.ffz_unread = {}; + f._chatv = this; this.$('.textarea-contain').append(f.build_ui_link(this)); this.$('.chat-messages').find('.html-tooltip').tipsy({live: true, html: true, gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')}); @@ -571,11 +575,6 @@ FFZ.prototype._modify_cview = function(view) { ffzChangeRoom: Ember.observer('controller.currentRoom', function() { f.update_ui_link(); - - if ( ! this.ffz_unread ) - f.log("!! Chat View Not Initialized !!", this); - - // Temporary fix this.ffz_unread = this.ffz_unread || {}; // Close mod cards when changing to a new room. @@ -584,7 +583,7 @@ FFZ.prototype._modify_cview = function(view) { var room = this.get('controller.currentRoom'), room_id = room && room.get('id'), - was_unread = room_id && this.ffz_unread && this.ffz_unread[room_id], + was_unread = room_id && this.ffz_unread[room_id], update_height = false; if ( room ) { @@ -714,6 +713,7 @@ FFZ.prototype._modify_cview = function(view) { ffzUpdateUnread: function(target_id) { var current_id = this.get('controller.currentRoom.id'); + this.ffz_unread = this.ffz_unread || {}; if ( target_id === current_id ) // We don't care about updates to the current room. @@ -1051,10 +1051,12 @@ FFZ.prototype._modify_cview = function(view) { // Chat Room Management Button - link.className = 'button glyph-only tooltip'; + link.className = 'button glyph-only'; link.title = "Chat Room Management"; link.innerHTML = constants.ROOMS + ''; + jQuery(link).tipsy({gravity: "n", offset: 5}); + link.addEventListener('click', function() { var controller = view.get('controller'); controller && controller.set('showList', !controller.get('showList')); diff --git a/src/ember/line.js b/src/ember/line.js index 36d1174b..95e3590a 100644 --- a/src/ember/line.js +++ b/src/ember/line.js @@ -607,6 +607,18 @@ FFZ.prototype.setup_line = function() { else this.log("Couldn't find VOD Chat Line component."); + + var other_lines = ['message-line','whisper-line']; + for(var i=0; i < other_lines.length; i++) { + var component = utils.ember_resolve('component:' + other_lines[i]); + if ( component ) + component.reopen({ + didUpdate: function() { }, + didInsertElement: function() { } + }); + } + + // Store the capitalization of our own name. var user = this.get_user(); if ( user && user.name ) @@ -810,12 +822,24 @@ FFZ.prototype._modify_chat_line = function(component, is_vod) { classNameBindings: is_vod ? ["msgObject.ffz_has_mention:ffz-mentioned"] : [":message-line", ":chat-line", "msgObject.style", "msgObject.ffz_has_mention:ffz-mentioned", "ffzWasDeleted:ffz-deleted", "ffzHasOldMessages:clearfix", "ffzHasOldMessages:ffz-has-deleted"], attributeBindings: ["msgObject.room:data-room", "msgObject.from:data-sender", "msgObject.deleted:data-deleted"], - render: function(e) { - e.push(this.buildSenderHTML()); - if ( this.get("msgObject.deleted") ) - e.push(this.buildDeletedMessageHTML()) + didUpdate: function() { + this.ffzRender(); + }, + + didInsertElement: function() { + this.ffzRender(); + }, + + ffzRender: function() { + var el = this.get('element'), + output = this.buildSenderHTML(); + + if ( this.get('msgObject.deleted') ) + output += this.buildDeletedMessageHTML() else - e.push(this.buildMessageHTML()); + output += this.buildMessageHTML(); + + el.innerHTML = output; }, ffzWasDeleted: function() { diff --git a/src/main.js b/src/main.js index 1dd10009..2611e658 100644 --- a/src/main.js +++ b/src/main.js @@ -35,7 +35,7 @@ FFZ.msg_commands = {}; // Version var VER = FFZ.version_info = { - major: 3, minor: 5, revision: 136, + major: 3, minor: 5, revision: 138, toString: function() { return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || ""); } diff --git a/src/ui/menu.js b/src/ui/menu.js index a7fe0e49..912f9a90 100644 --- a/src/ui/menu.js +++ b/src/ui/menu.js @@ -561,7 +561,7 @@ FFZ.menu_pages.channel = { if ( emote.emoticon_set ) { var favs = this.settings.favorite_emotes["twitch-" + emote.emoticon_set]; s.classList.add('ffz-can-favorite'); - s.classList.toggle('ffz-favorite', favs && favs.indexOf(emote.id) !== -1); + s.classList.toggle('ffz-favorite', favs && favs.indexOf(emote.id) !== -1 || false); } s.setAttribute('data-emote', emote.id);