1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-16 01:56:55 +00:00

Added: Ability to hide re-runs in sidebar channel lists (#687)

This commit is contained in:
1bakedpotato 2019-10-23 17:49:01 -05:00 committed by Mike
parent 903b0b234c
commit 3e653c0381
2 changed files with 34 additions and 0 deletions

View file

@ -19,6 +19,7 @@ const CLASSES = {
'side-closed-friends': '.side-nav--collapsed .online-friends',
'side-closed-rec-channels': '.side-nav--collapsed .recommended-channels,.side-nav--collapsed .ffz--popular-channels',
'side-offline-channels': '.side-nav-card__link[href*="/videos/"],.side-nav-card[href*="/videos/"]',
'side-rerun-channels': '.side-nav .ffz--side-nav-card-rerun',
'prime-offers': '.top-nav__prime',
@ -133,6 +134,16 @@ export default class CSSTweaks extends Module {
changed: val => this.toggleHide('side-offline-channels', val)
});
this.settings.add('layout.side-nav.hide-reruns', {
default: false,
ui: {
path: 'Appearance > Layout >> Side Navigation',
title: 'Hide Reruns',
component: 'setting-check-box'
},
changed: val => this.toggleHide('side-rerun-channels', val)
});
this.settings.add('layout.swap-sidebars', {
default: false,
ui: {
@ -282,6 +293,7 @@ export default class CSSTweaks extends Module {
this.toggleHide('side-nav', !this.settings.get('layout.side-nav.show'));
this.toggleHide('side-rec-friends', !this.settings.get('layout.side-nav.show-rec-friends'));
this.toggleHide('side-offline-channels', this.settings.get('layout.side-nav.hide-offline'));
this.toggleHide('side-rerun-channels', this.settings.get('layout.side-nav.hide-reruns'));
this.toggleHide('prime-offers', !this.settings.get('layout.prime-offers'));
this.toggleHide('top-discover', !this.settings.get('layout.discover'));

View file

@ -35,6 +35,11 @@ export default class Layout extends Module {
n => n.getPopularChannels && n.props && has(n.props, 'locale')
);
this.SideBarChannels = this.fine.define(
'nav-cards',
t => t.getCardSlideInContent && t.props && has(t.props, 'tooltipContent')
);
this.settings.add('layout.portrait', {
default: false,
ui: {
@ -179,6 +184,14 @@ export default class Layout extends Module {
this.PopularChannels.on('mount', this.updatePopular, this);
this.PopularChannels.on('update', this.updatePopular, this);
this.SideBarChannels.ready((cls, instances) => {
for(const inst of instances)
this.updateCardClass(inst);
});
this.SideBarChannels.on('mount', this.updateCardClass, this);
this.SideBarChannels.on('update', this.updateCardClass, this);
const t = this;
this.RightColumn.ready((cls, instances) => {
cls.prototype.ffzHideOnBreakpoint = function() {
@ -229,6 +242,15 @@ export default class Layout extends Module {
return this.settings.get('layout.is-minimal')
}
updateCardClass(inst) {
const node = this.fine.getChildNode(inst);
if ( node )
node.classList.toggle('ffz--side-nav-card-rerun',
inst.props?.tooltipContent?.props?.streamType === 'rerun'
);
}
updateNavLinks() {
for(const inst of this.TopNav.instances)
try {