wasserzaehler_roi.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="icon" href="favicon.ico" type="image/x-icon">
  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" style="vertical-align: top"><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. <div id="cputemp" ></div>
  56. <div id="rssi" ></div>
  57. </td>
  58. </tr>
  59. </table>
  60. <script src="/jquery-3.6.0.min.js"></script>
  61. <script type="text/javascript" src="./gethost.js"></script>
  62. <script type="text/javascript" src="./readconfigcommon.js"></script>
  63. <script type="text/javascript">
  64. function addZero(i) {
  65. if (i < 10) {
  66. i = "0" + i;
  67. }
  68. return i;
  69. }
  70. $(document).ready(function() {
  71. var d = new Date();
  72. var h = addZero(d.getHours());
  73. var m = addZero(d.getMinutes());
  74. var s = addZero(d.getSeconds());
  75. $('#img').html('<img src="/img_tmp/alg_roi.jpg" style="max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
  76. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  77. loadStatus();
  78. loadCPUTemp();
  79. loadRSSI();
  80. refresh();
  81. });
  82. function refresh() {
  83. setTimeout (function() {
  84. var time = new Date();
  85. var timestamp = new Date().getTime();
  86. var d = new Date();
  87. var h = addZero(d.getHours());
  88. var m = addZero(d.getMinutes());
  89. var s = addZero(d.getSeconds());
  90. // reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp
  91. $('#img').html('<img src="/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'"max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
  92. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  93. init();
  94. refresh();
  95. }, 300000);
  96. }
  97. var basepath = "http://192.168.178.22";
  98. function loadStatus() {
  99. url = basepath + '/statusflow.html';
  100. var xhttp = new XMLHttpRequest();
  101. xhttp.onreadystatechange = function() {
  102. if (this.readyState == 4 && this.status == 200) {
  103. var _rsp = xhttp.responseText;
  104. _rsp = "Status: " + _rsp;
  105. $('#statusflow').html(_rsp);
  106. }
  107. }
  108. xhttp.open("GET", url, true);
  109. xhttp.send();
  110. }
  111. function loadCPUTemp() {
  112. url = basepath + '/cputemp.html';
  113. var xhttp = new XMLHttpRequest();
  114. xhttp.onreadystatechange = function() {
  115. if (this.readyState == 4 && this.status == 200) {
  116. var _rsp = xhttp.responseText;
  117. $('#cputemp').html(_rsp);
  118. }
  119. }
  120. xhttp.open("GET", url, true);
  121. xhttp.send();
  122. }
  123. function loadRSSI() {
  124. url = basepath + '/rssi.html';
  125. var xhttp = new XMLHttpRequest();
  126. xhttp.onreadystatechange = function() {
  127. if (this.readyState == 4 && this.status == 200) {
  128. var _rsp = xhttp.responseText;
  129. $('#rssi').html(_rsp);
  130. }
  131. }
  132. xhttp.open("GET", url, true);
  133. xhttp.send();
  134. }
  135. function loadValue(_type, _div, _style) {
  136. url = basepath + '/wasserzaehler.html?all=true&type=' + _type;
  137. var xhttp = new XMLHttpRequest();
  138. xhttp.onreadystatechange = function() {
  139. if (this.readyState == 4 && this.status == 200) {
  140. var _rsp = xhttp.responseText;
  141. var _split = _rsp.split("\r");
  142. if (typeof _style == undefined)
  143. out = "<table>";
  144. else
  145. out = "<table style=\"" + _style + "\">";
  146. if (_split.length == 1)
  147. {
  148. var _zer = ZerlegeZeile(_split[0], "\t")
  149. if (_zer.length > 1)
  150. out = _zer[1];
  151. else
  152. out = "";
  153. }
  154. else
  155. {
  156. for (var j = 0; j < _split.length; ++j)
  157. {
  158. var _zer = ZerlegeZeile(_split[j], "\t")
  159. if (_zer.length == 1)
  160. out = out + "<tr><td>" + _zer[0] + "</td><td> </td></tr>";
  161. else
  162. out = out + "<tr><td>" + _zer[0] + "</td><td>" + _zer[1] + "</td></tr>";
  163. }
  164. out = out + "</table>"
  165. }
  166. document.getElementById(_div).innerHTML = out;
  167. }
  168. };
  169. xhttp.open("GET", url, true);
  170. xhttp.send();
  171. }
  172. function init(){
  173. basepath = getbasepath();
  174. loadValue("value", "value");
  175. loadValue("raw", "raw");
  176. loadValue("prevalue", "prevalue");
  177. loadValue("error", "error", "font-size:8px");
  178. loadStatus();
  179. loadCPUTemp();
  180. loadRSSI();
  181. }
  182. init();
  183. </script>
  184. </body>
  185. </html>