diff --git a/src/ember/chat-input.js b/src/ember/chat-input.js index 6e4288b4..ec230584 100644 --- a/src/ember/chat-input.js +++ b/src/ember/chat-input.js @@ -99,7 +99,7 @@ FFZ.prototype.setup_chat_input = function() { this._modify_chat_input(Input); - var views = this._roomv && this._roomv._viewRegistry || utils.ember_views(); + var views = utils.ember_views(); for(var key in views) { var v = views[key]; if ( v instanceof Input ) { @@ -277,6 +277,8 @@ FFZ.prototype._modify_chat_input = function(component) { if ( ! e.shiftKey && ! e.shiftLeft ) this.set('ffz_mru_index', -1); + setTimeout(this.ffzResizeInput.bind(this),10); + default: return this._onKeyDown(event); } diff --git a/src/ember/directory.js b/src/ember/directory.js index 7af44c26..ac79e2b1 100644 --- a/src/ember/directory.js +++ b/src/ember/directory.js @@ -291,12 +291,10 @@ FFZ.prototype._modify_following = function() { valid_hosts.push(host); } - f.log("Stuff!", [this, e, valid_hosts, skipped]); + //f.log("Stuff!", [this, e, valid_hosts, skipped]); this.set('ffz_skipped', skipped); this.setContent(valid_hosts); - this.set('total', e._total); - return; // We could get non-empty results even with no new hosts. this.set('gotNonEmptyResults', e.hosts && e.hosts.length); diff --git a/src/ember/layout.js b/src/ember/layout.js index 7735202f..b6e169ee 100644 --- a/src/ember/layout.js +++ b/src/ember/layout.js @@ -227,68 +227,74 @@ FFZ.prototype.setup_layout = function() { }.property("playerSize"), ffzPortraitWarning: function() { - if ( ! f.settings.portrait_mode || f._portrait_warning || f.settings.portrait_warning || ! this.get('isTooSmallForRightColumn') ) - return; + var t = this; + // Delay this, in case we're just resizing the window. + setTimeout(function() { + if ( ! f.settings.portrait_mode || f._portrait_warning || f.settings.portrait_warning || document.body.getAttribute('data-current-path').indexOf('user.') !== 0 || ! t.get('isTooSmallForRightColumn') ) + return; - f._portrait_warning = true; - f.show_message('Twitch\'s Chat Sidebar has been hidden as a result of FrankerFaceZ\'s Portrait Mode because the window is too wide.

Please disable Portrait Mode or make your window narrower.

Do not show this message again'); + f._portrait_warning = true; + f.show_message('Twitch\'s Chat Sidebar has been hidden as a result of FrankerFaceZ\'s Portrait Mode because the window is too wide.

Please disable Portrait Mode or make your window narrower.

Do not show this message again'); + }, 50); }.observes("isTooSmallForRightColumn"), ffzUpdateCss: function() { - // TODO: Fix this mess of duplicate code. var out = ''; - if ( ! f.has_bttv ) { - if ( this.get('portraitMode') ) { - var size = this.get('playerSize'), - height = size[1], - top = height + 120 + 60; + if ( this.get('isRightColumnClosed') ) + out = ''; + else { + if ( this.get('portraitMode') ) { + var size = this.get('playerSize'), + video_below = this.get('portraitVideoBelow'), + window_height = this.get('windowHeight'), + window_width = this.get('windowWidth'), - if ( this.get('portraitVideoBelow') ) { - var wh = this.get("windowHeight"), - mch = wh - top; + video_height = size[1] + 120 + 60, + chat_height = window_height - video_height, - out = (this.get('isRightColumnClosed') ? '' : 'body[data-current-path^="user."] #left_col, ') + - 'body[data-current-path^="user."]:not(.ffz-sidebar-swap) #main_col:not(.expandRight) { margin-right: 0 !important; top: ' + mch + 'px; height: ' + top + 'px; }' + - 'body[data-current-path^="user."].ffz-sidebar-swap #main_col:not(.expandRight) { margin-left: 0 !important; top: ' + mch + 'px; height: ' + top + 'px; }' + - 'body[data-current-path^="user."] #right_col { width: 100%; height: ' + mch + 'px; left: 0; }'; - } else - out = (this.get('isRightColumnClosed') ? '' : 'body[data-current-path^="user."] #left_col, ') + - 'body[data-current-path^="user."]:not(.ffz-sidebar-swap) #main_col:not(.expandRight) { margin-right: 0 !important; height: ' + top + 'px; }' + - 'body[data-current-path^="user."].ffz-sidebar-swap #main_col:not(.expandRight) { margin-left: 0 !important; height: ' + top + 'px; }' + - 'body[data-current-path^="user."] #right_col { width: 100%; top: ' + top + 'px; left: 0; }'; + video_top = video_below ? chat_height : 0, + chat_top = video_below ? 0 : video_height, - // Theatre Mode Portrait - if ( true ) { //this.get('theaterPortraitMode') ) { - // Recalculate the player height, not including the title or anything special. - var width = this.get("windowWidth"), - wh = this.get("windowHeight"), - height = (9 * width / 16); + theatre_video_height = Math.floor(Math.max(window_height * 0.1, Math.min(window_height - 300, 9 * window_width / 16))), + theatre_chat_height = window_height - theatre_video_height, - height = Math.floor(Math.max(wh * 0.1, Math.min(wh - 300, height))); + theatre_video_top = video_below ? theatre_chat_height : 0, + theatre_chat_top = video_below ? 0 : theatre_video_height; - if ( this.get('portraitVideoBelow') ) { - var mch = this.get("windowHeight") - height; - out += (this.get('isRightColumnClosed') ? '' : 'body[data-current-path^="user."] .app-main.theatre #left_col, ') + - 'body[data-current-path^="user."]:not(.ffz-sidebar-swap) .app-main.theatre #main_col:not(.expandRight) { margin-right: 0 !important; top: ' + mch + 'px; height: ' + height + 'px; }' + - 'body[data-current-path^="user."].ffz-sidebar-swap .app-main.theatre #main_col:not(.expandRight) { margin-left: 0 !important; top: ' + mch + 'px; height: ' + height + 'px; }' + - 'body[data-current-path^="user."] .app-main.theatre #right_col { width: 100%; height: ' + mch + 'px; left: 0; }'; - } else - out += 'body[data-current-path^="user."]:not(.ffz-sidebar-swap) .app-main.theatre #main_col:not(.expandRight) { margin-right: 0 !important; height: ' + height + 'px; }' + - 'body[data-current-path^="user."].ffz-sidebar-swap .app-main.theatre #main_col:not(.expandRight) { margin-left: 0 !important; height: ' + height + 'px; }' + - 'body[data-current-path^="user."] .app-main.theatre #right_col { width: 100%; top: ' + height + 'px; left: 0; }'; - } + out = 'body[data-current-path^="user."] #left_col,' + + 'body[data-current-path^="user."]:not(.ffz-sidebar-swap) #main_col{' + + 'margin-right:0 !important;' + + 'top:' + video_top + 'px;' + + 'height:' + video_height + 'px}' + + 'body[data-current-path^="user."].ffz-sidebar-swap #main_col{' + + 'margin-left:0 !important;' + + 'top:' + video_top + 'px;' + + 'height:' + video_height + 'px}' + + 'body[data-current-path^="user."] #right_col{' + + 'width:100%;' + + 'top:' + chat_top + 'px;' + + 'height:' + chat_height + 'px}' + + 'body[data-current-path^="user."] .app-main.theatre #left_col,' + + 'body[data-current-path^="user."] .app-main.theatre #main_col{' + + 'top:' + theatre_video_top + 'px;' + + 'height:' + theatre_video_height + 'px}' + + 'body[data-current-path^="user."] .app-main.theatre #right_col{' + + 'top:' + theatre_chat_top + 'px;' + + 'height:' + theatre_chat_height + 'px}'; - } else { - var width = this.get('rightColumnWidth'); - - out = '#main_col.expandRight #right_close { left: none !important; }' + - '#right_col { width: ' + width + 'px; }' + - 'body:not(.ffz-sidebar-swap) #main_col:not(.expandRight) { margin-right: ' + width + 'px; }' + - 'body.ffz-sidebar-swap #main_col:not(.expandRight) { margin-left: ' + width + 'px; }'; - } + } else { + var width = this.get('rightColumnWidth'); + out = '#main_col.expandRight #right_close{left: none !important}' + + '#right_col{width:' + width + 'px}' + + 'body:not(.ffz-sidebar-swap) #main_col:not(.expandRight){' + + 'margin-right:' + width + 'px}' + + 'body.ffz-sidebar-swap #main_col:not(.expandRight){' + + 'margin-left:' + width + 'px}'; + } + } f._layout_style.innerHTML = out; } diff --git a/src/ember/line.js b/src/ember/line.js index 7e2df856..9d08eaaf 100644 --- a/src/ember/line.js +++ b/src/ember/line.js @@ -900,13 +900,13 @@ FFZ.prototype._modify_chat_subline = function(component) { return; } else if ( cl.contains('ban') ) - this.sendAction("banUser", {user:from}); + this.sendAction("banUser", from); else if ( cl.contains('unban') ) - this.sendAction("unbanUser", {user:from}); + this.sendAction("unbanUser", from); else if ( cl.contains('timeout') ) - this.sendAction("timeoutUser", {user:from}); + this.sendAction("timeoutUser", from); } else if ( cl.contains('badge') ) { if ( cl.contains('turbo') ) @@ -926,10 +926,16 @@ FFZ.prototype._modify_chat_subline = function(component) { sender: from }); - } else if ( e.target.classList.contains('undelete') ) + } else if ( e.target.classList.contains('undelete') ) { + e.preventDefault(); this.set("msgObject.deleted", false); + } } - }) + }); + + try { + component.create().destroy() + } catch(err) { } } @@ -1005,6 +1011,10 @@ FFZ.prototype._modify_vod_line = function(component) { } } }); + + try { + component.create().destroy() + } catch(err) { } } diff --git a/src/ext/api.js b/src/ext/api.js index e5454075..545ac2ff 100644 --- a/src/ext/api.js +++ b/src/ext/api.js @@ -235,7 +235,7 @@ API.prototype.unload_set = function(id) { if ( ! room ) continue; - var ind = room.ext_sets.indexOf(exact_id); + var ind = room.ext_sets ? room.ext_sets.indexOf(exact_id) : -1; if ( ind !== -1 ) room.ext_sets.splice(ind,1); } @@ -345,7 +345,7 @@ API.prototype.register_room_set = function(room_id, id, emote_set) { this.ffz.emote_sets[exact_id] = emote_set; // Register it on the room. - room.ext_sets.push(exact_id); + room.ext_sets && room.ext_sets.push(exact_id); emote_set.users.push(room_id); } @@ -358,7 +358,7 @@ API.prototype.unregister_room_set = function(room_id, id) { if ( ! emote_set || ! room ) return; - var ind = room.ext_sets.indexOf(exact_id); + var ind = room.ext_sets ? room.ext_sets.indexOf(exact_id) : -1; if ( ind !== -1 ) room.ext_sets.splice(ind,1); diff --git a/src/main.js b/src/main.js index dbe701e9..cb259dd7 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: 142, + major: 3, minor: 5, revision: 145, toString: function() { return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || ""); } diff --git a/src/ui/following-count.js b/src/ui/following-count.js index a53c5da2..50bb2ef8 100644 --- a/src/ui/following-count.js +++ b/src/ui/following-count.js @@ -241,8 +241,11 @@ FFZ.prototype._build_following_tooltip = function(el) { // Reposition the tooltip. setTimeout(function() { - var tip = document.querySelector('.tipsy'), - bb = tip.getBoundingClientRect(), + var tip = document.querySelector('.tipsy'); + if ( ! tip ) + return; + + var bb = tip.getBoundingClientRect(), left = parseInt(tip.style.left || '0'), right = bb.left + tip.scrollWidth;