- date - format date according to given format. Format is the same as in [yunkong2.javascript](https://github.com/yunkong2/yunkong2.javascript/blob/master/README.md#formatdate)
To show timestamp of object write ".ts" or ".lc" (for last change) at the end of object id, e.g.:
```
Last change: {objectRed.lc;date(hh:mm)}
```
There is another possibility to write pattern:
```
Hypotenuse of {height} and {width} = {h:height;w:width;Math.max(20, Math.sqrt(h*h + w*w))}
```
```{h:height;w:width;h*w}``` will be interpreted as function:
```
value = (function () {
var h = "10";
var w = "20";
return Math.max(20, Math.sqrt(h*h + w*w));
})();
```
You can use *any* javascript functions. Arguments must be defined with ':', if not, it will be interpreted as formula.
Take care about types. All of them defined as strings. To be sure, that value will be treated as number use parseFloat function.
```
Hypotenuse of {height} and {width} = {h:height;w:width;Math.max(20, Math.sqrt(Math.pow(parseFloat(h), 2) + Math.pow(parseFloat(w), 2)))}
```
### Special bindings
There are a number different internal bindings to provide additional information in views:
* username - shows logged in user
* view - name of actual view
* wname - widget name
* widget - is an object with all data of widget. Can be used only in JS part, like {a:a;widget.data.name}
* wid - name of actual widget
* language - can be "de", "en" or "ru".
* instance - browser instance
* login - if login required or not (e.g. to show/hide logout button)
Note: to use ":" in calculations (e.g. in string formula) use "::" instead.
**Remember**, that style definitions will be interpreted as bindings, so use ```{{style: value}}``` or just
```
{
style: value
}
```
for that.**
## Filters
To visualise on the one view thw whole number of widgets you can use filters to reduce the amount of widgets simultaneously shown on the view.
Every widget has a field "filter". If you set it to some value, e.g. "light", so you can use other widget (bars - filters, filter - dropdown) to control which filter is actually active.
## Control interface
Vis creates 3 variables:
- control.instance - Here the browser instance should be written or FFFFFFFF if every browser must be controlled.
- control.data - Parameter for command. See specific command description.
- control.command - Command name. Write this variable triggers the command. That means before command will be written the "instance" and "data" must be prepared with data.
Commands:
* alert - show alert window in vis. "control.data" has following format "message;title;jquery-icon". Title and jquery-icon are optional. Icon names can be found [here](http://jqueryui.com/themeroller/). To show icon "ui-icon-info" write ```Message;;info```.
* changeView - switch to desired view. "control.data" must have name of view. You can specify project name too as "project/view". Default project is "main".
* refresh - reload vis, for instance after project is changed to reload on all browsers.
* reload - same as refresh.
* dialog - Show dialog window. Dialog must exist on view. One of:
- "static - HTML - Dialog",
- "static - Icon - Dialog",
- "container - HTML - view in jqui Dialog",
- "container - ext cmd - view in jqui Dialog",
- "container - Icon - view in jqui Dialog",
- "container - Button - view in jqui Dialog".
"control.data" must have id of dialog widget, e.g. "w00056".
* dialogClose
* popup - opens a new browser window. Link must be specified in "control.data", e.g. http://google.com
* playSound - play sound file. The link to file is specified in "control.data", e.g. http://www.modular-planet.de/fx/marsians/Marsiansrev.mp3.
You can upload your own file in vis and let it play as for instance "/vis.0/main/img/myFile.mp3".
If user changes the view or at start the variables will be filled by vis with
- "control.instance": browser instance and ack=true
- "control.data": project and view name in form "project/view", e.g. "main/view" (and ack=true)
- "control.command": "changedView" and ack=true
You can write the JSON-string or Object into control.command as ```{instance: 'AABBCCDD', command: 'cmd', data: 'ddd'}```. In this case the instance and data will be taken from JSON object.
## Default view
You can define for every view the desired resolution (Menu=>Tools=>Resolution). This is only the visual border in edit mode to show you the screen size on some specific device. In real time mode it will not be visible and all widgets outside of border will be visible.
Additionally you can define if this view must be used as default for this resolution.
So every time the **index.html** (without #viewName) is called, the best suitable for this resolution view will be opened.
If only one view has *"Default"* flag, so this view will be opened independent from screen resolution or orientation.
E.g. you can create two views "Landscape-Mobile" and "Portrait-Mobile" and these two views will be switched automatically when you change the orientation or screen size.
There is a helper widget "basic - Screen Resolution" that shows actual screen resolution and best suitable default view for this resolution.
## Settings
### Reload if sleep longer than
There is a rule, that after some disconnection period the whole VIS page will be reloaded to synchronise the project.
You can configure it in menu "Settings...". If you set interval to "never" so the page will be never reloaded.
### Reconnect interval
Set the interval between the connection attempts if disconnected. If you will set 2 seconds, it will try to establish the connection every 2 seconds.
### Dark reconnect screen
Sometimes (in the night) it is required to have dark loading screen. With this option you can set it.
Notice that this settings is valid only for reconnection and not for the first connect.
![Dark](img/dark_screen.png)
## Changelog
### 1.1.7 (2018-07-24)
* (bluefox) view8 corrected
### 1.1.6 (2018-07-18)
* (bluefox) support of new variables (see [Special bindings](#special-bindings) )
Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these.
Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes.