Allow hiding "Recently added, "Leaving soon" and "Genres" sections (#658)

This commit is contained in:
redphx
2025-02-03 21:25:38 +07:00
parent fd665b6fcd
commit 7894dea5ff
9 changed files with 76 additions and 11 deletions

View File

@@ -796,6 +796,8 @@ true` + text;
const sections: PartialRecord<UiSection, GamePassCloudGallery> = {
[UiSection.NATIVE_MKB]: GamePassCloudGallery.NATIVE_MKB,
[UiSection.MOST_POPULAR]: GamePassCloudGallery.MOST_POPULAR,
[UiSection.LEAVING_SOON]: GamePassCloudGallery.LEAVING_SOON,
[UiSection.RECENTLY_ADDED]: GamePassCloudGallery.RECENTLY_ADDED,
};
for (const section of PREF_HIDE_SECTIONS) {
@@ -817,6 +819,17 @@ if (e && e.id) {
return str;
},
ignoreGenresSection(str: string) {
let index = str.indexOf('="GenresRow"');
index > -1 && (index = PatcherUtils.lastIndexOf(str, '{', index));
if (index < 0) {
return false;
}
str = PatcherUtils.insertAt(str, index + 1, 'return null;');
return str;
},
// Override Storage.getSettings()
overrideStorageGetSettings(str: string) {
let text = '}getSetting(e){';
@@ -1193,6 +1206,7 @@ let HOME_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([
hideSections.includes(UiSection.NEWS) && 'ignoreNewsSection',
hideSections.includes(UiSection.FRIENDS) && 'ignorePlayWithFriendsSection',
hideSections.includes(UiSection.ALL_GAMES) && 'ignoreAllGamesSection',
hideSections.includes(UiSection.GENRES) && 'ignoreGenresSection',
STATES.browser.capabilities.touch && hideSections.includes(UiSection.TOUCH) && 'ignorePlayWithTouchSection',
hideSections.some(value => [UiSection.NATIVE_MKB, UiSection.MOST_POPULAR].includes(value)) && 'ignoreSiglSections',