author | Edouard Tisserant |
Thu, 03 Sep 2020 11:16:08 +0200 | |
branch | svghmi |
changeset 3052 | ffce85221ea5 |
parent 2958 | 895d3f2b1786 |
child 3232 | 7bdb766c2a4d |
permissions | -rw-r--r-- |
2902 | 1 |
// widget_back.ysl2 |
2779
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
2 |
|
2958
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
3 |
template "widget[@type='Back']", mode="widget_class" |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
4 |
|| |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
5 |
class BackWidget extends Widget{ |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
6 |
on_click(evt) { |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
7 |
if(jump_history.length > 1){ |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
8 |
jump_history.pop(); |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
9 |
let [page_name, index] = jump_history.pop(); |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
10 |
switch_page(page_name, index); |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
11 |
} |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
12 |
} |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
13 |
init() { |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
14 |
this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)"); |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
15 |
} |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
16 |
} |
895d3f2b1786
SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
17 |
|| |