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

Loading…
Cancel
Save