mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-07-03 04:41:42 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
1f632db6b4 | |||
c07e3297ca | |||
5e43915ff7 | |||
e21375821d | |||
6438e533d6 | |||
e9671cbe5d | |||
b99ec65cc9 | |||
addcf56abf | |||
db17bda673 |
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 4.6.0
|
// @version 4.6.2
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
56
dist/better-xcloud.user.js
vendored
56
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 4.6.0
|
// @version 4.6.2
|
||||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||||
// @author redphx
|
// @author redphx
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@ -104,7 +104,7 @@ class UserAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// src/utils/global.ts
|
// src/utils/global.ts
|
||||||
var SCRIPT_VERSION = "4.6.0";
|
var SCRIPT_VERSION = "4.6.2";
|
||||||
var SCRIPT_HOME = "https://github.com/redphx/better-xcloud";
|
var SCRIPT_HOME = "https://github.com/redphx/better-xcloud";
|
||||||
var AppInterface = window.AppInterface;
|
var AppInterface = window.AppInterface;
|
||||||
UserAgent.init();
|
UserAgent.init();
|
||||||
@ -2208,7 +2208,6 @@ class Preferences {
|
|||||||
const setting = Preferences.SETTINGS[settingId];
|
const setting = Preferences.SETTINGS[settingId];
|
||||||
if (setting.migrate && settingId in savedPrefs) {
|
if (setting.migrate && settingId in savedPrefs) {
|
||||||
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
|
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
|
||||||
delete setting.migrate;
|
|
||||||
}
|
}
|
||||||
setting.ready && setting.ready.call(this, setting);
|
setting.ready && setting.ready.call(this, setting);
|
||||||
}
|
}
|
||||||
@ -3275,15 +3274,23 @@ class MkbHandler {
|
|||||||
}
|
}
|
||||||
this.#mouseDataProvider.init();
|
this.#mouseDataProvider.init();
|
||||||
window.addEventListener("keydown", this.#onKeyboardEvent);
|
window.addEventListener("keydown", this.#onKeyboardEvent);
|
||||||
this.#$message = CE("div", { class: "bx-mkb-pointer-lock-msg bx-gone" }, createButton({
|
this.#$message = CE("div", { class: "bx-mkb-pointer-lock-msg bx-gone" }, CE("div", {}, CE("p", {}, t("mkb-click-to-activate")), CE("p", {}, t("press-key-to-toggle-mkb", { key: "F8" }))), CE("div", {}, createButton({
|
||||||
icon: BxIcon.MOUSE_SETTINGS,
|
icon: BxIcon.MOUSE_SETTINGS,
|
||||||
|
label: t("edit"),
|
||||||
style: ButtonStyle.PRIMARY,
|
style: ButtonStyle.PRIMARY,
|
||||||
onClick: (e) => {
|
onClick: (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
showStreamSettings("mkb");
|
showStreamSettings("mkb");
|
||||||
}
|
}
|
||||||
}), CE("div", {}, CE("p", {}, t("mkb-click-to-activate")), CE("p", {}, t("press-key-to-toggle-mkb", { key: "F8" }))));
|
}), createButton({
|
||||||
|
label: t("disable"),
|
||||||
|
onClick: (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.toggle();
|
||||||
|
}
|
||||||
|
})));
|
||||||
this.#$message.addEventListener("click", this.start.bind(this));
|
this.#$message.addEventListener("click", this.start.bind(this));
|
||||||
document.documentElement.appendChild(this.#$message);
|
document.documentElement.appendChild(this.#$message);
|
||||||
window.addEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this.#onPollingModeChanged);
|
window.addEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this.#onPollingModeChanged);
|
||||||
@ -3879,6 +3886,10 @@ class LoadingScreen {
|
|||||||
#game-stream div[class*=RocketAnimation-module__container] > svg {
|
#game-stream div[class*=RocketAnimation-module__container] > svg {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#game-stream video[class*=RocketAnimationVideo-module__video] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
$bgStyle.textContent += css;
|
$bgStyle.textContent += css;
|
||||||
}
|
}
|
||||||
@ -3967,8 +3978,8 @@ class LoadingScreen {
|
|||||||
LoadingScreen.reset();
|
LoadingScreen.reset();
|
||||||
}
|
}
|
||||||
static reset() {
|
static reset() {
|
||||||
|
LoadingScreen.#$bgStyle && setTimeout(() => LoadingScreen.#$bgStyle.textContent = "", 2000);
|
||||||
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add("bx-gone");
|
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add("bx-gone");
|
||||||
LoadingScreen.#$bgStyle && (LoadingScreen.#$bgStyle.textContent = "");
|
|
||||||
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
|
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
|
||||||
LoadingScreen.#waitTimeInterval = null;
|
LoadingScreen.#waitTimeInterval = null;
|
||||||
}
|
}
|
||||||
@ -5109,11 +5120,11 @@ var resizeVideoPlayer = function() {
|
|||||||
width = parentRect.width;
|
width = parentRect.width;
|
||||||
height = width / videoRatio;
|
height = width / videoRatio;
|
||||||
}
|
}
|
||||||
width = Math.floor(width);
|
width = Math.min(parentRect.width, Math.ceil(width));
|
||||||
height = Math.floor(height);
|
height = Math.min(parentRect.height, Math.ceil(height));
|
||||||
$video.style.width = `${width}px`;
|
$video.style.width = `${width}px`;
|
||||||
$video.style.height = `${height}px`;
|
$video.style.height = `${height}px`;
|
||||||
$video.style.objectFit = "scale-down";
|
$video.style.objectFit = "fill";
|
||||||
} else {
|
} else {
|
||||||
$video.style.width = "100%";
|
$video.style.width = "100%";
|
||||||
$video.style.height = "100%";
|
$video.style.height = "100%";
|
||||||
@ -6053,7 +6064,7 @@ div[class*=NotFocusedDialog] {
|
|||||||
height: var(--bx-button-height);
|
height: var(--bx-button-height);
|
||||||
line-height: var(--bx-button-height);
|
line-height: var(--bx-button-height);
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
vertical-align: -webkit-baseline-middle;
|
/* vertical-align: -webkit-baseline-middle; */
|
||||||
color: #fff;
|
color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@ -7013,7 +7024,6 @@ div[data-testid=media-container].bx-taking-screenshot:before {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
.bx-mkb-pointer-lock-msg {
|
.bx-mkb-pointer-lock-msg {
|
||||||
display: flex;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
@ -7037,14 +7047,7 @@ div[data-testid=media-container].bx-taking-screenshot:before {
|
|||||||
.bx-mkb-pointer-lock-msg:hover {
|
.bx-mkb-pointer-lock-msg:hover {
|
||||||
background: #151515;
|
background: #151515;
|
||||||
}
|
}
|
||||||
.bx-mkb-pointer-lock-msg button {
|
.bx-mkb-pointer-lock-msg > div:first-of-type {
|
||||||
margin-right: 12px;
|
|
||||||
height: 60px;
|
|
||||||
}
|
|
||||||
.bx-mkb-pointer-lock-msg svg {
|
|
||||||
width: 32px;
|
|
||||||
}
|
|
||||||
.bx-mkb-pointer-lock-msg div {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -7060,6 +7063,21 @@ div[data-testid=media-container].bx-taking-screenshot:before {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
.bx-mkb-pointer-lock-msg > div:last-of-type {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row;
|
||||||
|
margin-top: 10px;
|
||||||
|
button
|
||||||
|
}
|
||||||
|
.bx-mkb-pointer-lock-msg > div:last-of-type button {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.bx-mkb-pointer-lock-msg > div:last-of-type button:first-of-type {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
.bx-mkb-pointer-lock-msg > div:last-of-type button:last-of-type {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
.bx-mkb-preset-tools {
|
.bx-mkb-preset-tools {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
height: var(--bx-button-height);
|
height: var(--bx-button-height);
|
||||||
line-height: var(--bx-button-height);
|
line-height: var(--bx-button-height);
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
vertical-align: -webkit-baseline-middle;
|
/* vertical-align: -webkit-baseline-middle; */
|
||||||
color: #fff;
|
color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bx-mkb-pointer-lock-msg {
|
.bx-mkb-pointer-lock-msg {
|
||||||
display: flex;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
@ -41,16 +40,7 @@
|
|||||||
background: #151515;
|
background: #151515;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
> div:first-of-type {
|
||||||
margin-right: 12px;
|
|
||||||
height: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
svg {
|
|
||||||
width: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -69,6 +59,26 @@
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> div:last-of-type {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
&:first-of-type {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-of-type {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.bx-mkb-preset-tools {
|
.bx-mkb-preset-tools {
|
||||||
|
@ -46,6 +46,10 @@ export class LoadingScreen {
|
|||||||
#game-stream div[class*=RocketAnimation-module__container] > svg {
|
#game-stream div[class*=RocketAnimation-module__container] > svg {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#game-stream video[class*=RocketAnimationVideo-module__video] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
$bgStyle.textContent += css;
|
$bgStyle.textContent += css;
|
||||||
}
|
}
|
||||||
@ -163,9 +167,9 @@ export class LoadingScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static reset() {
|
static reset() {
|
||||||
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add('bx-gone');
|
LoadingScreen.#$bgStyle && setTimeout(() => LoadingScreen.#$bgStyle.textContent = '', 2000);
|
||||||
LoadingScreen.#$bgStyle && (LoadingScreen.#$bgStyle.textContent = '');
|
|
||||||
|
|
||||||
|
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add('bx-gone');
|
||||||
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
|
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
|
||||||
LoadingScreen.#waitTimeInterval = null;
|
LoadingScreen.#waitTimeInterval = null;
|
||||||
}
|
}
|
||||||
|
@ -464,8 +464,15 @@ export class MkbHandler {
|
|||||||
window.addEventListener('keydown', this.#onKeyboardEvent);
|
window.addEventListener('keydown', this.#onKeyboardEvent);
|
||||||
|
|
||||||
this.#$message = CE('div', {'class': 'bx-mkb-pointer-lock-msg bx-gone'},
|
this.#$message = CE('div', {'class': 'bx-mkb-pointer-lock-msg bx-gone'},
|
||||||
|
CE('div', {},
|
||||||
|
CE('p', {}, t('mkb-click-to-activate')),
|
||||||
|
CE('p', {}, t('press-key-to-toggle-mkb', {key: 'F8'})),
|
||||||
|
),
|
||||||
|
|
||||||
|
CE('div', {},
|
||||||
createButton({
|
createButton({
|
||||||
icon: BxIcon.MOUSE_SETTINGS,
|
icon: BxIcon.MOUSE_SETTINGS,
|
||||||
|
label: t('edit'),
|
||||||
style: ButtonStyle.PRIMARY,
|
style: ButtonStyle.PRIMARY,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -474,9 +481,16 @@ export class MkbHandler {
|
|||||||
showStreamSettings('mkb');
|
showStreamSettings('mkb');
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
CE('div', {},
|
|
||||||
CE('p', {}, t('mkb-click-to-activate')),
|
createButton({
|
||||||
CE('p', {}, t('press-key-to-toggle-mkb', {key: 'F8'})),
|
label: t('disable'),
|
||||||
|
onClick: e => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
this.toggle();
|
||||||
|
},
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -485,13 +485,13 @@ function resizeVideoPlayer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prevent floating points
|
// Prevent floating points
|
||||||
width = Math.floor(width);
|
width = Math.min(parentRect.width, Math.ceil(width));
|
||||||
height = Math.floor(height);
|
height = Math.min(parentRect.height, Math.ceil(height));
|
||||||
|
|
||||||
// Update size
|
// Update size
|
||||||
$video.style.width = `${width}px`;
|
$video.style.width = `${width}px`;
|
||||||
$video.style.height = `${height}px`;
|
$video.style.height = `${height}px`;
|
||||||
$video.style.objectFit = 'scale-down';
|
$video.style.objectFit = 'fill';
|
||||||
} else {
|
} else {
|
||||||
$video.style.width = '100%';
|
$video.style.width = '100%';
|
||||||
$video.style.height = '100%';
|
$video.style.height = '100%';
|
||||||
|
@ -703,7 +703,6 @@ export class Preferences {
|
|||||||
|
|
||||||
if (setting.migrate && settingId in savedPrefs) {
|
if (setting.migrate && settingId in savedPrefs) {
|
||||||
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
|
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
|
||||||
delete setting.migrate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setting.ready && setting.ready.call(this, setting);
|
setting.ready && setting.ready.call(this, setting);
|
||||||
@ -717,7 +716,7 @@ export class Preferences {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore deprecated settings
|
// Ignore deprecated/migrated settings
|
||||||
if (setting.migrate) {
|
if (setting.migrate) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user