diff -r 3f5194bba67d -r 1fcb50af0335 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Thu Mar 26 13:33:20 2020 +0100 +++ b/svghmi/gen_index_xhtml.xslt Thu Mar 26 14:21:52 2020 +0100 @@ -694,6 +694,33 @@ + + + on_click: function(evt) { + + console.log("Back !"); + + if(jump_history.length > 1){ + + jump_history.pop(); + + let [page_name, index] = jump_history.pop(); + + switch_page(page_name, index); + + } + + }, + + init: function() { + + this.element.setAttribute("onclick", "hmi_widgets[' + + '].on_click(evt)"); + + }, + + frequency: 5, @@ -890,7 +917,9 @@ const index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined; - switch_page(this.args[0], index); + const name = this.args[0]; + + switch_page(name, index); }, @@ -1195,6 +1224,8 @@ var need_cache_apply = []; + var jump_history = [[default_page, undefined]]; + function dispatch_value_to_widget(widget, index, value, oldval) { @@ -1731,7 +1762,7 @@ /* TODO LOG ERROR */ - return; + return false; } @@ -1743,7 +1774,7 @@ - switch_subscribed_page(page_name, page_index); + return switch_subscribed_page(page_name, page_index); }; @@ -1935,7 +1966,7 @@ /* TODO LOG ERROR */ - return; + return false; } @@ -1975,6 +2006,14 @@ requestHMIAnimation(); + + + jump_history.push([page_name, page_index]); + + + + return true; + }