--- a/svghmi/svghmi.js Tue Nov 08 11:03:45 2022 +0100
+++ b/svghmi/svghmi.js Wed Nov 09 12:14:35 2022 +0100
@@ -428,18 +428,22 @@
e.preventDefault();
});
-var screensaver_timer = null;
-function reset_screensaver_timer() {
- if(screensaver_timer){
- window.clearTimeout(screensaver_timer);
- }
- screensaver_timer = window.setTimeout(() => {
- switch_page("ScreenSaver");
- screensaver_timer = null;
- }, screensaver_delay*1000);
-}
-if(screensaver_delay)
+if(screensaver_delay){
+ var screensaver_timer = null;
+ function reset_screensaver_timer() {
+ if(screensaver_timer){
+ window.clearTimeout(screensaver_timer);
+ }
+ screensaver_timer = window.setTimeout(() => {
+ switch_page("ScreenSaver");
+ screensaver_timer = null;
+ }, screensaver_delay*1000);
+ }
document.body.addEventListener('pointerdown', reset_screensaver_timer);
+ // initialize screensaver
+ reset_screensaver_timer();
+}
+
function detach_detachables() {
@@ -601,9 +605,6 @@
// show main page
switch_page(default_page);
-// initialize screensaver
-reset_screensaver_timer();
-
var reconnect_delay = 0;
var periodic_reconnect_timer;