From ff0f0ea074c192673f207ce3611c641f406444b9 Mon Sep 17 00:00:00 2001 From: SirStendec Date: Mon, 25 Nov 2019 17:50:20 -0500 Subject: [PATCH] 4.16.0 * Added: Show the FFZ menu button on new dashboard pages. * Fixed: Synchronize settings with the `dashboard.twitch.tv` subdomain. * Fixed: Performance issue with metadata tool-tips being calculated too frequently. * Fixed: Metadata not appearing in theater mode when portrait mode is enabled. * API Added: Chat Action types can now override rendering. --- package.json | 2 +- src/bridge.js | 15 ++- src/modules/chat/actions/index.jsx | 74 ++++++++++--- src/modules/metadata.jsx | 26 +++-- src/settings/providers.js | 2 + src/sites/twitch-twilight/index.js | 47 +++++++- .../styles/portrait-metadata-top.scss | 3 + .../css_tweaks/styles/portrait-metadata.scss | 3 + src/sites/twitch-twilight/modules/layout.js | 18 +++ .../twitch-twilight/modules/menu_button.jsx | 26 ++++- .../twitch-twilight/modules/settings_sync.js | 104 ++++++++++++++++++ src/sites/twitch-twilight/styles/chat.scss | 9 +- src/utilities/compat/fine-router.js | 28 ++++- src/utilities/dom.js | 2 +- 14 files changed, 317 insertions(+), 42 deletions(-) create mode 100644 src/sites/twitch-twilight/modules/css_tweaks/styles/portrait-metadata-top.scss create mode 100644 src/sites/twitch-twilight/modules/css_tweaks/styles/portrait-metadata.scss create mode 100644 src/sites/twitch-twilight/modules/settings_sync.js diff --git a/package.json b/package.json index 1afc7d73..a34b0334 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.15.5", + "version": "4.16.0", "description": "FrankerFaceZ is a Twitch enhancement suite.", "license": "Apache-2.0", "scripts": { diff --git a/src/bridge.js b/src/bridge.js index 19fd4f57..02a9fd6a 100644 --- a/src/bridge.js +++ b/src/bridge.js @@ -82,7 +82,9 @@ class FFZBridge extends Module { ffz_type: 'loaded', data: out }); - } + + } else if ( msg.ffz_type === 'change' ) + this.onChange(msg); } send(msg) { // eslint-disable-line class-methods-use-this @@ -91,6 +93,17 @@ class FFZBridge extends Module { } catch(err) { this.log.error('send error', err); /* no-op */ } } + onChange(msg) { + const key = msg.key, + value = msg.value, + deleted = msg.deleted; + + if ( deleted ) + this.settings.provider.delete(key); + else + this.settings.provider.set(key, value); + } + onProviderChange(key, value, deleted) { this.send({ ffz_type: 'change', diff --git a/src/modules/chat/actions/index.jsx b/src/modules/chat/actions/index.jsx index ee655ddc..b4a018e5 100644 --- a/src/modules/chat/actions/index.jsx +++ b/src/modules/chat/actions/index.jsx @@ -437,12 +437,11 @@ export default class Actions extends Module { if ( ! data || ! data.action || ! data.appearance ) continue; - const ap = data.appearance || {}, - disp = data.display || {}, + let ap = data.appearance || {}; + const disp = data.display || {}, + act = this.actions[data.action]; - def = this.renderers[ap.type]; - - if ( ! def || disp.disabled || + if ( ! act || disp.disabled || (disp.mod_icons != null && disp.mod_icons !== !!mod_icons) || (disp.mod != null && disp.mod !== (current_user ? !!current_user.mod : false)) || (disp.staff != null && disp.staff !== (current_user ? !!current_user.staff : false)) || @@ -453,12 +452,23 @@ export default class Actions extends Module { (disp.followersOnly != null && disp.followersOnly !== current_room.followersOnly) ) continue; + if ( act.override_appearance ) { + const out = act.override_appearance.call(this, Object.assign({}, ap), data, null, current_room, current_user, mod_icons); + if ( out ) + ap = out; + } + + const def = this.renderers[ap.type]; + if ( ! def ) + continue; + const has_color = def.colored && ap.color, + disabled = maybe_call(act.disabled, this, data, null, current_room, current_user, mod_icons) || false, color = has_color && (chat && chat.colors ? chat.colors.process(ap.color) : ap.color), contents = def.render.call(this, ap, createElement, color); actions.push(