wasserzaehler_roi.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="icon" href="data:,">
  5. <title>Overview</title>
  6. <meta charset="utf-8">
  7. <style>
  8. .tg {border-collapse:collapse;border-spacing:0;width:100%;color: darkslategray;border: inset;height:585px;}
  9. .tg td{font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
  10. .tg th{height: 50px;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}
  11. .tg .tg-1{width:77%;font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
  12. .tg .tg-2{font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
  13. .tg .tg-3{height: 15px;font-size:14px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
  14. </style>
  15. </head>
  16. <body style="font-family: arial">
  17. <table class="tg">
  18. <tr>
  19. <td class="tg-1" rowspan="9"><div id="img"></div></td>
  20. <th class="th">Value:</th>
  21. </tr>
  22. <tr>
  23. <td class="tg-2">
  24. <div id="value"></div>
  25. </td>
  26. </tr>
  27. <tr>
  28. <th class="th">Previous Value:</th>
  29. </tr>
  30. <tr>
  31. <td class="tg-2">
  32. <div id="prevalue"></div>
  33. </td>
  34. </tr>
  35. <tr>
  36. <th class="th">Raw Value:</th>
  37. </tr>
  38. <tr>
  39. <td class="tg-2">
  40. <div id="raw"></div>
  41. </td>
  42. </tr>
  43. <tr>
  44. <th class="th">Error:</th>
  45. </tr>
  46. <tr>
  47. <td class="tg-2">
  48. <div id="error"></div>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td class="tg-3">
  53. <div id="timestamp" ></div>
  54. <div id="statusflow" ></div>
  55. </td>
  56. </tr>
  57. </table>
  58. <script src="/jquery-3.6.0.min.js"></script>
  59. <script type="text/javascript" src="./gethost.js"></script>
  60. <script type="text/javascript" src="./readconfigcommon.js"></script>
  61. <script type="text/javascript">
  62. function addZero(i) {
  63. if (i < 10) {
  64. i = "0" + i;
  65. }
  66. return i;
  67. }
  68. $(document).ready(function() {
  69. var d = new Date();
  70. var h = addZero(d.getHours());
  71. var m = addZero(d.getMinutes());
  72. var s = addZero(d.getSeconds());
  73. $('#img').html('<img src="/img_tmp/alg_roi.jpg" style="max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
  74. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  75. loadStatus();
  76. refresh();
  77. });
  78. function refresh() {
  79. setTimeout (function() {
  80. var time = new Date();
  81. var timestamp = new Date().getTime();
  82. var d = new Date();
  83. var h = addZero(d.getHours());
  84. var m = addZero(d.getMinutes());
  85. var s = addZero(d.getSeconds());
  86. // reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp
  87. $('#img').html('<img src="/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'"max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
  88. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  89. loadStatus();
  90. init();
  91. refresh();
  92. }, 300000);
  93. }
  94. var basepath = "http://192.168.178.22";
  95. function loadStatus() {
  96. url = basepath + '/statusflow.html';
  97. var xhttp = new XMLHttpRequest();
  98. xhttp.onreadystatechange = function() {
  99. if (this.readyState == 4 && this.status == 200) {
  100. var _rsp = xhttp.responseText;
  101. _rsp = "Status: " + _rsp;
  102. $('#statusflow').html(_rsp);
  103. }
  104. }
  105. xhttp.open("GET", url, true);
  106. xhttp.send();
  107. }
  108. function loadValue(_type, _div, _style) {
  109. url = basepath + '/wasserzaehler.html?all=true&type=' + _type;
  110. var xhttp = new XMLHttpRequest();
  111. xhttp.onreadystatechange = function() {
  112. if (this.readyState == 4 && this.status == 200) {
  113. var _rsp = xhttp.responseText;
  114. var _split = _rsp.split("\r");
  115. if (typeof _style == undefined)
  116. out = "<table>";
  117. else
  118. out = "<table style=\"" + _style + "\">";
  119. if (_split.length == 1)
  120. {
  121. var _zer = ZerlegeZeile(_split[0], "\t")
  122. if (_zer.length > 1)
  123. out = _zer[1];
  124. else
  125. out = "";
  126. }
  127. else
  128. {
  129. for (var j = 0; j < _split.length; ++j)
  130. {
  131. var _zer = ZerlegeZeile(_split[j], "\t")
  132. if (_zer.length == 1)
  133. out = out + "<tr><td>" + _zer[0] + "</td><td> </td></tr>";
  134. else
  135. out = out + "<tr><td>" + _zer[0] + "</td><td>" + _zer[1] + "</td></tr>";
  136. }
  137. out = out + "</table>"
  138. }
  139. document.getElementById(_div).innerHTML = out;
  140. }
  141. };
  142. xhttp.open("GET", url, true);
  143. xhttp.send();
  144. }
  145. function init(){
  146. basepath = getbasepath();
  147. loadValue("value", "value");
  148. loadValue("raw", "raw");
  149. loadValue("prevalue", "prevalue");
  150. loadValue("error", "error", "font-size:8px");
  151. loadStatus();
  152. }
  153. init();
  154. </script>
  155. </body>
  156. </html>