mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Add option to hide "Friends" section
This commit is contained in:
parent
d7ed9e1603
commit
938dfa6aaa
6
src/enums/ui-sections.ts
Normal file
6
src/enums/ui-sections.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export enum UiSection {
|
||||
NEWS = 'news',
|
||||
FRIENDS = 'friends',
|
||||
MOST_POPULAR = 'most-popular',
|
||||
ALL_GAMES = 'all-games',
|
||||
}
|
12
src/index.ts
12
src/index.ts
@ -33,6 +33,7 @@ import { NativeMkbHandler } from "./modules/mkb/native-mkb-handler";
|
||||
import { GuideMenu, GuideMenuTab } from "./modules/ui/guide-menu";
|
||||
import { StreamSettings } from "./modules/stream/stream-settings";
|
||||
import { updateVideoPlayer } from "./modules/stream/stream-settings-utils";
|
||||
import { UiSection } from "./enums/ui-sections";
|
||||
|
||||
|
||||
// Handle login page
|
||||
@ -100,8 +101,19 @@ window.addEventListener('load', e => {
|
||||
window.location.reload(true);
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
});
|
||||
|
||||
// Hide "Play with Friends" skeleton section
|
||||
if (getPref(PrefKey.UI_HIDE_SECTIONS).includes(UiSection.FRIENDS)) {
|
||||
document.addEventListener('readystatechange', e => {
|
||||
if (document.readyState === 'interactive') {
|
||||
const $parent = document.querySelector('div[class*=PlayWithFriendsSkeleton]')?.closest('div[class*=HomePage-module]') as HTMLElement;
|
||||
$parent && ($parent.style.display = 'none');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
window.BX_EXPOSED = BxExposed;
|
||||
|
||||
// Hide Settings UI when navigate to another page
|
||||
|
@ -13,6 +13,7 @@ import codeRemotePlayEnable from "./patches/remote-play-enable.js" with { type:
|
||||
import codeRemotePlayKeepAlive from "./patches/remote-play-keep-alive.js" with { type: "text" };
|
||||
import codeVibrationAdjust from "./patches/vibration-adjust.js" with { type: "text" };
|
||||
import { FeatureGates } from "@/utils/feature-gates.js";
|
||||
import { UiSection } from "@/enums/ui-sections.js";
|
||||
|
||||
type PatchArray = (keyof typeof PATCHES)[];
|
||||
|
||||
@ -744,7 +745,7 @@ let PATCH_ORDERS: PatchArray = [
|
||||
getPref(PrefKey.LOCAL_CO_OP_ENABLED) && 'supportLocalCoOp',
|
||||
getPref(PrefKey.GAME_FORTNITE_FORCE_CONSOLE) && 'forceFortniteConsole',
|
||||
|
||||
getPref(PrefKey.BLOCK_SOCIAL_FEATURES) && 'ignorePlayWithFriendsSection',
|
||||
getPref(PrefKey.UI_HIDE_SECTIONS).includes(UiSection.FRIENDS) && 'ignorePlayWithFriendsSection',
|
||||
|
||||
...(getPref(PrefKey.BLOCK_TRACKING) ? [
|
||||
'disableAiTrack',
|
||||
|
@ -96,6 +96,7 @@ const SETTINGS_UI = {
|
||||
PrefKey.HIDE_DOTS_ICON,
|
||||
PrefKey.REDUCE_ANIMATIONS,
|
||||
PrefKey.BLOCK_SOCIAL_FEATURES,
|
||||
PrefKey.UI_HIDE_SECTIONS,
|
||||
],
|
||||
},
|
||||
|
||||
|
@ -1,17 +1,25 @@
|
||||
import { CE } from "@utils/html";
|
||||
import { PrefKey, getPref } from "@utils/preferences";
|
||||
import { renderStylus } from "@macros/build" with {type: "macro"};
|
||||
import { UiSection } from "@/enums/ui-sections";
|
||||
|
||||
|
||||
export function addCss() {
|
||||
const STYLUS_CSS = renderStylus();
|
||||
let css = STYLUS_CSS;
|
||||
|
||||
// Hide "Play with Friends" section
|
||||
if (getPref(PrefKey.UI_HIDE_SECTIONS).includes(UiSection.FRIENDS)) {
|
||||
css += `
|
||||
div[class^=HomePage-module__bottomSpacing]:has(button[class*=SocialEmptyCard]),
|
||||
button[class*=SocialEmptyCard] {
|
||||
display: none;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
if (getPref(PrefKey.BLOCK_SOCIAL_FEATURES)) {
|
||||
css += `
|
||||
/* Hide "Play with friends" section */
|
||||
div[class^=HomePage-module__bottomSpacing]:has(button[class*=SocialEmptyCard]),
|
||||
button[class*=SocialEmptyCard],
|
||||
/* Hide "Start a party" button in the Guide menu */
|
||||
#gamepass-dialog-root div[class^=AchievementsPreview-module__container] + button[class*=HomeLandingPage-module__button]
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ import type { PreferenceSetting, PreferenceSettings } from "@/types/preferences"
|
||||
import { AppInterface, STATES } from "@utils/global";
|
||||
import { StreamPlayerType, StreamVideoProcessing } from "@enums/stream-player";
|
||||
import { UserAgentProfile } from "@/enums/user-agent";
|
||||
import { UiSection } from "@/enums/ui-sections";
|
||||
|
||||
export enum PrefKey {
|
||||
LAST_UPDATE_CHECK = 'version_last_check',
|
||||
@ -70,6 +71,7 @@ export enum PrefKey {
|
||||
|
||||
UI_LAYOUT = 'ui_layout',
|
||||
UI_SCROLLBAR_HIDE = 'ui_scrollbar_hide',
|
||||
UI_HIDE_SECTIONS = 'ui_hide_sections',
|
||||
|
||||
UI_HOME_CONTEXT_MENU_DISABLED = 'ui_home_context_menu_disabled',
|
||||
|
||||
@ -557,6 +559,20 @@ export class Preferences {
|
||||
default: STATES.browser.capabilities.touch,
|
||||
},
|
||||
|
||||
[PrefKey.UI_HIDE_SECTIONS]: {
|
||||
label: t('hide-sections'),
|
||||
default: [],
|
||||
multipleOptions: {
|
||||
[UiSection.NEWS]: t('section-news'),
|
||||
[UiSection.FRIENDS]: t('section-play-with-friends'),
|
||||
[UiSection.MOST_POPULAR]: t('section-most-popular'),
|
||||
[UiSection.ALL_GAMES]: t('section-all-games'),
|
||||
},
|
||||
params: {
|
||||
size: 4,
|
||||
},
|
||||
},
|
||||
|
||||
[PrefKey.BLOCK_SOCIAL_FEATURES]: {
|
||||
label: t('disable-social-features'),
|
||||
default: false,
|
||||
|
@ -110,6 +110,7 @@ const Texts = {
|
||||
"hide": "Hide",
|
||||
"hide-idle-cursor": "Hide mouse cursor on idle",
|
||||
"hide-scrollbar": "Hide web page's scrollbar",
|
||||
"hide-sections": "Hide sections",
|
||||
"hide-system-menu-icon": "Hide System menu's icon",
|
||||
"hide-touch-controller": "Hide touch controller",
|
||||
"horizontal-scroll-sensitivity": "Horizontal scroll sensitivity",
|
||||
@ -164,13 +165,13 @@ const Texts = {
|
||||
(e: any) => `${e.key} でこの機能を切替`,
|
||||
(e: any) => `${e.key} 키를 눌러 이 기능을 켜고 끄세요`,
|
||||
(e: any) => `Naciśnij ${e.key} aby przełączyć tę funkcję`,
|
||||
,
|
||||
(e: any) => `Pressione ${e.key} para alternar este recurso`,
|
||||
(e: any) => `Нажмите ${e.key} для переключения этой функции`,
|
||||
,
|
||||
(e: any) => `Etkinleştirmek için ${e.key} tuşuna basın`,
|
||||
(e: any) => `Натисніть ${e.key} щоб перемкнути цю функцію`,
|
||||
(e: any) => `Nhấn ${e.key} để bật/tắt tính năng này`,
|
||||
,
|
||||
(e: any) => `按下 ${e.key} 来切换此功能`,
|
||||
],
|
||||
"press-to-bind": "Press a key or do a mouse click to bind...",
|
||||
"prompt-preset-name": "Preset's name:",
|
||||
@ -191,6 +192,10 @@ const Texts = {
|
||||
"save": "Save",
|
||||
"screen": "Screen",
|
||||
"screenshot-apply-filters": "Applies video filters to screenshots",
|
||||
"section-all-games": "All games",
|
||||
"section-most-popular": "Most popular",
|
||||
"section-news": "News",
|
||||
"section-play-with-friends": "Play with friends",
|
||||
"separate-touch-controller": "Separate Touch controller & Controller #1",
|
||||
"separate-touch-controller-note": "Touch controller is Player 1, Controller #1 is Player 2",
|
||||
"server": "Server",
|
||||
|
Loading…
x
Reference in New Issue
Block a user