diff --git a/src/sites/twitch-twilight/modules/chat/viewer_card.jsx b/src/sites/twitch-twilight/modules/chat/viewer_card.jsx index 724da3fb..9c0b46e1 100644 --- a/src/sites/twitch-twilight/modules/chat/viewer_card.jsx +++ b/src/sites/twitch-twilight/modules/chat/viewer_card.jsx @@ -17,6 +17,23 @@ export default class ViewerCards extends Module { this.last_login = null; + this.settings.add('chat.viewer-cards.viewer-card-gift-subscribe-button', { + requires: ['channel.hide-all-sub-gifting'], + default: null, + process(ctx, val) { + if ( val != null ) + return val; + + return ctx.get('channel.hide-all-sub-gifting') + }, + ui: { + path: 'Chat > Viewer Cards >> Appearance', + title: 'Hide "Gift a Sub" button on viewer cards', + description: 'By default, this inherits its value from [Channel > Appearance > Hide all "Gift a Sub" button](~channel.appearance)', + component: 'setting-check-box' + }, + }); + this.settings.add('chat.viewer-cards.highlight-chat', { default: false, ui: { @@ -52,6 +69,9 @@ export default class ViewerCards extends Module { onEnable() { this.chat.context.on('changed:chat.viewer-cards.highlight-chat', this.refreshStyle, this); this.chat.context.on('changed:chat.viewer-cards.color', this.refreshStyle, this); + this.chat.context.getChanges('chat.viewer-cards.viewer-card-gift-subscribe-button', val => + this.css_tweaks.toggleHide('viewer-card-gift-subscribe-button', val) + ); this.on('..:update-colors', this.refreshStyle, this); this.ViewerCard.on('mount', this.updateCard, this); diff --git a/src/sites/twitch-twilight/modules/css_tweaks/index.js b/src/sites/twitch-twilight/modules/css_tweaks/index.js index 80bc8b3c..802f0f9c 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/index.js +++ b/src/sites/twitch-twilight/modules/css_tweaks/index.js @@ -46,7 +46,9 @@ const CLASSES = { 'not-live-bar': 'div[data-test-selector="non-live-video-banner-layout"]', 'channel-live-ind': '.channel-header__user .tw-channel-status-text-indicator,.channel-info-content .tw-halo__indicator', 'celebration': 'body .celebration__overlay', - 'mod-view': '.chat-input__buttons-container a[href*="/moderator"]' + 'mod-view': '.chat-input__buttons-container a[href*="/moderator"]', + + 'viewer-card-gift-subscribe-button': '.viewer-card button[data-test-selector="gift-subscribe-button"]' }; @@ -405,6 +407,16 @@ export default class CSSTweaks extends Module { changed: val => this.toggle('hide-unfollow-button', val) }); + this.settings.add('channel.hide-all-sub-gifting', { + default: false, + ui: { + path: 'Channel > Appearance >> General', + title: 'Hide all "Gift a Sub" button.', + component: 'setting-check-box' + }, + changed: val => this.toggle('hide-all-sub-gifting', val) + }); + this.settings.add('channel.hide-live-indicator', { requires: ['context.route.name'], process(ctx, val) { @@ -459,6 +471,7 @@ export default class CSSTweaks extends Module { this.toggleHide('prime-offers', !this.settings.get('layout.prime-offers')); this.toggleHide('top-discover', !this.settings.get('layout.discover')); this.toggle('hide-unfollow-button', this.settings.get('channel.hide-unfollow')); + this.toggle('hide-all-sub-gifting', this.settings.get('channel.hide-all-sub-gifting')); this.toggle('square-avatars', ! this.settings.get('channel.round-avatars')); //this.toggleHide('not-live-bar', this.settings.get('channel.hide-not-live-bar')); diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/hide-all-sub-gifting.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/hide-all-sub-gifting.scss new file mode 100644 index 00000000..6a991ad9 --- /dev/null +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/hide-all-sub-gifting.scss @@ -0,0 +1,4 @@ +.support-panel > div:not(.scrollable-area) button:not(.tw-interactable):not(.tw-purchase-button), +button[data-test-selector="gift-subscribe-button"] { + display: none !important; +} \ No newline at end of file