Add "ignoreNewsSection" patch

This commit is contained in:
redphx 2024-12-11 17:21:20 +07:00
parent 1d8517a997
commit f8b8012f5c
2 changed files with 19 additions and 0 deletions

View File

@ -4525,6 +4525,11 @@ true` + text;
if (index = str.indexOf(`const ${funcName}=e=>{`), index > -1 && (index = str.indexOf("return ", index)), index > -1 && (index = str.indexOf("?", index)), index < 0) return !1; if (index = str.indexOf(`const ${funcName}=e=>{`), index > -1 && (index = str.indexOf("return ", index)), index > -1 && (index = str.indexOf("?", index)), index < 0) return !1;
return str = str.substring(0, index) + "|| true" + str.substring(index), str; return str = str.substring(0, index) + "|| true" + str.substring(index), str;
}, },
ignoreNewsSection(str) {
let index = str.indexOf('Logger("CarouselRow")');
if (index > -1 && (index = PatcherUtils.lastIndexOf(str, "const ", index, 200)), index < 0) return !1;
return str = PatcherUtils.insertAt(str, index, "return null;"), str;
},
ignorePlayWithFriendsSection(str) { ignorePlayWithFriendsSection(str) {
let index = str.indexOf('location:"PlayWithFriendsRow",'); let index = str.indexOf('location:"PlayWithFriendsRow",');
if (index < 0) return !1; if (index < 0) return !1;
@ -4705,6 +4710,7 @@ ${subsVar} = subs;
"changeNotificationsSubscription" "changeNotificationsSubscription"
] : [] ] : []
]), hideSections = getPref("ui.hideSections"), HOME_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([ ]), hideSections = getPref("ui.hideSections"), HOME_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([
hideSections.includes("news") && "ignoreNewsSection",
hideSections.includes("friends") && "ignorePlayWithFriendsSection", hideSections.includes("friends") && "ignorePlayWithFriendsSection",
hideSections.includes("all-games") && "ignoreAllGamesSection", hideSections.includes("all-games") && "ignoreAllGamesSection",
STATES.browser.capabilities.touch && hideSections.includes("touch") && "ignorePlayWithTouchSection", STATES.browser.capabilities.touch && hideSections.includes("touch") && "ignorePlayWithTouchSection",

View File

@ -694,6 +694,18 @@ true` + text;
return str; return str;
}, },
// Don't render News section
ignoreNewsSection(str: string) {
let index = str.indexOf('Logger("CarouselRow")');
index > -1 && (index = PatcherUtils.lastIndexOf(str, 'const ', index, 200));
if (index < 0) {
return false;
}
str = PatcherUtils.insertAt(str, index, 'return null;');
return str;
},
// Don't render "Play With Friends" sections // Don't render "Play With Friends" sections
ignorePlayWithFriendsSection(str: string) { ignorePlayWithFriendsSection(str: string) {
let index = str.indexOf('location:"PlayWithFriendsRow",'); let index = str.indexOf('location:"PlayWithFriendsRow",');
@ -1045,6 +1057,7 @@ let PATCH_ORDERS = PatcherUtils.filterPatches([
const hideSections = getPref<UiSection[]>(PrefKey.UI_HIDE_SECTIONS); const hideSections = getPref<UiSection[]>(PrefKey.UI_HIDE_SECTIONS);
let HOME_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([ let HOME_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([
hideSections.includes(UiSection.NEWS) && 'ignoreNewsSection',
hideSections.includes(UiSection.FRIENDS) && 'ignorePlayWithFriendsSection', hideSections.includes(UiSection.FRIENDS) && 'ignorePlayWithFriendsSection',
hideSections.includes(UiSection.ALL_GAMES) && 'ignoreAllGamesSection', hideSections.includes(UiSection.ALL_GAMES) && 'ignoreAllGamesSection',
STATES.browser.capabilities.touch && hideSections.includes(UiSection.TOUCH) && 'ignorePlayWithTouchSection', STATES.browser.capabilities.touch && hideSections.includes(UiSection.TOUCH) && 'ignorePlayWithTouchSection',