DmitrMakeev commited on
Commit
1353b52
·
verified ·
1 Parent(s): e290abe

Update online.html

Browse files
Files changed (1) hide show
  1. online.html +28 -1
online.html CHANGED
@@ -94,6 +94,8 @@ document.addEventListener("DOMContentLoaded", function () {
94
  </nav>
95
 
96
 
 
 
97
 
98
  <div class="container mt-3">
99
 
@@ -842,6 +844,7 @@ function updateAlW(value) {
842
  document.getElementById("tA").textContent = data.tA;
843
  document.getElementById("hDm").textContent = data.hDm;
844
  document.getElementById("sVen").textContent = data.sVen;
 
845
  updateRFul(data.rFul);
846
  updateRLi(data.rLi);
847
  updateRWat(data.rWat);
@@ -967,7 +970,31 @@ function updateAlW(value) {
967
  setInterval(fetchValues, 10000);
968
  };
969
  </script>
970
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971
 
972
  </body>
973
  </html>
 
94
  </nav>
95
 
96
 
97
+ <h1>Текущее состояние растения</h1>
98
+ <img id="plantImage" src="/last_image" alt="Изображение растения">
99
 
100
  <div class="container mt-3">
101
 
 
844
  document.getElementById("tA").textContent = data.tA;
845
  document.getElementById("hDm").textContent = data.hDm;
846
  document.getElementById("sVen").textContent = data.sVen;
847
+
848
  updateRFul(data.rFul);
849
  updateRLi(data.rLi);
850
  updateRWat(data.rWat);
 
970
  setInterval(fetchValues, 10000);
971
  };
972
  </script>
973
+ <script>
974
+ function updateImage() {
975
+ // Добавляем timestamp для предотвращения кеширования
976
+ const timestamp = new Date().getTime();
977
+ const imgElement = document.getElementById("plantImage");
978
+
979
+ // Показываем индикатор загрузки
980
+ imgElement.style.opacity = "0.9";
981
+
982
+ // Обновляем источник изображения
983
+ imgElement.src = "/last_image?t=" + timestamp;
984
+
985
+ // Возвращаем нормальную прозрачность после загрузки
986
+ imgElement.onload = function() {
987
+ imgElement.style.opacity = "1";
988
+ }
989
+ }
990
+ // Первичная загрузка при открытии страницы
991
+ document.addEventListener('DOMContentLoaded', function() {
992
+ updateImage();
993
+
994
+ // Автоматическое обновление каждые 10 секунд
995
+ setInterval(updateImage, 10000);
996
+ });
997
+ </script>
998
 
999
  </body>
1000
  </html>