mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Update Guide menu detection
This commit is contained in:
parent
00ebb3f672
commit
3a16187504
19
src/index.ts
19
src/index.ts
@ -219,15 +219,18 @@ function observeRootDialog($root: HTMLElement) {
|
|||||||
const $addedElm = mutation.addedNodes[0];
|
const $addedElm = mutation.addedNodes[0];
|
||||||
if ($addedElm instanceof HTMLElement && $addedElm.className) {
|
if ($addedElm instanceof HTMLElement && $addedElm.className) {
|
||||||
if ($addedElm.className.startsWith('NavigationAnimation') || $addedElm.className.startsWith('DialogRoutes') || $addedElm.className.startsWith('Dialog-module__container')) {
|
if ($addedElm.className.startsWith('NavigationAnimation') || $addedElm.className.startsWith('DialogRoutes') || $addedElm.className.startsWith('Dialog-module__container')) {
|
||||||
// Find navigation bar
|
// Make sure it's Guide dialog
|
||||||
const $selectedTab = $addedElm.querySelector('div[class^=NavigationMenu] button[aria-selected=true');
|
if (document.querySelector('#gamepass-dialog-root div[class*=GuideDialog]')) {
|
||||||
if ($selectedTab) {
|
// Find navigation bar
|
||||||
let $elm: Element | null = $selectedTab;
|
const $selectedTab = $addedElm.querySelector('div[class^=NavigationMenu] button[aria-selected=true');
|
||||||
let index;
|
if ($selectedTab) {
|
||||||
for (index = 0; ($elm = $elm?.previousElementSibling); index++);
|
let $elm: Element | null = $selectedTab;
|
||||||
|
let index;
|
||||||
|
for (index = 0; ($elm = $elm?.previousElementSibling); index++);
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
BxEvent.dispatch(window, BxEvent.XCLOUD_GUIDE_MENU_SHOWN, {where: GuideMenuTab.HOME});
|
BxEvent.dispatch(window, BxEvent.XCLOUD_GUIDE_MENU_SHOWN, {where: GuideMenuTab.HOME});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,8 @@ export namespace BxEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppInterface && AppInterface.onEvent(eventName);
|
|
||||||
target.dispatchEvent(event);
|
target.dispatchEvent(event);
|
||||||
|
AppInterface && AppInterface.onEvent(eventName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user