From 49bcfaebeda79b948c6451800baf13fb1fc5c090 Mon Sep 17 00:00:00 2001 From: SirStendec Date: Wed, 5 Dec 2018 14:51:03 -0500 Subject: [PATCH] 4.0.0-rc13.13 * Added: Setting to force the tags/metadata bar to the top of information pane beneath the player. * Fixed: Some users, somehow, have their emote menu sorting setting set to an invalid value, breaking the player when it tries to sort. Fall back to the default if there's no valid sorting setting. * Changed: Make the changelog properly handle commits with versions starting with a `v`. --- src/main.js | 2 +- src/modules/chat/actions/index.jsx | 1 + .../main_menu/components/changelog.vue | 2 +- ...channel_bar.js => channel_bar.js.disabled} | 0 ...{legacy_channel_bar.js => channel_bar.jsx} | 74 +++++++++++++++++-- .../modules/chat/emote_menu.jsx | 2 +- 6 files changed, 73 insertions(+), 8 deletions(-) rename src/sites/twitch-twilight/modules/{channel_bar.js => channel_bar.js.disabled} (100%) rename src/sites/twitch-twilight/modules/{legacy_channel_bar.js => channel_bar.jsx} (59%) diff --git a/src/main.js b/src/main.js index b065d656..df33e0fd 100644 --- a/src/main.js +++ b/src/main.js @@ -149,7 +149,7 @@ ${typeof x[1] === 'string' ? x[1] : JSON.stringify(x[1], null, 4)}` FrankerFaceZ.Logger = Logger; const VER = FrankerFaceZ.version_info = { - major: 4, minor: 0, revision: 0, extra: '-rc13.12.1', + major: 4, minor: 0, revision: 0, extra: '-rc13.13', commit: __git_commit__, build: __webpack_hash__, toString: () => diff --git a/src/modules/chat/actions/index.jsx b/src/modules/chat/actions/index.jsx index 5eb4d28d..5cf9d53a 100644 --- a/src/modules/chat/actions/index.jsx +++ b/src/modules/chat/actions/index.jsx @@ -37,6 +37,7 @@ export default class Actions extends Module { {v: {action: 'ban', appearance: {type: 'icon', icon: 'ffz-i-block'}, options: {}, display: {mod: true, mod_icons: true, deleted: false}}}, {v: {action: 'unban', appearance: {type: 'icon', icon: 'ffz-i-ok'}, options: {}, display: {mod: true, mod_icons: true, deleted: true}}}, {v: {action: 'timeout', appearance: {type: 'icon', icon: 'ffz-i-clock'}, display: {mod: true, mod_icons: true}}}, + {v: {action: 'msg_delete', appearance: {type: 'icon', icon: 'ffz-i-trash'}, options: {}, display: {mod: true, mod_icons: true}}} ], type: 'array_merge', diff --git a/src/modules/main_menu/components/changelog.vue b/src/modules/main_menu/components/changelog.vue index 17548e01..56d6b929 100644 --- a/src/modules/main_menu/components/changelog.vue +++ b/src/modules/main_menu/components/changelog.vue @@ -51,7 +51,7 @@ import {get} from 'utilities/object'; -const TITLE_MATCH = /^(\d+\.\d+\.\d+(?:-[^\n]+)?)\n+/; +const TITLE_MATCH = /^v?(\d+\.\d+\.\d+(?:-[^\n]+)?)\n+/; export default { diff --git a/src/sites/twitch-twilight/modules/channel_bar.js b/src/sites/twitch-twilight/modules/channel_bar.js.disabled similarity index 100% rename from src/sites/twitch-twilight/modules/channel_bar.js rename to src/sites/twitch-twilight/modules/channel_bar.js.disabled diff --git a/src/sites/twitch-twilight/modules/legacy_channel_bar.js b/src/sites/twitch-twilight/modules/channel_bar.jsx similarity index 59% rename from src/sites/twitch-twilight/modules/legacy_channel_bar.js rename to src/sites/twitch-twilight/modules/channel_bar.jsx index bf178d74..e62cc83c 100644 --- a/src/sites/twitch-twilight/modules/legacy_channel_bar.js +++ b/src/sites/twitch-twilight/modules/channel_bar.jsx @@ -10,13 +10,16 @@ import {get, deep_copy} from 'utilities/object'; import CHANNEL_QUERY from './channel_header_query.gql'; -export default class LegacyChannelBar extends Module { +export default class ChannelBar extends Module { constructor(...args) { super(...args); this.should_enable = true; + this.inject('settings'); + this.inject('site.css_tweaks'); this.inject('site.fine'); + this.inject('site.web_munch'); this.inject('site.apollo'); this.inject('metadata'); this.inject('socket'); @@ -31,28 +34,89 @@ export default class LegacyChannelBar extends Module { }, false); + this.settings.add('channel.metadata.force-above', { + default: false, + ui: { + path: 'Channel > Metadata >> Appearance', + title: 'Force metadata and tags to the top of the channel information bar.', + component: 'setting-check-box' + }, + changed: val => this.css_tweaks.toggle('channel-metadata-top', val) + }); + + this.ChannelBar = this.fine.define( - 'legacy-channel-bar', + 'channel-bar', n => n.getTitle && n.getGame && n.renderGame, ['user'] ); this.HostBar = this.fine.define( - 'legacy-host-container', + 'host-container', n => n.handleReportHosterClick, ['user'] ) } - onEnable() { + async onEnable() { + /*const t = this, + React = await this.web_munch.findModule('react'); + + if ( ! React ) + return; + + //const createElement = React.createElement;*/ + + this.css_tweaks.toggle('channel-metadata-top', this.settings.get('channel.metadata.force-above')); + this.ChannelBar.on('unmount', this.unmountChannelBar, this); this.ChannelBar.on('mount', this.updateChannelBar, this); this.ChannelBar.on('update', this.updateChannelBar, this); this.ChannelBar.ready((cls, instances) => { - for(const inst of instances) + /*const old_render = cls.prototype.render; + + cls.prototype.render = function() { + if ( this.props.channelIsHosting ) + return null; + + const title = this.getTitle(); + + return (
+
+
+
+
+ {this.renderGameBoxArt()} +
+
+
+
+ + {title} + +
+
+
+
+
+
+
); + }*/ + + for(const inst of instances) { + //inst.forceUpdate(); this.updateChannelBar(inst); + } }); diff --git a/src/sites/twitch-twilight/modules/chat/emote_menu.jsx b/src/sites/twitch-twilight/modules/chat/emote_menu.jsx index c295d77e..d5869bef 100644 --- a/src/sites/twitch-twilight/modules/chat/emote_menu.jsx +++ b/src/sites/twitch-twilight/modules/chat/emote_menu.jsx @@ -1158,7 +1158,7 @@ export default class EmoteMenu extends Module { getSorter() { // eslint-disable-line class-methods-use-this - return EMOTE_SORTERS[t.chat.context.get('chat.emote-menu.sort-emotes')]; + return EMOTE_SORTERS[t.chat.context.get('chat.emote-menu.sort-emotes')] || EMOTE_SORTERS[0] || (() => 0); } buildState(props, old_state) {