Update better-xcloud.user.js

This commit is contained in:
redphx 2024-05-19 10:44:35 +07:00
parent 88b63a5518
commit d5f02550c7

View File

@ -1190,6 +1190,22 @@ var Texts = {
"Vô hiệu hóa", "Vô hiệu hóa",
"禁用" "禁用"
], ],
"disable-home-context-menu": [
,
,
"Disable context menu in Home page",
,
,
,
,
,
,
,
,
,
,
"Tắt menu ngữ cảnh trên Trang chủ"
],
"disable-native-mkb": [ "disable-native-mkb": [
"Native Maus- & Tastaturunterstützung deaktivieren", "Native Maus- & Tastaturunterstützung deaktivieren",
"Matikan Mouse & Keyboard bawaan", "Matikan Mouse & Keyboard bawaan",
@ -1199,7 +1215,7 @@ var Texts = {
"Disabilita il supporto nativo per Mouse e Tastiera", "Disabilita il supporto nativo per Mouse e Tastiera",
"ネイティブ版マウス&キーボードの機能を無効化", "ネイティブ版マウス&キーボードの機能を無効化",
"마우스 및 키보드 공식지원 기능 비활성화", "마우스 및 키보드 공식지원 기능 비활성화",
, "Wyłącz funkcję natywnej obsługi myszki i klawiatury",
"Desabilitar recurso nativo do Mouse e Teclado", "Desabilitar recurso nativo do Mouse e Teclado",
, ,
"Yerleşik klavye ve fare özelliğini kapat", "Yerleşik klavye ve fare özelliğini kapat",
@ -2072,7 +2088,7 @@ var Texts = {
"Off", "Off",
"Apagado", "Apagado",
"Désactivé", "Désactivé",
, "Disattivato",
"オフ", "オフ",
"꺼짐", "꺼짐",
"Wyłączone", "Wyłączone",
@ -3070,19 +3086,19 @@ var Texts = {
"拉伸" "拉伸"
], ],
"stretch-note": [ "stretch-note": [
, "Nicht verwenden bei Spielen mit nativer Touch-Unterstützung",
, ,
"Don't use with native touch games", "Don't use with native touch games",
"No usar con juegos nativos táctiles", "No usar con juegos nativos táctiles",
"Ne pas utiliser avec les jeux tactiles natifs",
"Non usare nei giochi con supporto touch nativo",
,
"터치 공식지원 게임에는 사용하지 마세요",
"Nie używaj dla gier wspierających natywne funkcje dotykowe",
, ,
, ,
, ,
, "Не використовуйте в іграх з рідним сенсором",
,
,
,
,
,
"Không dùng với các game cảm ứng trực tiếp" "Không dùng với các game cảm ứng trực tiếp"
], ],
"support-better-xcloud": [ "support-better-xcloud": [
@ -4635,6 +4651,7 @@ var PrefKey;
PrefKey2["UI_LOADING_SCREEN_ROCKET"] = "ui_loading_screen_rocket"; PrefKey2["UI_LOADING_SCREEN_ROCKET"] = "ui_loading_screen_rocket";
PrefKey2["UI_LAYOUT"] = "ui_layout"; PrefKey2["UI_LAYOUT"] = "ui_layout";
PrefKey2["UI_SCROLLBAR_HIDE"] = "ui_scrollbar_hide"; PrefKey2["UI_SCROLLBAR_HIDE"] = "ui_scrollbar_hide";
PrefKey2["UI_HOME_CONTEXT_MENU_DISABLED"] = "ui_home_context_menu_disabled";
PrefKey2["VIDEO_CLARITY"] = "video_clarity"; PrefKey2["VIDEO_CLARITY"] = "video_clarity";
PrefKey2["VIDEO_RATIO"] = "video_ratio"; PrefKey2["VIDEO_RATIO"] = "video_ratio";
PrefKey2["VIDEO_BRIGHTNESS"] = "video_brightness"; PrefKey2["VIDEO_BRIGHTNESS"] = "video_brightness";
@ -4995,6 +5012,10 @@ class Preferences {
label: t("hide-scrollbar"), label: t("hide-scrollbar"),
default: false default: false
}, },
[PrefKey.UI_HOME_CONTEXT_MENU_DISABLED]: {
label: t("disable-home-context-menu"),
default: false
},
[PrefKey.BLOCK_SOCIAL_FEATURES]: { [PrefKey.BLOCK_SOCIAL_FEATURES]: {
label: t("disable-social-features"), label: t("disable-social-features"),
default: false default: false
@ -7671,6 +7692,23 @@ function interceptHttpRequests() {
if (url.endsWith("/configuration")) { if (url.endsWith("/configuration")) {
BxEvent.dispatch(window, BxEvent.STREAM_STARTING); BxEvent.dispatch(window, BxEvent.STREAM_STARTING);
} }
if (url.startsWith("https://emerald.xboxservices.com/xboxcomfd/experimentation")) {
try {
const response = await NATIVE_FETCH(request, init);
const json = await response.json();
const overrideTreatments = {};
if (getPref(PrefKey.UI_HOME_CONTEXT_MENU_DISABLED)) {
overrideTreatments["EnableHomeContextMenu"] = false;
}
for (const key in overrideTreatments) {
json.exp.treatments[key] = overrideTreatments[key];
}
response.json = () => Promise.resolve(json);
return response;
} catch (e) {
console.log(e);
}
}
if (STATES.hasTouchSupport && url.includes("catalog.gamepass.com/sigls/")) { if (STATES.hasTouchSupport && url.includes("catalog.gamepass.com/sigls/")) {
const response = await NATIVE_FETCH(request, init); const response = await NATIVE_FETCH(request, init);
const obj = await response.clone().json(); const obj = await response.clone().json();
@ -10772,6 +10810,7 @@ var SETTINGS_UI = {
[t("ui")]: { [t("ui")]: {
items: [ items: [
PrefKey.UI_LAYOUT, PrefKey.UI_LAYOUT,
PrefKey.UI_HOME_CONTEXT_MENU_DISABLED,
PrefKey.STREAM_SIMPLIFY_MENU, PrefKey.STREAM_SIMPLIFY_MENU,
PrefKey.SKIP_SPLASH_VIDEO, PrefKey.SKIP_SPLASH_VIDEO,
!AppInterface && PrefKey.UI_SCROLLBAR_HIDE, !AppInterface && PrefKey.UI_SCROLLBAR_HIDE,
@ -10903,6 +10942,13 @@ function overridePreloadState() {
BxLogger.error(LOG_TAG5, e); BxLogger.error(LOG_TAG5, e);
} }
} }
if (getPref(PrefKey.UI_HOME_CONTEXT_MENU_DISABLED)) {
try {
state.experiments.experimentationInfo.data.treatments.EnableHomeContextMenu = false;
} catch (e) {
BxLogger.error(LOG_TAG5, e);
}
}
_state = state; _state = state;
STATES.appContext = structuredClone(state.appContext); STATES.appContext = structuredClone(state.appContext);
} }