|
@@ -2,7 +2,7 @@ import { compress, debounce, isScrollable, type Stringifiable } from "@sv443-net
|
|
|
import { type defaultData, formatVersion, getFeature, getFeatures, migrations, setFeatures } from "../config.js";
|
|
|
import { buildNumber, compressionFormat, host, mode, scriptInfo } from "../constants.js";
|
|
|
import { featInfo, disableBeforeUnload } from "../features/index.js";
|
|
|
-import { error, getResourceUrl, info, log, resourceAsString, getLocale, hasKey, initTranslations, setLocale, t, arrayWithSeparators, tp, type TrKey, onInteraction, getDomain, copyToClipboard, warn, compressionSupported, tryToDecompressAndParse } from "../utils/index.js";
|
|
|
+import { error, getResourceUrl, info, log, resourceAsString, getLocale, hasKey, initTranslations, setLocale, t, arrayWithSeparators, tp, type TrKey, onInteraction, getDomain, copyToClipboard, warn, compressionSupported, tryToDecompressAndParse, setInnerHtmlTrusted } from "../utils/index.js";
|
|
|
import { emitSiteEvent, siteEvents } from "../siteEvents.js";
|
|
|
import { getChangelogDialog, getFeatHelpDialog } from "../dialogs/index.js";
|
|
|
import type { FeatureCategory, FeatureKey, FeatureConfig, HotkeyObj, FeatureInfo } from "../types.js";
|
|
@@ -414,13 +414,13 @@ async function mountCfgMenu() {
|
|
|
|
|
|
let adornmentElem: undefined | HTMLElement;
|
|
|
|
|
|
- const adornContent = ftInfo.textAdornment?.();
|
|
|
- const adornContentAw = adornContent instanceof Promise ? await adornContent : adornContent;
|
|
|
- if((typeof adornContent === "string" || adornContent instanceof Promise) && typeof adornContentAw !== "undefined") {
|
|
|
+ const adornContentAsync = ftInfo.textAdornment?.();
|
|
|
+ const adornContent = adornContentAsync instanceof Promise ? await adornContentAsync : adornContentAsync;
|
|
|
+ if((typeof adornContentAsync === "string" || adornContentAsync instanceof Promise) && typeof adornContent !== "undefined") {
|
|
|
adornmentElem = document.createElement("span");
|
|
|
adornmentElem.id = `bytm-ftitem-${featKey}-adornment`;
|
|
|
adornmentElem.classList.add("bytm-ftitem-adornment");
|
|
|
- adornmentElem.innerHTML = adornContentAw;
|
|
|
+ setInnerHtmlTrusted(adornmentElem, adornContent);
|
|
|
}
|
|
|
|
|
|
let helpElem: undefined | HTMLDivElement;
|
|
@@ -438,7 +438,7 @@ async function mountCfgMenu() {
|
|
|
helpElem.ariaLabel = helpElem.title = t("feature_help_button_tooltip", t(`feature_desc_${featKey}`));
|
|
|
helpElem.role = "button";
|
|
|
helpElem.tabIndex = 0;
|
|
|
- helpElem.innerHTML = helpElemImgHtml;
|
|
|
+ setInnerHtmlTrusted(helpElem, helpElemImgHtml);
|
|
|
onInteraction(helpElem, async (e: MouseEvent | KeyboardEvent) => {
|
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|