diff -r 9226a830fbc3 -r 1379cd5c69dd svghmi/gen_index_xhtml.ysl2 --- a/svghmi/gen_index_xhtml.ysl2 Sat Apr 18 11:49:02 2020 +0200 +++ b/svghmi/gen_index_xhtml.ysl2 Sat Apr 18 13:14:45 2020 +0200 @@ -35,6 +35,8 @@ include widget_*.ysl2 + include scripts.ysl2 + template "*[namespace-uri()='reflect']", mode="debug_as_comment" { comment { | «local-name()» : @@ -61,54 +63,4 @@ } } } - - function "scripts" - { - | - | id = idstr => document.getElementById(idstr); - | - | var hmi_hash = [«$hmitree/@hash»]; - - | var hmi_widgets = { - apply "$hmi_elements", mode="hmi_elements"; - | } - | - | var heartbeat_index = «$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index»; - | - | var hmitree_types = [ - - foreach "$indexed_hmitree/*" { - | /* «@index» «@hmipath» */ "«substring(local-name(), 5)»"`if "position()!=last()" > ,` - } - - | ] - | - - | var detachable_elements = { - foreach "$detachable_elements"{ - | "«@id»":[id("«@id»"), id("«../@id»")]`if "position()!=last()" > ,` - } - | } - - | - | var page_desc = { - apply "$hmi_pages", mode="page_desc"; - | } - - | var keypads = { - foreach "$keypads_descs"{ - const "keypad_id","@id"; - foreach "arg"{ - const "g", "$geometry[@Id = $keypad_id]"; - | "«@value»":["«$keypad_id»", «$g/@x», «$g/@y»], - } - } - | } - - - | - | var default_page = "«$default_page»"; - | var svg_root = id("«/svg:svg/@id»"); - include text svghmi.js - } }