Add option to hide "All games" section

This commit is contained in:
redphx 2024-07-07 18:16:50 +07:00
parent 345d0f78dc
commit 975549b4e7
2 changed files with 26 additions and 2 deletions

View File

@ -705,7 +705,7 @@ true` + text;
return str;
},
// Don't render Play With Friends sections
// Don't render "Play With Friends" sections
ignorePlayWithFriendsSection(str: string) {
let index = str.indexOf('location:"PlayWithFriendsRow",');
if (index === -1) {
@ -719,7 +719,25 @@ true` + text;
str = str.substring(0, index) + 'return null;' + str.substring(index + 6);
return str;
},
// Don't render "All Games" sections
ignoreAllGamesSection(str: string) {
let index = str.indexOf('className:"AllGamesRow-module__allGamesRowContainer');
if (index === -1) {
return false;
}
index = str.indexOf('grid:!0,', index);
index > -1 && (index = str.indexOf('(0,', index - 70));
if (index === -1) {
return false;
}
str = str.substring(0, index) + 'true ? null :' + str.substring(index);
return str;
},
};
let PATCH_ORDERS: PatchArray = [
@ -746,6 +764,7 @@ let PATCH_ORDERS: PatchArray = [
getPref(PrefKey.GAME_FORTNITE_FORCE_CONSOLE) && 'forceFortniteConsole',
getPref(PrefKey.UI_HIDE_SECTIONS).includes(UiSection.FRIENDS) && 'ignorePlayWithFriendsSection',
getPref(PrefKey.UI_HIDE_SECTIONS).includes(UiSection.ALL_GAMES) && 'ignoreAllGamesSection',
...(getPref(PrefKey.BLOCK_TRACKING) ? [
'disableAiTrack',

View File

@ -16,6 +16,11 @@ export function addCss() {
selectorToHide.push('#BodyContent > div[class*=CarouselRow-module]');
}
// Hide "All games" section
if (PREF_HIDE_SECTIONS.includes(UiSection.ALL_GAMES)) {
selectorToHide.push('#BodyContent div[class*=AllGamesRow-module__gridContainer]');
}
// Hide "Start a party" button in the Guide menu
if (getPref(PrefKey.BLOCK_SOCIAL_FEATURES)) {
selectorToHide.push('#gamepass-dialog-root div[class^=AchievementsPreview-module__container] + button[class*=HomeLandingPage-module__button]');