diff --git a/www/css/custom.css b/www/css/custom.css index dcccedf..81f8588 100644 --- a/www/css/custom.css +++ b/www/css/custom.css @@ -24,4 +24,10 @@ display: inline-block; font-size: calc(10px + 0.9vw); font-weight: bold; +} + +.camera_sleep_text { + display: inline-block; + font-size: calc(10px + 0.9vw); + font-weight: bold; } \ No newline at end of file diff --git a/www/data/camera/msvcamN.avif b/www/data/camera/msvcamN.avif new file mode 100644 index 0000000..89d1525 Binary files /dev/null and b/www/data/camera/msvcamN.avif differ diff --git a/www/data/camera/msvcamS.avif b/www/data/camera/msvcamS.avif new file mode 100644 index 0000000..0619adf Binary files /dev/null and b/www/data/camera/msvcamS.avif differ diff --git a/www/index.html b/www/index.html index efe4d32..a0fcae1 100644 --- a/www/index.html +++ b/www/index.html @@ -27,12 +27,14 @@

Blick auf die Piste

Bild der Webcam mit Blick auf die Piste +

Blick nach Süden

Bild der Webcam mit Blick nach Süden +
@@ -44,7 +46,7 @@
pressewart@msv-buehl-moos.de
-

Last update: 2023/07/11

+

Last update: 2023/07/18

View code in GIT
diff --git a/www/js/webcam.js b/www/js/webcam.js index 658f167..74449b9 100644 --- a/www/js/webcam.js +++ b/www/js/webcam.js @@ -1,5 +1,7 @@ const boxes = document.getElementsByClassName('current_webcam_image_box'); const reload_interval = setInterval(reloadImages, 60000); +const wakeup_hour = 5; //UTC +const sleep_hour = 18; //UTC window.onload = function() { reloadImages(); @@ -20,9 +22,11 @@ function reloadImages() { var headline = box.childNodes[1] var image = box.childNodes[3] var status_text = box.childNodes[5] + var sleep_text = box.childNodes[7] if (checkImageSource(image.src) == 200) { status_text.style = "visibility:hidden" + sleep_text.style = "visibility:hidden" image.style = "width:100%;visibility:visible" if (!image.src.includes('?')) { image.src = `${image.src}?${Date.now()}`; @@ -30,12 +34,27 @@ function reloadImages() { image.src = image.src.slice(0, image.src.indexOf('?') + 1) + Date.now(); } } else { + console.log('unable to find image on server'); - image.alt = "Webcam nicht erreichbar." - image.style = "width:100%;visibility:hidden" - status_text.style = "visibility:visible" + + const now = new Date(); + const currentHour = now.getUTCHours(); + console.log(currentHour) + + if ((currentHour >= wakeup_hour) && (currentHour < sleep_hour)) { + console.log("Camera error/fault occurred") + sleep_text.style = "visibility:hidden" + image.alt = "Webcam nicht erreichbar." + image.style = "width:100%;visibility:hidden" + status_text.style = "visibility:visible" + } else { + console.log("Camera in sleep mode") + status_text.style = "visibility:hidden" + image.alt = "Webcam im Ruhemodus." + image.style = "width:100%;visibility:hidden" + sleep_text.style = "visibility:visible" + } } }); console.log('reload finished'); -} - +} \ No newline at end of file