mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-05 04:46:42 +02:00
Make Stream settings dialog controller-friendly
This commit is contained in:
@@ -9,6 +9,7 @@ type BxButton = {
|
||||
title?: string;
|
||||
disabled?: boolean;
|
||||
onClick?: EventListener;
|
||||
tabIndex?: number;
|
||||
attributes?: {[key: string]: any},
|
||||
}
|
||||
|
||||
@@ -94,6 +95,7 @@ export const createButton = <T=HTMLButtonElement>(options: BxButton): T => {
|
||||
options.title && $btn.setAttribute('title', options.title);
|
||||
options.disabled && (($btn as HTMLButtonElement).disabled = true);
|
||||
options.onClick && $btn.addEventListener('click', options.onClick);
|
||||
typeof options.tabIndex === 'number' && ($btn.tabIndex = options.tabIndex!);
|
||||
|
||||
for (const key in options.attributes) {
|
||||
if (!$btn.hasOwnProperty(key)) {
|
||||
|
@@ -175,13 +175,15 @@ export class SettingElement {
|
||||
$btnDec = CE('button', {
|
||||
'data-type': 'dec',
|
||||
type: 'button',
|
||||
tabindex: -1,
|
||||
class: options.hideSlider ? 'bx-focusable' : '',
|
||||
tabindex: options.hideSlider ? 0 : -1,
|
||||
}, '-') as HTMLButtonElement,
|
||||
$text = CE('span', {}, renderTextValue(value)) as HTMLSpanElement,
|
||||
$btnInc = CE('button', {
|
||||
'data-type': 'inc',
|
||||
type: 'button',
|
||||
tabindex: -1,
|
||||
class: options.hideSlider ? 'bx-focusable' : '',
|
||||
tabindex: options.hideSlider ? 0 : -1,
|
||||
}, '+') as HTMLButtonElement,
|
||||
);
|
||||
|
||||
|
@@ -371,6 +371,7 @@ export class Translations {
|
||||
static async updateTranslations(async=false) {
|
||||
// Don't have to download en-US
|
||||
if (Translations.#selectedLocale === Translations.#EN_US) {
|
||||
localStorage.removeItem(Translations.#KEY_TRANSLATIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user