svghmi/scripts.ysl2
branchsvghmi
changeset 2941 ef13a4007538
parent 2940 034b6ce4f885
child 2942 b07ad97e6019
equal deleted inserted replaced
2940:034b6ce4f885 2941:ef13a4007538
     1 function "scripts"
       
     2 {
       
     3     |
       
     4     | id = idstr => document.getElementById(idstr);
       
     5     |
       
     6     | var hmi_hash = [«$hmitree/@hash»];
       
     7 
       
     8     | var hmi_widgets = {
       
     9     apply "$hmi_elements", mode="hmi_elements";
       
    10     | }
       
    11     |
       
    12     | var heartbeat_index = «$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index»;
       
    13     |
       
    14     | var hmitree_types = [
       
    15 
       
    16     foreach "$indexed_hmitree/*" {
       
    17     |     /* «@index»  «@hmipath» */ "«substring(local-name(), 5)»"`if "position()!=last()" > ,`
       
    18     }
       
    19 
       
    20     | ]
       
    21     |
       
    22 
       
    23     | var detachable_elements = {
       
    24     foreach "$detachable_elements"{
       
    25     |     "«@id»":[id("«@id»"), id("«../@id»")]`if "position()!=last()" > ,`
       
    26     }
       
    27     | }
       
    28 
       
    29     |
       
    30     | var page_desc = {
       
    31     apply "$hmi_pages", mode="page_desc";
       
    32     | }
       
    33 
       
    34     | var keypads = {
       
    35     foreach "$keypads_descs"{
       
    36         const "keypad_id","@id";
       
    37         foreach "arg"{
       
    38             const "g", "$geometry[@Id = $keypad_id]";
       
    39     |     "«@value»":["«$keypad_id»", «$g/@x», «$g/@y»],
       
    40         }
       
    41     }
       
    42     | }
       
    43 
       
    44 
       
    45     |
       
    46     | var default_page = "«$default_page»";
       
    47     | var svg_root = id("«/svg:svg/@id»");
       
    48     include text svghmi.js
       
    49 }
       
    50