buttons: add led option to toggle, remove useless .light dom elements

This commit is contained in:
jean-emmanuel 2017-07-13 10:35:55 +02:00
parent 513eda1af2
commit 1be9cecaa7
7 changed files with 58 additions and 29 deletions

View file

@ -35,7 +35,7 @@ module.exports = class Push extends _widgets_base {
constructor(options) {
super({...options, html: '<div class="toggle"><div class="light"></div></div>'})
super({...options, html: '<div class="toggle"></div>'})
this.state = 0
this.active = 0

View file

@ -16,6 +16,7 @@ module.exports = class Toggle extends _widgets_base {
top:'auto',
width:'auto',
height:'auto',
led: false,
color:'auto',
css:'',
@ -34,7 +35,7 @@ module.exports = class Toggle extends _widgets_base {
constructor(options) {
super({...options, html: '<div class="toggle"><div class="light"></div></div>'})
super({...options, html: '<div class="toggle"></div>'})
this.widget.value = this.widget.find('span')
this.widget.state = 0
@ -45,6 +46,8 @@ module.exports = class Toggle extends _widgets_base {
this.fakeclick()
})
if (this.getProp('led')) this.container.addClass('led')
this.classHolders = this.widget.add(this.container)
this.value = this.getProp('off')

View file

@ -79,7 +79,7 @@ module.exports = class Modal extends Panel {
this.setValue(0, {sync:true, send:true})
})
this.light = $('<div class="toggle"><div class="light"></div></div>').appendTo(this.container)
this.light = $('<div class="toggle"></div>').appendTo(this.container)
if (this.getProp('doubleTap')) {
doubletabreset(this.light, ()=>{