ソースを参照

ui config fixes

* sliders now adjust correctly on initialization
* bug fix in 'show clock on dim' flag (parses to int correctly now instead
  of interpreting it as string)
clementinecomputing 5 年 前
コミット
c4ce9b44de
1 ファイル変更14 行追加3 行削除
  1. 14 3
      busunit/DIUv2/html/js/diu_ui-ORG.js

+ 14 - 3
busunit/DIUv2/html/js/diu_ui-ORG.js

@@ -1136,9 +1136,20 @@ function _get_system_config() {
 
   g_ctx.config.last_update = Date.now();
 
-  if ("brightness" in m)    { g_ctx.config.brightness = m["brightness"]; }
-  if ("volume" in m)        { g_ctx.config.volume = m["volume"]; }
-  if ("showdimclock" in m)  { g_ctx.config.showdimclock = m["showdimclock"]; }
+  if ("brightness" in m)    { g_ctx.config.brightness = parseInt(m["brightness"]); }
+  if ("volume" in m)        { g_ctx.config.volume = parseInt(m["volume"]); }
+  if ("showdimclock" in m)  { g_ctx.config.showdimclock = parseInt(m["showdimclock"]); }
+
+  var ele;
+
+  ele = $("#ui_configuration_volume");
+  if (ele) { ele.val(g_ctx.config.volume/100.0); }
+
+  ele = $("#ui_configuration_brightness");
+  if (ele) { ele.val(g_ctx.config.brightness/100.0); }
+
+  ele = document.getElementById("ui_configuration_showclockondim");
+  if (ele) { ele.innerHTML = ((g_ctx.config.showdimclock == 1) ? "X" : "" ); }
 
   _process_volume(g_ctx.config.volume/100.0);
   _process_brightness(g_ctx.config.brightness/100.0);