Compare commits

...

9 Commits

Author SHA1 Message Date
1f632db6b4 Bump version to 4.6.2 2024-05-30 17:24:50 +07:00
c07e3297ca Update better-xcloud.user.js 2024-05-30 17:22:19 +07:00
5e43915ff7 Add a Disable button in the MKB dialog 2024-05-30 17:22:06 +07:00
e21375821d Update better-xcloud.user.js 2024-05-30 16:46:56 +07:00
6438e533d6 Hide rocket animation in Smart TV profile 2024-05-30 16:46:48 +07:00
e9671cbe5d Fix video not being full screen (#415) 2024-05-30 16:28:05 +07:00
b99ec65cc9 Update better-xcloud.user.js 2024-05-30 09:34:47 +07:00
addcf56abf Minor fix 2024-05-30 09:22:04 +07:00
db17bda673 Bump version to 4.6.1 2024-05-30 07:09:39 +07:00
8 changed files with 94 additions and 49 deletions

View File

@ -1,5 +1,5 @@
// ==UserScript==
// @name Better xCloud
// @namespace https://github.com/redphx
// @version 4.6.0
// @version 4.6.2
// ==/UserScript==

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name Better xCloud
// @namespace https://github.com/redphx
// @version 4.6.0
// @version 4.6.2
// @description Improve Xbox Cloud Gaming (xCloud) experience
// @author redphx
// @license MIT
@ -104,7 +104,7 @@ class UserAgent {
}
// 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 AppInterface = window.AppInterface;
UserAgent.init();
@ -2208,7 +2208,6 @@ class Preferences {
const setting = Preferences.SETTINGS[settingId];
if (setting.migrate && settingId in savedPrefs) {
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
delete setting.migrate;
}
setting.ready && setting.ready.call(this, setting);
}
@ -3275,15 +3274,23 @@ class MkbHandler {
}
this.#mouseDataProvider.init();
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,
label: t("edit"),
style: ButtonStyle.PRIMARY,
onClick: (e) => {
e.preventDefault();
e.stopPropagation();
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));
document.documentElement.appendChild(this.#$message);
window.addEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this.#onPollingModeChanged);
@ -3879,6 +3886,10 @@ class LoadingScreen {
#game-stream div[class*=RocketAnimation-module__container] > svg {
display: none;
}
#game-stream video[class*=RocketAnimationVideo-module__video] {
display: none;
}
`;
$bgStyle.textContent += css;
}
@ -3967,8 +3978,8 @@ class LoadingScreen {
LoadingScreen.reset();
}
static reset() {
LoadingScreen.#$bgStyle && setTimeout(() => LoadingScreen.#$bgStyle.textContent = "", 2000);
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add("bx-gone");
LoadingScreen.#$bgStyle && (LoadingScreen.#$bgStyle.textContent = "");
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
LoadingScreen.#waitTimeInterval = null;
}
@ -5109,11 +5120,11 @@ var resizeVideoPlayer = function() {
width = parentRect.width;
height = width / videoRatio;
}
width = Math.floor(width);
height = Math.floor(height);
width = Math.min(parentRect.width, Math.ceil(width));
height = Math.min(parentRect.height, Math.ceil(height));
$video.style.width = `${width}px`;
$video.style.height = `${height}px`;
$video.style.objectFit = "scale-down";
$video.style.objectFit = "fill";
} else {
$video.style.width = "100%";
$video.style.height = "100%";
@ -6053,7 +6064,7 @@ div[class*=NotFocusedDialog] {
height: var(--bx-button-height);
line-height: var(--bx-button-height);
vertical-align: middle;
vertical-align: -webkit-baseline-middle;
/* vertical-align: -webkit-baseline-middle; */
color: #fff;
overflow: hidden;
white-space: nowrap;
@ -7013,7 +7024,6 @@ div[data-testid=media-container].bx-taking-screenshot:before {
color: #fff;
}
.bx-mkb-pointer-lock-msg {
display: flex;
cursor: pointer;
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 {
background: #151515;
}
.bx-mkb-pointer-lock-msg button {
margin-right: 12px;
height: 60px;
}
.bx-mkb-pointer-lock-msg svg {
width: 32px;
}
.bx-mkb-pointer-lock-msg div {
.bx-mkb-pointer-lock-msg > div:first-of-type {
display: flex;
flex-direction: column;
text-align: left;
@ -7060,6 +7063,21 @@ div[data-testid=media-container].bx-taking-screenshot:before {
font-size: 14px;
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 {
display: flex;
margin-bottom: 12px;

View File

@ -74,7 +74,7 @@
height: var(--bx-button-height);
line-height: var(--bx-button-height);
vertical-align: middle;
vertical-align: -webkit-baseline-middle;
/* vertical-align: -webkit-baseline-middle; */
color: #fff;
overflow: hidden;
white-space: nowrap;

View File

@ -16,7 +16,6 @@
}
.bx-mkb-pointer-lock-msg {
display: flex;
cursor: pointer;
user-select: none;
-webkit-user-select: none;
@ -41,16 +40,7 @@
background: #151515;
}
button {
margin-right: 12px;
height: 60px;
}
svg {
width: 32px;
}
div {
> div:first-of-type {
display: flex;
flex-direction: column;
text-align: left;
@ -69,6 +59,26 @@
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 {

View File

@ -46,6 +46,10 @@ export class LoadingScreen {
#game-stream div[class*=RocketAnimation-module__container] > svg {
display: none;
}
#game-stream video[class*=RocketAnimationVideo-module__video] {
display: none;
}
`;
$bgStyle.textContent += css;
}
@ -163,9 +167,9 @@ export class LoadingScreen {
}
static reset() {
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add('bx-gone');
LoadingScreen.#$bgStyle && (LoadingScreen.#$bgStyle.textContent = '');
LoadingScreen.#$bgStyle && setTimeout(() => LoadingScreen.#$bgStyle.textContent = '', 2000);
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add('bx-gone');
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
LoadingScreen.#waitTimeInterval = null;
}

