Browse Source

chore: deploy

Sv443 1 năm trước cách đây
mục cha
commit
6c47bb85dc
2 tập tin đã thay đổi với 20 bổ sung4 xóa
  1. 20 3
      dist/BetterYTM.user.js
  2. 0 1
      src/types.ts

+ 20 - 3
dist/BetterYTM.user.js

@@ -237,7 +237,7 @@ var LogLevel;
 })(LogLevel || (LogLevel = {}));const modeRaw = "development";
 const branchRaw = "develop";
 const hostRaw = "github";
-const buildNumberRaw = "e00f898";
+const buildNumberRaw = "dc43f1b";
 /** The mode in which the script was built (production or development) */
 const mode = (modeRaw.match(/^#{{.+}}$/) ? "production" : modeRaw);
 /** The branch to use in various URLs that point to the GitHub repo */
@@ -2048,10 +2048,12 @@ function addCfgMenu() {
                         if (typeof ftInfo.min !== "undefined") // @ts-ignore
                             inputElem.min = ftInfo.min;
                         // @ts-ignore
-                        if (ftInfo.max !== "undefined") // @ts-ignore
+                        if (typeof ftInfo.max !== "undefined") // @ts-ignore
                             inputElem.max = ftInfo.max;
                         if (typeof initialVal !== "undefined")
                             inputElem.value = String(initialVal);
+                        if (type === "text" && ftInfo.valueHidden)
+                            inputElem.value = String(initialVal).replace(/./g, "•");
                         if (type === "number" || type === "slider" && step)
                             inputElem.step = String(step);
                         if (type === "toggle" && typeof initialVal !== "undefined")
@@ -2100,6 +2102,10 @@ function addCfgMenu() {
                                 if (typeof initialVal !== "undefined")
                                     confChanged(featKey, initialVal, v);
                             };
+                            const unsub = siteEvents.on("cfgMenuClosed", () => {
+                                unsub();
+                                textInputUpdate();
+                            });
                             inputElem.addEventListener("blur", () => textInputUpdate());
                             inputElem.addEventListener("keydown", (e) => e.key === "Tab" && textInputUpdate());
                         }
@@ -4023,6 +4029,7 @@ const featInfo = {
     },
     geniUrlToken: {
         type: "text",
+        valueHidden: true,
         category: "lyrics",
         default: "",
         normalize: (val) => val.trim(),
@@ -4210,7 +4217,7 @@ const globalFuncs = {
     hasKeyFor,
     t,
     tp,
-    getFeatures,
+    getFeatures: getFeaturesInterface,
     saveFeatures,
     fetchLyricsUrlTop,
     getLyricsCacheEntry,
@@ -4239,6 +4246,16 @@ function setGlobalProp(key, value) {
 /** Emits an event on the BYTM interface */
 function emitInterface(type, ...data) {
     getUnsafeWindow().dispatchEvent(new CustomEvent(type, { detail: data[0] }));
+}
+//#MARKER proxy functions
+function getFeaturesInterface() {
+    const features = getFeatures();
+    for (const ftKey of Object.keys(features)) {
+        const info = featInfo[ftKey];
+        if (info && info.valueHidden) // @ts-ignore
+            features[ftKey] = undefined;
+    }
+    return features;
 }let curLogLevel = LogLevel.Info;
 /** Common prefix to be able to tell logged messages apart and filter them in devtools */
 const consPrefix = `[${scriptInfo.name}]`;

+ 0 - 1
src/types.ts

@@ -80,7 +80,6 @@ export type InterfaceFunctions = {
 
 // shim for the BYTM interface properties
 export type BytmObject =
-  // properties defined and modified by BYTM at runtime
   {
     [key: string]: unknown;
     locale: TrLocale;