Make Stream settings dialog controller-friendly

This commit is contained in:
redphx
2024-07-16 17:08:56 +07:00
parent be338f3e34
commit b66cb448ec
10 changed files with 257 additions and 29 deletions

View File

@@ -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)) {

View File

@@ -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,
);

View File

@@ -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;
}