diff --git a/package.json b/package.json index 86e89c37..9a7cd21f 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.18.8", + "version": "4.19.0", "description": "FrankerFaceZ is a Twitch enhancement suite.", "license": "Apache-2.0", "scripts": { diff --git a/src/modules/main_menu/components/action-editor.vue b/src/modules/main_menu/components/action-editor.vue index 65e50878..8a8c7697 100644 --- a/src/modules/main_menu/components/action-editor.vue +++ b/src/modules/main_menu/components/action-editor.vue @@ -343,7 +343,7 @@ :key="key" :value="key" > - {{ a.title_i18n ? t(a.title_i18n, a.title, a) : a.title }} + {{ t(a.title_i18n || `chat.actions.${key}`, a.title, a) }} diff --git a/src/sites/twitch-twilight/modules/chat/index.js b/src/sites/twitch-twilight/modules/chat/index.js index 902504ef..a23cad01 100644 --- a/src/sites/twitch-twilight/modules/chat/index.js +++ b/src/sites/twitch-twilight/modules/chat/index.js @@ -265,6 +265,15 @@ export default class ChatHook extends Module { } }); + this.settings.add('chat.banners.hype-train', { + default: true, + ui: { + path: 'Chat > Appearance >> Community', + title: 'Allow the Hype Train to be displayed in chat.', + component: 'setting-check-box', + } + }); + this.settings.add('chat.community-chest.show', { default: true, ui: { @@ -635,6 +644,10 @@ export default class ChatHook extends Module { this.PointsClaimButton.forceUpdate(); }); + this.chat.context.on('changed:chat.banners.hype-train', this.cleanHighlights, this); + this.chat.context.on('changed:chat.subs.gift-banner', this.cleanHighlights, this); + this.chat.context.on('changed:chat.banners.polls', this.cleanHighlights, this); + this.chat.context.on('changed:chat.subs.gift-banner', () => this.GiftBanner.forceUpdate(), this); this.chat.context.on('changed:chat.width', this.updateChatCSS, this); this.settings.main_context.on('changed:chat.use-width', this.updateChatCSS, this); @@ -1029,6 +1042,32 @@ export default class ChatHook extends Module { } + cleanHighlights() { + const types = { + 'community_sub_gift': this.chat.context.get('chat.subs.gift-banner'), + 'megacheer': this.chat.context.get('chat.bits.show'), + 'hype_train': this.chat.context.get('chat.banners.hype-train'), + 'poll': this.chat.context.get('chat.banners.polls') + }; + + const highlights = this.community_stack?.highlights; + if ( ! Array.isArray(highlights) ) + return; + + for(const entry of highlights) { + if ( ! entry || ! entry.event || ! entry.id ) + continue; + + const type = entry.event.type; + if ( type && has(types, type) && ! types[type] ) + this.community_dispatch({ + type: 'remove-highlight', + id: entry.id + }); + } + } + + defineClasses() { if ( this.CommunityStackHandler ) return true; @@ -1048,6 +1087,8 @@ export default class ChatHook extends Module { t.community_stack = stack; t.community_dispatch = dispatch; + t.cleanHighlights(); + return null; }