diff --git a/src/modules/chat/emotes.js b/src/modules/chat/emotes.js index dba70726..a5bb7c3b 100644 --- a/src/modules/chat/emotes.js +++ b/src/modules/chat/emotes.js @@ -56,6 +56,7 @@ export default class Emotes extends Module { super(...args); this.inject('socket'); + this.inject('settings'); this.twitch_inventory_sets = []; this.__twitch_emote_to_set = new Map; @@ -67,6 +68,16 @@ export default class Emotes extends Module { this.emote_sets = {}; this._set_refs = {}; this._set_timers = {}; + + this.settings.add('chat.fix-bad-emotes', { + default: true, + ui: { + path: 'Chat > Appearance >> Emotes', + title: 'Fix Bad Twitch Global Emotes', + description: 'Clean up the images for bad Twitch global emotes, removing white borders and solid backgrounds.', + component: 'setting-check-box' + } + }); } onEnable() { diff --git a/src/modules/chat/tokenizers.js b/src/modules/chat/tokenizers.js index 9c4c94b6..7cd3f156 100644 --- a/src/modules/chat/tokenizers.js +++ b/src/modules/chat/tokenizers.js @@ -716,7 +716,7 @@ export const TwitchEmotes = { let src, srcSet; const replacement = REPLACEMENTS[e_id]; - if ( replacement ) { + if ( replacement && this.context.get('chat.fix-bad-emotes') ) { src = `${REPLACEMENT_BASE}${replacement}`; srcSet = ''; diff --git a/src/sites/twitch-twilight/modules/chat/index.js b/src/sites/twitch-twilight/modules/chat/index.js index 32e29af5..3badb516 100644 --- a/src/sites/twitch-twilight/modules/chat/index.js +++ b/src/sites/twitch-twilight/modules/chat/index.js @@ -291,6 +291,7 @@ export default class ChatHook extends Module { this.chat.context.on('changed:chat.lines.borders', this.updateLineBorders, this); this.chat.context.on('changed:chat.filtering.highlight-mentions', this.updateMentionCSS, this); this.chat.context.on('changed:chat.filtering.highlight-tokens', this.updateMentionCSS, this); + this.chat.context.on('changed:chat.fix-bad-emotes', this.updateChatLines, this); this.chat.context.on('changed:chat.lines.alternate', val => { this.css_tweaks.toggle('chat-rows', val);