AY 4 years ago
parent
commit
02b6d5a637
2 changed files with 40 additions and 19 deletions
  1. 18 9
      webroot/setting/eula.html
  2. 22 10
      webroot/setting/properties.html

+ 18 - 9
webroot/setting/eula.html

@@ -21,27 +21,36 @@
     <a href="https://account.mojang.com/documents/minecraft_eula">MINECRAFT END USER LICENSE AGREEMENT</a>
     <div id="settings" class="ui form">
     </div>
-    <div class="ui button" onclick="sendCmd()">Update</div>
+    <div class="ui button" onclick="submit()">Update</div>
 </body>
 <script>
-    $.get("/eula", function(data) {
-        if (data.length == 0) {
-            $("#settings").html(`
+    updateInfo()
+
+    function updateInfo() {
+        $.get("/eula", function(data) {
+            if (data.length == 0) {
+                $("#settings").html(`
                         <div class="inline field">
                             <label>No item :(</label>
                         </div>
                         <div class="ui divider"></div>
                     `)
-            return
-        }
-        $("#settings").html(`
+                return
+            }
+            $("#settings").html(`
                 <div class="inline field">
                     <label style="width:46vw">EULA</label>
-                    <input style="width:46vw" type="text" id="EULA" placeholder="` + data + `" value="` + data + `">
+                    <input style="width:46vw" type="text" id="eula" placeholder="` + data + `" value="` + data + `">
                 </div>
                 <div class="ui divider"></div>
         `)
-    });
+        });
+    }
+
+    function submit() {
+        var value = $("#eula").val();
+        $.get("/eula/change?value=" + value)
+    }
 </script>
 
 </html>

+ 22 - 10
webroot/setting/properties.html

@@ -20,30 +20,42 @@
 <body>
     <div id="settings" class="ui form">
     </div>
-    <div class="ui button" onclick="sendCmd()">Update</div>
+    <div class="ui button" onclick="submit()">Update</div>
 </body>
 <script>
-    $.get("/properties", function(data) {
-        if (data.length == 0) {
-            $("#settings").html(`
+    updateInfo()
+
+    function updateInfo() {
+        $.get("/properties", function(data) {
+            if (data.length == 0) {
+                $("#settings").html(`
                         <div class="inline field">
                             <label>No item :(</label>
                         </div>
                         <div class="ui divider"></div>
                     `)
-            return
-        }
-        $("#settings").html("");
-        $.each(data, function(i, item) {
-            $("#settings").append(`
+                return
+            }
+            $("#settings").html("");
+            $.each(data, function(i, item) {
+                $("#settings").append(`
                 <div class="inline field">
                     <label style="width:46vw">` + item.key + `</label>
                     <input style="width:46vw" type="text" id="` + item.key + `" placeholder="` + item.value + `" value="` + item.value + `">
                 </div>
                 <div class="ui divider"></div>
             `)
+            })
+        });
+    }
+
+    function submit() {
+        $.each($("input"), function(i, item) {
+            var key = $(item).attr("id");
+            var value = $(item).val();
+            $.get("/properties/change?key=" + key + "&value=" + value)
         })
-    });
+    }
 </script>
 
 </html>