Inject Better xCloud button to Remote Play page's header

This commit is contained in:
redphx
2025-04-26 08:22:20 +07:00
parent e3789b4fb7
commit 3bfa7e5f21
5 changed files with 16 additions and 9 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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]');
}