# HG changeset patch # User Edouard Tisserant # Date 1568876509 -7200 # Node ID e468f18df20038e35f098122814c0e79169e737b # Parent 75c6a31caca657edd1ba9bcd1e321e91b8f1265f SVGHMI: moved static JS code to a separate file included at xhtml generation time diff -r 75c6a31caca6 -r e468f18df200 svghmi/gen_index_xhtml.ysl2 --- a/svghmi/gen_index_xhtml.ysl2 Wed Sep 18 11:09:35 2019 +0200 +++ b/svghmi/gen_index_xhtml.ysl2 Thu Sep 19 09:01:49 2019 +0200 @@ -47,20 +47,14 @@ } apply "@* | node()"; } - script - || - (function(){ - var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws'); - var ws = new WebSocket(relative_URI); - ws.onmessage = function (evt) { - var received_msg = evt.data; - alert("Message is received..."+received_msg); - }; - ws.onopen = function (evt) { - ws.send("test"); - }; - })(); - || + script{ + /*TODO add : + - pages content + + with ref to elt ? + - widgets parameters + */ + include text svghmi.js + } } } diff -r 75c6a31caca6 -r e468f18df200 svghmi/svghmi.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svghmi/svghmi.js Thu Sep 19 09:01:49 2019 +0200 @@ -0,0 +1,11 @@ +(function(){ + var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws'); + var ws = new WebSocket(relative_URI); + ws.onmessage = function (evt) { + var received_msg = evt.data; + alert("Message is received..."+received_msg); + }; + ws.onopen = function (evt) { + ws.send("test"); + }; +})();