Name | CircusJSLib2.0.0.js |
Description | Implements ReadValue and WriteValue in Javascript. |
Download | CircusJSLib2.0.0.js |
Hardware | Web Page |
In the example example_js_randomsignal there is displayed a single value from the signal Random Signal ignoring any location data (style='display:none')
In the example example_js_madridtemp there is displayed a temperature from the signal Temperature in Madrid reading location data (style='display:block')
Note! Only public signals can be embeded in a web (no token is needed).
1) Invoke the downloaded circuslib.js script (right before closing BODY tag). Do the same with jquery lib:
<script type="text/javascript" src="/your/realtive/path/jquery-3.1.0.js"></script>
2) Place this DIV in your HTML code, one for each signal to show, pasting key where asked, like this:
<div class='circus' id='your_key_here'> <div class='value'> <!--VALUE will be placed here--> </div> <div class='location' style='display:none'> <div class='loclabel'>Latitude: </div><div class='lat locelement'><!--LAT will be placed here--></div> <div class='loclabel'>Longitude: </div><div class='lon locelement'><!--LON will be placed here--></div> <div class='loclabel'>Altitude: </div><div class='alt locelement'><!--ALT will be placed here--></div> <div class='loclabel'>Is moving: </div><div class='ismobile locelement'><!--ISMOBILE will be placed here--></div> </div> </div>
Note: if location is set to style='display:none' this div won't show and no queries about location will be done in order to free browser's load. Turn it to style='display:block' to work
3) Invoke function pollCircus() once. For instance, when your page loads, in the BODY tag:
optional) Give it some style, include this css file in your header
Of course, it's just an idea... feel free to change it