mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-13 08:29:18 +02:00
Optimize CE()
This commit is contained in:
@@ -24,7 +24,7 @@ export class MicrophoneAction extends BaseGameBarAction {
|
||||
onClick: this.onClick,
|
||||
});
|
||||
|
||||
this.$content = CE('div', {}, $btnMuted, $btnDefault);
|
||||
this.$content = CE('div', false, $btnMuted, $btnDefault);
|
||||
|
||||
BxEventBus.Stream.on('microphone.state.changed', payload => {
|
||||
const enabled = payload.state === MicrophoneState.ENABLED;
|
||||
|
@@ -24,7 +24,7 @@ export class RendererAction extends BaseGameBarAction {
|
||||
classes: ['bx-activated'],
|
||||
});
|
||||
|
||||
this.$content = CE('div', {}, $btnDefault, $btnActivated);
|
||||
this.$content = CE('div', false, $btnDefault, $btnActivated);
|
||||
|
||||
BxEventBus.Stream.on('video.visibility.changed', payload => {
|
||||
this.$content.dataset.activated = (!payload.isVisible).toString();
|
||||
|
@@ -24,7 +24,7 @@ export class SpeakerAction extends BaseGameBarAction {
|
||||
classes: ['bx-activated'],
|
||||
});
|
||||
|
||||
this.$content = CE('div', {}, $btnEnable, $btnMuted);
|
||||
this.$content = CE('div', false, $btnEnable, $btnMuted);
|
||||
|
||||
BxEventBus.Stream.on('speaker.state.changed', payload => {
|
||||
const enabled = payload.state === SpeakerState.ENABLED;
|
||||
|
@@ -25,7 +25,7 @@ export class TouchControlAction extends BaseGameBarAction {
|
||||
classes: ['bx-activated'],
|
||||
});
|
||||
|
||||
this.$content = CE('div', {}, $btnEnable, $btnDisable);
|
||||
this.$content = CE('div', false, $btnEnable, $btnDisable);
|
||||
}
|
||||
|
||||
onClick = (e: Event) => {
|
||||
|
@@ -110,11 +110,11 @@ export class LoadingScreen {
|
||||
let $waitTimeBox = LoadingScreen.$waitTimeBox;
|
||||
if (!$waitTimeBox) {
|
||||
$waitTimeBox = CE('div', { class: 'bx-wait-time-box' },
|
||||
CE('label', {}, t('server')),
|
||||
CE('span', {}, getPreferredServerRegion()),
|
||||
CE('label', {}, t('wait-time-estimated')),
|
||||
CE('label', false, t('server')),
|
||||
CE('span', false, getPreferredServerRegion()),
|
||||
CE('label', false, t('wait-time-estimated')),
|
||||
$estimated = CE('span', {}),
|
||||
CE('label', {}, t('wait-time-countdown')),
|
||||
CE('label', false, t('wait-time-countdown')),
|
||||
$countDown = CE('span', {}),
|
||||
);
|
||||
|
||||
|
@@ -78,7 +78,7 @@ export class MkbPopup {
|
||||
this.$title = CE('p'),
|
||||
this.$btnActivate = this.createActivateButton(),
|
||||
|
||||
CE('div', {},
|
||||
CE('div', false,
|
||||
createButton({
|
||||
label: t('ignore'),
|
||||
style: ButtonStyle.GHOST,
|
||||
|
@@ -227,7 +227,7 @@ export class StreamStats {
|
||||
class: `bx-stat-${statKey}`,
|
||||
title: stat.name,
|
||||
},
|
||||
CE('label', {}, statKey.toUpperCase()),
|
||||
CE('label', false, statKey.toUpperCase()),
|
||||
stat.$element,
|
||||
);
|
||||
|
||||
|
@@ -167,14 +167,14 @@ export abstract class BaseProfileManagerDialog<T extends PresetRecord> extends N
|
||||
|
||||
this.$container = CE('div', { class: 'bx-centered-dialog' },
|
||||
CE('div', { class: 'bx-dialog-title' },
|
||||
CE('p', {}, this.title),
|
||||
CE('p', false, this.title),
|
||||
createButton({
|
||||
icon: BxIcon.CLOSE,
|
||||
style: ButtonStyle.FOCUSABLE | ButtonStyle.CIRCULAR | ButtonStyle.GHOST,
|
||||
onClick: e => this.hide(),
|
||||
}),
|
||||
),
|
||||
CE('div', {},
|
||||
CE('div', false,
|
||||
$header,
|
||||
this.$defaultNote = CE('div', { class: 'bx-default-preset-note bx-gone' }, t('default-preset-note')),
|
||||
),
|
||||
|
@@ -37,7 +37,7 @@ export class KeyboardShortcutsManagerDialog extends BaseProfileManagerDialog<Key
|
||||
continue;
|
||||
}
|
||||
|
||||
const $fieldSet = CE('fieldset', {}, CE('legend', {}, groupLabel));
|
||||
const $fieldSet = CE('fieldset', false, CE('legend', false, groupLabel));
|
||||
for (const action in items) {
|
||||
const crumbs = items[action as keyof typeof items];
|
||||
if (!crumbs) {
|
||||
@@ -66,7 +66,7 @@ export class KeyboardShortcutsManagerDialog extends BaseProfileManagerDialog<Key
|
||||
}
|
||||
}
|
||||
|
||||
this.$content = CE('div', {},
|
||||
this.$content = CE('div', false,
|
||||
this.$unbindNote = CE('i', { class: 'bx-mkb-note' }, t('right-click-to-unbind')),
|
||||
$rows,
|
||||
);
|
||||
|
@@ -93,7 +93,7 @@ export class MkbMappingManagerDialog extends BaseProfileManagerDialog<MkbPresetR
|
||||
}
|
||||
|
||||
private render() {
|
||||
const $rows = CE('div', {},
|
||||
const $rows = CE('div', false,
|
||||
this.$unbindNote = CE('i', { class: 'bx-mkb-note' }, t('right-click-to-unbind')),
|
||||
);
|
||||
|
||||
@@ -131,7 +131,7 @@ export class MkbMappingManagerDialog extends BaseProfileManagerDialog<MkbPresetR
|
||||
}
|
||||
|
||||
const savePreset = () => this.savePreset();
|
||||
const $extraSettings = CE('div', {},
|
||||
const $extraSettings = CE('div', false,
|
||||
createSettingRow(
|
||||
t('map-mouse-to'),
|
||||
this.$mouseMapTo = BxSelectElement.create(CE('select', { _on: { input: savePreset } },
|
||||
@@ -166,7 +166,7 @@ export class MkbMappingManagerDialog extends BaseProfileManagerDialog<MkbPresetR
|
||||
),
|
||||
);
|
||||
|
||||
this.$content = CE('div', {},
|
||||
this.$content = CE('div', false,
|
||||
$rows,
|
||||
$extraSettings,
|
||||
);
|
||||
|
@@ -37,7 +37,7 @@ export class RemotePlayDialog extends NavigationDialog {
|
||||
const $settingNote = CE('p', {});
|
||||
|
||||
const currentResolution = getPref(PrefKey.REMOTE_PLAY_STREAM_RESOLUTION);
|
||||
let $resolutions : HTMLSelectElement | NavigationElement = CE('select', {},
|
||||
let $resolutions : HTMLSelectElement | NavigationElement = CE('select', false,
|
||||
CE('option', { value: StreamResolution.DIM_720P }, '720p'),
|
||||
CE('option', { value: StreamResolution.DIM_1080P }, '1080p'),
|
||||
// CE('option', { value: StreamResolution.DIM_1080P_HQ }, `1080p (HQ)`),
|
||||
@@ -58,8 +58,8 @@ export class RemotePlayDialog extends NavigationDialog {
|
||||
|
||||
const $qualitySettings = CE('div', {
|
||||
class: 'bx-remote-play-settings',
|
||||
}, CE('div', {},
|
||||
CE('label', {}, t('target-resolution'), $settingNote),
|
||||
}, CE('div', false,
|
||||
CE('label', false, t('target-resolution'), $settingNote),
|
||||
$resolutions,
|
||||
));
|
||||
|
||||
@@ -72,7 +72,7 @@ export class RemotePlayDialog extends NavigationDialog {
|
||||
for (let con of consoles) {
|
||||
const $child = CE('div', { class: 'bx-remote-play-device-wrapper' },
|
||||
CE('div', { class: 'bx-remote-play-device-info' },
|
||||
CE('div', {},
|
||||
CE('div', false,
|
||||
CE('span', { class: 'bx-remote-play-device-name' }, con.deviceName),
|
||||
CE('span', { class: 'bx-remote-play-console-type' }, con.consoleType.replace('Xbox', ''))
|
||||
),
|
||||
|
@@ -170,8 +170,8 @@ export class SettingsDialog extends NavigationDialog {
|
||||
this.$btnSuggestion = CE('div', {
|
||||
class: 'bx-suggest-toggler bx-focusable',
|
||||
tabindex: 0,
|
||||
}, CE('label', {}, t('suggest-settings')),
|
||||
CE('span', {}, '❯'),
|
||||
}, CE('label', false, t('suggest-settings')),
|
||||
CE('span', false, '❯'),
|
||||
);
|
||||
this.$btnSuggestion.addEventListener('click', SuggestionsSetting.renderSuggestions.bind(this));
|
||||
|
||||
@@ -518,7 +518,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
label: t('layout'),
|
||||
content: CE('select', {
|
||||
disabled: true,
|
||||
}, CE('option', {}, t('default'))),
|
||||
}, CE('option', false, t('default'))),
|
||||
onCreated: (setting: SettingTabSectionItem, $elm: HTMLSelectElement) => {
|
||||
$elm.addEventListener('input', e => {
|
||||
TouchController.applyCustomLayout($elm.value, 1000);
|
||||
@@ -1066,7 +1066,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
orientation: 'horizontal',
|
||||
}
|
||||
},
|
||||
CE('span', {}, label),
|
||||
CE('span', false, label),
|
||||
section.helpUrl && createButton({
|
||||
icon: BxIcon.QUESTION,
|
||||
style: ButtonStyle.GHOST | ButtonStyle.FOCUSABLE,
|
||||
@@ -1146,7 +1146,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
focus: () => this.focusActiveTab(),
|
||||
},
|
||||
}),
|
||||
CE('div', {},
|
||||
CE('div', false,
|
||||
this.$btnReload = createButton({
|
||||
icon: BxIcon.REFRESH,
|
||||
style: ButtonStyle.FOCUSABLE | ButtonStyle.DROP_SHADOW,
|
||||
|
@@ -56,7 +56,7 @@ export class ControllerExtraSettings extends HTMLElement {
|
||||
}));
|
||||
|
||||
$container.append(
|
||||
CE('span', {}, t('no-controllers-connected')),
|
||||
CE('span', false, t('no-controllers-connected')),
|
||||
CE('div', { class: 'bx-controller-extra-wrapper' },
|
||||
$selectControllers,
|
||||
|
||||
@@ -98,7 +98,7 @@ export class ControllerExtraSettings extends HTMLElement {
|
||||
),
|
||||
{
|
||||
multiLines: true,
|
||||
$note: CE('div', { class: 'bx-settings-dialog-note' }, 'ⓘ ' + t('slightly-increase-input-latency')),
|
||||
$note: CE('div', { class: 'bx-settings-dialog-note' }, 'ⓘ ' + t('slightly-increases-input-latency')),
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@@ -92,7 +92,7 @@ export class SuggestionsSetting {
|
||||
|
||||
// Start rendering
|
||||
const $suggestedSettings = CE('div', { class: 'bx-suggest-wrapper' });
|
||||
const $select = CE('select', {},
|
||||
const $select = CE('select', false,
|
||||
hasRecommendedSettings && CE('option', { value: 'recommended' }, t('recommended')),
|
||||
!hasRecommendedSettings && CE('option', { value: 'highest' }, t('highest-quality')),
|
||||
CE('option', { value: 'default' }, t('default')),
|
||||
|
@@ -30,7 +30,7 @@ export class GameTile {
|
||||
if (typeof totalWaitTime === 'number' && isElementVisible($elm)) {
|
||||
const $div = CE('div', { class: 'bx-game-tile-wait-time' },
|
||||
createSvgIcon(BxIcon.PLAYTIME),
|
||||
CE('span', {}, totalWaitTime < 60 ? totalWaitTime + 's' : secondsToHm(totalWaitTime)),
|
||||
CE('span', false, totalWaitTime < 60 ? totalWaitTime + 's' : secondsToHm(totalWaitTime)),
|
||||
);
|
||||
|
||||
const duration = (totalWaitTime >= 15 * 60) ? 'long' : (totalWaitTime >= 10 * 60) ? 'medium' : (totalWaitTime >= 5 * 60 ) ? 'short' : '';
|
||||
|
@@ -39,7 +39,7 @@ export class HeaderSection {
|
||||
onClick: e => SettingsDialog.getInstance().show(),
|
||||
});
|
||||
|
||||
this.$buttonsWrapper = CE('div', {},
|
||||
this.$buttonsWrapper = CE('div', false,
|
||||
getPref(PrefKey.REMOTE_PLAY_ENABLED) ? this.$btnRemotePlay : null,
|
||||
this.$btnSettings,
|
||||
);
|
||||
|
Reference in New Issue
Block a user