Commit 173c21f8 authored by Mart Lubbers's avatar Mart Lubbers

apply suggestions and clean up

parent e2c3e43e
Pipeline #29339 passed with stage
in 5 minutes and 12 seconds
......@@ -34,28 +34,26 @@ itasks.ProgressBar = {
var me = this,
el = this.domEl;
var child = document.createElement('span');
//https://stackoverflow.com/questions/41429906/how-to-display-data-label-inside-html5-progress-bar-cross-browser-compatible
var child = document.createElement('span');
child.setAttribute('class', 'value');
el.appendChild(child);
el.setAttribute('data-label', me.attributes.text);
me.setProgress(me.attributes.value);
me.setText(value);
},
setProgress:function(value) {
if(typeof value == 'number')
this.domEl.children[0].style='width:'+value+'%;';
else
this.domEl.children[0].style='';
this.domEl.children[0].style=typeof value == 'number' ? ('width:'+value+'%;') : '';
},
setText:function(text) {
this.domEl.setAttribute('data-label', text);
},
onAttributeChange:function(name,value) {
switch(name) {
case 'value':
if (value == null)
this.domEl.children[0].style='';
else
this.domEl.children[0].style='width:'+value+'%;';
case 'text':
this.setProgress(value);
case 'text':
this.setText(value);
}
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment