Browse Source

Fix HTML document structure in data.html

SybexXx 12 giờ trước cách đây
mục cha
commit
6653fb7701
1 tập tin đã thay đổi với 33 bổ sung và 1 xóa
  1. 33 1
      sd-card/html/data.html

+ 33 - 1
sd-card/html/data.html

@@ -66,7 +66,39 @@
                 <button class="button" onClick="window.location.href = 'graph.html?v=$COMMIT_HASH'">Show Graph</button>
                 <button class="button" onClick="window.location.href = 'graph.html?v=$COMMIT_HASH'">Show Graph</button>
             </div>
             </div>
           </div>
           </div>
-    </body>
+    
+
+    <script>  
+            function reload() {
+                document.getElementById('data').innerHTML += "<br><b>Reloading...<b><br><br>";
+                window.scrollBy(0,document.body.scrollHeight);
+                funcRequest(getDomainname() + '/data');
+            } 
+    
+            async function funcRequest(url){
+                await fetch(url)
+                .then((res) => {
+                    if (!res.ok) {
+                        document.getElementById("data").innerHTML = "HTTP error " + res.status;
+                    }
+    
+                    return res.text();
+                })
+                .then((data) => {
+                    document.getElementById('data').innerHTML = "<br>" + data.split("\n").join("\n<br>") + "&nbsp;";
+    
+                    window.scrollBy(0,document.body.scrollHeight);
+    
+                })
+                .catch((err) => {
+                    document.getElementById("data").innerHTML = err;
+                });
+            }
+    
+            funcRequest(getDomainname() + '/data');
+    
+        </script>
+</body>
 
 
     <script>  
     <script>  
         function reload() {
         function reload() {