mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Fix Settings sometimes not being injected to header
This commit is contained in:
parent
eb42f4a3d3
commit
9fad2914ac
6
dist/better-xcloud.user.js
vendored
6
dist/better-xcloud.user.js
vendored
@ -5746,12 +5746,12 @@ class HeaderSection {
|
||||
HeaderSection.#$remotePlayBtn.classList.remove("bx-gone");
|
||||
}
|
||||
static watchHeader() {
|
||||
const $header = document.querySelector("#PageContent header");
|
||||
if (!$header)
|
||||
let $root = document.querySelector("#PageContent header") || document.querySelector("#root");
|
||||
if (!$root)
|
||||
return;
|
||||
HeaderSection.#observer && HeaderSection.#observer.disconnect(), HeaderSection.#observer = new MutationObserver((mutationList) => {
|
||||
HeaderSection.#timeout && clearTimeout(HeaderSection.#timeout), HeaderSection.#timeout = window.setTimeout(HeaderSection.checkHeader, 2000);
|
||||
}), HeaderSection.#observer.observe($header, { subtree: !0, childList: !0 }), HeaderSection.checkHeader();
|
||||
}), HeaderSection.#observer.observe($root, { subtree: !0, childList: !0 }), HeaderSection.checkHeader();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ document.addEventListener('readystatechange', e => {
|
||||
// Preload Remote Play
|
||||
getPref(PrefKey.REMOTE_PLAY_ENABLED) && RemotePlay.preload();
|
||||
} else {
|
||||
// Show Settings button in the header when not signed
|
||||
// Show Settings button in the header when not signed in
|
||||
HeaderSection.watchHeader();
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,8 @@ export class HeaderSection {
|
||||
}
|
||||
|
||||
static watchHeader() {
|
||||
const $header = document.querySelector('#PageContent header');
|
||||
if (!$header) {
|
||||
let $root = document.querySelector('#PageContent header') || document.querySelector('#root');
|
||||
if (!$root) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ export class HeaderSection {
|
||||
HeaderSection.#timeout && clearTimeout(HeaderSection.#timeout);
|
||||
HeaderSection.#timeout = window.setTimeout(HeaderSection.checkHeader, 2000);
|
||||
});
|
||||
HeaderSection.#observer.observe($header, {subtree: true, childList: true});
|
||||
HeaderSection.#observer.observe($root, {subtree: true, childList: true});
|
||||
|
||||
HeaderSection.checkHeader();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user