@ -0,0 +1,2 @@
|
||||
/node_modules
|
||||
/nbproject
|
@ -0,0 +1,3 @@
|
||||
Gruntfile.js
|
||||
tasks
|
||||
node_modules
|
@ -0,0 +1,6 @@
|
||||
os:
|
||||
- linux
|
||||
language: node_js
|
||||
node_js:
|
||||
- '4'
|
||||
- '8'
|
@ -0,0 +1,212 @@
|
||||
// To use this file in WebStorm, right click on the file name in the Project Panel (normally left) and select "Open Grunt Console"
|
||||
|
||||
/** @namespace __dirname */
|
||||
/* jshint -W097 */// jshint strict:false
|
||||
/*jslint node: true */
|
||||
"use strict";
|
||||
|
||||
module.exports = function (grunt) {
|
||||
|
||||
var srcDir = __dirname + '/';
|
||||
var pkg = grunt.file.readJSON('package.json');
|
||||
var iopackage = grunt.file.readJSON('io-package.json');
|
||||
var version = (pkg && pkg.version) ? pkg.version : iopackage.common.version;
|
||||
var newname = grunt.option('name');
|
||||
var author = grunt.option('author') || 'nisiode';
|
||||
var email = grunt.option('email') || 'email@mail.com';
|
||||
var fs = require('fs');
|
||||
|
||||
// check arguments
|
||||
if (process.argv[2] == 'rename') {
|
||||
console.log('Try to rename to "' + newname + '"');
|
||||
if (!newname) {
|
||||
console.log('Please write the new material name, like: "grunt rename --name=mywidgetset" --author="Author Name"');
|
||||
process.exit();
|
||||
}
|
||||
if (newname.indexOf(' ') != -1) {
|
||||
console.log('Name may not have space in it.');
|
||||
process.exit();
|
||||
}
|
||||
if (newname.toLowerCase() != newname) {
|
||||
console.log('Name must be lower case.');
|
||||
process.exit();
|
||||
}
|
||||
if (fs.existsSync(__dirname + '/admin/material.png')) {
|
||||
fs.renameSync(__dirname + '/admin/material.png', __dirname + '/admin/' + newname + '.png');
|
||||
}
|
||||
if (fs.existsSync(__dirname + '/widgets/material.html')) {
|
||||
fs.renameSync(__dirname + '/widgets/material.html', __dirname + '/widgets/' + newname + '.html');
|
||||
}
|
||||
if (fs.existsSync(__dirname + '/widgets/material/js/material.js')) {
|
||||
fs.renameSync(__dirname + '/widgets/material/js/material.js', __dirname + '/widgets/material/js/' + newname + '.js');
|
||||
}
|
||||
if (fs.existsSync(__dirname + '/widgets/material')) {
|
||||
fs.renameSync(__dirname + '/widgets/material', __dirname + '/widgets/' + newname);
|
||||
}
|
||||
}
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: pkg,
|
||||
|
||||
replace: {
|
||||
version: {
|
||||
options: {
|
||||
patterns: [
|
||||
{
|
||||
match: /version: *"[\.0-9]*"/,
|
||||
replacement: 'version: "' + version + '"'
|
||||
},
|
||||
{
|
||||
match: /"version": *"[\.0-9]*",/g,
|
||||
replacement: '"version": "' + version + '",'
|
||||
},
|
||||
{
|
||||
match: /version: *"[\.0-9]*",/g,
|
||||
replacement: 'version: "' + version + '",'
|
||||
}
|
||||
]
|
||||
},
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
flatten: true,
|
||||
src: [
|
||||
srcDir + 'package.json',
|
||||
srcDir + 'io-package.json'
|
||||
],
|
||||
dest: srcDir
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
flatten: true,
|
||||
src: [
|
||||
srcDir + 'widgets/' + pkg.name.substring('yunkong2.vis-'.length) + '.html'
|
||||
],
|
||||
dest: srcDir + 'widgets'
|
||||
}
|
||||
]
|
||||
},
|
||||
name: {
|
||||
options: {
|
||||
patterns: [
|
||||
{
|
||||
match: /material/g,
|
||||
replacement: newname
|
||||
},
|
||||
{
|
||||
match: /Material/g,
|
||||
replacement: newname ? (newname[0].toUpperCase() + newname.substring(1)) : 'Material'
|
||||
},
|
||||
{
|
||||
match: /nisiode/g,
|
||||
replacement: author
|
||||
},
|
||||
{
|
||||
match: /email@mail.com/g,
|
||||
replacement: email
|
||||
}
|
||||
]
|
||||
},
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
flatten: true,
|
||||
src: [
|
||||
srcDir + 'io-package.json',
|
||||
srcDir + 'LICENSE',
|
||||
srcDir + 'package.json',
|
||||
srcDir + 'README.md',
|
||||
srcDir + 'io-package.json',
|
||||
srcDir + 'Gruntfile.js'
|
||||
],
|
||||
dest: srcDir
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
flatten: true,
|
||||
src: [
|
||||
srcDir + 'widgets/' + newname +'.html'
|
||||
],
|
||||
dest: srcDir + 'widgets'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
flatten: true,
|
||||
src: [
|
||||
srcDir + 'admin/index.html'
|
||||
],
|
||||
dest: srcDir + 'admin'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
flatten: true,
|
||||
src: [
|
||||
srcDir + 'widgets/' + newname + '/js/' + newname +'.js'
|
||||
],
|
||||
dest: srcDir + 'widgets/' + newname + '/js'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
flatten: true,
|
||||
src: [
|
||||
srcDir + 'widgets/' + newname + '/css/*.css'
|
||||
],
|
||||
dest: srcDir + 'widgets/' + newname + '/css'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
// Javascript code styler
|
||||
jscs: require(__dirname + '/tasks/jscs.js'),
|
||||
// Lint
|
||||
jshint: require(__dirname + '/tasks/jshint.js'),
|
||||
|
||||
http: {
|
||||
get_hjscs: {
|
||||
options: {
|
||||
url: 'https://raw.githubusercontent.com/yunkong2/yunkong2.js-controller/master/tasks/jscs.js'
|
||||
},
|
||||
dest: 'tasks/jscs.js'
|
||||
},
|
||||
get_jshint: {
|
||||
options: {
|
||||
url: 'https://raw.githubusercontent.com/yunkong2/yunkong2.js-controller/master/tasks/jshint.js'
|
||||
},
|
||||
dest: 'tasks/jshint.js'
|
||||
},
|
||||
get_jscsRules: {
|
||||
options: {
|
||||
url: 'https://raw.githubusercontent.com/yunkong2/yunkong2.js-controller/master/tasks/jscsRules.js'
|
||||
},
|
||||
dest: 'tasks/jscsRules.js'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-replace');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-jscs');
|
||||
grunt.loadNpmTasks('grunt-http');
|
||||
|
||||
grunt.registerTask('default', [
|
||||
'http',
|
||||
'replace:version',
|
||||
'jshint',
|
||||
'jscs'
|
||||
]);
|
||||
|
||||
grunt.registerTask('prepublish', [
|
||||
'http',
|
||||
'replace:version'
|
||||
]);
|
||||
|
||||
grunt.registerTask('p', [
|
||||
'http',
|
||||
'replace:version'
|
||||
]);
|
||||
|
||||
grunt.registerTask('rename', [
|
||||
'replace:name'
|
||||
]);
|
||||
};
|
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015, nisiode <email@mail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
@ -0,0 +1,48 @@
|
||||
![Logo](admin/material.png)
|
||||
# yunkong2.vis-material
|
||||
============
|
||||
|
||||
[![NPM version](http://img.shields.io/npm/v/yunkong2.vis-material.svg)](https://www.npmjs.com/package/yunkong2.vis-material)
|
||||
[![Downloads](https://img.shields.io/npm/dm/yunkong2.vis-material.svg)](https://www.npmjs.com/package/yunkong2.vis-material)
|
||||
[![Travis-CI](http://img.shields.io/travis/nisiode/yunkong2.vis-material/master.svg)](https://travis-ci.org/nisiode/yunkong2.vis-material)
|
||||
|
||||
[![NPM](https://nodei.co/npm/yunkong2.vis-material.png?downloads=true)](https://nodei.co/npm/yunkong2.vis-material/)
|
||||
|
||||
|
||||
material - Material widgets for yunkong2.vis.
|
||||
|
||||
You can read instructions in material.js, material.html files
|
||||
|
||||
These widgets are in addition to the material design style of Uhula, which you can find here:
|
||||
https://github.com/Uhula/yunkong2-Material-Design-Style
|
||||
|
||||
|
||||
![Example](img/widgets.png)
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
### 0.1.5 (2018-07-11)
|
||||
- (pix) feat: new window shutter widget
|
||||
|
||||
### 0.1.4 (2018-07-10)
|
||||
- (pix) feat: new humidity widget
|
||||
|
||||
### 0.1.3 (2018-01-21)
|
||||
- (nisio) feat: new dimmer widget
|
||||
|
||||
### 0.1.2 (2018-01-20)
|
||||
- (nisio) feat: switch added to light widget
|
||||
|
||||
### 0.1.1 (2018-01-14)
|
||||
- (nisio) feat: temperature and light widget
|
||||
|
||||
### 0.1.0 (2018-01-13)
|
||||
- (nisio) Initial version for public testing (includes css from material design styles V1.8)
|
||||
|
||||
### 0.0.1 (2018-01-01)
|
||||
- (nisio) Initial version for internal testing
|
||||
|
||||
## License
|
||||
Copyright (c) 2018-2018 nisiode
|
||||
MIT
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 27 KiB |
@ -0,0 +1,78 @@
|
||||
{
|
||||
"common": {
|
||||
"name": "vis-material",
|
||||
"version": "0.1.5",
|
||||
"news": {
|
||||
"0.1.5": {
|
||||
"en": "feat: new window shutter widget",
|
||||
"de": "feat: neues Fenster-Rollladen widget",
|
||||
"ru": "feat: new window shutter widget"
|
||||
},
|
||||
"0.1.4": {
|
||||
"en": "feat: new humidity widget",
|
||||
"de": "feat: neues Luftfeuchte widget",
|
||||
"ru": "feat: new humidity widget"
|
||||
},
|
||||
"0.1.3": {
|
||||
"en": "feat: new dimmer widget",
|
||||
"de": "feat: new dimmer widget",
|
||||
"ru": "feat: new dimmer widget"
|
||||
},
|
||||
"0.1.2": {
|
||||
"en": "feat: switch added to light widget",
|
||||
"de": "feat: switch added to light widget",
|
||||
"ru": "feat: switch added to light widget"
|
||||
},
|
||||
"0.1.1": {
|
||||
"en": "feat: temperature and light widget",
|
||||
"de": "feat: temperature and light widget",
|
||||
"ru": "feat: temperature and light widget"
|
||||
},
|
||||
"0.1.0": {
|
||||
"en": "feat: include material css from uhula",
|
||||
"de": "feat: include material css from uhula",
|
||||
"ru": "feat: include material css from uhula"
|
||||
},
|
||||
"0.0.1": {
|
||||
"en": "initial adapter",
|
||||
"de": "Initiale Version",
|
||||
"ru": "Первоначальный адаптер",
|
||||
"pt": "Versão inicial",
|
||||
"fr": "Version initiale",
|
||||
"nl": "Eerste release"
|
||||
}
|
||||
},
|
||||
"title": "material widgets",
|
||||
"desc": {
|
||||
"en": "material Widgets for yunkong2.vis",
|
||||
"de": "material Widgets für yunkong2.vis",
|
||||
"ru": "material Widgets для yunkong2.vis",
|
||||
"pt": "molde de Widgets para o yunkong2.vis",
|
||||
"fr": "modèle de Widgets pour yunkong2.vis",
|
||||
"nl": "sjabloon widgets voor yunkong2.vis"
|
||||
},
|
||||
"platform": "Javascript/Node.js",
|
||||
"icon": "material.png",
|
||||
"enabled": true,
|
||||
"mode": "once",
|
||||
"extIcon": "https://git.spacen.net/nisiode/yunkong2.vis-material/raw/master/admin/material.png",
|
||||
"keywords": ["material", "vis", "GUI", "graphical", "scada"],
|
||||
"readme": "https://github.com/nisiode/yunkong2.vis-material/blob/master/README.md",
|
||||
"authors": [
|
||||
"nisiode <nisio.air@gmail.com>"
|
||||
],
|
||||
"localLink": "%web_protocol%://%ip%:%web_port%/vis/edit.html",
|
||||
"license": "MIT",
|
||||
"dependencies": ["vis"],
|
||||
"onlyWWW": true,
|
||||
"noConfig": true,
|
||||
"singleton": true,
|
||||
"type": "visualization-widgets",
|
||||
"restartAdapters": ["vis"]
|
||||
},
|
||||
"native": {
|
||||
"dependencies": []
|
||||
},
|
||||
"instanceObjects": [
|
||||
]
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "yunkong2.vis-material",
|
||||
"description": "material widgets for yunkong2.vis",
|
||||
"version": "0.1.5",
|
||||
"author": {
|
||||
"name": "nisiode",
|
||||
"email": "nisio.air@gmail.com"
|
||||
},
|
||||
"contributors": [
|
||||
"nisiode <nisio.air@gmail.com>",
|
||||
"pix <pix---@hotmail.com>"
|
||||
],
|
||||
"homepage": "https://github.com/nisiode/yunkong2.vis-material.git",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nisiode/yunkong2.vis-material.git"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/nisiode/yunkong2.vis-material/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"yunkong2",
|
||||
"GUI",
|
||||
"material vis"
|
||||
],
|
||||
"devDependencies": {
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-contrib-clean": "^0.6.0",
|
||||
"grunt-contrib-compress": "^0.13.0",
|
||||
"grunt-contrib-copy": "^0.8.0",
|
||||
"grunt-contrib-jshint": "^0.11.3",
|
||||
"grunt-exec": "^0.4.6",
|
||||
"grunt-http": "^1.6.0",
|
||||
"grunt-jscs": "^2.8.0",
|
||||
"grunt-replace": "^0.9.3",
|
||||
"mocha": "^4.1.0",
|
||||
"chai": "^4.1.2"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nisiode/yunkong2.vis-material/issues"
|
||||
},
|
||||
"readmeFilename": "README.md",
|
||||
"main": "widgets/material.html",
|
||||
"scripts": {
|
||||
"test": "node node_modules/mocha/bin/mocha --exit"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
var srcDir = __dirname + "/../";
|
||||
|
||||
module.exports = {
|
||||
all: {
|
||||
src: [
|
||||
srcDir + "*.js",
|
||||
srcDir + "lib/*.js",
|
||||
srcDir + "adapter/example/*.js",
|
||||
srcDir + "tasks/**/*.js",
|
||||
srcDir + "www/**/*.js",
|
||||
'!' + srcDir + "www/lib/**/*.js",
|
||||
'!' + srcDir + 'node_modules/**/*.js',
|
||||
'!' + srcDir + 'adapter/*/node_modules/**/*.js'
|
||||
],
|
||||
options: require('./jscsRules.js')
|
||||
}
|
||||
};
|
@ -0,0 +1,36 @@
|
||||
module.exports = {
|
||||
force: true,
|
||||
"requireCurlyBraces": ["else", "for", "while", "do", "try", "catch"], /*"if",*/
|
||||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
|
||||
"requireSpaceBeforeBlockStatements": true,
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
"disallowSpacesInFunctionDeclaration": {"beforeOpeningRoundBrace": true},
|
||||
"disallowSpacesInNamedFunctionExpression": {"beforeOpeningRoundBrace": true},
|
||||
"requireSpacesInFunctionExpression": {"beforeOpeningCurlyBrace": true},
|
||||
"requireSpacesInAnonymousFunctionExpression": {"beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true},
|
||||
"requireSpacesInNamedFunctionExpression": {"beforeOpeningCurlyBrace": true},
|
||||
"requireSpacesInFunctionDeclaration": {"beforeOpeningCurlyBrace": true},
|
||||
"disallowMultipleVarDecl": true,
|
||||
"requireBlocksOnNewline": true,
|
||||
"disallowEmptyBlocks": true,
|
||||
"disallowSpacesInsideObjectBrackets": true,
|
||||
"disallowSpacesInsideArrayBrackets": true,
|
||||
"disallowSpaceAfterObjectKeys": true,
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
//"requireAlignedObjectValues": "all",
|
||||
"requireOperatorBeforeLineBreak": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
|
||||
// "disallowLeftStickedOperators": ["?", "+", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
|
||||
// "requireRightStickedOperators": ["!"],
|
||||
// "requireSpaceAfterBinaryOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
|
||||
//"disallowSpaceAfterBinaryOperators": [","],
|
||||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
|
||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
||||
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
"requireSpaceAfterBinaryOperators": ["?", ">", ",", ">=", "<=", "<", "+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
//"validateIndentation": 4,
|
||||
//"validateQuoteMarks": { "mark": "\"", "escape": true },
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowKeywordsOnNewLine": ["else", "catch"]
|
||||
|
||||
};
|
@ -0,0 +1,17 @@
|
||||
var srcDir = __dirname + "/../";
|
||||
|
||||
module.exports = {
|
||||
options: {
|
||||
force: true
|
||||
},
|
||||
all: [
|
||||
srcDir + "*.js",
|
||||
srcDir + "lib/*.js",
|
||||
srcDir + "adapter/example/*.js",
|
||||
srcDir + "tasks/**/*.js",
|
||||
srcDir + "www/**/*.js",
|
||||
'!' + srcDir + "www/lib/**/*.js",
|
||||
'!' + srcDir + 'node_modules/**/*.js',
|
||||
'!' + srcDir + 'adapter/*/node_modules/**/*.js'
|
||||
]
|
||||
};
|
@ -0,0 +1,47 @@
|
||||
/* jshint -W097 */
|
||||
/* jshint strict:false */
|
||||
/* jslint node: true */
|
||||
/* jshint expr: true */
|
||||
var expect = require('chai').expect;
|
||||
var fs = require('fs');
|
||||
|
||||
describe('Test package.json and io-package.json', function() {
|
||||
it('Test package files', function (done) {
|
||||
var fileContentIOPackage = fs.readFileSync(__dirname + '/../io-package.json');
|
||||
var ioPackage = JSON.parse(fileContentIOPackage);
|
||||
|
||||
var fileContentNPMPackage = fs.readFileSync(__dirname + '/../package.json');
|
||||
var npmPackage = JSON.parse(fileContentNPMPackage);
|
||||
|
||||
expect(ioPackage).to.be.an('object');
|
||||
expect(npmPackage).to.be.an('object');
|
||||
|
||||
expect(ioPackage.common.version).to.exist;
|
||||
expect(npmPackage.version).to.exist;
|
||||
|
||||
if (!expect(ioPackage.common.version).to.be.equal(npmPackage.version)) {
|
||||
console.log('ERROR: Version numbers in package.json and io-package.json differ!!');
|
||||
}
|
||||
|
||||
if (!ioPackage.common.news || !ioPackage.common.news[ioPackage.common.version]) {
|
||||
console.log('WARNING: No news entry for current version exists in io-package.json, no rollback in Admin possible!');
|
||||
}
|
||||
|
||||
expect(ioPackage.common.authors).to.exist;
|
||||
if (ioPackage.common.name.indexOf('template') !== 0) {
|
||||
if (Array.isArray(ioPackage.common.authors)) {
|
||||
expect(ioPackage.common.authors.length).to.not.be.equal(0);
|
||||
if (ioPackage.common.authors.length === 1) {
|
||||
expect(ioPackage.common.authors[0]).to.not.be.equal('my Name <my@email.com>');
|
||||
}
|
||||
}
|
||||
else {
|
||||
expect(ioPackage.common.authors).to.not.be.equal('my Name <my@email.com>');
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log('Testing for set authors field in io-package skipped because template adapter');
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
@ -0,0 +1,229 @@
|
||||
<!--
|
||||
yunkong2.vis material Widget-Set
|
||||
version: "0.1.5"
|
||||
Copyright 2018 nisiode<nisio.air@mail.com>
|
||||
forked by Pix (7/2018) (Humidty, shutter)
|
||||
|
||||
-->
|
||||
|
||||
<!-- here you can include so many css as you want -->
|
||||
<link rel="stylesheet" href="widgets/material/css/material.css" />
|
||||
<link rel="stylesheet" href="widgets/material/css/style.css" />
|
||||
<!-- here you can include so many js-files as you want -->
|
||||
<script type="text/javascript" src="widgets/material/js/material.js"></script>
|
||||
|
||||
<script id="tplMaListDoor"
|
||||
type="text/ejs"
|
||||
class="vis-tpl"
|
||||
data-vis-prev='<div id="prev_tplMaListWindow" style="position: relative; text-align: initial;padding: 4px ">
|
||||
<div class="vis-widget_prev " style="width: 100px; height: 100px; padding:2px; background-color: #212121" >
|
||||
<img src="widgets/material/img/fts_door.png" style="width: 100px; height: 100px;"></div></div>'
|
||||
data-vis-attrs="oid/id;title/text;subtitle/text;"
|
||||
data-vis-set="material"
|
||||
data-vis-type="val"
|
||||
data-vis-name="ListDoor">
|
||||
<div class="vis-widget <%== this.data.attr('class') %> md-list" id="<%= this.data.attr('wid') %>" >
|
||||
<div class="vis-widget-body" >
|
||||
<div class="md-list-icon">
|
||||
<img src="widgets/material/img/fts_door.png">
|
||||
</div>
|
||||
<div class="md-list-desc">
|
||||
<div class="md-list-title mdui-title" >
|
||||
<%= this.data.attr('title') %>
|
||||
</div>
|
||||
<div class="md-list-subtitle mdui-subtitle">
|
||||
<%= this.data.attr('subtitle') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-list-value mdui-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% vis.binds.material.tplMdListDoor(this.data.wid, this.view, this.data); %>
|
||||
</script>
|
||||
|
||||
<script id="tplMaListWindow"
|
||||
type="text/ejs"
|
||||
class="vis-tpl"
|
||||
data-vis-prev='<div id="prev_tplMaListWindow" style="position: relative; text-align: initial;padding: 4px ">
|
||||
<div class="vis-widget_prev " style="width: 100px; height: 100px; padding:2px; background-color: #212121" >
|
||||
<img src="widgets/material/img/fts_window_2w.png" style="width: 100px; height: 100px;"></div></div>'
|
||||
data-vis-attrs="oid/id;title/text;subtitle/text;"
|
||||
data-vis-set="material"
|
||||
data-vis-type="val"
|
||||
data-vis-name="ListWindow">
|
||||
<div class="vis-widget <%== this.data.attr('class') %> md-list" id="<%= this.data.attr('wid') %>" >
|
||||
<div class="vis-widget-body" >
|
||||
<div class="md-list-icon">
|
||||
<img src="widgets/material/img/fts_window_2w.png">
|
||||
</div>
|
||||
<div class="md-list-desc">
|
||||
<div class="md-list-title mdui-title" >
|
||||
<%= this.data.attr('title') %>
|
||||
</div>
|
||||
<div class="md-list-subtitle mdui-subtitle">
|
||||
<%= this.data.attr('subtitle') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-list-value mdui-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% vis.binds.material.tplMdListWindow(this.data.wid, this.view, this.data); %>
|
||||
</script>
|
||||
|
||||
<script id="tplMaListShutter"
|
||||
type="text/ejs"
|
||||
class="vis-tpl"
|
||||
data-vis-prev='<div id="prev_tplMaListShutter" style="position: relative; text-align: initial;padding: 4px ">
|
||||
<div class="vis-widget_prev " style="width: 100px; height: 100px; padding:2px; background-color: #212121" >
|
||||
<img src="widgets/material/img/fts_shutter_100.png" style="width: 100px; height: 100px;"></div></div>'
|
||||
data-vis-attrs="oid/id;title/text;subtitle/text;"
|
||||
data-vis-set="material"
|
||||
data-vis-type="val"
|
||||
data-vis-name="ListWindowShutter">
|
||||
<div class="vis-widget <%== this.data.attr('class') %> md-list" id="<%= this.data.attr('wid') %>" >
|
||||
<div class="vis-widget-body" >
|
||||
<div class="md-list-icon">
|
||||
<img src="widgets/material/img/fts_shutter_100.png">
|
||||
</div>
|
||||
<div class="md-list-desc">
|
||||
<div class="md-list-title mdui-title" >
|
||||
<%= this.data.attr('title') %>
|
||||
</div>
|
||||
<div class="md-list-subtitle mdui-subtitle">
|
||||
<%= this.data.attr('subtitle') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-list-value" >
|
||||
<div class="mdui-slider" >
|
||||
<div class="sliderJQUI" id="<%= this.data.attr('wid') %>_slider" data-oid="<%= this.data.attr('oid') %>" data-oid2="<%= this.data.attr('oid-2') %>" data-oid-working="<%= this.data.attr('oid-working') %>" data-oid2-working="<%= this.data.attr('oid-2-working') %>"<%= (el) -> vis.binds.jqueryui.slider(el, {min:0,max:100,step:1,inverted:true}) %> /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% vis.binds.material.tplMdListShutter(this.data.wid, this.view, this.data); %>
|
||||
</script>
|
||||
|
||||
<script id="tplMaListTemp"
|
||||
type="text/ejs"
|
||||
class="vis-tpl"
|
||||
data-vis-prev='<div id="prev_tplMaListTemp" style="position: relative; text-align: initial;padding: 4px ">
|
||||
<div class="vis-widget_prev " style="width: 100px; height: 100px; padding:2px; background-color: #212121" >
|
||||
<img src="widgets/material/img/temp_temperature.png" style="width: 100px; height: 100px;"></div></div>'
|
||||
data-vis-attrs="oid/id;title/text;subtitle/text;"
|
||||
data-vis-set="material"
|
||||
data-vis-type="val"
|
||||
data-vis-name="ListTemperature">
|
||||
<div class="vis-widget <%== this.data.attr('class') %> md-list" id="<%= this.data.attr('wid') %>" >
|
||||
<div class="vis-widget-body" >
|
||||
<div class="md-list-icon">
|
||||
<img src="widgets/material/img/temp_temperature.png">
|
||||
</div>
|
||||
<div class="md-list-desc">
|
||||
<div class="md-list-title mdui-title" >
|
||||
<%= this.data.attr('title') %>
|
||||
</div>
|
||||
<div class="md-list-subtitle mdui-subtitle">
|
||||
<%= this.data.attr('subtitle') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-list-value mdui-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% vis.binds.material.tplMdListTemp(this.data.wid, this.view, this.data); %>
|
||||
</script>
|
||||
|
||||
<script id="tplMaListHumid"
|
||||
type="text/ejs"
|
||||
class="vis-tpl"
|
||||
data-vis-prev='<div id="prev_tplMaListHumid" style="position: relative; text-align: initial;padding: 4px ">
|
||||
<div class="vis-widget_prev " style="width: 100px; height: 100px; padding:2px; background-color: #212121" >
|
||||
<img src="widgets/material/img/humid_humidity.png" style="width: 100px; height: 100px;"></div></div>'
|
||||
data-vis-attrs="oid/id;title/text;subtitle/text;"
|
||||
data-vis-set="material"
|
||||
data-vis-type="val"
|
||||
data-vis-name="ListHumidity">
|
||||
<div class="vis-widget <%== this.data.attr('class') %> md-list" id="<%= this.data.attr('wid') %>" >
|
||||
<div class="vis-widget-body" >
|
||||
<div class="md-list-icon">
|
||||
<img src="widgets/material/img/humid_humidity.png">
|
||||
</div>
|
||||
<div class="md-list-desc">
|
||||
<div class="md-list-title mdui-title" >
|
||||
<%= this.data.attr('title') %>
|
||||
</div>
|
||||
<div class="md-list-subtitle mdui-subtitle">
|
||||
<%= this.data.attr('subtitle') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-list-value mdui-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% vis.binds.material.tplMdListHumid(this.data.wid, this.view, this.data); %>
|
||||
</script>
|
||||
|
||||
<script id="tplMaListLight"
|
||||
type="text/ejs"
|
||||
class="vis-tpl"
|
||||
data-vis-prev='<div id="prev_tplMaListLight" style="position: relative; text-align: initial;padding: 4px ">
|
||||
<div class="vis-widget_prev " style="width: 100px; height: 100px; padding:2px; background-color: #212121" >
|
||||
<img src="widgets/material/img/light_light_dim_100.png" style="width: 100px; height: 100px;"></div></div>'
|
||||
data-vis-attrs="oid/id;title/text;subtitle/text;"
|
||||
data-vis-set="material"
|
||||
data-vis-type="val"
|
||||
data-vis-name="ListLight">
|
||||
<div class="vis-widget <%== this.data.attr('class') %> md-list" id="<%= this.data.attr('wid') %>" >
|
||||
<div class="vis-widget-body" >
|
||||
<div class="md-list-icon">
|
||||
<img src="widgets/material/img/light_light_dim_100.png">
|
||||
</div>
|
||||
<div class="md-list-desc">
|
||||
<div class="md-list-title mdui-title" >
|
||||
<%= this.data.attr('title') %>
|
||||
</div>
|
||||
<div class="md-list-subtitle mdui-subtitle">
|
||||
<%= this.data.attr('subtitle') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-list-value" >
|
||||
<div class="mdui-switch" >
|
||||
<input type="checkbox" name="<%= this.data.attr('wid') %>_checkbox" id="<%= this.data.attr('wid') %>_checkbox" data-oid="<%= this.data.attr('oid') %>" />
|
||||
<label for="<%= this.data.attr('wid') %>_checkbox"><label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% vis.binds.material.tplMdListLight(this.data.wid, this.view, this.data); %>
|
||||
</script>
|
||||
|
||||
<script id="tplMaListLightDim"
|
||||
type="text/ejs"
|
||||
class="vis-tpl"
|
||||
data-vis-prev='<div id="prev_tplMaListLightDim" style="position: relative; text-align: initial;padding: 4px ">
|
||||
<div class="vis-widget_prev " style="width: 100px; height: 100px; padding:2px; background-color: #212121" >
|
||||
<img src="widgets/material/img/light_light_dim_100.png" style="width: 100px; height: 100px;"></div></div>'
|
||||
data-vis-attrs="oid/id;title/text;subtitle/text;"
|
||||
data-vis-set="material"
|
||||
data-vis-type="val"
|
||||
data-vis-name="ListLightDim">
|
||||
<div class="vis-widget <%== this.data.attr('class') %> md-list" id="<%= this.data.attr('wid') %>" >
|
||||
<div class="vis-widget-body" >
|
||||
<div class="md-list-icon">
|
||||
<img src="widgets/material/img/light_light_dim_100.png">
|
||||
</div>
|
||||
<div class="md-list-desc">
|
||||
<div class="md-list-title mdui-title" >
|
||||
<%= this.data.attr('title') %>
|
||||
</div>
|
||||
<div class="md-list-subtitle mdui-subtitle">
|
||||
<%= this.data.attr('subtitle') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-list-value" >
|
||||
<div class="mdui-slider" >
|
||||
<div class="sliderJQUI" id="<%= this.data.attr('wid') %>_slider" data-oid="<%= this.data.attr('oid') %>" data-oid2="<%= this.data.attr('oid-2') %>" data-oid-working="<%= this.data.attr('oid-working') %>" data-oid2-working="<%= this.data.attr('oid-2-working') %>"<%= (el) -> vis.binds.jqueryui.slider(el, {min:0,max:100,step:1,inverted:false}) %> /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% vis.binds.material.tplMdListLightDim(this.data.wid, this.view, this.data); %>
|
||||
</script>
|
@ -0,0 +1,34 @@
|
||||
.md-list{
|
||||
width: 100%;
|
||||
height: 56px;
|
||||
}
|
||||
.md-list-icon{
|
||||
float: left;
|
||||
width: 72px;
|
||||
height: 56px;
|
||||
}
|
||||
.md-list-icon img{
|
||||
margin-left: 8px;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
}
|
||||
|
||||
.md-list-desc{
|
||||
float: left;
|
||||
width: calc(100% - 72px - 100px - 16px);
|
||||
height: 56px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.md-list-value{
|
||||
float: left;
|
||||
width: 100px !important;
|
||||
text-align: right;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.md-list-value .mdui-switch{
|
||||
width: 48px;
|
||||
height: 24px;
|
||||
margin-left: 52px;
|
||||
}
|
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 8.8 KiB |
@ -0,0 +1,2 @@
|
||||
http://creativecommons.org/licenses/by-sa/3.0/de/
|
||||
Creative Commons Namensnennung-Weitergabe unter gleichen Bedingungen 3.0 Deutschland Lizenz
|
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,274 @@
|
||||
/*
|
||||
yunkong2.vis material Widget-Set
|
||||
version: "0.1.4"
|
||||
Copyright 2018 nisiode<nisio.air@mail.com>
|
||||
forked by Pix 7/2018 (humidity, shutter)
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
// add translations for edit mode
|
||||
if (vis.editMode) {
|
||||
$.extend(true, systemDictionary, {
|
||||
"title": {"en": "Title", "de": "Titel", "ru": "???"},
|
||||
"subtitle": {"en": "Subtitle", "de": "Untertitel", "ru": "???"}
|
||||
});
|
||||
}
|
||||
|
||||
// add translations for non-edit mode
|
||||
$.extend(true, systemDictionary, {
|
||||
"Instance": {"en": "Instance", "de": "Instanz", "ru": "?????????"},
|
||||
"open": {"en": "open", "de": "offen", "ru": "?????????"},
|
||||
"tilted": {"en": "tilted", "de": "gekippt", "ru": "?????????"},
|
||||
"closed": {"en": "closed", "de": "geschlossen", "ru": "?????????"},
|
||||
"on": {"en": "on", "de": "an", "ru": "?????????"},
|
||||
"off": {"en": "off", "de": "aus", "ru": "?????????"}
|
||||
});
|
||||
|
||||
vis.binds.material = {
|
||||
version: "0.1.5",
|
||||
showVersion: function () {
|
||||
if (vis.binds.material.version) {
|
||||
console.log('Version material: ' + vis.binds.material.version);
|
||||
vis.binds.material.version = null;
|
||||
}
|
||||
},
|
||||
tplMdListDoor: function (widgetID, view, data) {
|
||||
const srcOpen = 'widgets/material/img/fts_door_open.png';
|
||||
const srcClosed = 'widgets/material/img/fts_door.png';
|
||||
const valOpen = _('open');
|
||||
const valClosed = _('closed');
|
||||
|
||||
var $div = $('#' + widgetID);
|
||||
// if nothing found => wait
|
||||
if (!$div.length) {
|
||||
return setTimeout(function () {
|
||||
vis.binds.material.tplMdListDoor(widgetID, view, data);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function update(state){
|
||||
var value = (state) ? valOpen : valClosed;
|
||||
var src = (state) ? srcOpen : srcClosed;
|
||||
$div.find('.md-list-value').html(value);
|
||||
$div.find('.md-list-icon').find('img').attr('src', src);
|
||||
}
|
||||
|
||||
if (data.oid) {
|
||||
// subscribe on updates of value
|
||||
vis.states.bind(data.oid + '.val', function (e, newVal, oldVal) {
|
||||
update(newVal);
|
||||
});
|
||||
|
||||
// set current value
|
||||
update(vis.states[data.oid + '.val']);
|
||||
}
|
||||
},
|
||||
tplMdListWindow: function (widgetID, view, data) {
|
||||
const srcOpen = 'widgets/material/img/fts_window_2w_open.png';
|
||||
const srcClosed = 'widgets/material/img/fts_window_2w.png';
|
||||
const valOpen = _('open');
|
||||
const valClosed = _('closed');
|
||||
var $div = $('#' + widgetID);
|
||||
|
||||
// if nothing found => wait
|
||||
if (!$div.length) {
|
||||
return setTimeout(function () {
|
||||
vis.binds.material.tplMdListWindow(widgetID, view, data);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function update(state){
|
||||
var value = (state) ? valOpen : valClosed;
|
||||
var src = (state) ? srcOpen : srcClosed;
|
||||
$div.find('.md-list-value').html(value);
|
||||
$div.find('.md-list-icon').find('img').attr('src', src);
|
||||
}
|
||||
|
||||
if (data.oid) {
|
||||
// subscribe on updates of value
|
||||
vis.states.bind(data.oid + '.val', function (e, newVal, oldVal) {
|
||||
update(newVal);
|
||||
});
|
||||
|
||||
// set current value
|
||||
update(vis.states[data.oid + '.val']);
|
||||
}
|
||||
},
|
||||
tplMdListTemp: function (widgetID, view, data) {
|
||||
var $div = $('#' + widgetID);
|
||||
|
||||
// if nothing found => wait
|
||||
if (!$div.length) {
|
||||
return setTimeout(function () {
|
||||
vis.binds.material.tplMdListTemp(widgetID, view, data);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
// grey out the value in case the last change is more than 24h ago
|
||||
var curTime = new Date().getTime();
|
||||
var lcTime = vis.states[data.oid + '.lc'];
|
||||
var seconds = (curTime - lcTime) / 1000;
|
||||
if(seconds > 86400){
|
||||
$div.find('.md-list-value').css('opacity', '0.5');
|
||||
}
|
||||
|
||||
function update(state){
|
||||
if(typeof state === 'number'){
|
||||
$div.find('.md-list-value').html(state.toFixed(1) + ' °C');
|
||||
}
|
||||
}
|
||||
|
||||
if (data.oid) {
|
||||
// subscribe on updates of value
|
||||
vis.states.bind(data.oid + '.val', function (e, newVal, oldVal) {
|
||||
update(newVal);
|
||||
});
|
||||
|
||||
// set current value
|
||||
update(vis.states[data.oid + '.val']);
|
||||
}
|
||||
},
|
||||
tplMdListHumid: function (widgetID, view, data) {
|
||||
var $div = $('#' + widgetID);
|
||||
|
||||
// if nothing found => wait
|
||||
if (!$div.length) {
|
||||
return setTimeout(function () {
|
||||
vis.binds.material.tplMdListHumid(widgetID, view, data);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
// grey out the value in case the last change is more than 24h ago
|
||||
var curTime = new Date().getTime();
|
||||
var lcTime = vis.states[data.oid + '.lc'];
|
||||
var seconds = (curTime - lcTime) / 1000;
|
||||
if(seconds > 86400){
|
||||
$div.find('.md-list-value').css('opacity', '0.5');
|
||||
}
|
||||
|
||||
function update(state){
|
||||
if(typeof state === 'number'){
|
||||
$div.find('.md-list-value').html(state.toFixed(1) + ' %');
|
||||
}
|
||||
}
|
||||
|
||||
if (data.oid) {
|
||||
// subscribe on updates of value
|
||||
vis.states.bind(data.oid + '.val', function (e, newVal, oldVal) {
|
||||
update(newVal);
|
||||
});
|
||||
|
||||
// set current value
|
||||
update(vis.states[data.oid + '.val']);
|
||||
}
|
||||
},
|
||||
tplMdListLight: function (widgetID, view, data) {
|
||||
const srcOff = 'widgets/material/img/light_light_dim_00.png';
|
||||
const srcOn = 'widgets/material/img/light_light_dim_100.png';
|
||||
var $div = $('#' + widgetID);
|
||||
|
||||
// if nothing found => wait
|
||||
if (!$div.length) {
|
||||
return setTimeout(function () {
|
||||
vis.binds.material.tplMdListLight(widgetID, view, data);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function update(state){
|
||||
var src = (state) ? srcOn : srcOff;
|
||||
var $tmp = $('#' + widgetID + '_checkbox');
|
||||
$tmp.prop('checked', state);
|
||||
$div.find('.md-list-icon').find('img').attr('src', src);
|
||||
}
|
||||
|
||||
if (!vis.editMode) {
|
||||
var $this = $('#' + widgetID + '_checkbox');
|
||||
$this.change(function () {
|
||||
var $this_ = $(this);
|
||||
vis.setValue($this_.data('oid'), $this_.prop('checked'));
|
||||
});
|
||||
}
|
||||
|
||||
if (data.oid) {
|
||||
// subscribe on updates of value
|
||||
vis.states.bind(data.oid + '.val', function (e, newVal, oldVal) {
|
||||
update(newVal);
|
||||
});
|
||||
|
||||
// set current value
|
||||
update(vis.states[data.oid + '.val']);
|
||||
}
|
||||
},
|
||||
tplMdListLightDim: function (widgetID, view, data) {
|
||||
const srcOff = 'widgets/material/img/light_light_dim_00.png';
|
||||
const srcOn = 'widgets/material/img/light_light_dim_100.png';
|
||||
var $div = $('#' + widgetID);
|
||||
|
||||
// if nothing found => wait
|
||||
if (!$div.length) {
|
||||
return setTimeout(function () {
|
||||
vis.binds.material.tplMdListLightDim(widgetID, view, data);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function update(state){
|
||||
var src = 'widgets/material/img/light_light_dim_' + Math.ceil(state/10) + '0.png';
|
||||
$div.find('.md-list-icon').find('img').attr('src', src);
|
||||
}
|
||||
|
||||
/* if (!vis.editMode) {
|
||||
var $this = $('#' + widgetID + '_slider');
|
||||
$this.change(function () {
|
||||
var $this_ = $(this);
|
||||
vis.setValue($this_.data('oid'), $this_.prop('checked'));
|
||||
});
|
||||
} */
|
||||
|
||||
if (data.oid) {
|
||||
// subscribe on updates of value
|
||||
vis.states.bind(data.oid + '.val', function (e, newVal, oldVal) {
|
||||
update(newVal);
|
||||
});
|
||||
|
||||
// set current value
|
||||
update(vis.states[data.oid + '.val']);
|
||||
}
|
||||
},
|
||||
tplMdListShutter: function (widgetID, view, data) {
|
||||
const srcOff = 'widgets/material/img/fts_shutter_00.png';
|
||||
const srcOn = 'widgets/material/img/fts_shutter_100.png';
|
||||
var $div = $('#' + widgetID);
|
||||
|
||||
// if nothing found => wait
|
||||
if (!$div.length) {
|
||||
return setTimeout(function () {
|
||||
vis.binds.material.tplMdListShutter(widgetID, view, data);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function update(state){
|
||||
var src = 'widgets/material/img/fts_shutter_' + Math.ceil(state/10) + '0.png';
|
||||
$div.find('.md-list-icon').find('img').attr('src', src);
|
||||
}
|
||||
|
||||
/* if (!vis.editMode) {
|
||||
var $this = $('#' + widgetID + '_slider');
|
||||
$this.change(function () {
|
||||
var $this_ = $(this);
|
||||
vis.setValue($this_.data('oid'), $this_.prop('checked'));
|
||||
});
|
||||
} */
|
||||
|
||||
if (data.oid) {
|
||||
// subscribe on updates of value
|
||||
vis.states.bind(data.oid + '.val', function (e, newVal, oldVal) {
|
||||
update(newVal);
|
||||
});
|
||||
|
||||
// set current value
|
||||
update(vis.states[data.oid + '.val']);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
vis.binds.material.showVersion();
|