mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 23:57:19 +02:00
Update better-xcloud.user.js
This commit is contained in:
parent
498123af85
commit
298a40d156
51
dist/better-xcloud.user.js
vendored
51
dist/better-xcloud.user.js
vendored
@ -506,7 +506,7 @@ var Texts = {
|
|||||||
controller: "Controller",
|
controller: "Controller",
|
||||||
"controller-shortcuts": "Controller shortcuts",
|
"controller-shortcuts": "Controller shortcuts",
|
||||||
"controller-shortcuts-connect-note": "Connect a controller to use this feature",
|
"controller-shortcuts-connect-note": "Connect a controller to use this feature",
|
||||||
"controller-shortcuts-xbox-note": "The Xbox button is the one that opens the Guide menu",
|
"controller-shortcuts-xbox-note": "Button to open the Guide menu",
|
||||||
"controller-vibration": "Controller vibration",
|
"controller-vibration": "Controller vibration",
|
||||||
copy: "Copy",
|
copy: "Copy",
|
||||||
custom: "Custom",
|
custom: "Custom",
|
||||||
@ -3345,7 +3345,7 @@ class ControllerShortcut {
|
|||||||
static #buttonsStatus = {};
|
static #buttonsStatus = {};
|
||||||
static #$selectProfile;
|
static #$selectProfile;
|
||||||
static #$selectActions = {};
|
static #$selectActions = {};
|
||||||
static #$remap;
|
static #$container;
|
||||||
static #ACTIONS = {};
|
static #ACTIONS = {};
|
||||||
static reset(index) {
|
static reset(index) {
|
||||||
ControllerShortcut.#buttonsCache[index] = [];
|
ControllerShortcut.#buttonsCache[index] = [];
|
||||||
@ -3423,7 +3423,7 @@ class ControllerShortcut {
|
|||||||
}
|
}
|
||||||
static #updateProfileList(e) {
|
static #updateProfileList(e) {
|
||||||
const $select = ControllerShortcut.#$selectProfile;
|
const $select = ControllerShortcut.#$selectProfile;
|
||||||
const $remap = ControllerShortcut.#$remap;
|
const $container = ControllerShortcut.#$container;
|
||||||
const $fragment = document.createDocumentFragment();
|
const $fragment = document.createDocumentFragment();
|
||||||
while ($select.firstElementChild) {
|
while ($select.firstElementChild) {
|
||||||
$select.firstElementChild.remove();
|
$select.firstElementChild.remove();
|
||||||
@ -3443,17 +3443,10 @@ class ControllerShortcut {
|
|||||||
}
|
}
|
||||||
if (hasGamepad) {
|
if (hasGamepad) {
|
||||||
$select.appendChild($fragment);
|
$select.appendChild($fragment);
|
||||||
$remap.classList.remove("bx-gone");
|
|
||||||
$select.disabled = false;
|
|
||||||
$select.selectedIndex = 0;
|
$select.selectedIndex = 0;
|
||||||
$select.dispatchEvent(new Event("change"));
|
$select.dispatchEvent(new Event("change"));
|
||||||
} else {
|
|
||||||
$remap.classList.add("bx-gone");
|
|
||||||
$select.disabled = true;
|
|
||||||
const $option = CE("option", {}, "---");
|
|
||||||
$fragment.appendChild($option);
|
|
||||||
$select.appendChild($fragment);
|
|
||||||
}
|
}
|
||||||
|
$container.dataset.hasGamepad = hasGamepad.toString();
|
||||||
}
|
}
|
||||||
static #switchProfile(profile) {
|
static #switchProfile(profile) {
|
||||||
let actions = ControllerShortcut.#ACTIONS[profile];
|
let actions = ControllerShortcut.#ACTIONS[profile];
|
||||||
@ -3518,15 +3511,15 @@ class ControllerShortcut {
|
|||||||
}
|
}
|
||||||
$baseSelect.appendChild($optGroup);
|
$baseSelect.appendChild($optGroup);
|
||||||
}
|
}
|
||||||
const $container = CE("div", {});
|
let $remap;
|
||||||
const $profile = CE("select", { class: "bx-shortcut-profile", autocomplete: "off" });
|
let $selectProfile;
|
||||||
$profile.addEventListener("change", (e) => {
|
const $container = CE("div", { "data-has-gamepad": "false" }, CE("div", {}, CE("p", { class: "bx-shortcut-note" }, t("controller-shortcuts-connect-note"))), $remap = CE("div", {}, $selectProfile = CE("select", { class: "bx-shortcut-profile", autocomplete: "off" }), CE("p", { class: "bx-shortcut-note" }, CE("span", { class: "bx-prompt" }, PrompFont.HOME), ": " + t("controller-shortcuts-xbox-note"))));
|
||||||
ControllerShortcut.#switchProfile($profile.value);
|
$selectProfile.addEventListener("change", (e) => {
|
||||||
|
ControllerShortcut.#switchProfile($selectProfile.value);
|
||||||
});
|
});
|
||||||
$container.appendChild($profile);
|
|
||||||
const onActionChanged = (e) => {
|
const onActionChanged = (e) => {
|
||||||
const $target = e.target;
|
const $target = e.target;
|
||||||
const profile = $profile.value;
|
const profile = $selectProfile.value;
|
||||||
const button2 = $target.dataset.button;
|
const button2 = $target.dataset.button;
|
||||||
const action = $target.value;
|
const action = $target.value;
|
||||||
const $fakeSelect = $target.previousElementSibling;
|
const $fakeSelect = $target.previousElementSibling;
|
||||||
@ -3539,7 +3532,6 @@ class ControllerShortcut {
|
|||||||
$fakeSelect.firstElementChild.text = fakeText;
|
$fakeSelect.firstElementChild.text = fakeText;
|
||||||
!e.ignoreOnChange && ControllerShortcut.#updateAction(profile, button2, action);
|
!e.ignoreOnChange && ControllerShortcut.#updateAction(profile, button2, action);
|
||||||
};
|
};
|
||||||
const $remap = CE("div", { class: "bx-gone" });
|
|
||||||
let button;
|
let button;
|
||||||
for (button in buttons) {
|
for (button in buttons) {
|
||||||
const $row = CE("div", { class: "bx-shortcut-row" });
|
const $row = CE("div", { class: "bx-shortcut-row" });
|
||||||
@ -3558,8 +3550,8 @@ class ControllerShortcut {
|
|||||||
$remap.appendChild($row);
|
$remap.appendChild($row);
|
||||||
}
|
}
|
||||||
$container.appendChild($remap);
|
$container.appendChild($remap);
|
||||||
ControllerShortcut.#$selectProfile = $profile;
|
ControllerShortcut.#$selectProfile = $selectProfile;
|
||||||
ControllerShortcut.#$remap = $remap;
|
ControllerShortcut.#$container = $container;
|
||||||
window.addEventListener("gamepadconnected", ControllerShortcut.#updateProfileList);
|
window.addEventListener("gamepadconnected", ControllerShortcut.#updateProfileList);
|
||||||
window.addEventListener("gamepaddisconnected", ControllerShortcut.#updateProfileList);
|
window.addEventListener("gamepaddisconnected", ControllerShortcut.#updateProfileList);
|
||||||
ControllerShortcut.#updateProfileList();
|
ControllerShortcut.#updateProfileList();
|
||||||
@ -6010,6 +6002,9 @@ div[class^=HUDButton-module__hiddenContainer] ~ div:not([class^=HUDButton-module
|
|||||||
.bx-no-padding {
|
.bx-no-padding {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
}
|
}
|
||||||
|
.bx-prompt {
|
||||||
|
font-family: var(--bx-promptfont-font);
|
||||||
|
}
|
||||||
#headerArea,
|
#headerArea,
|
||||||
#uhfSkipToMain,
|
#uhfSkipToMain,
|
||||||
.uhf-footer {
|
.uhf-footer {
|
||||||
@ -6994,19 +6989,33 @@ div[data-testid=media-container].bx-taking-screenshot:before {
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
padding-top: 16px;
|
padding-top: 16px;
|
||||||
}
|
}
|
||||||
|
.bx-quick-settings-tab-contents div[data-group="shortcuts"] > div[data-has-gamepad=true] > div:first-of-type {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.bx-quick-settings-tab-contents div[data-group="shortcuts"] > div[data-has-gamepad=true] > div:last-of-type {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.bx-quick-settings-tab-contents div[data-group="shortcuts"] > div[data-has-gamepad=false] > div:first-of-type {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.bx-quick-settings-tab-contents div[data-group="shortcuts"] > div[data-has-gamepad=false] > div:last-of-type {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.bx-quick-settings-tab-contents div[data-group="shortcuts"] .bx-shortcut-profile {
|
.bx-quick-settings-tab-contents div[data-group="shortcuts"] .bx-shortcut-profile {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
.bx-quick-settings-tab-contents div[data-group="shortcuts"] .bx-shortcut-note {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
.bx-quick-settings-tab-contents div[data-group="shortcuts"] .bx-shortcut-row {
|
.bx-quick-settings-tab-contents div[data-group="shortcuts"] .bx-shortcut-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
.bx-quick-settings-tab-contents div[data-group="shortcuts"] .bx-shortcut-row label.bx-prompt {
|
.bx-quick-settings-tab-contents div[data-group="shortcuts"] .bx-shortcut-row label.bx-prompt {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-family: var(--bx-promptfont-font);
|
|
||||||
font-size: 26px;
|
font-size: 26px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user