mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-07 05:38:27 +02:00
Show custom touch layout's author name in toast message
This commit is contained in:
@@ -393,7 +393,7 @@ export class MkbHandler {
|
||||
}),
|
||||
CE('div', {},
|
||||
CE('p', {}, t('mkb-click-to-activate')),
|
||||
CE('p', {}, t<any>('press-key-to-toggle-mkb')({key: 'F8'})),
|
||||
CE('p', {}, t('press-key-to-toggle-mkb', {key: 'F8'})),
|
||||
),
|
||||
);
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { STATES } from "@utils/global";
|
||||
import { CE } from "@utils/html";
|
||||
import { CE, escapeHtml } from "@utils/html";
|
||||
import { Toast } from "@utils/toast";
|
||||
import { BxEvent } from "@utils/bx-event";
|
||||
import { BX_FLAGS } from "@utils/bx-flags";
|
||||
@@ -168,7 +168,17 @@ export class TouchController {
|
||||
}
|
||||
|
||||
// Show a toast with layout's name
|
||||
layoutChanged && Toast.show(t('touch-control-layout'), layout.name);
|
||||
let msg: string;
|
||||
let html = false;
|
||||
if (layout.author) {
|
||||
const author = `<b>${escapeHtml(layout.author)}</b>`;
|
||||
msg = t('touch-control-layout-by', {name: author});
|
||||
html = true;
|
||||
} else {
|
||||
msg = t('touch-control-layout');
|
||||
}
|
||||
|
||||
layoutChanged && Toast.show(msg, layout.name, {html: html});
|
||||
|
||||
window.setTimeout(() => {
|
||||
window.BX_EXPOSED.touch_layout_manager.changeLayoutForScope({
|
||||
|
@@ -217,7 +217,14 @@ function setupQuickSettingsBar() {
|
||||
for (const key in data.layouts) {
|
||||
const layout = data.layouts[key];
|
||||
|
||||
const $option = CE('option', {value: key}, layout.name);
|
||||
let name;
|
||||
if (layout.author) {
|
||||
name = `${layout.name} (${layout.author})`;
|
||||
} else {
|
||||
name = layout.name;
|
||||
}
|
||||
|
||||
const $option = CE('option', {value: key}, name);
|
||||
$fragment.appendChild($option);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user