From d4fcb0d76aef5613e094aba3ee8ee29ce615f7be Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 2 Dec 2022 15:21:47 +0100 Subject: [locationinfo] Workaround calendar scrolling to wrong day --- .../locationinfo/templates/frontend-default.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'modules-available/locationinfo/templates') diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html index 6e04550d..cc62075e 100755 --- a/modules-available/locationinfo/templates/frontend-default.html +++ b/modules-available/locationinfo/templates/frontend-default.html @@ -564,6 +564,8 @@ optional: putInRange(config, 'rotation', 0, 3, 0); } + var updateTimer = null; + /** * generates the Room divs and calls the needed functions depending on the rooms mode */ @@ -651,7 +653,7 @@ optional: } mainUpdateLoop(); - setInterval(mainUpdateLoop, 10000); + updateTimer = setInterval(mainUpdateLoop, 10000); setInterval(updateHeaders, globalConfig.eco ? 10000 : 1000); } @@ -679,7 +681,14 @@ optional: var today = date.getDate(); if (lastDate !== false) { if (lastDate !== today) { - location.reload(true); + if (updateTimer !== null) { + clearInterval(updateTimer); + updateTimer = null; + } + // Delay by a minute, sometimes the calendar shows the previous day if we load too quickly. + setTimeout(function() { + location.reload(true); + }, 60000); } } else { lastDate = today; @@ -1326,7 +1335,6 @@ optional: /========================================== Room Layout ============================================= */ - const picSizeX = 3.8; const picSizeY = 3; -- cgit v1.2.3-55-g7522