From 2cb07d6c789414ee568a52009801eb0bae3746c4 Mon Sep 17 00:00:00 2001 From: SirStendec Date: Wed, 25 May 2016 01:06:27 -0400 Subject: [PATCH] 3.5.188. Continued bug fixing for Ember internals restructuring. Fixed enhanced following control again. Fixed a bug re-inserting deleted message history into chat. --- src/ember/channel.js | 17 +++++++++-------- src/ember/chatview.js | 2 +- src/ember/following.js | 12 +++++++++++- src/ember/line.js | 6 +++--- src/ember/moderation-card.js | 27 +++++++++++++++------------ src/ember/room.js | 2 +- src/main.js | 2 +- src/tokenize.js | 2 +- style.css | 3 +++ 9 files changed, 45 insertions(+), 28 deletions(-) diff --git a/src/ember/channel.js b/src/ember/channel.js index 4fd5be73..2891095f 100644 --- a/src/ember/channel.js +++ b/src/ember/channel.js @@ -303,7 +303,7 @@ FFZ.prototype._modify_cindex = function(view) { btn.id = 'ffz-ui-host-button'; btn.className = 'button action'; - btn.addEventListener('click', this.ffzClickHost.bind(btn, this, false)); + btn.addEventListener('click', this.ffzClickHost.bind(this, false)); var before; try { before = container.querySelector(':scope > .theatre-button'); } @@ -343,7 +343,7 @@ FFZ.prototype._modify_cindex = function(view) { btn.id = 'ffz-ui-host-button'; btn.className = 'button action'; - btn.addEventListener('click', this.ffzClickHost.bind(btn, this, true)); + btn.addEventListener('click', this.ffzClickHost.bind(this, true)); var before; try { before = container.querySelector(':scope > .theatre-button'); } @@ -370,19 +370,20 @@ FFZ.prototype._modify_cindex = function(view) { } }, - ffzClickHost: function(controller, is_host) { - var target = is_host ? controller.get('controller.hostModeTarget.id') : (controller.get('controller.content.id') || controller.get('controller.id')), + ffzClickHost: function(is_host, e) { + var btn = e.target, + target = is_host ? this.get('controller.hostModeTarget.id') : (this.get('controller.content.id') || this.get('controller.id')), user = f.get_user(), room = user && f.rooms && f.rooms[user.login] && f.rooms[user.login].room, now_hosting = room && room.ffz_host_target; - if ( ! room || controller.get('ffz_host_updating') ) + if ( ! room || this.get('ffz_host_updating') ) return; - this.classList.add('disabled'); - this.title = 'Updating...'; + btn.classList.add('disabled'); + btn.title = 'Updating...'; - controller.set('ffz_host_updating', true); + this.set('ffz_host_updating', true); if ( now_hosting === target ) room.send("/unhost", true); else diff --git a/src/ember/chatview.js b/src/ember/chatview.js index 15b20a4d..e54ccf3d 100644 --- a/src/ember/chatview.js +++ b/src/ember/chatview.js @@ -616,7 +616,7 @@ FFZ.prototype._modify_cview = function(view) { // Close mod cards when changing to a new room. if ( f._mod_card ) - f._mod_card.send('close'); + f._mod_card.get('closeAction')(); var room = this.get('controller.currentRoom'), room_id = room && room.get('id'), diff --git a/src/ember/following.js b/src/ember/following.js index 1d25dd71..c7961815 100644 --- a/src/ember/following.js +++ b/src/ember/following.js @@ -174,9 +174,19 @@ FFZ.prototype._modify_display_followed_item = function(component) { } }, + ffzParentModel: function() { + var x = this.get('parentView'); + while(x) { + var model = x.get('model'); + if ( model ) + return model; + x = x.get('parentView'); + } + }.property('parentView'), + ffzInit: function() { var el = this.get('element'), - channel_id = this.get('parentView.parentView.model.id'), + channel_id = this.get('ffzParentModel.id'), //.get('parentView.parentView.parentView.model.id'), is_following = document.body.getAttribute('data-current-path').indexOf('.following') !== -1, user = f.get_user(), diff --git a/src/ember/line.js b/src/ember/line.js index c8ca23ef..4c77e92a 100644 --- a/src/ember/line.js +++ b/src/ember/line.js @@ -907,13 +907,13 @@ FFZ.prototype._modify_chat_subline = function(component) { return; } else if ( cl.contains('ban') ) - this.sendAction("banUser", from); + this.sendAction("banUser", {user:from}); else if ( cl.contains('unban') ) - this.sendAction("unbanUser", from); + this.sendAction("unbanUser", {user:from}); else if ( cl.contains('timeout') ) - this.sendAction("timeoutUser", from); + this.sendAction("timeoutUser", {user:from}); } else if ( cl.contains('badge') ) { if ( cl.contains('turbo') ) diff --git a/src/ember/moderation-card.js b/src/ember/moderation-card.js index e6b42c56..0a3ee963 100644 --- a/src/ember/moderation-card.js +++ b/src/ember/moderation-card.js @@ -21,7 +21,7 @@ var FFZ = window.FrankerFaceZ, try { - helpers = window.require && window.require("ember-twitch-chat/helpers/chat-line-helpers"); + helpers = window.require && window.require("web-client/helpers/chat/chat-line-helpers"); } catch(err) { } @@ -490,6 +490,11 @@ FFZ.settings_info.mod_card_durations = { // ---------------- FFZ.prototype.setup_mod_card = function() { + try { + helpers = window.require && window.require("web-client/helpers/chat/chat-line-helpers"); + } catch(err) { } + + this.log("Modifying Mousetrap stopCallback so we can catch ESC."); var orig_stop = Mousetrap.stopCallback; Mousetrap.stopCallback = function(e, element, combo) { @@ -598,17 +603,15 @@ FFZ.prototype.setup_mod_card = function() { // Action Override - if ( this._actions ) { - this._actions.banUser = function(e) { - var room = utils.ember_lookup('controller:chat').get('currentRoom'); - room.send("/ban " + e + ban_reason(), true); - } + this.set('banAction', function(e) { + var room = utils.ember_lookup('controller:chat').get('currentRoom'); + room.send("/ban " + e.user + ban_reason(), true); + }); - this._actions.timeoutUser = function(e) { - var room = utils.ember_lookup('controller:chat').get('currentRoom'); - room.send("/timeout " + e + " 600" + ban_reason(), true); - } - } + this.set('timeoutAction', function(e) { + var room = utils.ember_lookup('controller:chat').get('currentRoom'); + room.send("/timeout " + e.user + " 600 " + ban_reason(), true); + }); // Alias Display @@ -749,7 +752,7 @@ FFZ.prototype.setup_mod_card = function() { else if ( key != keycodes.ESC ) return; - controller.send('close'); + t.get('closeAction')(); }); } diff --git a/src/ember/room.js b/src/ember/room.js index aa95896f..61432cd2 100644 --- a/src/ember/room.js +++ b/src/ember/room.js @@ -725,7 +725,7 @@ FFZ.prototype._insert_history = function(room_id, data, from_server) { if ( f.settings.remove_deleted && msg.deleted ) return true; - if ( msg.tags.target && msg.tags.target !== '@@' ) { + if ( msg.tags && msg.tags.target && msg.tags.target !== '@@' ) { var is_mine = current_user && current_user.login === msg.tags.target; if ( ! is_mine && ! r.ffzShouldDisplayNotice() ) return true; diff --git a/src/main.js b/src/main.js index ee43ce30..28343958 100644 --- a/src/main.js +++ b/src/main.js @@ -37,7 +37,7 @@ FFZ.msg_commands = {}; // Version var VER = FFZ.version_info = { - major: 3, minor: 5, revision: 185, + major: 3, minor: 5, revision: 188, toString: function() { return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || ""); } diff --git a/src/tokenize.js b/src/tokenize.js index 7e992662..8a94b9d4 100644 --- a/src/tokenize.js +++ b/src/tokenize.js @@ -148,7 +148,7 @@ FFZ.prototype.setup_tokenization = function() { this.load_twitch_emote_data(); try { - helpers = window.require && window.require("ember-twitch-chat/helpers/chat-line-helpers"); + helpers = window.require && window.require("web-client/helpers/chat/chat-line-helpers"); } catch(err) { } if ( ! helpers ) diff --git a/style.css b/style.css index 4fc4e9c5..5499616c 100644 --- a/style.css +++ b/style.css @@ -1104,6 +1104,7 @@ body:not(.ffz-bttv) .dropmenu.share { margin-bottom: 0; } /* Menu Scrollbar */ +.activity-react__all::-webkit-scrollbar, .conversations-list .scroll-container::-webkit-scrollbar, .chatters-container::-webkit-scrollbar, .ffz-scrollbar::-webkit-scrollbar, @@ -1119,6 +1120,7 @@ body:not(.ffz-bttv) .dropmenu.share { margin-bottom: 0; } width: 6px; } +.activity-react__all::-webkit-scrollbar-thumb, .conversations-list .scroll-container::-webkit-scrollbar-thumb, .chatters-container::-webkit-scrollbar-thumb, .ffz-scrollbar::-webkit-scrollbar-thumb, @@ -1135,6 +1137,7 @@ body:not(.ffz-bttv) .dropmenu.share { margin-bottom: 0; } box-shadow: 0 0 1px 1px rgba(255,255,255,0.25); } +.ffz-dark .activity-react__all::-webkit-scrollbar-thumb, .ffz-dark .conversations-list .scroll-container::-webkit-scrollbar-thumb, .ffz-dark .ffz-scrollbar::-webkit-scrollbar-thumb, .ffz-dark .table::-webkit-scrollbar-thumb,