Update better-xcloud.user.js

This commit is contained in:
redphx 2025-01-28 06:23:22 +07:00 committed by GitHub
parent 84415de09f
commit ee4055e169
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Better xCloud // @name Better xCloud
// @namespace https://github.com/redphx // @namespace https://github.com/redphx
// @version 6.3.0-beta // @version 6.3.0-beta-1
// @description Improve Xbox Cloud Gaming (xCloud) experience // @description Improve Xbox Cloud Gaming (xCloud) experience
// @author redphx // @author redphx
// @license MIT // @license MIT
@ -190,7 +190,7 @@ class UserAgent {
}); });
} }
} }
var SCRIPT_VERSION = "6.3.0-beta", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface; var SCRIPT_VERSION = "6.3.0-beta-1", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
UserAgent.init(); UserAgent.init();
var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, STATES = { var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, STATES = {
supportedRegion: !0, supportedRegion: !0,
@ -5437,10 +5437,10 @@ class SettingsManager {
if (!this.SETTINGS[pref]) this.SETTINGS[pref] = {}; if (!this.SETTINGS[pref]) this.SETTINGS[pref] = {};
this.updateDataset($elm, pref), this.SETTINGS[pref].$element = $elm; this.updateDataset($elm, pref), this.SETTINGS[pref].$element = $elm;
} }
getElement(pref) { getElement(pref, params) {
if (!this.SETTINGS[pref]) this.SETTINGS[pref] = {}; if (!this.SETTINGS[pref]) this.SETTINGS[pref] = {};
let $elm = this.SETTINGS[pref].$element; let $elm = this.SETTINGS[pref].$element;
if (!$elm) $elm = SettingElement.fromPref(pref, () => {}), this.SETTINGS[pref].$element = $elm; if (!$elm) $elm = SettingElement.fromPref(pref, () => {}, params), this.SETTINGS[pref].$element = $elm;
return this.updateDataset($elm, pref), $elm; return this.updateDataset($elm, pref), $elm;
} }
updateDataset($elm, pref) { updateDataset($elm, pref) {
@ -7346,7 +7346,7 @@ class SettingsDialog extends NavigationDialog {
let $inp = $control.nextElementSibling; let $inp = $control.nextElementSibling;
$inp.value = userAgent2, $inp.readOnly = !isCustom, $inp.disabled = !isCustom, !e.target.disabled && this.onGlobalSettingChanged(e); $inp.value = userAgent2, $inp.readOnly = !isCustom, $inp.disabled = !isCustom, !e.target.disabled && this.onGlobalSettingChanged(e);
}); });
else if ($control = this.settingsManager.getElement(pref), settingTab.group === "global") $control.addEventListener("input", this.onGlobalSettingChanged); else if ($control = this.settingsManager.getElement(pref, setting.params), settingTab.group === "global") $control.addEventListener("input", this.onGlobalSettingChanged);
if ($control instanceof HTMLSelectElement) $control = BxSelectElement.create($control); if ($control instanceof HTMLSelectElement) $control = BxSelectElement.create($control);
} }
let prefDefinition = null; let prefDefinition = null;