Browse Source

Add {left} value for progress text templates #1611

pull/1627/head
jlukic 9 years ago
parent
commit
26a4e4280d
1 changed files with 12 additions and 5 deletions
  1. 17
      src/definitions/modules/progress.js

17
src/definitions/modules/progress.js

@ -185,12 +185,16 @@ $.fn.progress = function(parameters) {
total = module.total || 0,
percent = (module.is.visible() && animating)
? module.get.displayPercent()
: module.percent || 0
: module.percent || 0,
left = (module.total > 0)
? (total - value)
: (100 - percent)
;
templateText = templateText || '';
templateText = templateText
.replace('{value}', value)
.replace('{total}', total)
.replace('{left}', left)
.replace('{percent}', percent)
;
module.debug('Adding variables to progress bar text', templateText);
@ -379,20 +383,23 @@ $.fn.progress = function(parameters) {
settings.onChange.call(element, percent, module.value, module.total);
},
labelInterval: function() {
clearInterval(module.interval);
$bar
.one(transitionEnd + eventNamespace, function() {
var
animationCallback = function() {
module.verbose('Bar finished animating, removing continuous label updates');
clearInterval(module.interval);
animating = false;
module.set.labels();
})
}
;
clearInterval(module.interval);
$bar.one(transitionEnd + eventNamespace, animationCallback);
module.timer = setTimeout(animationCallback, settings.duration + 100);
animating = true;
module.interval = setInterval(module.set.labels, settings.framerate);
},
labels: function() {
module.verbose('Setting both bar progress and outer label text');
console.log('updating');
module.set.barLabel();
module.set.state();
},

Loading…
Cancel
Save