Allow hiding BYOG section

This commit is contained in:
redphx 2025-02-04 20:51:50 +07:00
parent 66b1f92f4c
commit d4f070f6bb
5 changed files with 28 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -762,6 +762,18 @@ true` + text;
return str; return str;
}, },
ignoreByogSection(str: string) {
let index = str.indexOf('"ByogRow-module__container');
index > -1 && (index = PatcherUtils.lastIndexOf(str, 'return', index, 100));
if (index < 0) {
return false;
}
str = PatcherUtils.insertAt(str, index, 'return null;');
return str;
},
// home-page.js // home-page.js
ignorePlayWithTouchSection(str: string) { ignorePlayWithTouchSection(str: string) {
let index = str.indexOf('("Play_With_Touch"),'); let index = str.indexOf('("Play_With_Touch"),');
@ -1207,6 +1219,8 @@ let HOME_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([
hideSections.includes(UiSection.FRIENDS) && 'ignorePlayWithFriendsSection', hideSections.includes(UiSection.FRIENDS) && 'ignorePlayWithFriendsSection',
hideSections.includes(UiSection.ALL_GAMES) && 'ignoreAllGamesSection', hideSections.includes(UiSection.ALL_GAMES) && 'ignoreAllGamesSection',
hideSections.includes(UiSection.GENRES) && 'ignoreGenresSection', hideSections.includes(UiSection.GENRES) && 'ignoreGenresSection',
!getGlobalPref(GlobalPref.BLOCK_FEATURES).includes(BlockFeature.BYOG) && hideSections.includes(UiSection.BOYG) && 'ignoreByogSection',
STATES.browser.capabilities.touch && hideSections.includes(UiSection.TOUCH) && 'ignorePlayWithTouchSection', STATES.browser.capabilities.touch && hideSections.includes(UiSection.TOUCH) && 'ignorePlayWithTouchSection',
hideSections.some(value => [UiSection.NATIVE_MKB, UiSection.MOST_POPULAR].includes(value)) && 'ignoreSiglSections', hideSections.some(value => [UiSection.NATIVE_MKB, UiSection.MOST_POPULAR].includes(value)) && 'ignoreSiglSections',

View File

@ -25,7 +25,7 @@ export function addCss() {
} }
// Hide BYOG section // Hide BYOG section
if (getGlobalPref(GlobalPref.BLOCK_FEATURES).includes(BlockFeature.BYOG)) { if (getGlobalPref(GlobalPref.BLOCK_FEATURES).includes(BlockFeature.BYOG) || getGlobalPref(GlobalPref.UI_HIDE_SECTIONS).includes(UiSection.BOYG)) {
selectorToHide.push('#BodyContent > div[class*=ByogRow-module__container___]'); selectorToHide.push('#BodyContent > div[class*=ByogRow-module__container___]');
} }

View File

@ -466,6 +466,7 @@ export class GlobalSettingsStorage extends BaseSettingsStorage<GlobalPref> {
[UiSection.NATIVE_MKB]: t('section-native-mkb'), [UiSection.NATIVE_MKB]: t('section-native-mkb'),
[UiSection.TOUCH]: t('section-touch'), [UiSection.TOUCH]: t('section-touch'),
[UiSection.MOST_POPULAR]: t('section-most-popular'), [UiSection.MOST_POPULAR]: t('section-most-popular'),
[UiSection.BOYG]: t('stream-your-own-game'),
[UiSection.RECENTLY_ADDED]: t('section-recently-added'), [UiSection.RECENTLY_ADDED]: t('section-recently-added'),
[UiSection.LEAVING_SOON]: t('section-leaving-soon'), [UiSection.LEAVING_SOON]: t('section-leaving-soon'),
[UiSection.GENRES]: t('section-genres'), [UiSection.GENRES]: t('section-genres'),