Update HTML / Autorefresh

- Update HTML-Content (SD-Card)
- Implementation of Auto-Refresh (Picture & Values)  on Overview-Page (300s)
- Implementation of "jquery-3.5.1.min.js"
This commit is contained in:
michaeljoos72
2020-09-19 19:07:26 +02:00
committed by GitHub
parent bb05957d33
commit 0d1b58542b
13 changed files with 684 additions and 557 deletions

View File

@@ -1,93 +1,107 @@
<html><head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css" media="screen">
.tg {border-collapse:collapse;border-spacing:0;width:100%;color: darkslategray;border: inset;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:24px;font-weight:bold;text-align:left;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg .tg-hfl5{font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
</style>
<!DOCTYPE html>
<html>
<head>
<title>Overview</title>
<meta charset="utf-8">
<style>
.tg {border-collapse:collapse;border-spacing:0;width:100%;color: darkslategray;border: inset;height:585px;}
.tg td{font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{height: 55px;font-size:24px;font-weight:bold;text-align:left;padding:0px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;background-color:#f0f0f0}
.tg .tg-1{width:78%;font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
.tg .tg-2{font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
.tg .tg-3{height: 15px;font-size:14px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
</style>
</head>
<script src="/jquery-3.5.1.min.js"></script>
<script>
function includeHTML() {
var z, i, elmnt, file, xhttp;
/* Loop through a collection of all HTML elements: */
z = document.getElementsByTagName("*");
for (i = 0; i < z.length; i++) {
elmnt = z[i];
/*search for elements with a certain atrribute:*/
file = elmnt.getAttribute("w3-include-html");
if (file) {
/* Make an HTTP request using the attribute value as the file name: */
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {elmnt.innerHTML = this.responseText;}
if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
/* Remove the attribute, and call this function once more: */
elmnt.removeAttribute("w3-include-html");
includeHTML();
}
}
xhttp.open("GET", file, true);
xhttp.send();
/* Exit the function: */
return;
}
function addZero(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
$ (document).ready(function() {
var d = new Date();
var h = addZero(d.getHours());
var m = addZero(d.getMinutes());
var s = addZero(d.getSeconds());
$('#img').html('<img src="/img_tmp/alg_roi.jpg" style="width:740px;max-height:100%"></img>');
$("#raw").load("/wasserzaehler.html?rawvalue=true");
$("#corrected").load("/wasserzaehler.html");
$("#checked").load("/setPreValue.html");
$("#start").load("/starttime");
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
refresh();
});
function refresh() {
setTimeout (function() {
var time = new Date();
var timestamp = new Date().getTime();
var d = new Date();
var h = addZero(d.getHours());
var m = addZero(d.getMinutes());
var s = addZero(d.getSeconds());
// reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp
$('#img').html('<img src="/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'" style="width:740px;max-height:100%"></img>');
$("#raw").load("/wasserzaehler.html?rawvalue=true");
$("#corrected").load("/wasserzaehler.html");
$("#checked").load("/setPreValue.html");
$("#start").load("/starttime");
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
refresh();
}, 300000);
}
}
</script>
<body style="font-family: arial">
<table class="tg">
<tr>
<td class="tg-hfl5" rowspan="8"><img src="/img_tmp/alg_roi.jpg" alt="ROI-Image"></td>
<th class="th">
Raw Value:
</th>
<td class="tg-1" rowspan="9"><div id="img"></div></td>
<th class="th">Raw Value:</th>
</tr>
<tr>
<td class="tg-hfl5">
<div w3-include-html="/wasserzaehler.html?rawvalue=true"></div>
<td class="tg-2">
<div id="raw"></div>
</td>
</tr>
<tr>
<th class="th">
Corrected Value:
</th>
<th class="th">Corrected Value:</th>
</tr>
<tr>
<td class="tg-hfl5">
<div w3-include-html="/wasserzaehler.html"></div>
<td class="tg-2">
<div id="corrected"></div>
</td>
</tr>
<tr>
<th class="th">
Checked Value:
</th>
<th class="th">Checked Value:</th>
</tr>
<tr>
<td class="tg-hfl5">
<div w3-include-html="/setPreValue.html"></div>
<td class="tg-2">
<div id="checked"></div>
</td>
</tr>
<tr>
<th class="th">
Start Time:
</th>
<th class="th">Start Time:</th>
</tr>
<tr>
<td class="tg-hfl5">
<div w3-include-html="/starttime"></div>
<td class="tg-2">
<div id="start"></div>
</td>
</tr>
</tr>
<tr>
<td class="tg-3">
<div id="timestamp"></div>
</td>
</tr>
</table>
<script>
includeHTML();
</script>
</body></html>
</body>
</html>