diff --git a/dist/better-xcloud.lite.user.js b/dist/better-xcloud.lite.user.js index b180425..ebc7541 100755 --- a/dist/better-xcloud.lite.user.js +++ b/dist/better-xcloud.lite.user.js @@ -407,7 +407,7 @@ var SUPPORTED_LANGUAGES = { "how-to-fix": "How to fix", "how-to-improve-app-performance": "How to improve app's performance", ignore: "Ignore", - "image-quality": "Image quality", + "image-quality": "Website's image quality", import: "Import", "in-game-controller-customization": "In-game controller customization", "in-game-controller-shortcuts": "In-game controller shortcuts", @@ -5378,7 +5378,10 @@ class LoadingScreen { } static setBackground(imageUrl) { let $bgStyle = LoadingScreen.$bgStyle; - imageUrl = imageUrl + "?w=1920", $bgStyle.textContent += '#game-stream{background-color:transparent !important;background-position:center center !important;background-repeat:no-repeat !important;background-size:cover !important}#game-stream rect[width="800"]{transition:opacity .3s ease-in-out !important}' + `#game-stream {background-image: linear-gradient(#00000033, #000000e6), url(${imageUrl}) !important;}`; + imageUrl = imageUrl + "?w=1920"; + let imageQuality = getPref("ui.imageQuality"); + if (imageQuality !== 90) imageUrl += "&q=" + imageQuality; + $bgStyle.textContent += '#game-stream{background-color:transparent !important;background-position:center center !important;background-repeat:no-repeat !important;background-size:cover !important}#game-stream rect[width="800"]{transition:opacity .3s ease-in-out !important}' + `#game-stream {background-image: linear-gradient(#00000033, #000000e6), url(${imageUrl}) !important;}`; let bg = new Image; bg.onload = (e) => { $bgStyle.textContent += '#game-stream rect[width="800"]{opacity:0 !important}'; diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index d0995bb..9af75ce 100755 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -439,7 +439,7 @@ var SUPPORTED_LANGUAGES = { "how-to-fix": "How to fix", "how-to-improve-app-performance": "How to improve app's performance", ignore: "Ignore", - "image-quality": "Image quality", + "image-quality": "Website's image quality", import: "Import", "in-game-controller-customization": "In-game controller customization", "in-game-controller-shortcuts": "In-game controller shortcuts", @@ -4882,6 +4882,11 @@ ${subsVar} = subs; index = PatcherUtils.indexOf(str, "return", index, 200); let newCode = `${paramVar}.set('q', ${getPref("ui.imageQuality")});`; return str = PatcherUtils.insertAt(str, index, newCode), str; + }, + setBackgroundImageQuality(str) { + let index = str.indexOf("}?w=${"); + if (index > -1 && (index = PatcherUtils.indexOf(str, "}", index + 1, 10, !0)), index < 0) return !1; + return str = PatcherUtils.insertAt(str, index, `&q=${getPref("ui.imageQuality")}`), str; } }, PATCH_ORDERS = PatcherUtils.filterPatches([ ...AppInterface && getPref("nativeMkb.mode") === "on" ? [ @@ -4891,7 +4896,10 @@ ${subsVar} = subs; ] : [], "exposeReactCreateComponent", "gameCardCustomIcons", - getPref("ui.imageQuality") < 90 && "setImageQuality", + ...getPref("ui.imageQuality") < 90 ? [ + "setImageQuality", + "setBackgroundImageQuality" + ] : [], "modifyPreloadedState", "optimizeGameSlugGenerator", "detectBrowserRouterReady", @@ -7974,7 +7982,10 @@ class LoadingScreen { } static setBackground(imageUrl) { let $bgStyle = LoadingScreen.$bgStyle; - imageUrl = imageUrl + "?w=1920", $bgStyle.textContent += '#game-stream{background-color:transparent !important;background-position:center center !important;background-repeat:no-repeat !important;background-size:cover !important}#game-stream rect[width="800"]{transition:opacity .3s ease-in-out !important}' + `#game-stream {background-image: linear-gradient(#00000033, #000000e6), url(${imageUrl}) !important;}`; + imageUrl = imageUrl + "?w=1920"; + let imageQuality = getPref("ui.imageQuality"); + if (imageQuality !== 90) imageUrl += "&q=" + imageQuality; + $bgStyle.textContent += '#game-stream{background-color:transparent !important;background-position:center center !important;background-repeat:no-repeat !important;background-size:cover !important}#game-stream rect[width="800"]{transition:opacity .3s ease-in-out !important}' + `#game-stream {background-image: linear-gradient(#00000033, #000000e6), url(${imageUrl}) !important;}`; let bg = new Image; bg.onload = (e) => { $bgStyle.textContent += '#game-stream rect[width="800"]{opacity:0 !important}'; diff --git a/src/modules/loading-screen.ts b/src/modules/loading-screen.ts index 3e0a248..c7b7853 100755 --- a/src/modules/loading-screen.ts +++ b/src/modules/loading-screen.ts @@ -63,6 +63,11 @@ export class LoadingScreen { // Limit max width to reduce image size imageUrl = imageUrl + '?w=1920'; + const imageQuality = getPref(PrefKey.UI_IMAGE_QUALITY); + if (imageQuality !== 90) { + imageUrl += '&q=' + imageQuality; + } + $bgStyle.textContent! += compressCss(` #game-stream { background-color: transparent !important; diff --git a/src/modules/patcher/patcher.ts b/src/modules/patcher/patcher.ts index 2cb653d..71c2d7c 100755 --- a/src/modules/patcher/patcher.ts +++ b/src/modules/patcher/patcher.ts @@ -1103,6 +1103,18 @@ ${subsVar} = subs; return str; }, + + setBackgroundImageQuality(str: string) { + let index = str.indexOf('}?w=${'); + index > -1 && (index = PatcherUtils.indexOf(str, '}', index + 1, 10, true)); + + if (index < 0) { + return false; + } + + str = PatcherUtils.insertAt(str, index, `&q=${getPref(PrefKey.UI_IMAGE_QUALITY)}`); + return str; + } }; let PATCH_ORDERS = PatcherUtils.filterPatches([ @@ -1116,7 +1128,10 @@ let PATCH_ORDERS = PatcherUtils.filterPatches([ 'gameCardCustomIcons', // 'gameCardPassTitle', - getPref(PrefKey.UI_IMAGE_QUALITY) < 90 && 'setImageQuality', + ...(getPref(PrefKey.UI_IMAGE_QUALITY) < 90 ? [ + 'setImageQuality', + 'setBackgroundImageQuality', + ] : []), 'modifyPreloadedState', diff --git a/src/utils/translation.ts b/src/utils/translation.ts index 3ed0c80..6b258b1 100755 --- a/src/utils/translation.ts +++ b/src/utils/translation.ts @@ -151,7 +151,7 @@ const Texts = { "how-to-fix": "How to fix", "how-to-improve-app-performance": "How to improve app's performance", "ignore": "Ignore", - "image-quality": "Image quality", + "image-quality": "Website's image quality", "import": "Import", "in-game-controller-customization": "In-game controller customization", "in-game-controller-shortcuts": "In-game controller shortcuts",