mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-03 06:07:19 +02:00
Set background image's quality
This commit is contained in:
parent
de21549e0d
commit
b3697df8dc
7
dist/better-xcloud.lite.user.js
vendored
7
dist/better-xcloud.lite.user.js
vendored
@ -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}';
|
||||
|
17
dist/better-xcloud.user.js
vendored
17
dist/better-xcloud.user.js
vendored
@ -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}';
|
||||
|
@ -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;
|
||||
|
@ -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',
|
||||
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user