mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Avoid rendering the Settings multiple times
This commit is contained in:
parent
0330d0d811
commit
397b3baa9b
@ -8266,7 +8266,7 @@ a.bx-button {
|
|||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.better_xcloud_settings {
|
.bx-settings-container {
|
||||||
background-color: #151515;
|
background-color: #151515;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
@ -9971,7 +9971,7 @@ function injectSettingsButton($parent) {
|
|||||||
label: PREF_PREFERRED_REGION,
|
label: PREF_PREFERRED_REGION,
|
||||||
style: ButtonStyle.GHOST | ButtonStyle.FOCUSABLE | ButtonStyle.FULL_HEIGHT,
|
style: ButtonStyle.GHOST | ButtonStyle.FOCUSABLE | ButtonStyle.FULL_HEIGHT,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
const $settings = document.querySelector('.better_xcloud_settings');
|
const $settings = document.querySelector('.bx-settings-container');
|
||||||
$settings.classList.toggle('bx-gone');
|
$settings.classList.toggle('bx-gone');
|
||||||
$settings.scrollIntoView();
|
$settings.scrollIntoView();
|
||||||
document.activeElement && document.activeElement.blur();
|
document.activeElement && document.activeElement.blur();
|
||||||
@ -9985,12 +9985,16 @@ function injectSettingsButton($parent) {
|
|||||||
|
|
||||||
// Add the Settings button to the web page
|
// Add the Settings button to the web page
|
||||||
$headerFragment.appendChild($settingsBtn);
|
$headerFragment.appendChild($settingsBtn);
|
||||||
|
|
||||||
$parent.appendChild($headerFragment);
|
$parent.appendChild($headerFragment);
|
||||||
|
|
||||||
|
// Avoid rendering the Settings multiple times
|
||||||
|
if (document.querySelector('.bx-settings-container')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup Settings UI
|
// Setup Settings UI
|
||||||
const $container = CE('div', {
|
const $container = CE('div', {
|
||||||
'class': 'better_xcloud_settings bx-gone',
|
'class': 'bx-settings-container bx-gone',
|
||||||
});
|
});
|
||||||
|
|
||||||
let $updateAvailable;
|
let $updateAvailable;
|
||||||
@ -11155,7 +11159,7 @@ function onHistoryChanged(e) {
|
|||||||
|
|
||||||
setTimeout(RemotePlay.detect, 10);
|
setTimeout(RemotePlay.detect, 10);
|
||||||
|
|
||||||
const $settings = document.querySelector('.better_xcloud_settings');
|
const $settings = document.querySelector('.bx-settings-container');
|
||||||
if ($settings) {
|
if ($settings) {
|
||||||
$settings.classList.add('bx-gone');
|
$settings.classList.add('bx-gone');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user