Add "Reload stream" & "Back to home" buttons in the Guide menu

This commit is contained in:
redphx
2024-06-01 16:29:01 +07:00
parent 322418ec5b
commit 8f9976da28
4 changed files with 57 additions and 11 deletions

View File

@@ -340,15 +340,17 @@ export class StreamBadges {
window.addEventListener(BxEvent.XCLOUD_GUIDE_SHOWN, async e => {
const where = (e as any).where as XcloudGuideWhere;
if (where === XcloudGuideWhere.HOME && STATES.isPlaying) {
const $btnQuit = document.querySelector('#gamepass-dialog-root a[class*=QuitGameButton]');
if (!$btnQuit) {
return;
}
// Add badges
$btnQuit.insertAdjacentElement('beforebegin', await StreamBadges.getInstance().render());
if (where !== XcloudGuideWhere.HOME || !STATES.isPlaying) {
return;
}
const $btnQuit = document.querySelector('#gamepass-dialog-root a[class*=QuitGameButton]');
if (!$btnQuit) {
return;
}
// Add badges
$btnQuit.insertAdjacentElement('beforebegin', await StreamBadges.getInstance().render());
});
}
}