mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-03 06:07: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==
|
||||
// @name Better xCloud (Lite)
|
||||
// @namespace https://github.com/redphx
|
||||
// @version 6.2.1
|
||||
// @version 6.2.2
|
||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||
// @author redphx
|
||||
// @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();
|
||||
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,
|
||||
@ -3784,15 +3784,15 @@ class NavigationDialogManager {
|
||||
this.gamepadHoldingIntervalId && window.clearInterval(this.gamepadHoldingIntervalId), this.gamepadHoldingIntervalId = null;
|
||||
}
|
||||
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() {
|
||||
if (!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 (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.stopGamepadPolling(), this.dialog) {
|
||||
let dialogIndex = this.dialogsStack.indexOf(this.dialog);
|
||||
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) {
|
||||
if (!$elm) return !1;
|
||||
@ -3862,10 +3862,10 @@ class NavigationDialogManager {
|
||||
return null;
|
||||
}
|
||||
startGamepadPolling() {
|
||||
window.BX_EXPOSED.disableGamepadPolling = !0, this.stopGamepadPolling(), this.gamepadPollingIntervalId = window.setInterval(this.pollGamepad, NavigationDialogManager.GAMEPAD_POLLING_INTERVAL);
|
||||
this.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) {
|
||||
let dialog = this.dialog;
|
||||
|
2
dist/better-xcloud.meta.js
vendored
2
dist/better-xcloud.meta.js
vendored
@ -1,5 +1,5 @@
|
||||
// ==UserScript==
|
||||
// @name Better xCloud
|
||||
// @namespace https://github.com/redphx
|
||||
// @version 6.2.1
|
||||
// @version 6.2.2
|
||||
// ==/UserScript==
|
||||
|
16
dist/better-xcloud.user.js
vendored
16
dist/better-xcloud.user.js
vendored
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name Better xCloud
|
||||
// @namespace https://github.com/redphx
|
||||
// @version 6.2.1
|
||||
// @version 6.2.2
|
||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||
// @author redphx
|
||||
// @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();
|
||||
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,
|
||||
@ -3911,15 +3911,15 @@ class NavigationDialogManager {
|
||||
this.gamepadHoldingIntervalId && window.clearInterval(this.gamepadHoldingIntervalId), this.gamepadHoldingIntervalId = null;
|
||||
}
|
||||
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() {
|
||||
if (this.clearGamepadHoldingInterval(), this.stopGamepadPolling(), !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 (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.stopGamepadPolling(), this.dialog) {
|
||||
let dialogIndex = this.dialogsStack.indexOf(this.dialog);
|
||||
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) {
|
||||
if (!$elm) return !1;
|
||||
@ -3989,10 +3989,10 @@ class NavigationDialogManager {
|
||||
return null;
|
||||
}
|
||||
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() {
|
||||
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) {
|
||||
let dialog = this.dialog;
|
||||
|
@ -410,6 +410,9 @@ export class NavigationDialogManager {
|
||||
|
||||
BxEventBus.Script.emit('dialog.shown', {});
|
||||
|
||||
// Stop xCloud's navigation polling
|
||||
window.BX_EXPOSED.disableGamepadPolling = true;
|
||||
|
||||
// Lock scroll bar
|
||||
document.body.classList.add('bx-no-scroll');
|
||||
|
||||
@ -436,18 +439,11 @@ export class NavigationDialogManager {
|
||||
this.$container.addEventListener('keydown', this);
|
||||
|
||||
// Start gamepad polling
|
||||
if (isFullVersion()) {
|
||||
this.startGamepadPolling();
|
||||
}
|
||||
this.startGamepadPolling();
|
||||
}
|
||||
|
||||
hide() {
|
||||
// Stop gamepad polling
|
||||
if (isFullVersion()) {
|
||||
this.clearGamepadHoldingInterval();
|
||||
this.stopGamepadPolling();
|
||||
}
|
||||
|
||||
this.clearGamepadHoldingInterval();
|
||||
if (!this.isShowing()) {
|
||||
return;
|
||||
}
|
||||
@ -465,6 +461,9 @@ export class NavigationDialogManager {
|
||||
// Remove event listeners
|
||||
this.$container.removeEventListener('keydown', this);
|
||||
|
||||
// Stop gamepad polling
|
||||
this.stopGamepadPolling();
|
||||
|
||||
// Remove current dialog and everything after it from dialogs stack
|
||||
if (this.dialog) {
|
||||
const dialogIndex = this.dialogsStack.indexOf(this.dialog);
|
||||
@ -476,6 +475,9 @@ export class NavigationDialogManager {
|
||||
// Unmount dialog
|
||||
this.unmountCurrentDialog();
|
||||
|
||||
// Enable xCloud's navigation polling
|
||||
window.BX_EXPOSED.disableGamepadPolling = false;
|
||||
|
||||
// Show the last dialog in dialogs stack
|
||||
if (this.dialogsStack.length) {
|
||||
this.dialogsStack[this.dialogsStack.length - 1].show();
|
||||
@ -639,18 +641,16 @@ export class NavigationDialogManager {
|
||||
}
|
||||
|
||||
private startGamepadPolling() {
|
||||
// Stop xCloud's navigation polling
|
||||
window.BX_EXPOSED.disableGamepadPolling = true;
|
||||
|
||||
this.stopGamepadPolling();
|
||||
this.gamepadPollingIntervalId = window.setInterval(this.pollGamepad, NavigationDialogManager.GAMEPAD_POLLING_INTERVAL);
|
||||
|
||||
if (isFullVersion()) {
|
||||
this.gamepadPollingIntervalId = window.setInterval(this.pollGamepad, NavigationDialogManager.GAMEPAD_POLLING_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
private stopGamepadPolling() {
|
||||
// Enable xCloud's navigation polling
|
||||
window.BX_EXPOSED.disableGamepadPolling = false;
|
||||
|
||||
this.gamepadLastStates = [];
|
||||
|
||||
this.gamepadPollingIntervalId && window.clearInterval(this.gamepadPollingIntervalId);
|
||||
this.gamepadPollingIntervalId = null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user