Logic Machine Forum
Custom Javascript - simple Hello World example? - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Custom Javascript - simple Hello World example? (/showthread.php?tid=4345)



Custom Javascript - simple Hello World example? - temp4 - 03.11.2022

Hi!

I cannot get the "Custom Javascript" tool to function in Wiser for KNX from the menu Scripting > Tools > Edit custom JavaScript

This is the default content of the textfield:

$(function(){

  // your code here
});


Exactly what should I input here to make the js-code run in the web browser when using the Touch3 visualization?


I've tried replacing //your code here with console.log('Hello world') but the browser console reports nothing. Nor does log('Hello world in W4K') log anything to the Wiser for KNX "Logs"...

NB. I have mailed Schneider support (who usually respond within a week) but for two weeks I've received no answer...

Thanks!

Robert


RE: Custom Javascript - simple Hello World example? - admin - 03.11.2022

Custom JS only works in standard visualization, trends and schedulers.


RE: Custom Javascript - simple Hello World example? - temp4 - 03.11.2022

Aha! I see.

Is there any other method to inject Javascript into a Touch3 visualization in Wiser for KNX? Ideally as a separate .js-file.


RE: Custom Javascript - simple Hello World example? - temp4 - 04.11.2022

Would it be possible to access the template files for the Touch3 viz and add something like <script src="/path/my-javascript.js"></script> and then update this referenced file occasionally?


RE: Custom Javascript - simple Hello World example? - admin - 04.11.2022

There's no easy way of doing this. What kind of functionality do you want to implement with custom JavaScript?


RE: Custom Javascript - simple Hello World example? - temp4 - 07.11.2022

I was planning on doing all sorts of things. For example modifying CSS (=styles) and the DOM (=HTML elements), parsing JSON strings to draw simple diagrams, adding tooltips etc. Basically things too complex to maintain unless they can be stored in an external .js-file...


RE: Custom Javascript - simple Hello World example? - admin - 07.11.2022

LM Mosaic supports custom JS/CSS widgets but SE Touch3 does not. There's nothing that we can do about it.