svghmi/scripts.ysl2
branchsvghmi
changeset 2938 1379cd5c69dd
parent 2937 9226a830fbc3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/svghmi/scripts.ysl2	Sat Apr 18 13:14:45 2020 +0200
@@ -0,0 +1,50 @@
+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
+}
+