mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 23:57:19 +02:00
Fix problem with controller in Settings dialog
This commit is contained in:
parent
0bf4c289db
commit
d3ef988af7
16
dist/better-xcloud.lite.user.js
vendored
16
dist/better-xcloud.lite.user.js
vendored
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud (Lite)
|
// @name Better xCloud (Lite)
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 6.2.1
|
// @version 6.2.2
|
||||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||||
// @author redphx
|
// @author redphx
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@ -105,7 +105,7 @@ class UserAgent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var SCRIPT_VERSION = "6.2.1", SCRIPT_VARIANT = "lite", AppInterface = window.AppInterface;
|
var SCRIPT_VERSION = "6.2.2", SCRIPT_VARIANT = "lite", 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,
|
||||||
@ -3784,15 +3784,15 @@ class NavigationDialogManager {
|
|||||||
this.gamepadHoldingIntervalId && window.clearInterval(this.gamepadHoldingIntervalId), this.gamepadHoldingIntervalId = null;
|
this.gamepadHoldingIntervalId && window.clearInterval(this.gamepadHoldingIntervalId), this.gamepadHoldingIntervalId = null;
|
||||||
}
|
}
|
||||||
show(dialog, configs = {}, clearStack = !1) {
|
show(dialog, configs = {}, clearStack = !1) {
|
||||||
this.clearGamepadHoldingInterval(), BxEventBus.Script.emit("dialog.shown", {}), document.body.classList.add("bx-no-scroll"), this.unmountCurrentDialog(), this.dialogsStack.push(dialog), this.dialog = dialog, dialog.onBeforeMount(configs), this.$container.appendChild(dialog.getContent()), dialog.onMounted(configs), this.$overlay.classList.remove("bx-gone"), this.$overlay.classList.toggle("bx-invisible", !dialog.isOverlayVisible()), this.$container.classList.remove("bx-gone"), this.$container.addEventListener("keydown", this);
|
this.clearGamepadHoldingInterval(), BxEventBus.Script.emit("dialog.shown", {}), window.BX_EXPOSED.disableGamepadPolling = !0, document.body.classList.add("bx-no-scroll"), this.unmountCurrentDialog(), this.dialogsStack.push(dialog), this.dialog = dialog, dialog.onBeforeMount(configs), this.$container.appendChild(dialog.getContent()), dialog.onMounted(configs), this.$overlay.classList.remove("bx-gone"), this.$overlay.classList.toggle("bx-invisible", !dialog.isOverlayVisible()), this.$container.classList.remove("bx-gone"), this.$container.addEventListener("keydown", this), this.startGamepadPolling();
|
||||||
}
|
}
|
||||||
hide() {
|
hide() {
|
||||||
if (!this.isShowing()) return;
|
if (this.clearGamepadHoldingInterval(), !this.isShowing()) return;
|
||||||
if (document.body.classList.remove("bx-no-scroll"), BxEventBus.Script.emit("dialog.dismissed", {}), this.$overlay.classList.add("bx-gone"), this.$overlay.classList.remove("bx-invisible"), this.$container.classList.add("bx-gone"), this.$container.removeEventListener("keydown", this), this.dialog) {
|
if (document.body.classList.remove("bx-no-scroll"), BxEventBus.Script.emit("dialog.dismissed", {}), this.$overlay.classList.add("bx-gone"), this.$overlay.classList.remove("bx-invisible"), this.$container.classList.add("bx-gone"), this.$container.removeEventListener("keydown", this), this.stopGamepadPolling(), this.dialog) {
|
||||||
let dialogIndex = this.dialogsStack.indexOf(this.dialog);
|
let dialogIndex = this.dialogsStack.indexOf(this.dialog);
|
||||||
if (dialogIndex > -1) this.dialogsStack = this.dialogsStack.slice(0, dialogIndex);
|
if (dialogIndex > -1) this.dialogsStack = this.dialogsStack.slice(0, dialogIndex);
|
||||||
}
|
}
|
||||||
if (this.unmountCurrentDialog(), this.dialogsStack.length) this.dialogsStack[this.dialogsStack.length - 1].show();
|
if (this.unmountCurrentDialog(), window.BX_EXPOSED.disableGamepadPolling = !1, this.dialogsStack.length) this.dialogsStack[this.dialogsStack.length - 1].show();
|
||||||
}
|
}
|
||||||
focus($elm) {
|
focus($elm) {
|
||||||
if (!$elm) return !1;
|
if (!$elm) return !1;
|
||||||
@ -3862,10 +3862,10 @@ class NavigationDialogManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
startGamepadPolling() {
|
startGamepadPolling() {
|
||||||
window.BX_EXPOSED.disableGamepadPolling = !0, this.stopGamepadPolling(), this.gamepadPollingIntervalId = window.setInterval(this.pollGamepad, NavigationDialogManager.GAMEPAD_POLLING_INTERVAL);
|
this.stopGamepadPolling();
|
||||||
}
|
}
|
||||||
stopGamepadPolling() {
|
stopGamepadPolling() {
|
||||||
window.BX_EXPOSED.disableGamepadPolling = !1, this.gamepadLastStates = [], this.gamepadPollingIntervalId && window.clearInterval(this.gamepadPollingIntervalId), this.gamepadPollingIntervalId = null;
|
this.gamepadLastStates = [], this.gamepadPollingIntervalId && window.clearInterval(this.gamepadPollingIntervalId), this.gamepadPollingIntervalId = null;
|
||||||
}
|
}
|
||||||
focusDirection(direction) {
|
focusDirection(direction) {
|
||||||
let dialog = this.dialog;
|
let dialog = this.dialog;
|
||||||
|
2
dist/better-xcloud.meta.js
vendored
2
dist/better-xcloud.meta.js
vendored
@ -1,5 +1,5 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 6.2.1
|
// @version 6.2.2
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
16
dist/better-xcloud.user.js
vendored
16
dist/better-xcloud.user.js
vendored
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 6.2.1
|
// @version 6.2.2
|
||||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||||
// @author redphx
|
// @author redphx
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@ -107,7 +107,7 @@ class UserAgent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var SCRIPT_VERSION = "6.2.1", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
var SCRIPT_VERSION = "6.2.2", 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,
|
||||||
@ -3911,15 +3911,15 @@ class NavigationDialogManager {
|
|||||||
this.gamepadHoldingIntervalId && window.clearInterval(this.gamepadHoldingIntervalId), this.gamepadHoldingIntervalId = null;
|
this.gamepadHoldingIntervalId && window.clearInterval(this.gamepadHoldingIntervalId), this.gamepadHoldingIntervalId = null;
|
||||||
}
|
}
|
||||||
show(dialog, configs = {}, clearStack = !1) {
|
show(dialog, configs = {}, clearStack = !1) {
|
||||||
this.clearGamepadHoldingInterval(), BxEventBus.Script.emit("dialog.shown", {}), document.body.classList.add("bx-no-scroll"), this.unmountCurrentDialog(), this.dialogsStack.push(dialog), this.dialog = dialog, dialog.onBeforeMount(configs), this.$container.appendChild(dialog.getContent()), dialog.onMounted(configs), this.$overlay.classList.remove("bx-gone"), this.$overlay.classList.toggle("bx-invisible", !dialog.isOverlayVisible()), this.$container.classList.remove("bx-gone"), this.$container.addEventListener("keydown", this), this.startGamepadPolling();
|
this.clearGamepadHoldingInterval(), BxEventBus.Script.emit("dialog.shown", {}), window.BX_EXPOSED.disableGamepadPolling = !0, document.body.classList.add("bx-no-scroll"), this.unmountCurrentDialog(), this.dialogsStack.push(dialog), this.dialog = dialog, dialog.onBeforeMount(configs), this.$container.appendChild(dialog.getContent()), dialog.onMounted(configs), this.$overlay.classList.remove("bx-gone"), this.$overlay.classList.toggle("bx-invisible", !dialog.isOverlayVisible()), this.$container.classList.remove("bx-gone"), this.$container.addEventListener("keydown", this), this.startGamepadPolling();
|
||||||
}
|
}
|
||||||
hide() {
|
hide() {
|
||||||
if (this.clearGamepadHoldingInterval(), this.stopGamepadPolling(), !this.isShowing()) return;
|
if (this.clearGamepadHoldingInterval(), !this.isShowing()) return;
|
||||||
if (document.body.classList.remove("bx-no-scroll"), BxEventBus.Script.emit("dialog.dismissed", {}), this.$overlay.classList.add("bx-gone"), this.$overlay.classList.remove("bx-invisible"), this.$container.classList.add("bx-gone"), this.$container.removeEventListener("keydown", this), this.dialog) {
|
if (document.body.classList.remove("bx-no-scroll"), BxEventBus.Script.emit("dialog.dismissed", {}), this.$overlay.classList.add("bx-gone"), this.$overlay.classList.remove("bx-invisible"), this.$container.classList.add("bx-gone"), this.$container.removeEventListener("keydown", this), this.stopGamepadPolling(), this.dialog) {
|
||||||
let dialogIndex = this.dialogsStack.indexOf(this.dialog);
|
let dialogIndex = this.dialogsStack.indexOf(this.dialog);
|
||||||
if (dialogIndex > -1) this.dialogsStack = this.dialogsStack.slice(0, dialogIndex);
|
if (dialogIndex > -1) this.dialogsStack = this.dialogsStack.slice(0, dialogIndex);
|
||||||
}
|
}
|
||||||
if (this.unmountCurrentDialog(), this.dialogsStack.length) this.dialogsStack[this.dialogsStack.length - 1].show();
|
if (this.unmountCurrentDialog(), window.BX_EXPOSED.disableGamepadPolling = !1, this.dialogsStack.length) this.dialogsStack[this.dialogsStack.length - 1].show();
|
||||||
}
|
}
|
||||||
focus($elm) {
|
focus($elm) {
|
||||||
if (!$elm) return !1;
|
if (!$elm) return !1;
|
||||||
@ -3989,10 +3989,10 @@ class NavigationDialogManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
startGamepadPolling() {
|
startGamepadPolling() {
|
||||||
window.BX_EXPOSED.disableGamepadPolling = !0, this.stopGamepadPolling(), this.gamepadPollingIntervalId = window.setInterval(this.pollGamepad, NavigationDialogManager.GAMEPAD_POLLING_INTERVAL);
|
this.stopGamepadPolling(), this.gamepadPollingIntervalId = window.setInterval(this.pollGamepad, NavigationDialogManager.GAMEPAD_POLLING_INTERVAL);
|
||||||
}
|
}
|
||||||
stopGamepadPolling() {
|
stopGamepadPolling() {
|
||||||
window.BX_EXPOSED.disableGamepadPolling = !1, this.gamepadLastStates = [], this.gamepadPollingIntervalId && window.clearInterval(this.gamepadPollingIntervalId), this.gamepadPollingIntervalId = null;
|
this.gamepadLastStates = [], this.gamepadPollingIntervalId && window.clearInterval(this.gamepadPollingIntervalId), this.gamepadPollingIntervalId = null;
|
||||||
}
|
}
|
||||||
focusDirection(direction) {
|
focusDirection(direction) {
|
||||||
let dialog = this.dialog;
|
let dialog = this.dialog;
|
||||||
|
@ -410,6 +410,9 @@ export class NavigationDialogManager {
|
|||||||
|
|
||||||
BxEventBus.Script.emit('dialog.shown', {});
|
BxEventBus.Script.emit('dialog.shown', {});
|
||||||
|
|
||||||
|
// Stop xCloud's navigation polling
|
||||||
|
window.BX_EXPOSED.disableGamepadPolling = true;
|
||||||
|
|
||||||
// Lock scroll bar
|
// Lock scroll bar
|
||||||
document.body.classList.add('bx-no-scroll');
|
document.body.classList.add('bx-no-scroll');
|
||||||
|
|
||||||
@ -436,18 +439,11 @@ export class NavigationDialogManager {
|
|||||||
this.$container.addEventListener('keydown', this);
|
this.$container.addEventListener('keydown', this);
|
||||||
|
|
||||||
// Start gamepad polling
|
// Start gamepad polling
|
||||||
if (isFullVersion()) {
|
|
||||||
this.startGamepadPolling();
|
this.startGamepadPolling();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
// Stop gamepad polling
|
|
||||||
if (isFullVersion()) {
|
|
||||||
this.clearGamepadHoldingInterval();
|
this.clearGamepadHoldingInterval();
|
||||||
this.stopGamepadPolling();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.isShowing()) {
|
if (!this.isShowing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -465,6 +461,9 @@ export class NavigationDialogManager {
|
|||||||
// Remove event listeners
|
// Remove event listeners
|
||||||
this.$container.removeEventListener('keydown', this);
|
this.$container.removeEventListener('keydown', this);
|
||||||
|
|
||||||
|
// Stop gamepad polling
|
||||||
|
this.stopGamepadPolling();
|
||||||
|
|
||||||
// Remove current dialog and everything after it from dialogs stack
|
// Remove current dialog and everything after it from dialogs stack
|
||||||
if (this.dialog) {
|
if (this.dialog) {
|
||||||
const dialogIndex = this.dialogsStack.indexOf(this.dialog);
|
const dialogIndex = this.dialogsStack.indexOf(this.dialog);
|
||||||
@ -476,6 +475,9 @@ export class NavigationDialogManager {
|
|||||||
// Unmount dialog
|
// Unmount dialog
|
||||||
this.unmountCurrentDialog();
|
this.unmountCurrentDialog();
|
||||||
|
|
||||||
|
// Enable xCloud's navigation polling
|
||||||
|
window.BX_EXPOSED.disableGamepadPolling = false;
|
||||||
|
|
||||||
// Show the last dialog in dialogs stack
|
// Show the last dialog in dialogs stack
|
||||||
if (this.dialogsStack.length) {
|
if (this.dialogsStack.length) {
|
||||||
this.dialogsStack[this.dialogsStack.length - 1].show();
|
this.dialogsStack[this.dialogsStack.length - 1].show();
|
||||||
@ -639,18 +641,16 @@ export class NavigationDialogManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private startGamepadPolling() {
|
private startGamepadPolling() {
|
||||||
// Stop xCloud's navigation polling
|
|
||||||
window.BX_EXPOSED.disableGamepadPolling = true;
|
|
||||||
|
|
||||||
this.stopGamepadPolling();
|
this.stopGamepadPolling();
|
||||||
|
|
||||||
|
if (isFullVersion()) {
|
||||||
this.gamepadPollingIntervalId = window.setInterval(this.pollGamepad, NavigationDialogManager.GAMEPAD_POLLING_INTERVAL);
|
this.gamepadPollingIntervalId = window.setInterval(this.pollGamepad, NavigationDialogManager.GAMEPAD_POLLING_INTERVAL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private stopGamepadPolling() {
|
private stopGamepadPolling() {
|
||||||
// Enable xCloud's navigation polling
|
|
||||||
window.BX_EXPOSED.disableGamepadPolling = false;
|
|
||||||
|
|
||||||
this.gamepadLastStates = [];
|
this.gamepadLastStates = [];
|
||||||
|
|
||||||
this.gamepadPollingIntervalId && window.clearInterval(this.gamepadPollingIntervalId);
|
this.gamepadPollingIntervalId && window.clearInterval(this.gamepadPollingIntervalId);
|
||||||
this.gamepadPollingIntervalId = null;
|
this.gamepadPollingIntervalId = null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user