View File

@ -464,20 +464,34 @@ export class MkbHandler {
window.addEventListener('keydown', this.#onKeyboardEvent);
this.#$message = CE('div', {'class': 'bx-mkb-pointer-lock-msg bx-gone'},
createButton({
icon: BxIcon.MOUSE_SETTINGS,
style: ButtonStyle.PRIMARY,
onClick: e => {
e.preventDefault();
e.stopPropagation();
showStreamSettings('mkb');
},
}),
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,
label: t('edit'),
style: ButtonStyle.PRIMARY,
onClick: e => {
e.preventDefault();
e.stopPropagation();
showStreamSettings('mkb');
},
}),
createButton({
label: t('disable'),
onClick: e => {
e.preventDefault();
e.stopPropagation();
this.toggle();
},
}),
),
);
this.#$message.addEventListener('click', this.start.bind(this));

View File

@ -485,13 +485,13 @@ function resizeVideoPlayer() {
}
// Prevent floating points
width = Math.floor(width);
height = Math.floor(height);
width = Math.min(parentRect.width, Math.ceil(width));
height = Math.min(parentRect.height, Math.ceil(height));
// Update size
$video.style.width = `${width}px`;
$video.style.height = `${height}px`;
$video.style.objectFit = 'scale-down';
$video.style.objectFit = 'fill';
} else {
$video.style.width = '100%';
$video.style.height = '100%';

View File

@ -703,7 +703,6 @@ export class Preferences {
if (setting.migrate && settingId in savedPrefs) {
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
delete setting.migrate;
}
setting.ready && setting.ready.call(this, setting);
@ -717,7 +716,7 @@ export class Preferences {
continue;
}
// Ignore deprecated settings
// Ignore deprecated/migrated settings
if (setting.migrate) {
continue;
}