浏览代码

fix broken autoexec toggle

Christian Herzog 5 年之前
父节点
当前提交
5a29b84a1c
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 2 1
      components/wifi-manager/code.js
  2. 1 1
      components/wifi-manager/index.html

+ 2 - 1
components/wifi-manager/code.js

@@ -175,10 +175,10 @@ $(document).ready(function(){
     });
 
     $("input#autoexec-cb").on("click", function() {
-        showMessage('please wait for the ESP32 to reboot', 'WARNING');
         var data = { 'timestamp': Date.now() };
         autoexec = (this.checked)?1:0;
         data['autoexec'] = autoexec;
+        showMessage('please wait for the ESP32 to reboot', 'WARNING');
         $.ajax({
             url: '/config.json',
             dataType: 'json',
@@ -665,6 +665,7 @@ function getConfig() {
     $.getJSON("/config.json", function(data) {
         for (var key in data) {
             if (data.hasOwnProperty(key)) {
+                console.log(key+": "+data[key]);
                 if (key == 'autoexec') {
                     if (data["autoexec"] === "1") {
                         $("#autoexec-cb")[0].checked=true;

+ 1 - 1
components/wifi-manager/index.html

@@ -202,8 +202,8 @@
 
                     <h1>Start Squeezelite (toggle to activate changes)</h1>
                     <div class="custom-control custom-switch">
-                          <label class="custom-control-label" for="autoexec-cb"></label>
                           <input type="checkbox" class="custom-control-input" id="autoexec-cb" checked="checked">
+                          <label class="custom-control-label" for="autoexec-cb"></label>
                     </div>
                     <br />
                 </div>