Show custom touch layout's author name in toast message

This commit is contained in:
redphx
2024-05-08 17:04:14 +07:00
parent d8fada8f5d
commit 26bf14eda6
8 changed files with 65 additions and 18 deletions

View File

@@ -96,5 +96,13 @@ export const createButton = <T=HTMLButtonElement>(options: BxButton): T => {
return $btn as T;
}
export function escapeHtml(html: string): string {
const text = document.createTextNode(html);
const $span = document.createElement('span');
$span.appendChild(text);
return $span.innerHTML;
}
export const CTN = document.createTextNode.bind(document);
window.BX_CE = createElement;

View File

@@ -29,12 +29,11 @@ export function overridePreloadState() {
// Add list of games with custom layouts to the official list
if (STATES.hasTouchSupport) {
TouchController.updateCustomList();
let customList = TouchController.getCustomList();
try {
const sigls = state.xcloud.sigls;
if (GamePassCloudGallery.TOUCH in sigls) {
let customList = TouchController.getCustomList();
const allGames = sigls[GamePassCloudGallery.ALL].data.products;
// Remove non-cloud games from the list

View File

@@ -2,6 +2,7 @@ import { CE } from "@utils/html";
type ToastOptions = {
instant?: boolean;
html?: boolean;
}
export class Toast {
@@ -40,9 +41,13 @@ export class Toast {
Toast.#timeout = window.setTimeout(Toast.#hide, Toast.#DURATION);
// Get values from item
const [msg, status, _] = Toast.#stack.shift()!;
const [msg, status, options] = Toast.#stack.shift()!;
Toast.#$msg.textContent = msg;
if (options.html) {
Toast.#$msg.innerHTML = msg;
} else {
Toast.#$msg.textContent = msg;
}
if (status) {
Toast.#$status.classList.remove('bx-gone');

View File

@@ -2755,21 +2755,21 @@ const Texts = {
"特殊游戏按钮样式",
],
"tc-default-opacity": [
,
"Standard Deckkraft",
,
"Default opacity",
"Opacidad por defecto",
,
,
"既定の透過度",
,
,
,
,
,
,
,
,
"Domyślna przezroczystość",
"Opacidade padrão",
"Прозрачность по умолчанию",
"Varsayılan opaklık",
"Непрозорість за замовчуванням",
"Độ mờ mặc định",
,
"默认不透明度",
],
"tc-muted-colors": [
"Matte Farben",
@@ -2890,6 +2890,23 @@ const Texts = {
"Bố cục điều khiển cảm ứng",
"触摸控制布局",
],
"touch-control-layout-by": [
(e: any) => `Touch-Steuerungslayout von ${e.name}`,
,
(e: any) => `Touch control layout by ${e.name}`,
,
,
,
(e: any) => `タッチ操作レイアウト作成者: ${e.name}`,
,
(e: any) => `Układ sterowania dotykowego stworzony przez ${e.name}`,
,
,
(e: any) => `${e.name} kişisinin dokunmatik kontrolcü tuş şeması`,
(e: any) => `Розташування сенсорного керування від ${e.name}`,
(e: any) => `Bố cục điều khiển cảm ứng tạo bởi ${e.name}`,
,
],
"touch-controller": [
"Touch-Controller",
"Kontrol sentuhan",