Bladeren bron

Fix HTML document structure in info.html

SybexXx 13 uur geleden
bovenliggende
commit
8dde4ed898
1 gewijzigde bestanden met toevoegingen van 114 en 126 verwijderingen
  1. 114 126
      sd-card/html/info.html

+ 114 - 126
sd-card/html/info.html

@@ -33,13 +33,11 @@ table {
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
 	<table>
 	<table>
-		<colgroup>
+		<caption><h3>Runtime Information</h3></caption>
+        <colgroup>
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 65%;">
 			<col span="1" style="width: 65%;">
 		</colgroup>
 		</colgroup>
-		<tr>
-			<h3>Runtime Information</h3>
-		</tr>
 		<tr>
 		<tr>
 			<td>Start time:</td>
 			<td>Start time:</td>
 			<td><output id="starttime"></output></td>
 			<td><output id="starttime"></output></td>
@@ -51,13 +49,11 @@ table {
 	</table>
 	</table>
 
 
 	<table>
 	<table>
-		<colgroup>
+		<caption><h3>Build Info</h3></caption>
+        <colgroup>
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 65%;">
 			<col span="1" style="width: 65%;">
 		</colgroup>
 		</colgroup>
-		<tr>
-			<h3>Build Info</h3>
-		</tr>
 		<tr>
 		<tr>
 			<td>Firmware version:</td>
 			<td>Firmware version:</td>
 			<td>
 			<td>
@@ -80,13 +76,11 @@ table {
 	</table>
 	</table>
 
 
 	<table>
 	<table>
-		<colgroup>
+		<caption><h3>Device Info</h3></caption>
+        <colgroup>
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 65%;">
 			<col span="1" style="width: 65%;">
 		</colgroup>
 		</colgroup>
-		<tr>
-			<h3>Device Info</h3>
-		</tr>
 		<tr>
 		<tr>
 			<td>Chip Cores:</td>
 			<td>Chip Cores:</td>
 			<td>
 			<td>
@@ -109,13 +103,11 @@ table {
 
 
 
 
 	<table>
 	<table>
-		<colgroup>
+		<caption><h3>Host Info</h3></caption>
+        <colgroup>
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 65%;">
 			<col span="1" style="width: 65%;">
 		</colgroup>
 		</colgroup>
-		<tr>			
-			<h3>Host Info</h3>
-		</tr>
 		<tr>
 		<tr>
 			<td>Hostname:</td>
 			<td>Hostname:</td>
 			<td>
 			<td>
@@ -137,13 +129,11 @@ table {
 	</table>
 	</table>
 
 
 	<table>
 	<table>
-		<colgroup>
+		<caption><h3>SD Card Info</h3></caption>
+        <colgroup>
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 65%;">
 			<col span="1" style="width: 65%;">
 		</colgroup>
 		</colgroup>
-		<tr>			
-			<h3>SD Card Info</h3>
-		</tr>
 		<tr>
 		<tr>
 			<td>SD card manufacturer:</td>
 			<td>SD card manufacturer:</td>
 			<td>
 			<td>
@@ -189,13 +179,11 @@ table {
 	</table>
 	</table>
 
 
 	<table>
 	<table>
-		<colgroup>
+		<caption><h3>Memory Info</h3></caption>
+        <colgroup>
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 65%;">
 			<col span="1" style="width: 65%;">
 		</colgroup>
 		</colgroup>
-		<tr>			
-			<h3>Memory Info</h3>
-		</tr>
 		<tr>
 		<tr>
 			<td>Total Free (Int + Ext):</td>	
 			<td>Total Free (Int + Ext):</td>	
 			<td>
 			<td>
@@ -244,111 +232,111 @@ table {
 <h3>Copyright</h3>
 <h3>Copyright</h3>
 Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edge-device" target=_blank>Jomjol</a> and others.
 Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edge-device" target=_blank>Jomjol</a> and others.
 
 
-</body>
-</html>
 
 
-<script type="text/javascript">
-    function setOutput(id, value, suffix)
-    {
-        var field = document.getElementById(id);
-        if (!field) {
-            return;
-        }
-
-        if (value === undefined || value === null || value === "") {
-            field.value = "N/A";
-        } else {
-            field.value = String(value) + (suffix || "");
-        }
-    }
-
-    function formatStartTime(value)
-    {
-        if (!value || value.length < 15) {
-            return value || "";
-        }
 
 
-        // Input format: YYYYMMDD-HHMMSS
-        return value.substr(6, 2) + "." +
-               value.substr(4, 2) + "." +
-               value.substr(0, 4) + " " +
-               value.substr(9, 2) + ":" +
-               value.substr(11, 2) + ":" +
-               value.substr(13, 2);
-    }
-
-    function formatBuildTime(value)
-    {
-        if (!value || value.length < 16) {
-            return value || "";
-        }
-
-        // Input format: YYYY-MM-DD HH:MM
-        return value.substr(8, 2) + "." +
-               value.substr(5, 2) + "." +
-               value.substr(0, 4) + " " +
-               value.substr(11, 2) + ":" +
-               value.substr(14, 2);
-    }
-
-    function loadSystemInfo()
-    {
-        var request = new XMLHttpRequest();
-        request.onreadystatechange = function() {
-            if (this.readyState !== 4) {
+    <script type="text/javascript">
+        function setOutput(id, value, suffix)
+        {
+            var field = document.getElementById(id);
+            if (!field) {
                 return;
                 return;
             }
             }
-
-            if (this.status !== 200) {
-                console.error("Could not load system information:", this.status);
-                return;
+    
+            if (value === undefined || value === null || value === "") {
+                field.value = "N/A";
+            } else {
+                field.value = String(value) + (suffix || "");
             }
             }
-
-            try {
-                var response = JSON.parse(this.responseText);
-                var info = Array.isArray(response) ? response[0] : response;
-                if (!info || typeof info !== "object") {
-                    throw new Error("Invalid system information response");
-                }
-
-                setOutput("starttime", formatStartTime(info.starttime));
-                setOutput("uptime", info.uptime);
-                setOutput("firmware", info.firmware);
-                setOutput("build-time", formatBuildTime(info.buildtime));
-                setOutput("web-ui", info.html);
-
-                setOutput("chip-cores", info.chipCores);
-                setOutput("chip-revision", info.chipRevision);
-                setOutput("chip-features", info.chipFeatures);
-
-                setOutput("hostname", info.hostname);
-                setOutput("IP-address", info.IPv4);
-                setOutput("wlan-ssid", info.SSID);
-
-                setOutput("SDCardManufacturer", info.sdCardManufacturer);
-                setOutput("SDCardName", info.sdCardName);
-                setOutput("SDCardCapacity", info.sdCardCapacity, " MB");
-                setOutput("SDCardSectorSize", info.sdCardSectorSize, " byte");
-                setOutput("SDCardPartitionSize", info.sdCardPartitionSize, " MB");
-                setOutput("SDCardFreePartitionSpace", info.sdCardFreePartitionSpace, " MB");
-                setOutput("SDCardPartitionAllocationSize", info.sdCardPartitionAllocationSize, " byte");
-
-                setOutput("RAMTotalFree", info.RAMTotalFree, " byte");
-                setOutput("ExtRAMFree", info.ExtRAMFree, " byte");
-                setOutput("ExtRAMLargestFree", info.ExtRAMLargestFree, " byte");
-                setOutput("ExtRAMMinFree", info.ExtRAMMinFree, " byte");
-                setOutput("IntRAMFree", info.IntRAMFree, " byte");
-                setOutput("IntRAMLargestFree", info.IntRAMLargestFree, " byte");
-                setOutput("IntRAMMinFree", info.IntRAMMinFree, " byte");
-            } catch (error) {
-                console.error("Could not parse system information:", error);
+        }
+    
+        function formatStartTime(value)
+        {
+            if (!value || value.length < 15) {
+                return value || "";
             }
             }
-        };
-
-        request.open("GET", getDomainname() + "/sysinfo", true);
-        request.send();
-    }
-
-    loadSystemInfo();
-</script>
-
+    
+            // Input format: YYYYMMDD-HHMMSS
+            return value.substr(6, 2) + "." +
+                   value.substr(4, 2) + "." +
+                   value.substr(0, 4) + " " +
+                   value.substr(9, 2) + ":" +
+                   value.substr(11, 2) + ":" +
+                   value.substr(13, 2);
+        }
+    
+        function formatBuildTime(value)
+        {
+            if (!value || value.length < 16) {
+                return value || "";
+            }
+    
+            // Input format: YYYY-MM-DD HH:MM
+            return value.substr(8, 2) + "." +
+                   value.substr(5, 2) + "." +
+                   value.substr(0, 4) + " " +
+                   value.substr(11, 2) + ":" +
+                   value.substr(14, 2);
+        }
+    
+        function loadSystemInfo()
+        {
+            var request = new XMLHttpRequest();
+            request.onreadystatechange = function() {
+                if (this.readyState !== 4) {
+                    return;
+                }
+    
+                if (this.status !== 200) {
+                    console.error("Could not load system information:", this.status);
+                    return;
+                }
+    
+                try {
+                    var response = JSON.parse(this.responseText);
+                    var info = Array.isArray(response) ? response[0] : response;
+                    if (!info || typeof info !== "object") {
+                        throw new Error("Invalid system information response");
+                    }
+    
+                    setOutput("starttime", formatStartTime(info.starttime));
+                    setOutput("uptime", info.uptime);
+                    setOutput("firmware", info.firmware);
+                    setOutput("build-time", formatBuildTime(info.buildtime));
+                    setOutput("web-ui", info.html);
+    
+                    setOutput("chip-cores", info.chipCores);
+                    setOutput("chip-revision", info.chipRevision);
+                    setOutput("chip-features", info.chipFeatures);
+    
+                    setOutput("hostname", info.hostname);
+                    setOutput("IP-address", info.IPv4);
+                    setOutput("wlan-ssid", info.SSID);
+    
+                    setOutput("SDCardManufacturer", info.sdCardManufacturer);
+                    setOutput("SDCardName", info.sdCardName);
+                    setOutput("SDCardCapacity", info.sdCardCapacity, " MB");
+                    setOutput("SDCardSectorSize", info.sdCardSectorSize, " byte");
+                    setOutput("SDCardPartitionSize", info.sdCardPartitionSize, " MB");
+                    setOutput("SDCardFreePartitionSpace", info.sdCardFreePartitionSpace, " MB");
+                    setOutput("SDCardPartitionAllocationSize", info.sdCardPartitionAllocationSize, " byte");
+    
+                    setOutput("RAMTotalFree", info.RAMTotalFree, " byte");
+                    setOutput("ExtRAMFree", info.ExtRAMFree, " byte");
+                    setOutput("ExtRAMLargestFree", info.ExtRAMLargestFree, " byte");
+                    setOutput("ExtRAMMinFree", info.ExtRAMMinFree, " byte");
+                    setOutput("IntRAMFree", info.IntRAMFree, " byte");
+                    setOutput("IntRAMLargestFree", info.IntRAMLargestFree, " byte");
+                    setOutput("IntRAMMinFree", info.IntRAMMinFree, " byte");
+                } catch (error) {
+                    console.error("Could not parse system information:", error);
+                }
+            };
+    
+            request.open("GET", getDomainname() + "/sysinfo", true);
+            request.send();
+        }
+    
+        loadSystemInfo();
+    </script>
+</body>
+</html>