# HG changeset patch
# User Edouard Tisserant
# Date 1667555778 -3600
# Node ID efbc869494678098f2d00a16c70b94ad39034a55
# Parent e42a09c1d3f3d7b3b12431bf66b704857509566d
SVGHMI: update generated XSLT
diff -r e42a09c1d3f3 -r efbc86949467 svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt Fri Nov 04 10:55:30 2022 +0100
+++ b/svghmi/gen_index_xhtml.xslt Fri Nov 04 10:56:18 2022 +0100
@@ -637,6 +637,27 @@
";
+
+
+
+
+
+
+
+ ScreenSaver page has missing or malformed delay argument.
+
+
+
+
+
+ null
+
+
+
+ var screensaver_delay =
+
+ ;
+
@@ -2907,9 +2928,17 @@
if(jump_history.length > 1){
- jump_history.pop();
-
- let [page_name, index] = jump_history.pop();
+ let page_name, index;
+
+ do {
+
+ jump_history.pop(); // forget current page
+
+ if(jump_history.length == 0) return;
+
+ [page_name, index] = jump_history[jump_history.length-1];
+
+ } while(page_name == "ScreenSaver") // never go back to ScreenSaver
switch_page(page_name, index);
@@ -2919,7 +2948,7 @@
init() {
- this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)");
+ this.element.onclick = this.on_click.bind(this);
}
@@ -12099,6 +12128,32 @@
+ 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)
+
+ document.body.addEventListener('pointerdown', reset_screensaver_timer);
+
+
+
function detach_detachables() {
@@ -12237,11 +12292,17 @@
requestHMIAnimation();
- jump_history.push([page_name, page_index]);
-
- if(jump_history.length > 42)
-
- jump_history.shift();
+ let [last_page_name, last_page_index] = jump_history[jump_history.length-1];
+
+ if(last_page_name != page_name || last_page_index != page_index){
+
+ jump_history.push([page_name, page_index]);
+
+ if(jump_history.length > 42)
+
+ jump_history.shift();
+
+ }
@@ -12413,6 +12474,12 @@
+ // initialize screensaver
+
+ reset_screensaver_timer();
+
+
+
var reconnect_delay = 0;
var periodic_reconnect_timer;