mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-03 06:07:19 +02:00
Linting
This commit is contained in:
parent
557a38214d
commit
4011eb402a
20
dist/better-xcloud.lite.user.js
vendored
20
dist/better-xcloud.lite.user.js
vendored
@ -38,7 +38,7 @@ try {
|
||||
if (!BX_FLAGS.DeviceInfo.userAgent) BX_FLAGS.DeviceInfo.userAgent = window.navigator.userAgent;
|
||||
BxLogger.info("BxFlags", BX_FLAGS);
|
||||
var NATIVE_FETCH = window.fetch;
|
||||
var SMART_TV_UNIQUE_ID = "FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA", CHROMIUM_VERSION = "123.0.0.0";
|
||||
var SMART_TV_UNIQUE_ID = "FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA", CHROMIUM_VERSION = "125.0.0.0";
|
||||
if (!!window.chrome || window.navigator.userAgent.includes("Chrome")) {
|
||||
let match = window.navigator.userAgent.match(/\s(?:Chrome|Edg)\/([\d\.]+)/);
|
||||
if (match) CHROMIUM_VERSION = match[1];
|
||||
@ -2515,6 +2515,7 @@ class ControllerSettingsTable extends BaseLocalTable {
|
||||
async getControllersData() {
|
||||
let all = await this.getAll(), results = {};
|
||||
for (let key in all) {
|
||||
if (!all[key]) continue;
|
||||
let settings = all[key].data;
|
||||
settings.vibrationIntensity /= 100, results[key] = settings;
|
||||
}
|
||||
@ -3085,8 +3086,14 @@ class EmulatedMkbHandler extends MkbHandler {
|
||||
else this.mouseDataProvider = new PointerLockMouseDataProvider(this);
|
||||
if (this.mouseDataProvider.init(), window.addEventListener("keydown", this.onKeyboardEvent), window.addEventListener("keyup", this.onKeyboardEvent), window.addEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this.onPollingModeChanged), window.addEventListener(BxEvent.XCLOUD_DIALOG_SHOWN, this.onDialogShown), AppInterface) window.addEventListener(BxEvent.POINTER_LOCK_REQUESTED, this), window.addEventListener(BxEvent.POINTER_LOCK_EXITED, this);
|
||||
else document.addEventListener("pointerlockchange", this.onPointerLockChange), document.addEventListener("pointerlockerror", this.onPointerLockError);
|
||||
if (MkbPopup.getInstance().reset(), AppInterface) Toast.show(t("press-key-to-toggle-mkb", { key: "<b>F8</b>" }), t("virtual-controller"), { html: !0 }), this.waitForMouseData(!1);
|
||||
else this.waitForMouseData(!0);
|
||||
if (MkbPopup.getInstance().reset(), AppInterface) {
|
||||
let shortcutKey = StreamSettings.findKeyboardShortcut("mkb.toggle");
|
||||
if (shortcutKey) {
|
||||
let msg = t("press-key-to-toggle-mkb", { key: `<b>${KeyHelper.codeToKeyName(shortcutKey)}</b>` });
|
||||
Toast.show(msg, t("native-mkb"), { html: !0 });
|
||||
}
|
||||
this.waitForMouseData(!1);
|
||||
} else this.waitForMouseData(!0);
|
||||
}
|
||||
destroy() {
|
||||
if (!this.initialized) return;
|
||||
@ -3295,7 +3302,7 @@ class NavigationDialogManager {
|
||||
if (this.gamepadLastStates[gamepad.index] = null, lastKeyPressed) return;
|
||||
if (this.updateActiveInput("gamepad"), this.handleGamepad(gamepad, releasedButton)) return;
|
||||
if (releasedButton === 0) {
|
||||
document.activeElement && document.activeElement.dispatchEvent(new MouseEvent("click", { bubbles: !0 }));
|
||||
document.activeElement?.dispatchEvent(new MouseEvent("click", { bubbles: !0 }));
|
||||
return;
|
||||
} else if (releasedButton === 1) {
|
||||
this.hide();
|
||||
@ -3560,6 +3567,7 @@ class BxSelectElement extends HTMLSelectElement {
|
||||
$btnPrev.classList.toggle("bx-inactive", disableButtons), $btnNext.classList.toggle("bx-inactive", disableButtons);
|
||||
for (let i = 0;i < optionsList.length; i++) {
|
||||
let $option2 = optionsList[i], $indicator = indicatorsList[i];
|
||||
if (!$option2 || !$indicator) continue;
|
||||
if (clearDataSet($indicator), $option2.selected) $indicator.dataset.selected = "true";
|
||||
if ($option2.index === visibleIndex) $indicator.dataset.highlighted = "true";
|
||||
}
|
||||
@ -5489,7 +5497,7 @@ class XcloudInterceptor {
|
||||
let PREF_STREAM_TARGET_RESOLUTION = getPref("stream.video.resolution"), PREF_STREAM_PREFERRED_LOCALE = getPref("stream.locale"), url = typeof request === "string" ? request : request.url, parsedUrl = new URL(url), badgeRegion = parsedUrl.host.split(".", 1)[0];
|
||||
for (let regionName in STATES.serverRegions) {
|
||||
let region = STATES.serverRegions[regionName];
|
||||
if (parsedUrl.origin == region.baseUri) {
|
||||
if (region && parsedUrl.origin === region.baseUri) {
|
||||
badgeRegion = regionName;
|
||||
break;
|
||||
}
|
||||
@ -6307,7 +6315,7 @@ class XboxApi {
|
||||
let url = `https://displaycatalog.mp.microsoft.com/v7.0/products/lookup?market=US&languages=en&value=${xboxTitleId}&alternateId=XboxTitleId&fieldsTemplate=browse`, productTitle = (await (await NATIVE_FETCH(url)).json()).Products[0].LocalizedProperties[0].ProductTitle;
|
||||
return XboxApi.CACHED_TITLES[xboxTitleId] = productTitle, productTitle;
|
||||
} catch (e) {}
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
class RootDialogObserver {
|
||||
|
34
dist/better-xcloud.user.js
vendored
34
dist/better-xcloud.user.js
vendored
@ -40,7 +40,7 @@ try {
|
||||
if (!BX_FLAGS.DeviceInfo.userAgent) BX_FLAGS.DeviceInfo.userAgent = window.navigator.userAgent;
|
||||
BxLogger.info("BxFlags", BX_FLAGS);
|
||||
var NATIVE_FETCH = window.fetch;
|
||||
var SMART_TV_UNIQUE_ID = "FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA", CHROMIUM_VERSION = "123.0.0.0";
|
||||
var SMART_TV_UNIQUE_ID = "FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA", CHROMIUM_VERSION = "125.0.0.0";
|
||||
if (!!window.chrome || window.navigator.userAgent.includes("Chrome")) {
|
||||
let match = window.navigator.userAgent.match(/\s(?:Chrome|Edg)\/([\d\.]+)/);
|
||||
if (match) CHROMIUM_VERSION = match[1];
|
||||
@ -2624,6 +2624,7 @@ class ControllerSettingsTable extends BaseLocalTable {
|
||||
async getControllersData() {
|
||||
let all = await this.getAll(), results = {};
|
||||
for (let key in all) {
|
||||
if (!all[key]) continue;
|
||||
let settings = all[key].data;
|
||||
settings.vibrationIntensity /= 100, results[key] = settings;
|
||||
}
|
||||
@ -3200,8 +3201,14 @@ class EmulatedMkbHandler extends MkbHandler {
|
||||
else this.mouseDataProvider = new PointerLockMouseDataProvider(this);
|
||||
if (this.mouseDataProvider.init(), window.addEventListener("keydown", this.onKeyboardEvent), window.addEventListener("keyup", this.onKeyboardEvent), window.addEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this.onPollingModeChanged), window.addEventListener(BxEvent.XCLOUD_DIALOG_SHOWN, this.onDialogShown), AppInterface) window.addEventListener(BxEvent.POINTER_LOCK_REQUESTED, this), window.addEventListener(BxEvent.POINTER_LOCK_EXITED, this);
|
||||
else document.addEventListener("pointerlockchange", this.onPointerLockChange), document.addEventListener("pointerlockerror", this.onPointerLockError);
|
||||
if (MkbPopup.getInstance().reset(), AppInterface) Toast.show(t("press-key-to-toggle-mkb", { key: "<b>F8</b>" }), t("virtual-controller"), { html: !0 }), this.waitForMouseData(!1);
|
||||
else this.waitForMouseData(!0);
|
||||
if (MkbPopup.getInstance().reset(), AppInterface) {
|
||||
let shortcutKey = StreamSettings.findKeyboardShortcut("mkb.toggle");
|
||||
if (shortcutKey) {
|
||||
let msg = t("press-key-to-toggle-mkb", { key: `<b>${KeyHelper.codeToKeyName(shortcutKey)}</b>` });
|
||||
Toast.show(msg, t("native-mkb"), { html: !0 });
|
||||
}
|
||||
this.waitForMouseData(!1);
|
||||
} else this.waitForMouseData(!0);
|
||||
}
|
||||
destroy() {
|
||||
if (!this.initialized) return;
|
||||
@ -3418,7 +3425,7 @@ class NavigationDialogManager {
|
||||
if (this.gamepadLastStates[gamepad.index] = null, lastKeyPressed) return;
|
||||
if (this.updateActiveInput("gamepad"), this.handleGamepad(gamepad, releasedButton)) return;
|
||||
if (releasedButton === 0) {
|
||||
document.activeElement && document.activeElement.dispatchEvent(new MouseEvent("click", { bubbles: !0 }));
|
||||
document.activeElement?.dispatchEvent(new MouseEvent("click", { bubbles: !0 }));
|
||||
return;
|
||||
} else if (releasedButton === 1) {
|
||||
this.hide();
|
||||
@ -3869,6 +3876,7 @@ class BxSelectElement extends HTMLSelectElement {
|
||||
$btnPrev.classList.toggle("bx-inactive", disableButtons), $btnNext.classList.toggle("bx-inactive", disableButtons);
|
||||
for (let i = 0;i < optionsList.length; i++) {
|
||||
let $option2 = optionsList[i], $indicator = indicatorsList[i];
|
||||
if (!$option2 || !$indicator) continue;
|
||||
if (clearDataSet($indicator), $option2.selected) $indicator.dataset.selected = "true";
|
||||
if ($option2.index === visibleIndex) $indicator.dataset.highlighted = "true";
|
||||
}
|
||||
@ -4031,7 +4039,7 @@ window.dispatchEvent(new GamepadEvent('gamepadconnected', { gamepad }));
|
||||
}
|
||||
};
|
||||
window.BX_EXPOSED.toggleLocalCoOp = this.toggleLocalCoOp.bind(this);`;
|
||||
var set_currently_focused_interactable_default = `e && BxEvent.dispatch(window, BxEvent.NAVIGATION_FOCUS_CHANGED, {element: e});`;
|
||||
var set_currently_focused_interactable_default = `e && BxEvent.dispatch(window, BxEvent.NAVIGATION_FOCUS_CHANGED, { element: e });`;
|
||||
var remote_play_enable_default = `connectMode: window.BX_REMOTE_PLAY_CONFIG ? "xhome-connect" : "cloud-connect",
|
||||
remotePlayServerId: (window.BX_REMOTE_PLAY_CONFIG && window.BX_REMOTE_PLAY_CONFIG.serverId) || '',`;
|
||||
var remote_play_keep_alive_default = `const msg = JSON.parse(e);
|
||||
@ -4329,7 +4337,9 @@ BxEvent.dispatch(window, BxEvent.XCLOUD_POLLING_MODE_CHANGED);
|
||||
patchXcloudTitleInfo(str) {
|
||||
let text = "async cloudConnect", index = str.indexOf(text);
|
||||
if (index < 0) return !1;
|
||||
let backetIndex = str.indexOf("{", index), titleInfoVar = str.substring(index, backetIndex).match(/\(([^)]+)\)/)[1].split(",")[0], newCode = `
|
||||
let backetIndex = str.indexOf("{", index), params = str.substring(index, backetIndex).match(/\(([^)]+)\)/)[1];
|
||||
if (!params) return !1;
|
||||
let titleInfoVar = params.split(",")[0], newCode = `
|
||||
${titleInfoVar} = window.BX_EXPOSED.modifyTitleInfo(${titleInfoVar});
|
||||
BxLogger.info('patchXcloudTitleInfo', ${titleInfoVar});
|
||||
`;
|
||||
@ -4338,7 +4348,9 @@ BxLogger.info('patchXcloudTitleInfo', ${titleInfoVar});
|
||||
patchRemotePlayMkb(str) {
|
||||
let text = "async homeConsoleConnect", index = str.indexOf(text);
|
||||
if (index < 0) return !1;
|
||||
let backetIndex = str.indexOf("{", index), configsVar = str.substring(index, backetIndex).match(/\(([^)]+)\)/)[1].split(",")[1], newCode = `
|
||||
let backetIndex = str.indexOf("{", index), params = str.substring(index, backetIndex).match(/\(([^)]+)\)/)[1];
|
||||
if (!params) return !1;
|
||||
let configsVar = params.split(",")[1], newCode = `
|
||||
Object.assign(${configsVar}.inputConfiguration, {
|
||||
enableMouseInput: false,
|
||||
enableKeyboardInput: false,
|
||||
@ -7317,7 +7329,7 @@ class XhomeInterceptor {
|
||||
XhomeInterceptor.consoleAddrs = {};
|
||||
for (let pair of pairs) {
|
||||
let [keyAddr, keyPort] = pair;
|
||||
if (serverDetails[keyAddr]) {
|
||||
if (keyAddr && keyPort && serverDetails[keyAddr]) {
|
||||
let port = serverDetails[keyPort], ports = new Set;
|
||||
port && ports.add(port), ports.add(9002), XhomeInterceptor.consoleAddrs[serverDetails[keyAddr]] = Array.from(ports);
|
||||
}
|
||||
@ -7836,7 +7848,7 @@ class XcloudInterceptor {
|
||||
let PREF_STREAM_TARGET_RESOLUTION = getPref("stream.video.resolution"), PREF_STREAM_PREFERRED_LOCALE = getPref("stream.locale"), url = typeof request === "string" ? request : request.url, parsedUrl = new URL(url), badgeRegion = parsedUrl.host.split(".", 1)[0];
|
||||
for (let regionName in STATES.serverRegions) {
|
||||
let region = STATES.serverRegions[regionName];
|
||||
if (parsedUrl.origin == region.baseUri) {
|
||||
if (region && parsedUrl.origin === region.baseUri) {
|
||||
badgeRegion = regionName;
|
||||
break;
|
||||
}
|
||||
@ -8814,7 +8826,7 @@ class XcloudApi {
|
||||
async getTitleInfo(id) {
|
||||
if (id in this.CACHE_TITLES) return this.CACHE_TITLES[id];
|
||||
let baseUri = STATES.selectedRegion.baseUri;
|
||||
if (!baseUri || !STATES.gsToken) return null;
|
||||
if (!baseUri || !STATES.gsToken) return;
|
||||
let json;
|
||||
try {
|
||||
json = (await (await NATIVE_FETCH(`${baseUri}/v2/titles`, {
|
||||
@ -9048,7 +9060,7 @@ class XboxApi {
|
||||
let url = `https://displaycatalog.mp.microsoft.com/v7.0/products/lookup?market=US&languages=en&value=${xboxTitleId}&alternateId=XboxTitleId&fieldsTemplate=browse`, productTitle = (await (await NATIVE_FETCH(url)).json()).Products[0].LocalizedProperties[0].ProductTitle;
|
||||
return XboxApi.CACHED_TITLES[xboxTitleId] = productTitle, productTitle;
|
||||
} catch (e) {}
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
class RootDialogObserver {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { compressCss, isFullVersion } from "@macros/build" with {type: "macro"};
|
||||
import { compressCss, isFullVersion } from "@macros/build" with { type: "macro" };
|
||||
|
||||
import "@utils/global";
|
||||
import { BxEvent } from "@utils/bx-event";
|
||||
@ -199,7 +199,7 @@ window.addEventListener(BxEvent.XCLOUD_SERVERS_UNAVAILABLE, e => {
|
||||
if ($unsupportedPage) {
|
||||
SettingsDialog.getInstance().show();
|
||||
}
|
||||
}, {once: true});
|
||||
}, { once: true });
|
||||
|
||||
window.addEventListener(BxEvent.XCLOUD_SERVERS_READY, e => {
|
||||
STATES.isSignedIn = true;
|
||||
|
@ -3,8 +3,8 @@ import { ShortcutHandler } from "@/utils/shortcut-handler";
|
||||
|
||||
|
||||
export class ControllerShortcut {
|
||||
private static buttonsCache: {[key: string]: boolean[]} = {};
|
||||
private static buttonsStatus: {[key: string]: boolean[]} = {};
|
||||
private static buttonsCache: { [key: string]: boolean[] } = {};
|
||||
private static buttonsStatus: { [key: string]: boolean[] } = {};
|
||||
|
||||
static reset(index: number) {
|
||||
ControllerShortcut.buttonsCache[index] = [];
|
||||
|
@ -47,8 +47,8 @@ export class GameBar {
|
||||
|
||||
const position = getPref<GameBarPosition>(PrefKey.GAME_BAR_POSITION);
|
||||
|
||||
const $gameBar = CE('div', {id: 'bx-game-bar', class: 'bx-gone', 'data-position': position},
|
||||
$container = CE('div', {class: 'bx-game-bar-container bx-offscreen'}),
|
||||
const $gameBar = CE('div', { id: 'bx-game-bar', class: 'bx-gone', 'data-position': position },
|
||||
$container = CE('div', { class: 'bx-game-bar-container bx-offscreen' }),
|
||||
createSvgIcon(position === 'bottom-left' ? BxIcon.CARET_RIGHT : BxIcon.CARET_LEFT),
|
||||
);
|
||||
|
||||
|
@ -4,7 +4,7 @@ import { t } from "@utils/translation";
|
||||
import { STATES } from "@utils/global";
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { getPref } from "@/utils/settings-storages/global-settings-storage";
|
||||
import { compressCss } from "@macros/build" with {type: "macro"};
|
||||
import { compressCss } from "@macros/build" with { type: "macro" };
|
||||
import { LoadingScreenRocket } from "@/enums/pref-values";
|
||||
|
||||
export class LoadingScreen {
|
||||
|
@ -95,7 +95,7 @@ export class KeyHelper {
|
||||
const tmp = str.split(':');
|
||||
|
||||
const code = tmp[0] as KeyEventInfo['code'];
|
||||
const modifiers = parseInt(tmp[1]);
|
||||
const modifiers = parseInt(tmp[1] as string);
|
||||
|
||||
return {
|
||||
code,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { isFullVersion } from "@macros/build" with {type: "macro"};
|
||||
import { isFullVersion } from "@macros/build" with { type: "macro" };
|
||||
|
||||
import { MkbPresetKey, MouseConstant, MouseMapTo, WheelCode } from "@/enums/mkb";
|
||||
import { BxEvent } from "@utils/bx-event";
|
||||
@ -16,6 +16,8 @@ import { getPref } from "@/utils/settings-storages/global-settings-storage";
|
||||
import { GamepadKey, GamepadStick } from "@/enums/gamepad";
|
||||
import { MkbPopup } from "./mkb-popup";
|
||||
import type { MkbConvertedPresetData } from "@/types/presets";
|
||||
import { StreamSettings } from "@/utils/stream-settings";
|
||||
import { ShortcutAction } from "@/enums/shortcut-actions";
|
||||
|
||||
const PointerToMouseButton = {
|
||||
1: 0,
|
||||
@ -168,7 +170,7 @@ export class EmulatedMkbHandler extends MkbHandler {
|
||||
|
||||
private popup: MkbPopup;
|
||||
|
||||
private STICK_MAP: {[key in GamepadKey]?: [GamepadKey[], number, number]} = {
|
||||
private STICK_MAP: { [key in GamepadKey]?: [GamepadKey[], number, number] } = {
|
||||
[GamepadKey.LS_LEFT]: [this.LEFT_STICK_X, 0, -1],
|
||||
[GamepadKey.LS_RIGHT]: [this.LEFT_STICK_X, 0, 1],
|
||||
[GamepadKey.LS_UP]: [this.LEFT_STICK_Y, 1, -1],
|
||||
@ -529,7 +531,12 @@ export class EmulatedMkbHandler extends MkbHandler {
|
||||
MkbPopup.getInstance().reset();
|
||||
|
||||
if (AppInterface) {
|
||||
Toast.show(t('press-key-to-toggle-mkb', {key: `<b>F8</b>`}), t('virtual-controller'), {html: true});
|
||||
const shortcutKey = StreamSettings.findKeyboardShortcut(ShortcutAction.MKB_TOGGLE);
|
||||
if (shortcutKey) {
|
||||
const msg = t('press-key-to-toggle-mkb', { key: `<b>${KeyHelper.codeToKeyName(shortcutKey)}</b>` });
|
||||
Toast.show(msg, t('native-mkb'), { html: true });
|
||||
}
|
||||
|
||||
this.waitForMouseData(false);
|
||||
} else {
|
||||
this.waitForMouseData(true);
|
||||
@ -627,7 +634,7 @@ export class EmulatedMkbHandler extends MkbHandler {
|
||||
this.waitForMouseData(true);
|
||||
this.mouseDataProvider?.stop();
|
||||
|
||||
// Toast.show(t('virtual-controller'), t('disabled'), {instant: true});
|
||||
// Toast.show(t('virtual-controller'), t('disabled'), { instant: true });
|
||||
}
|
||||
|
||||
static setupEvents() {
|
||||
|
@ -182,7 +182,7 @@ export class NativeMkbHandler extends MkbHandler {
|
||||
window.BX_EXPOSED.stopTakRendering = true;
|
||||
this.waitForMouseData(false);
|
||||
|
||||
Toast.show(t('native-mkb'), t('enabled'), {instant: true});
|
||||
Toast.show(t('native-mkb'), t('enabled'), { instant: true });
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
@ -480,6 +480,10 @@ BxEvent.dispatch(window, BxEvent.XCLOUD_POLLING_MODE_CHANGED);
|
||||
|
||||
// Get param name
|
||||
const params = str.substring(index, backetIndex).match(/\(([^)]+)\)/)![1];
|
||||
if (!params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const titleInfoVar = params.split(',')[0];
|
||||
|
||||
const newCode = `
|
||||
@ -502,6 +506,10 @@ BxLogger.info('patchXcloudTitleInfo', ${titleInfoVar});
|
||||
|
||||
// Get param name
|
||||
const params = str.substring(index, backetIndex).match(/\(([^)]+)\)/)![1];
|
||||
if (!params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const configsVar = params.split(',')[1];
|
||||
|
||||
const newCode = `
|
||||
|
@ -1 +1 @@
|
||||
e && BxEvent.dispatch(window, BxEvent.NAVIGATION_FOCUS_CHANGED, {element: e});
|
||||
e && BxEvent.dispatch(window, BxEvent.NAVIGATION_FOCUS_CHANGED, { element: e });
|
||||
|
@ -204,7 +204,7 @@ export class RemotePlayManager {
|
||||
}
|
||||
|
||||
if (this.consoles.length === 0) {
|
||||
Toast.show(t('no-consoles-found'), '', {instant: true});
|
||||
Toast.show(t('no-consoles-found'), '', { instant: true });
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ export class MicrophoneShortcut {
|
||||
|
||||
try {
|
||||
window.BX_EXPOSED.streamSession.tryEnableChatAsync(enableMic);
|
||||
showToast && Toast.show(t('microphone'), t(enableMic ? 'unmuted': 'muted'), {instant: true});
|
||||
showToast && Toast.show(t('microphone'), t(enableMic ? 'unmuted': 'muted'), { instant: true });
|
||||
|
||||
return enableMic;
|
||||
} catch (e) {
|
||||
|
@ -37,7 +37,7 @@ export class SoundShortcut {
|
||||
SoundShortcut.setGainNodeVolume(newValue);
|
||||
|
||||
// Show toast
|
||||
Toast.show(`${t('stream')} ❯ ${t('volume')}`, newValue + '%', {instant: true});
|
||||
Toast.show(`${t('stream')} ❯ ${t('volume')}`, newValue + '%', { instant: true });
|
||||
|
||||
return newValue;
|
||||
}
|
||||
@ -69,7 +69,7 @@ export class SoundShortcut {
|
||||
}
|
||||
|
||||
SoundShortcut.setGainNodeVolume(targetValue);
|
||||
Toast.show(`${t('stream')} ❯ ${t('volume')}`, status, {instant: true});
|
||||
Toast.show(`${t('stream')} ❯ ${t('volume')}`, status, { instant: true });
|
||||
|
||||
BxEvent.dispatch(window, BxEvent.SPEAKER_STATE_CHANGED, {
|
||||
speakerState: targetValue === 0 ? SpeakerState.MUTED : SpeakerState.ENABLED,
|
||||
@ -82,7 +82,7 @@ export class SoundShortcut {
|
||||
$media.muted = !$media.muted;
|
||||
|
||||
const status = $media.muted ? t('muted') : t('unmuted');
|
||||
Toast.show(`${t('stream')} ❯ ${t('volume')}`, status, {instant: true});
|
||||
Toast.show(`${t('stream')} ❯ ${t('volume')}`, status, { instant: true });
|
||||
|
||||
BxEvent.dispatch(window, BxEvent.SPEAKER_STATE_CHANGED, {
|
||||
speakerState: $media.muted ? SpeakerState.MUTED : SpeakerState.ENABLED,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { isFullVersion } from "@macros/build" with {type: "macro"};
|
||||
import { isFullVersion } from "@macros/build" with { type: "macro" };
|
||||
|
||||
import { CE } from "@/utils/html";
|
||||
import { WebGL2Player } from "./player/webgl2-player";
|
||||
@ -52,7 +52,7 @@ export class StreamPlayer {
|
||||
id: 'bx-video-filters',
|
||||
xmlns: 'http://www.w3.org/2000/svg',
|
||||
class: 'bx-gone',
|
||||
}, CE('defs', {xmlns: 'http://www.w3.org/2000/svg'},
|
||||
}, CE('defs', { xmlns: 'http://www.w3.org/2000/svg' },
|
||||
CE('filter', {
|
||||
id: 'bx-filter-usm',
|
||||
xmlns: 'http://www.w3.org/2000/svg',
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { isLiteVersion } from "@macros/build" with {type: "macro"};
|
||||
import { isLiteVersion } from "@macros/build" with { type: "macro" };
|
||||
|
||||
import { t } from "@utils/translation";
|
||||
import { BxEvent } from "@utils/bx-event";
|
||||
@ -118,9 +118,9 @@ export class StreamBadges {
|
||||
return $badge;
|
||||
}
|
||||
|
||||
$badge = CE('div', {class: 'bx-badge', title: badgeInfo.name},
|
||||
CE('span', {class: 'bx-badge-name'}, createSvgIcon(badgeInfo.icon)),
|
||||
CE('span', {class: 'bx-badge-value', style: `background-color: ${badgeInfo.color}`}, value),
|
||||
$badge = CE('div', { class: 'bx-badge', title: badgeInfo.name },
|
||||
CE('span', { class: 'bx-badge-name' }, createSvgIcon(badgeInfo.icon)),
|
||||
CE('span', { class: 'bx-badge-value', style: `background-color: ${badgeInfo.color}` }, value),
|
||||
);
|
||||
|
||||
if (name === StreamBadge.BATTERY) {
|
||||
@ -219,7 +219,7 @@ export class StreamBadges {
|
||||
this.serverInfo.audio ? this.badges.audio.$element : [StreamBadge.AUDIO, '?'],
|
||||
];
|
||||
|
||||
const $container = CE('div', {class: 'bx-badges'});
|
||||
const $container = CE('div', { class: 'bx-badges' });
|
||||
|
||||
for (const item of BADGES) {
|
||||
if (!item) {
|
||||
|
@ -209,7 +209,7 @@ export class StreamStats {
|
||||
}
|
||||
|
||||
private async render() {
|
||||
this.$container = CE('div', {class: 'bx-stats-bar bx-gone'});
|
||||
this.$container = CE('div', { class: 'bx-stats-bar bx-gone' });
|
||||
|
||||
let statKey: keyof typeof this.stats;
|
||||
for (statKey in this.stats) {
|
||||
|
@ -267,7 +267,7 @@ export class StreamUiHandler {
|
||||
};
|
||||
});
|
||||
|
||||
observer.observe($screen, {subtree: true, childList: true});
|
||||
observer.observe($screen, { subtree: true, childList: true });
|
||||
StreamUiHandler.observer = observer;
|
||||
}
|
||||
}
|
||||
|
@ -233,13 +233,13 @@ export class TouchController {
|
||||
let html = false;
|
||||
if (layout.author) {
|
||||
const author = `<b>${escapeHtml(layout.author)}</b>`;
|
||||
msg = t('touch-control-layout-by', {name: author});
|
||||
msg = t('touch-control-layout-by', { name: author });
|
||||
html = true;
|
||||
} else {
|
||||
msg = t('touch-control-layout');
|
||||
}
|
||||
|
||||
layoutChanged && Toast.show(msg, layout.name, {html: html});
|
||||
layoutChanged && Toast.show(msg, layout.name, { html });
|
||||
|
||||
window.setTimeout(() => {
|
||||
// Show gyroscope control in the "More options" dialog if this layout has gyroscope
|
||||
|
@ -154,7 +154,7 @@ export class NavigationDialogManager {
|
||||
private constructor() {
|
||||
BxLogger.info(this.LOG_TAG, 'constructor()');
|
||||
|
||||
this.$overlay = CE('div', {class: 'bx-navigation-dialog-overlay bx-gone'});
|
||||
this.$overlay = CE('div', { class: 'bx-navigation-dialog-overlay bx-gone' });
|
||||
this.$overlay.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -164,7 +164,7 @@ export class NavigationDialogManager {
|
||||
|
||||
document.documentElement.appendChild(this.$overlay);
|
||||
|
||||
this.$container = CE('div', {class: 'bx-navigation-dialog bx-gone'});
|
||||
this.$container = CE('div', { class: 'bx-navigation-dialog bx-gone' });
|
||||
document.documentElement.appendChild(this.$container);
|
||||
|
||||
// Hide dialog when the Guide menu is shown
|
||||
@ -186,7 +186,7 @@ export class NavigationDialogManager {
|
||||
// Find un-calculated <select> elements
|
||||
this.calculateSelectBoxes($dialog);
|
||||
});
|
||||
observer.observe(this.$container, {childList: true});
|
||||
observer.observe(this.$container, { childList: true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ export class NavigationDialogManager {
|
||||
} else if (keyCode === 'Enter' || keyCode === 'NumpadEnter' || keyCode === 'Space') {
|
||||
if (!($target instanceof HTMLInputElement && $target.type === 'text')) {
|
||||
handled = true;
|
||||
$target.dispatchEvent(new MouseEvent('click', {bubbles: true}));
|
||||
$target.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
||||
}
|
||||
} else if (keyCode === 'Escape') {
|
||||
handled = true;
|
||||
@ -393,7 +393,7 @@ export class NavigationDialogManager {
|
||||
}
|
||||
|
||||
if (releasedButton === GamepadKey.A) {
|
||||
document.activeElement && document.activeElement.dispatchEvent(new MouseEvent('click', {bubbles: true}));
|
||||
document.activeElement?.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
||||
return;
|
||||
} else if (releasedButton === GamepadKey.B) {
|
||||
this.hide();
|
||||
|
@ -95,8 +95,8 @@ export class ControllerShortcutsManagerDialog extends BaseProfileManagerDialog<C
|
||||
};
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
fragment.appendChild(CE('p', {class: 'bx-shortcut-note'},
|
||||
CE('span', {class: 'bx-prompt'}, PrompFont.HOME),
|
||||
fragment.appendChild(CE('p', { class: 'bx-shortcut-note' },
|
||||
CE('span', { class: 'bx-prompt' }, PrompFont.HOME),
|
||||
': ' + t('controller-shortcuts-xbox-note'),
|
||||
));
|
||||
|
||||
@ -109,8 +109,8 @@ export class ControllerShortcutsManagerDialog extends BaseProfileManagerDialog<C
|
||||
orientation: 'horizontal',
|
||||
},
|
||||
});
|
||||
const $label = CE('label', {class: 'bx-prompt'}, `${PrompFont.HOME}${prompt}`);
|
||||
const $div = CE('div', {class: 'bx-shortcut-actions'});
|
||||
const $label = CE('label', { class: 'bx-prompt' }, `${PrompFont.HOME}${prompt}`);
|
||||
const $div = CE('div', { class: 'bx-shortcut-actions' });
|
||||
|
||||
let $fakeSelect: HTMLSelectElement | null = null;
|
||||
if (!PREF_CONTROLLER_FRIENDLY_UI) {
|
||||
|
@ -32,7 +32,7 @@ export class RemotePlayDialog extends NavigationDialog {
|
||||
}
|
||||
|
||||
private setupDialog() {
|
||||
const $fragment = CE('div', {'class': 'bx-remote-play-container'});
|
||||
const $fragment = CE('div', { class: 'bx-remote-play-container' });
|
||||
|
||||
const $settingNote = CE('p', {});
|
||||
|
||||
@ -69,13 +69,13 @@ export class RemotePlayDialog extends NavigationDialog {
|
||||
const consoles = manager.getConsoles();
|
||||
|
||||
for (let con of consoles) {
|
||||
const $child = CE('div', {class: 'bx-remote-play-device-wrapper'},
|
||||
CE('div', {class: 'bx-remote-play-device-info'},
|
||||
const $child = CE('div', { class: 'bx-remote-play-device-wrapper' },
|
||||
CE('div', { class: 'bx-remote-play-device-info' },
|
||||
CE('div', {},
|
||||
CE('span', {class: 'bx-remote-play-device-name'}, con.deviceName),
|
||||
CE('span', {class: 'bx-remote-play-console-type'}, con.consoleType.replace('Xbox', ''))
|
||||
CE('span', { class: 'bx-remote-play-device-name' }, con.deviceName),
|
||||
CE('span', { class: 'bx-remote-play-console-type' }, con.consoleType.replace('Xbox', ''))
|
||||
),
|
||||
CE('div', {class: 'bx-remote-play-power-state'}, this.STATE_LABELS[con.powerState]),
|
||||
CE('div', { class: 'bx-remote-play-power-state' }, this.STATE_LABELS[con.powerState]),
|
||||
),
|
||||
|
||||
// Connect button
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { isFullVersion } from "@macros/build" with {type: "macro"};
|
||||
import { isFullVersion } from "@macros/build" with { type: "macro" };
|
||||
|
||||
import { limitVideoPlayerFps, onChangeVideoPlayerType, updateVideoPlayer } from "@/modules/stream/stream-settings-utils";
|
||||
import { ButtonStyle, CE, createButton, createSettingRow, createSvgIcon, escapeCssSelector, type BxButtonOptions } from "@/utils/html";
|
||||
@ -39,7 +39,7 @@ type SettingTabSectionItem = Partial<{
|
||||
note: string | (() => HTMLElement);
|
||||
experimental: string;
|
||||
content: HTMLElement | (() => HTMLElement);
|
||||
options: {[key: string]: string};
|
||||
options: { [key: string]: string };
|
||||
unsupported: boolean;
|
||||
unsupportedNote: string;
|
||||
onChange: (e: any, value: number) => void;
|
||||
@ -112,7 +112,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
if (!SCRIPT_VERSION.includes('beta') && PREF_LATEST_VERSION && PREF_LATEST_VERSION != SCRIPT_VERSION) {
|
||||
// Show new version button
|
||||
const opts = {
|
||||
label: '🌟 ' + t('new-version-available', {version: PREF_LATEST_VERSION}),
|
||||
label: '🌟 ' + t('new-version-available', { version: PREF_LATEST_VERSION }),
|
||||
style: ButtonStyle.PRIMARY | ButtonStyle.FOCUSABLE | ButtonStyle.FULL_WIDTH,
|
||||
} as BxButtonOptions;
|
||||
|
||||
@ -549,7 +549,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
|
||||
// If there is no custom layouts -> show only Default option
|
||||
if (!customLayouts) {
|
||||
$elm.appendChild(CE('option', {value: ''}, t('default')));
|
||||
$elm.appendChild(CE('option', { value: '' }, t('default')));
|
||||
$elm.value = '';
|
||||
$elm.dispatchEvent(new Event('input'));
|
||||
return;
|
||||
@ -567,7 +567,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
name = layout.name;
|
||||
}
|
||||
|
||||
const $option = CE('option', {value: key}, name);
|
||||
const $option = CE('option', { value: key }, name);
|
||||
$fragment.appendChild($option);
|
||||
}
|
||||
|
||||
@ -859,7 +859,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
|
||||
setting.options[value] = label;
|
||||
|
||||
const $option = CE<HTMLOptionElement>('option', {value: value}, label);
|
||||
const $option = CE<HTMLOptionElement>('option', { value }, label);
|
||||
const continent = continents[region.contintent];
|
||||
if (!continent.children) {
|
||||
continent.children = [];
|
||||
@ -1002,9 +1002,9 @@ export class SettingsDialog extends NavigationDialog {
|
||||
|
||||
let $note;
|
||||
if (unsupportedNote) {
|
||||
$note = CE('div', {class: 'bx-settings-dialog-note'}, unsupportedNote);
|
||||
$note = CE('div', { class: 'bx-settings-dialog-note' }, unsupportedNote);
|
||||
} else if (note) {
|
||||
$note = CE('div', {class: 'bx-settings-dialog-note'}, note);
|
||||
$note = CE('div', { class: 'bx-settings-dialog-note' }, note);
|
||||
}
|
||||
|
||||
const $row = createSettingRow(label, !prefDefinition?.unsupported && $control, {
|
||||
@ -1083,7 +1083,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
|
||||
// Add note
|
||||
if (section.unsupportedNote) {
|
||||
const $note = CE('b', {class: 'bx-note-unsupported'}, section.unsupportedNote);
|
||||
const $note = CE('b', { class: 'bx-note-unsupported' }, section.unsupportedNote);
|
||||
|
||||
$tabContent.appendChild($note);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export class ControllerExtraSettings extends HTMLElement {
|
||||
CE('div', { class: 'bx-controller-extra-wrapper' },
|
||||
$selectControllers,
|
||||
|
||||
CE('div', {class: 'bx-sub-content-box'},
|
||||
CE('div', { class: 'bx-sub-content-box' },
|
||||
createSettingRow(
|
||||
t('controller-shortcuts-in-game'),
|
||||
CE('div', {
|
||||
|
@ -91,12 +91,12 @@ export class SuggestionsSetting {
|
||||
SuggestionsSetting.generateDefaultSuggestedSettings.call(this);
|
||||
|
||||
// Start rendering
|
||||
const $suggestedSettings = CE('div', {class: 'bx-suggest-wrapper'});
|
||||
const $suggestedSettings = CE('div', { class: 'bx-suggest-wrapper' });
|
||||
const $select = CE<HTMLSelectElement>('select', {},
|
||||
hasRecommendedSettings && CE('option', {value: 'recommended'}, t('recommended')),
|
||||
!hasRecommendedSettings && CE('option', {value: 'highest'}, t('highest-quality')),
|
||||
CE('option', {value: 'default'}, t('default')),
|
||||
CE('option', {value: 'lowest'}, t('lowest-quality')),
|
||||
hasRecommendedSettings && CE('option', { value: 'recommended' }, t('recommended')),
|
||||
!hasRecommendedSettings && CE('option', { value: 'highest' }, t('highest-quality')),
|
||||
CE('option', { value: 'default' }, t('default')),
|
||||
CE('option', { value: 'lowest' }, t('lowest-quality')),
|
||||
);
|
||||
$select.addEventListener('input', e => {
|
||||
const profile = $select.value as SuggestedSettingProfile;
|
||||
@ -107,13 +107,13 @@ export class SuggestionsSetting {
|
||||
|
||||
let note: HTMLElement | string | undefined;
|
||||
if (profile === 'recommended') {
|
||||
note = t('recommended-settings-for-device', {device: recommendedDevice});
|
||||
note = t('recommended-settings-for-device', { device: recommendedDevice });
|
||||
} else if (profile === 'highest') {
|
||||
// Add note for "Highest quality" profile
|
||||
note = '⚠️ ' + t('highest-quality-note');
|
||||
}
|
||||
|
||||
note && fragment.appendChild(CE('div', {class: 'bx-suggest-note'}, note));
|
||||
note && fragment.appendChild(CE('div', { class: 'bx-suggest-note' }, note));
|
||||
|
||||
const settings = this.suggestedSettings[profile];
|
||||
let prefKey: PrefKey;
|
||||
@ -265,7 +265,7 @@ export class SuggestionsSetting {
|
||||
|
||||
// Get recommended settings from GitHub
|
||||
try {
|
||||
let {brand, board, model} = androidInfo!;
|
||||
let { brand, board, model } = androidInfo!;
|
||||
brand = normalize(brand);
|
||||
board = normalize(board);
|
||||
model = normalize(model);
|
||||
|
@ -28,7 +28,7 @@ export class GameTile {
|
||||
}
|
||||
|
||||
if (typeof totalWaitTime === 'number' && isElementVisible($elm)) {
|
||||
const $div = CE('div', {'class': 'bx-game-tile-wait-time'},
|
||||
const $div = CE('div', { class: 'bx-game-tile-wait-time' },
|
||||
createSvgIcon(BxIcon.PLAYTIME),
|
||||
CE('span', {}, secondsToHms(totalWaitTime)),
|
||||
);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { isFullVersion } from "@macros/build" with {type: "macro"};
|
||||
import { isFullVersion } from "@macros/build" with { type: "macro" };
|
||||
|
||||
import { BxEvent } from "@/utils/bx-event";
|
||||
import { AppInterface, STATES } from "@/utils/global";
|
||||
@ -42,7 +42,7 @@ export class GuideMenu {
|
||||
// Wait until the Guide dialog is closed
|
||||
window.addEventListener(BxEvent.XCLOUD_DIALOG_DISMISSED, e => {
|
||||
setTimeout(() => SettingsDialog.getInstance().show(), 50);
|
||||
}, {once: true});
|
||||
}, { once: true });
|
||||
|
||||
// Close all xCloud's dialogs
|
||||
this.closeGuideMenu();
|
||||
@ -218,7 +218,7 @@ export class GuideMenu {
|
||||
for (index = 0; ($elm = $elm?.previousElementSibling); index++);
|
||||
|
||||
if (index === 0) {
|
||||
BxEvent.dispatch(window, BxEvent.XCLOUD_GUIDE_MENU_SHOWN, {where: GuideMenuTab.HOME});
|
||||
BxEvent.dispatch(window, BxEvent.XCLOUD_GUIDE_MENU_SHOWN, { where: GuideMenuTab.HOME });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ export class HeaderSection {
|
||||
this.timeoutId && clearTimeout(this.timeoutId);
|
||||
this.timeoutId = window.setTimeout(this.checkHeader, 2000);
|
||||
});
|
||||
this.observer.observe($root, {subtree: true, childList: true});
|
||||
this.observer.observe($root, { subtree: true, childList: true });
|
||||
|
||||
this.checkHeader();
|
||||
}
|
||||
|
2
src/types/global.d.ts
vendored
2
src/types/global.d.ts
vendored
@ -9,7 +9,7 @@ declare global {
|
||||
interface Window {
|
||||
AppInterface: any;
|
||||
BX_FLAGS?: BxFlags;
|
||||
BX_CE: (elmName: string, props: {[index: string]: any}={}) => HTMLElement;
|
||||
BX_CE: (elmName: string, props: { [index: string]: any }={}) => HTMLElement;
|
||||
BX_EXPOSED: typeof BxExposed & Partial<{
|
||||
shouldShowSensorControls: boolean;
|
||||
stopTakRendering: boolean;
|
||||
|
6
src/types/preferences.d.ts
vendored
6
src/types/preferences.d.ts
vendored
@ -1,8 +1,8 @@
|
||||
export type PreferenceSetting = {
|
||||
default: any;
|
||||
optionsGroup?: string;
|
||||
options?: {[index: string]: string};
|
||||
multipleOptions?: {[index: string]: string};
|
||||
options?: { [index: string]: string };
|
||||
multipleOptions?: { [index: string]: string };
|
||||
unsupported?: boolean;
|
||||
unsupportedNote?: string | (() => HTMLElement);
|
||||
note?: string | (() => HTMLElement);
|
||||
@ -17,4 +17,4 @@ export type PreferenceSetting = {
|
||||
label?: string;
|
||||
};
|
||||
|
||||
export type PreferenceSettings = {[index in PrefKey]: PreferenceSetting};
|
||||
export type PreferenceSettings = { [index in PrefKey]: PreferenceSetting };
|
||||
|
2
src/types/presets.d.ts
vendored
2
src/types/presets.d.ts
vendored
@ -65,7 +65,7 @@ type KeyboardShortcutConvertedPresetData = KeyboardShortcutPresetData & {
|
||||
interface AllPresets<T extends PresetRecord> {
|
||||
default: Array<number>,
|
||||
custom: Array<number>,
|
||||
data: {[key: string]: T},
|
||||
data: { [key: string]: T },
|
||||
};
|
||||
|
||||
interface AllPresetsData<T extends PresetRecord> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { isFullVersion } from "@macros/build" with {type: "macro"};
|
||||
import { isFullVersion } from "@macros/build" with { type: "macro" };
|
||||
|
||||
import { ControllerShortcut } from "@/modules/controller-shortcut";
|
||||
import { BxEvent } from "@utils/bx-event";
|
||||
|
@ -8,7 +8,7 @@ export type BxFlags = {
|
||||
SafariWorkaround: boolean;
|
||||
|
||||
ForceNativeMkbTitles: string[];
|
||||
FeatureGates: {[key: string]: boolean} | null,
|
||||
FeatureGates: { [key: string]: boolean } | null,
|
||||
|
||||
DeviceInfo: {
|
||||
deviceType: 'android' | 'android-tv' | 'android-handheld' | 'webos' | 'unknown',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { CE } from "@utils/html";
|
||||
import { compressCss, renderStylus } from "@macros/build" with {type: "macro"};
|
||||
import { compressCss, renderStylus } from "@macros/build" with { type: "macro" };
|
||||
import { UiSection } from "@/enums/pref-values";
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { getPref } from "./settings-storages/global-settings-storage";
|
||||
|
@ -3,7 +3,7 @@ import { BX_FLAGS } from "./bx-flags";
|
||||
import { getPref } from "./settings-storages/global-settings-storage";
|
||||
import { NativeMkbMode } from "@/enums/pref-values";
|
||||
|
||||
export let FeatureGates: {[key: string]: boolean} = {
|
||||
export let FeatureGates: { [key: string]: boolean } = {
|
||||
PwaPrompt: false,
|
||||
EnableWifiWarnings: false,
|
||||
EnableUpdateRequiredPage: false,
|
||||
|
@ -31,7 +31,7 @@ export function showGamepadToast(gamepad: Gamepad) {
|
||||
status = t('disconnected');
|
||||
}
|
||||
|
||||
Toast.show(text, status, {instant: false});
|
||||
Toast.show(text, status, { instant: false });
|
||||
}
|
||||
|
||||
export function getUniqueGamepadNames() {
|
||||
|
@ -47,7 +47,7 @@ export const STATES: BxStates = {
|
||||
pointerServerPort: 9269,
|
||||
};
|
||||
|
||||
export const STORAGE: {[key: string]: BaseSettingsStore} = {};
|
||||
export const STORAGE: { [key: string]: BaseSettingsStore } = {};
|
||||
|
||||
export function deepClone(obj: any): typeof obj | {} {
|
||||
if (!obj) {
|
||||
|
@ -47,7 +47,7 @@ export type BxButtonOptions = Partial<{
|
||||
disabled: boolean;
|
||||
onClick: EventListener;
|
||||
tabIndex: number;
|
||||
attributes: {[key: string]: any},
|
||||
attributes: { [key: string]: any },
|
||||
}>;
|
||||
|
||||
export type SettingsRowOptions = Partial<{
|
||||
@ -186,7 +186,7 @@ export function createSettingRow(label: string, $control: HTMLElement | false |
|
||||
let $label: HTMLElement;
|
||||
|
||||
const $row = CE<HTMLLabelElement>('label', { class: 'bx-settings-row' },
|
||||
$label = CE('span', {class: 'bx-settings-label'},
|
||||
$label = CE('span', { class: 'bx-settings-label' },
|
||||
label,
|
||||
options.$note,
|
||||
),
|
||||
|
@ -55,11 +55,11 @@ export class BaseLocalTable<T extends BaseRecord> {
|
||||
return this.call(table.get.bind(table), ...arguments);
|
||||
}
|
||||
|
||||
async getAll(): Promise<{[key: string]: T}> {
|
||||
async getAll(): Promise<{ [key: string]: T }> {
|
||||
const table = await this.prepareTable();
|
||||
// @ts-ignore
|
||||
const all = await (this.call(table.getAll.bind(table), ...arguments) as Promise<T[]>);
|
||||
const results: {[key: string]: T} = {};
|
||||
const results: { [key: string]: T } = {};
|
||||
|
||||
all.forEach(item => {
|
||||
results[item.id as T['id']] = item;
|
||||
|
@ -23,9 +23,13 @@ export class ControllerSettingsTable extends BaseLocalTable<ControllerSettingsRe
|
||||
|
||||
async getControllersData() {
|
||||
const all = await this.getAll();
|
||||
const results: {[key: string]: ControllerSettingsRecord['data']} = {};
|
||||
const results: { [key: string]: ControllerSettingsRecord['data'] } = {};
|
||||
|
||||
for (const key in all) {
|
||||
if (!all[key]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const settings = all[key].data;
|
||||
// Pre-calculate virabtionIntensity
|
||||
settings.vibrationIntensity /= 100;
|
||||
|
@ -50,7 +50,7 @@ export function patchVideoApi() {
|
||||
const $parent = this.parentElement!!;
|
||||
// Video tag is stream player
|
||||
if (!this.src && $parent.dataset.testid === 'media-container') {
|
||||
this.addEventListener('loadedmetadata', showFunc, {once: true});
|
||||
this.addEventListener('loadedmetadata', showFunc, { once: true });
|
||||
}
|
||||
|
||||
return nativePlay.apply(this);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { isFullVersion } from "@macros/build" with {type: "macro"};
|
||||
import { isFullVersion } from "@macros/build" with { type: "macro" };
|
||||
|
||||
import { BX_FLAGS, NATIVE_FETCH } from "@utils/bx-flags";
|
||||
import { TouchController } from "@modules/touch-controller";
|
||||
@ -39,7 +39,7 @@ function clearAllLogs() {
|
||||
clearDbLogs('XCloudAppLogs', 'logs');
|
||||
}
|
||||
|
||||
function updateIceCandidates(candidates: any, options: {preferIpv6Server: boolean, consoleAddrs?: RemotePlayConsoleAddresses}) {
|
||||
function updateIceCandidates(candidates: any, options: { preferIpv6Server: boolean, consoleAddrs?: RemotePlayConsoleAddresses }) {
|
||||
const pattern = new RegExp(/a=candidate:(?<foundation>\d+) (?<component>\d+) UDP (?<priority>\d+) (?<ip>[^\s]+) (?<port>\d+) (?<the_rest>.*)/);
|
||||
|
||||
const lst = [];
|
||||
@ -48,7 +48,7 @@ function updateIceCandidates(candidates: any, options: {preferIpv6Server: boolea
|
||||
continue;
|
||||
}
|
||||
|
||||
const groups: {[index: string]: string | number} = pattern.exec(item.candidate)!.groups!;
|
||||
const groups: { [index: string]: string | number } = pattern.exec(item.candidate)!.groups!;
|
||||
lst.push(groups);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ export class RootDialogObserver {
|
||||
}
|
||||
}
|
||||
});
|
||||
observer.observe($root, {subtree: true, childList: true});
|
||||
observer.observe($root, { subtree: true, childList: true });
|
||||
}
|
||||
|
||||
public static waitForRootDialog() {
|
||||
@ -107,6 +107,6 @@ export class RootDialogObserver {
|
||||
}
|
||||
};
|
||||
});
|
||||
observer.observe(document.documentElement, {subtree: true, childList: true});
|
||||
observer.observe(document.documentElement, { subtree: true, childList: true });
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ export class ScreenshotManager {
|
||||
|
||||
this.$download = CE<HTMLAnchorElement>('a');
|
||||
|
||||
this.$canvas = CE<HTMLCanvasElement>('canvas', {'class': 'bx-gone'});
|
||||
this.$canvas = CE<HTMLCanvasElement>('canvas', { class: 'bx-gone' });
|
||||
this.canvasContext = this.$canvas.getContext('2d', {
|
||||
alpha: false,
|
||||
willReadFrequently: false,
|
||||
|
@ -41,7 +41,7 @@ export class SettingElement {
|
||||
for (let value in setting.options) {
|
||||
const label = setting.options[value];
|
||||
|
||||
const $option = CE<HTMLOptionElement>('option', {value: value}, label);
|
||||
const $option = CE<HTMLOptionElement>('option', { value }, label);
|
||||
$parent.appendChild($option);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ export class SettingElement {
|
||||
for (const value in setting.multipleOptions) {
|
||||
const label = setting.multipleOptions[value];
|
||||
|
||||
const $option = CE<HTMLOptionElement>('option', {value: value}, label) as HTMLOptionElement;
|
||||
const $option = CE<HTMLOptionElement>('option', { value }, label) as HTMLOptionElement;
|
||||
$option.selected = currentValue.indexOf(value) > -1;
|
||||
|
||||
$option.addEventListener('mousedown', function(e) {
|
||||
@ -111,7 +111,7 @@ export class SettingElement {
|
||||
}
|
||||
|
||||
private static renderCheckbox(key: string, setting: PreferenceSetting, currentValue: any, onChange: any) {
|
||||
const $control = CE('input', {type: 'checkbox', tabindex: 0}) as HTMLInputElement;
|
||||
const $control = CE('input', { type: 'checkbox', tabindex: 0 }) as HTMLInputElement;
|
||||
$control.checked = currentValue;
|
||||
|
||||
onChange && $control.addEventListener('input', e => {
|
||||
|
@ -89,7 +89,7 @@ export class GlobalSettingsStorage extends BaseSettingsStorage {
|
||||
},
|
||||
[PrefKey.SERVER_REGION]: {
|
||||
label: t('region'),
|
||||
note: CE('a', {target: '_blank', href: 'https://umap.openstreetmap.fr/en/map/xbox-cloud-gaming-servers_1135022'}, t('server-locations')),
|
||||
note: CE('a', { target: '_blank', href: 'https://umap.openstreetmap.fr/en/map/xbox-cloud-gaming-servers_1135022' }, t('server-locations')),
|
||||
default: 'default',
|
||||
},
|
||||
[PrefKey.SERVER_BYPASS_RESTRICTION]: {
|
||||
|
@ -24,9 +24,9 @@ export class Toast {
|
||||
private constructor() {
|
||||
BxLogger.info(this.LOG_TAG, 'constructor()');
|
||||
|
||||
this.$wrapper = CE('div', {class: 'bx-toast bx-offscreen'},
|
||||
this.$msg = CE('span', {class: 'bx-toast-msg'}),
|
||||
this.$status = CE('span', {class: 'bx-toast-status'}),
|
||||
this.$wrapper = CE('div', { class: 'bx-toast bx-offscreen' },
|
||||
this.$msg = CE('span', { class: 'bx-toast-msg' }),
|
||||
this.$status = CE('span', { class: 'bx-toast-status' }),
|
||||
);
|
||||
|
||||
this.$wrapper.addEventListener('transitionend', e => {
|
||||
|
@ -9,12 +9,12 @@ type UserAgentConfig = {
|
||||
|
||||
const SMART_TV_UNIQUE_ID = 'FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA';
|
||||
|
||||
let CHROMIUM_VERSION = '123.0.0.0';
|
||||
let CHROMIUM_VERSION = '125.0.0.0';
|
||||
if (!!(window as any).chrome || window.navigator.userAgent.includes('Chrome')) {
|
||||
// Get Chromium version in the original User-Agent value
|
||||
const match = window.navigator.userAgent.match(/\s(?:Chrome|Edg)\/([\d\.]+)/);
|
||||
if (match) {
|
||||
CHROMIUM_VERSION = match[1];
|
||||
CHROMIUM_VERSION = match[1] as string;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,11 +102,11 @@ export function roundToNearest(value: number, interval: number): number {
|
||||
export async function copyToClipboard(text: string, showToast=true): Promise<boolean> {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
showToast && Toast.show('Copied to clipboard', '', {instant: true});
|
||||
showToast && Toast.show('Copied to clipboard', '', { instant: true });
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
showToast && Toast.show('Failed to copy', '', {instant: true});
|
||||
showToast && Toast.show('Failed to copy', '', { instant: true });
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -128,10 +128,10 @@ export function parseDetailsPath(path: string) {
|
||||
return;
|
||||
}
|
||||
|
||||
const titleSlug = matches.groups.titleSlug.replaceAll('\%' + '7C', '-');
|
||||
const titleSlug = matches.groups.titleSlug!.replaceAll('\%' + '7C', '-');
|
||||
const productId = matches.groups.productId;
|
||||
|
||||
return {titleSlug, productId};
|
||||
return { titleSlug, productId };
|
||||
}
|
||||
|
||||
export function clearAllData() {
|
||||
|
@ -3,7 +3,7 @@ import { NATIVE_FETCH } from "./bx-flags"
|
||||
export class XboxApi {
|
||||
private static CACHED_TITLES: Record<string, string> = {};
|
||||
|
||||
static async getProductTitle(xboxTitleId: number | string): Promise<string | null> {
|
||||
static async getProductTitle(xboxTitleId: number | string): Promise<string | undefined> {
|
||||
xboxTitleId = xboxTitleId.toString();
|
||||
if (XboxApi.CACHED_TITLES[xboxTitleId]) {
|
||||
return XboxApi.CACHED_TITLES[xboxTitleId];
|
||||
@ -20,6 +20,6 @@ export class XboxApi {
|
||||
return productTitle;
|
||||
} catch (e) {}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -7,21 +7,21 @@ export class XcloudApi {
|
||||
public static getInstance = () => XcloudApi.instance ?? (XcloudApi.instance = new XcloudApi());
|
||||
private readonly LOG_TAG = 'XcloudApi';
|
||||
|
||||
private CACHE_TITLES: {[key: string]: XcloudTitleInfo} = {};
|
||||
private CACHE_WAIT_TIME: {[key: string]: XcloudWaitTimeInfo} = {};
|
||||
private CACHE_TITLES: { [key: string]: XcloudTitleInfo } = {};
|
||||
private CACHE_WAIT_TIME: { [key: string]: XcloudWaitTimeInfo } = {};
|
||||
|
||||
private constructor() {
|
||||
BxLogger.info(this.LOG_TAG, 'constructor()');
|
||||
}
|
||||
|
||||
async getTitleInfo(id: string): Promise<XcloudTitleInfo | null> {
|
||||
async getTitleInfo(id: string): Promise<XcloudTitleInfo | undefined> {
|
||||
if (id in this.CACHE_TITLES) {
|
||||
return this.CACHE_TITLES[id];
|
||||
}
|
||||
|
||||
const baseUri = STATES.selectedRegion.baseUri;
|
||||
if (!baseUri || !STATES.gsToken) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
let json;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { isFullVersion } from "@macros/build" with {type: "macro"};
|
||||
import { isFullVersion } from "@macros/build" with { type: "macro" };
|
||||
|
||||
import { LoadingScreen } from "@modules/loading-screen";
|
||||
import { RemotePlayManager } from "@/modules/remote-play-manager";
|
||||
@ -116,7 +116,7 @@ export class XcloudInterceptor {
|
||||
|
||||
let match = serverRegex.exec(region.baseUri);
|
||||
if (match) {
|
||||
shortName = match[1];
|
||||
shortName = match[1] as string;
|
||||
if (serverExtra[regionName]) {
|
||||
shortName = serverExtra[regionName][0] + ' ' + shortName;
|
||||
region.contintent = serverExtra[regionName][1];
|
||||
@ -155,10 +155,10 @@ export class XcloudInterceptor {
|
||||
const url = (typeof request === 'string') ? request : (request as Request).url;
|
||||
const parsedUrl = new URL(url);
|
||||
|
||||
let badgeRegion: string = parsedUrl.host.split('.', 1)[0];
|
||||
let badgeRegion: string = parsedUrl.host.split('.', 1)[0] as string;
|
||||
for (let regionName in STATES.serverRegions) {
|
||||
const region = STATES.serverRegions[regionName];
|
||||
if (parsedUrl.origin == region.baseUri) {
|
||||
if (region && parsedUrl.origin === region.baseUri) {
|
||||
badgeRegion = regionName;
|
||||
break;
|
||||
}
|
||||
@ -168,7 +168,7 @@ export class XcloudInterceptor {
|
||||
const clone = (request as Request).clone();
|
||||
const body = await clone.json();
|
||||
|
||||
const headers: {[index: string]: string} = {};
|
||||
const headers: { [index: string]: string } = {};
|
||||
for (const pair of (clone.headers as any).entries()) {
|
||||
headers[pair[0]] = pair[1];
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ export class XhomeInterceptor {
|
||||
XhomeInterceptor.consoleAddrs = {};
|
||||
for (const pair of pairs) {
|
||||
const [keyAddr, keyPort] = pair;
|
||||
if (serverDetails[keyAddr]) {
|
||||
if (keyAddr && keyPort && serverDetails[keyAddr]) {
|
||||
const port = serverDetails[keyPort];
|
||||
// Add port 9002 to the list of ports
|
||||
const ports = new Set<number>();
|
||||
@ -107,7 +107,7 @@ export class XhomeInterceptor {
|
||||
return response;
|
||||
}
|
||||
|
||||
private static async handleInputConfigs(request: Request | URL, opts: {[index: string]: any}) {
|
||||
private static async handleInputConfigs(request: Request | URL, opts: { [index: string]: any }) {
|
||||
const response = await NATIVE_FETCH(request);
|
||||
|
||||
if (getPref<TouchControllerMode>(PrefKey.TOUCH_CONTROLLER_MODE) !== TouchControllerMode.ALL) {
|
||||
@ -147,7 +147,7 @@ export class XhomeInterceptor {
|
||||
private static async handleTitles(request: Request) {
|
||||
const clone = request.clone();
|
||||
|
||||
const headers: {[index: string]: any} = {};
|
||||
const headers: { [index: string]: any } = {};
|
||||
for (const pair of (clone.headers as any).entries()) {
|
||||
headers[pair[0]] = pair[1];
|
||||
}
|
||||
@ -183,7 +183,7 @@ export class XhomeInterceptor {
|
||||
|
||||
const clone = request.clone();
|
||||
|
||||
const headers: {[index: string]: string} = {};
|
||||
const headers: { [index: string]: string } = {};
|
||||
for (const pair of (clone.headers as any).entries()) {
|
||||
headers[pair[0]] = pair[1];
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ export class BxNumberStepper extends HTMLInputElement implements BxHtmlSettingEl
|
||||
|
||||
if (options.ticks || options.exactTicks) {
|
||||
const markersId = `markers-${key}`;
|
||||
const $markers = CE('datalist', {id: markersId});
|
||||
const $markers = CE('datalist', { id: markersId });
|
||||
$range.setAttribute('list', markersId);
|
||||
|
||||
if (options.exactTicks) {
|
||||
@ -140,7 +140,7 @@ export class BxNumberStepper extends HTMLInputElement implements BxHtmlSettingEl
|
||||
}
|
||||
} else {
|
||||
for (let i = self.uiMin + options.ticks!; i < self.uiMax; i += options.ticks!) {
|
||||
$markers.appendChild(CE<HTMLOptionElement>('option', {value: i}));
|
||||
$markers.appendChild(CE<HTMLOptionElement>('option', { value: i }));
|
||||
}
|
||||
}
|
||||
self.appendChild($markers);
|
||||
|
@ -260,6 +260,9 @@ export class BxSelectElement extends HTMLSelectElement {
|
||||
for (let i = 0; i < optionsList.length; i++) {
|
||||
const $option = optionsList[i];
|
||||
const $indicator = indicatorsList[i];
|
||||
if (!$option || !$indicator) {
|
||||
continue;
|
||||
}
|
||||
|
||||
clearDataSet($indicator);
|
||||
if ($option.selected) {
|
||||
@ -288,7 +291,7 @@ export class BxSelectElement extends HTMLSelectElement {
|
||||
visibleIndex: currentIndex,
|
||||
} = this;
|
||||
|
||||
const goNext = (e.target as any).closest('button') === $btnNext;
|
||||
const goNext = (e.target as HTMLElement).closest('button') === $btnNext;
|
||||
|
||||
let newIndex = goNext ? currentIndex + 1 : currentIndex - 1;
|
||||
if (newIndex > this.optionsList.length - 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user