diff --git a/dist/better-xcloud.lite.user.js b/dist/better-xcloud.lite.user.js index a83d192..64c2d93 100755 --- a/dist/better-xcloud.lite.user.js +++ b/dist/better-xcloud.lite.user.js @@ -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: "F8" }), 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: `${KeyHelper.codeToKeyName(shortcutKey)}` }); + 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 { diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index eb63093..dee3b77 100755 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -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: "F8" }), 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: `${KeyHelper.codeToKeyName(shortcutKey)}` }); + 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 { diff --git a/src/index.ts b/src/index.ts index 858c1d7..cecd906 100755 --- a/src/index.ts +++ b/src/index.ts @@ -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; diff --git a/src/modules/controller-shortcut.ts b/src/modules/controller-shortcut.ts index 4fd854f..5d74bd4 100755 --- a/src/modules/controller-shortcut.ts +++ b/src/modules/controller-shortcut.ts @@ -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] = []; diff --git a/src/modules/game-bar/game-bar.ts b/src/modules/game-bar/game-bar.ts index 14c85cb..b1a0785 100755 --- a/src/modules/game-bar/game-bar.ts +++ b/src/modules/game-bar/game-bar.ts @@ -47,8 +47,8 @@ export class GameBar { const position = getPref(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), ); diff --git a/src/modules/loading-screen.ts b/src/modules/loading-screen.ts index 9ac3597..4ba5548 100755 --- a/src/modules/loading-screen.ts +++ b/src/modules/loading-screen.ts @@ -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 { diff --git a/src/modules/mkb/key-helper.ts b/src/modules/mkb/key-helper.ts index 1f68c2c..86e2306 100755 --- a/src/modules/mkb/key-helper.ts +++ b/src/modules/mkb/key-helper.ts @@ -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, diff --git a/src/modules/mkb/mkb-handler.ts b/src/modules/mkb/mkb-handler.ts index 5a82904..a2ef204 100755 --- a/src/modules/mkb/mkb-handler.ts +++ b/src/modules/mkb/mkb-handler.ts @@ -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: `F8`}), t('virtual-controller'), {html: true}); + const shortcutKey = StreamSettings.findKeyboardShortcut(ShortcutAction.MKB_TOGGLE); + if (shortcutKey) { + const msg = t('press-key-to-toggle-mkb', { key: `${KeyHelper.codeToKeyName(shortcutKey)}` }); + 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() { diff --git a/src/modules/mkb/native-mkb-handler.ts b/src/modules/mkb/native-mkb-handler.ts index 987a25d..84051ee 100755 --- a/src/modules/mkb/native-mkb-handler.ts +++ b/src/modules/mkb/native-mkb-handler.ts @@ -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() { diff --git a/src/modules/patcher/patcher.ts b/src/modules/patcher/patcher.ts index b553453..4f8d7a0 100755 --- a/src/modules/patcher/patcher.ts +++ b/src/modules/patcher/patcher.ts @@ -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 = ` diff --git a/src/modules/patcher/patches/set-currently-focused-interactable.js b/src/modules/patcher/patches/set-currently-focused-interactable.js index aeb55f5..b3a2c75 100755 --- a/src/modules/patcher/patches/set-currently-focused-interactable.js +++ b/src/modules/patcher/patches/set-currently-focused-interactable.js @@ -1 +1 @@ -e && BxEvent.dispatch(window, BxEvent.NAVIGATION_FOCUS_CHANGED, {element: e}); +e && BxEvent.dispatch(window, BxEvent.NAVIGATION_FOCUS_CHANGED, { element: e }); diff --git a/src/modules/remote-play-manager.ts b/src/modules/remote-play-manager.ts index a695f37..40d1c28 100755 --- a/src/modules/remote-play-manager.ts +++ b/src/modules/remote-play-manager.ts @@ -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; } diff --git a/src/modules/shortcuts/microphone-shortcut.ts b/src/modules/shortcuts/microphone-shortcut.ts index eb54266..4972be9 100755 --- a/src/modules/shortcuts/microphone-shortcut.ts +++ b/src/modules/shortcuts/microphone-shortcut.ts @@ -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) { diff --git a/src/modules/shortcuts/sound-shortcut.ts b/src/modules/shortcuts/sound-shortcut.ts index 5f1b9f8..75d3564 100755 --- a/src/modules/shortcuts/sound-shortcut.ts +++ b/src/modules/shortcuts/sound-shortcut.ts @@ -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, diff --git a/src/modules/stream-player.ts b/src/modules/stream-player.ts index 94a65e7..d323a24 100755 --- a/src/modules/stream-player.ts +++ b/src/modules/stream-player.ts @@ -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', diff --git a/src/modules/stream/stream-badges.ts b/src/modules/stream/stream-badges.ts index 8c61c47..dfbf2a1 100755 --- a/src/modules/stream/stream-badges.ts +++ b/src/modules/stream/stream-badges.ts @@ -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) { diff --git a/src/modules/stream/stream-stats.ts b/src/modules/stream/stream-stats.ts index 0569cf4..4ce2c84 100755 --- a/src/modules/stream/stream-stats.ts +++ b/src/modules/stream/stream-stats.ts @@ -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) { diff --git a/src/modules/stream/stream-ui.ts b/src/modules/stream/stream-ui.ts index ae3a6c4..ad64b4c 100755 --- a/src/modules/stream/stream-ui.ts +++ b/src/modules/stream/stream-ui.ts @@ -267,7 +267,7 @@ export class StreamUiHandler { }; }); - observer.observe($screen, {subtree: true, childList: true}); + observer.observe($screen, { subtree: true, childList: true }); StreamUiHandler.observer = observer; } } diff --git a/src/modules/touch-controller.ts b/src/modules/touch-controller.ts index 53aecc0..b6b4ddf 100755 --- a/src/modules/touch-controller.ts +++ b/src/modules/touch-controller.ts @@ -233,13 +233,13 @@ export class TouchController { let html = false; if (layout.author) { const author = `${escapeHtml(layout.author)}`; - 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 diff --git a/src/modules/ui/dialog/navigation-dialog.ts b/src/modules/ui/dialog/navigation-dialog.ts index b30dd9b..584f27c 100755 --- a/src/modules/ui/dialog/navigation-dialog.ts +++ b/src/modules/ui/dialog/navigation-dialog.ts @@ -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