mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-19 04:20:54 +00:00
Add setting to hide the Latest Videos
section (#634)
This commit is contained in:
parent
39fb185ecf
commit
134d9dc0fd
1 changed files with 39 additions and 5 deletions
|
@ -59,12 +59,18 @@ export default class Directory extends SiteModule {
|
||||||
DIR_ROUTES
|
DIR_ROUTES
|
||||||
);
|
);
|
||||||
|
|
||||||
this.DirectoryVideos = this.fine.define(
|
this.DirectorySuggestedVideos = this.fine.define(
|
||||||
'directory-videos',
|
'directory-suggested-videos',
|
||||||
n => n.props && n.props.directoryWidth && n.props.data && n.render && n.render.toString().includes('SuggestedVideos'),
|
n => n.props && n.props.directoryWidth && n.props.data && n.render && n.render.toString().includes('SuggestedVideos'),
|
||||||
DIR_ROUTES
|
DIR_ROUTES
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.DirectoryLatestVideos = this.fine.define(
|
||||||
|
'directory-latest-videos',
|
||||||
|
n => n.props && n.props.component === 'LatestVideosFromFollowedCarousel',
|
||||||
|
DIR_ROUTES
|
||||||
|
);
|
||||||
|
|
||||||
this.settings.add('directory.uptime', {
|
this.settings.add('directory.uptime', {
|
||||||
default: 1,
|
default: 1,
|
||||||
|
|
||||||
|
@ -146,7 +152,18 @@ export default class Directory extends SiteModule {
|
||||||
component: 'setting-check-box'
|
component: 'setting-check-box'
|
||||||
},
|
},
|
||||||
|
|
||||||
changed: () => this.DirectoryVideos.forceUpdate()
|
changed: () => this.DirectorySuggestedVideos.forceUpdate()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.settings.add('directory.hide-latest-videos', {
|
||||||
|
default: false,
|
||||||
|
ui: {
|
||||||
|
path: 'Directory > Following >> Categories',
|
||||||
|
title: 'Do not show `Latest Videos` in the Following Directory.',
|
||||||
|
component: 'setting-check-box'
|
||||||
|
},
|
||||||
|
|
||||||
|
changed: () => this.DirectoryLatestVideos.forceUpdate()
|
||||||
});
|
});
|
||||||
|
|
||||||
this.routeClick = this.routeClick.bind(this);
|
this.routeClick = this.routeClick.bind(this);
|
||||||
|
@ -184,7 +201,7 @@ export default class Directory extends SiteModule {
|
||||||
this.DirectoryShelf.forceUpdate();
|
this.DirectoryShelf.forceUpdate();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.DirectoryVideos.ready(cls => {
|
this.DirectorySuggestedVideos.ready(cls => {
|
||||||
const old_render = cls.prototype.render;
|
const old_render = cls.prototype.render;
|
||||||
cls.prototype.render = function() {
|
cls.prototype.render = function() {
|
||||||
try {
|
try {
|
||||||
|
@ -198,7 +215,24 @@ export default class Directory extends SiteModule {
|
||||||
return old_render.call(this);
|
return old_render.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.DirectoryVideos.forceUpdate();
|
this.DirectorySuggestedVideos.forceUpdate();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.DirectoryLatestVideos.ready(cls => {
|
||||||
|
const old_render = cls.prototype.render;
|
||||||
|
cls.prototype.render = function() {
|
||||||
|
try {
|
||||||
|
if ( t.settings.get('directory.hide-latest-videos') )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
} catch(err) {
|
||||||
|
t.log.capture(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
return old_render.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.DirectoryLatestVideos.forceUpdate();
|
||||||
})
|
})
|
||||||
|
|
||||||
this.DirectoryCard.ready((cls, instances) => {
|
this.DirectoryCard.ready((cls, instances) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue