Compare commits

...

3 Commits

Author SHA1 Message Date
eec41c58b6 Bump version to 1.13.1 2023-08-18 17:44:01 +07:00
38cc78e0da Bump version to 1.13.1 2023-08-18 17:43:43 +07:00
3cf029818e Fix crashing when not skipping splash video 2023-08-18 17:07:43 +07:00
2 changed files with 18 additions and 13 deletions

View File

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

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 1.13 // @version 1.13.1
// @description Improve Xbox Cloud Gaming (xCloud) experience // @description Improve Xbox Cloud Gaming (xCloud) experience
// @author redphx // @author redphx
// @license MIT // @license MIT
@ -13,7 +13,7 @@
// ==/UserScript== // ==/UserScript==
'use strict'; 'use strict';
const SCRIPT_VERSION = '1.13'; const SCRIPT_VERSION = '1.13.1';
const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud'; const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
console.log(`[Better xCloud] readyState: ${document.readyState}`); console.log(`[Better xCloud] readyState: ${document.readyState}`);
@ -325,7 +325,8 @@ class LoadingScreen {
LoadingScreen.#orgWebTitle && (document.title = LoadingScreen.#orgWebTitle); LoadingScreen.#orgWebTitle && (document.title = LoadingScreen.#orgWebTitle);
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add('better-xcloud-gone'); LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add('better-xcloud-gone');
document.querySelector('#game-stream rect[width="800"]').addEventListener('transitionend', e => { const $rocketBg = document.querySelector('#game-stream rect[width="800"]');
$rocketBg && $rocketBg.addEventListener('transitionend', e => {
LoadingScreen.#$bgStyle.textContent += ` LoadingScreen.#$bgStyle.textContent += `
#game-stream { #game-stream {
background: #000 !important; background: #000 !important;
@ -2016,7 +2017,7 @@ div[class*=NotFocusedDialog] {
height: 0px !important; height: 0px !important;
} }
#game-stream video { #game-stream video:not([src]) {
visibility: hidden; visibility: hidden;
} }
`; `;
@ -2344,7 +2345,7 @@ function interceptHttpRequests() {
} }
if (url.endsWith('/configuration') && url.includes('/sessions/cloud/') && request.method === 'GET') { if (url.endsWith('/configuration') && url.includes('/sessions/cloud/') && request.method === 'GET') {
LoadingScreen.hide(); PREF_UI_LOADING_SCREEN_GAME_ART && LoadingScreen.hide();
const promise = orgFetch(...arg); const promise = orgFetch(...arg);
if (!PREF_OVERRIDE_CONFIGURATION) { if (!PREF_OVERRIDE_CONFIGURATION) {
@ -2940,14 +2941,18 @@ function patchVideoApi() {
HTMLMediaElement.prototype.play = function() { HTMLMediaElement.prototype.play = function() {
LoadingScreen.reset(); LoadingScreen.reset();
if (PREF_SKIP_SPLASH_VIDEO && this.className.startsWith('XboxSplashVideo')) { if (this.className && this.className.startsWith('XboxSplashVideo')) {
this.volume = 0; if (PREF_SKIP_SPLASH_VIDEO) {
this.style.display = 'none'; this.volume = 0;
this.dispatchEvent(new Event('ended')); this.style.display = 'none';
this.dispatchEvent(new Event('ended'));
return { return {
catch: () => {}, catch: () => {},
}; };
}
return this.orgPlay.apply(this);
} }
this.addEventListener('playing', showFunc); this.addEventListener('playing', showFunc);