Selaa lähdekoodia

fix: min and max not being set correctly

Sven 1 vuosi sitten
vanhempi
commit
0b1027b8ba
2 muutettua tiedostoa jossa 4 lisäystä ja 5 poistoa
  1. 2 1
      src/features/menu/menu.ts
  2. 2 4
      src/features/menu/menu_old.ts

+ 2 - 1
src/features/menu/menu.ts

@@ -8,11 +8,12 @@ import "./menu.css";
 // - support for "custom widgets"
 // - debounce or save on button press to store new configuration
 // - much better scaling including no vw and vh units
+// - cleanup function per feature so a page reload is not always needed
 
 //#MARKER menu
 
 /**
- * These are the base selector values for the menu tabs  
+ * The base selector values for the menu tabs  
  * Header selector format: `#${baseValue}-header`  
  * Content selector format: `#${baseValue}-content`
  */

+ 2 - 4
src/features/menu/menu_old.ts

@@ -101,15 +101,13 @@ export async function addMenu() {
   /** Gets called whenever the feature config is changed */
   const confChanged = debounce(async (key: keyof typeof defaultFeatures, initialVal: number | boolean | Record<string, unknown>, newVal: number | boolean | Record<string, unknown>) => {
     const fmt = (val: unknown) => typeof val === "object" ? JSON.stringify(val) : String(val);
-    info(`Feature config changed, key '${key}' from value '${fmt(initialVal)}' to '${fmt(newVal)}'`);
+    info(`Feature config changed at key '${key}', from value '${fmt(initialVal)}' to '${fmt(newVal)}'`);
 
     const featConf = { ...await getFeatures() };
 
     featConf[key] = newVal as never;
 
     await saveFeatureConf(featConf);
-
-    log("Saved feature config changes:\n", await GM.getValue("betterytm-config"));
   });
 
   const features = await getFeatures();
@@ -178,7 +176,7 @@ export async function addMenu() {
         inputElem.step = step;
 
       // @ts-ignore
-      if(ftInfo.min && ftInfo.max) {
+      if(typeof ftInfo.min !== "undefined" && ftInfo.max !== "undefined") {
         // @ts-ignore
         inputElem.min = ftInfo.min;
         // @ts-ignore