mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-01 13:17:20 +02:00
Inject Better xCloud button to Remote Play page's header
This commit is contained in:
parent
e3789b4fb7
commit
3bfa7e5f21
8
dist/better-xcloud.pretty.user.js
vendored
8
dist/better-xcloud.pretty.user.js
vendored
@ -5113,7 +5113,7 @@ class PatcherUtils {
|
||||
static patchBeforePageLoad(str, page) {
|
||||
let index = str.indexOf(`chunkName:()=>"${page}-page",`);
|
||||
if (index < 0) return !1;
|
||||
return str = PatcherUtils.replaceAfterIndex(str, "requireAsync(e){", `requireAsync(e){window.BX_EXPOSED.beforePageLoad("${page}");`, index), str = PatcherUtils.replaceAfterIndex(str, "requireSync(e){", `requireSync(e){window.BX_EXPOSED.beforePageLoad("${page}");`, index), console.log(str), str;
|
||||
return str = PatcherUtils.replaceAfterIndex(str, "requireAsync(e){", `requireAsync(e){window.BX_EXPOSED.beforePageLoad("${page}");`, index), str = PatcherUtils.replaceAfterIndex(str, "requireSync(e){", `requireSync(e){window.BX_EXPOSED.beforePageLoad("${page}");`, index), str;
|
||||
}
|
||||
static isVarCharacter(char) {
|
||||
let code = char.charCodeAt(0), isUppercase = code >= 65 && code <= 90, isLowercase = code >= 97 && code <= 122, isDigit = code >= 48 && code <= 57;
|
||||
@ -5622,7 +5622,7 @@ ${subsVar} = subs;
|
||||
return str = PatcherUtils.insertAt(str, index, `&q=${getGlobalPref("ui.imageQuality")}`), str;
|
||||
},
|
||||
injectHeaderUseEffect(str) {
|
||||
let index = str.indexOf('"EdgewaterHeader-module__spaceBetween');
|
||||
let index = str.indexOf('className:"Header-module__header');
|
||||
if (index > -1 && (index = PatcherUtils.lastIndexOf(str, "return", index, 300)), index < 0) return !1;
|
||||
return PatcherUtils.injectUseEffect(str, index, "Script", "ui.header.rendered");
|
||||
},
|
||||
@ -8361,7 +8361,9 @@ class HeaderSection {
|
||||
});
|
||||
}
|
||||
checkHeader = () => {
|
||||
let $target = document.querySelector("#PageContent div[class*=EdgewaterHeader-module__rightSectionSpacing]");
|
||||
let $header = document.querySelector("#gamepass-root header[class^=Header-module__header]");
|
||||
if (!$header) return;
|
||||
let $target = $header.querySelector("div[class*=EdgewaterHeader-module__rightSectionSpacing], div[class*=RemotePlayHeader-module__rightSectionSpacing]");
|
||||
if (!$target) $target = document.querySelector("div[class^=UnsupportedMarketPage-module__buttons]");
|
||||
if ($target?.appendChild(this.$buttonsWrapper), !STATES.isSignedIn) BxEventBus.Script.emit("xcloud.server", { status: "signed-out" });
|
||||
};
|
||||
|
6
dist/better-xcloud.user.js
vendored
6
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -54,7 +54,7 @@ export class PatcherUtils {
|
||||
|
||||
str = PatcherUtils.replaceAfterIndex(str, 'requireAsync(e){', `requireAsync(e){window.BX_EXPOSED.beforePageLoad("${page}");`, index);
|
||||
str = PatcherUtils.replaceAfterIndex(str, 'requireSync(e){', `requireSync(e){window.BX_EXPOSED.beforePageLoad("${page}");`, index);
|
||||
console.log(str);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -1091,7 +1091,7 @@ ${subsVar} = subs;
|
||||
},
|
||||
|
||||
injectHeaderUseEffect(str: string) {
|
||||
let index = str.indexOf('"EdgewaterHeader-module__spaceBetween');
|
||||
let index = str.indexOf('className:"Header-module__header');
|
||||
index > -1 && (index = PatcherUtils.lastIndexOf(str, 'return', index, 300));
|
||||
if (index < 0) {
|
||||
return false;
|
||||
|
@ -75,7 +75,12 @@ export class HeaderSection {
|
||||
}
|
||||
|
||||
checkHeader = () => {
|
||||
let $target = document.querySelector('#PageContent div[class*=EdgewaterHeader-module__rightSectionSpacing]');
|
||||
const $header = document.querySelector('#gamepass-root header[class^=Header-module__header]');
|
||||
if (!$header) {
|
||||
return;
|
||||
}
|
||||
|
||||
let $target = $header.querySelector('div[class*=EdgewaterHeader-module__rightSectionSpacing], div[class*=RemotePlayHeader-module__rightSectionSpacing]');
|
||||
if (!$target) {
|
||||
$target = document.querySelector('div[class^=UnsupportedMarketPage-module__buttons]');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user