|
@ -10535,7 +10535,7 @@ $.fn.progress = function(parameters) { |
|
|
edgeValue = module.total; |
|
|
edgeValue = module.total; |
|
|
module.debug('Incrementing value by', incrementValue, startValue, edgeValue); |
|
|
module.debug('Incrementing value by', incrementValue, startValue, edgeValue); |
|
|
if(newValue > edgeValue ) { |
|
|
if(newValue > edgeValue ) { |
|
|
module.debug('Value cannot decrement above total', edgeValue); |
|
|
module.debug('Value cannot increment above total', edgeValue); |
|
|
newValue = edgeValue; |
|
|
newValue = edgeValue; |
|
|
} |
|
|
} |
|
|
module.set.progress(newValue); |
|
|
module.set.progress(newValue); |
|
@ -10544,10 +10544,10 @@ $.fn.progress = function(parameters) { |
|
|
startValue = module.percent || 0; |
|
|
startValue = module.percent || 0; |
|
|
incrementValue = incrementValue || module.get.randomValue(); |
|
|
incrementValue = incrementValue || module.get.randomValue(); |
|
|
newValue = startValue + incrementValue; |
|
|
newValue = startValue + incrementValue; |
|
|
edgeValue = 0; |
|
|
edgeValue = 100; |
|
|
module.debug('Incrementing percentage by value', incrementValue, startValue); |
|
|
module.debug('Incrementing percentage by', incrementValue, startValue); |
|
|
if(newValue < edgeValue ) { |
|
|
if(newValue > edgeValue ) { |
|
|
module.debug('Value cannot decrement below zero'); |
|
|
module.debug('Value cannot increment above 100 percent'); |
|
|
newValue = edgeValue; |
|
|
newValue = edgeValue; |
|
|
} |
|
|
} |
|
|
module.set.progress(newValue); |
|
|
module.set.progress(newValue); |
|
@ -10556,26 +10556,28 @@ $.fn.progress = function(parameters) { |
|
|
decrement: function(decrementValue) { |
|
|
decrement: function(decrementValue) { |
|
|
var |
|
|
var |
|
|
total = module.total || false, |
|
|
total = module.total || false, |
|
|
|
|
|
edgeValue = 0, |
|
|
startValue, |
|
|
startValue, |
|
|
newValue |
|
|
newValue |
|
|
; |
|
|
; |
|
|
if(total) { |
|
|
if(total) { |
|
|
startValue = module.value || 0; |
|
|
startValue = module.value || 0; |
|
|
decrementValue = -decrementValue || -1; |
|
|
decrementValue = decrementValue || 1; |
|
|
newValue = startValue + decrementValue; |
|
|
newValue = startValue - decrementValue; |
|
|
module.debug('Decrementing value by', decrementValue, startValue); |
|
|
module.debug('Decrementing value by', decrementValue, startValue); |
|
|
if(newValue > module.total ) { |
|
|
|
|
|
newValue = module.total; |
|
|
|
|
|
} |
|
|
|
|
|
module.set.progress(newValue); |
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
startValue = module.percent || 0; |
|
|
startValue = module.percent || 0; |
|
|
decrementValue = -decrementValue || -module.get.randomValue(); |
|
|
decrementValue = decrementValue || module.get.randomValue(); |
|
|
newValue = startValue + decrementValue; |
|
|
newValue = startValue - decrementValue; |
|
|
module.debug('Decrementing percentage by value', decrementValue, startValue); |
|
|
module.debug('Decrementing percentage by', decrementValue, startValue); |
|
|
module.set.progress(newValue); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(newValue < edgeValue) { |
|
|
|
|
|
module.debug('Value cannot decrement below 0'); |
|
|
|
|
|
newValue = 0; |
|
|
|
|
|
} |
|
|
|
|
|
module.set.progress(newValue); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
get: { |
|
|
get: { |
|
@ -10609,8 +10611,42 @@ $.fn.progress = function(parameters) { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
is: { |
|
|
|
|
|
success: function() { |
|
|
|
|
|
return $module.hasClass(className.success); |
|
|
|
|
|
}, |
|
|
|
|
|
warning: function() { |
|
|
|
|
|
return $module.hasClass(className.warning); |
|
|
|
|
|
}, |
|
|
|
|
|
error: function() { |
|
|
|
|
|
return $module.hasClass(className.error); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
remove: { |
|
|
|
|
|
active: function() { |
|
|
|
|
|
module.verbose('Removing active state'); |
|
|
|
|
|
$module.removeClass(className.active); |
|
|
|
|
|
}, |
|
|
|
|
|
success: function() { |
|
|
|
|
|
module.verbose('Removing success state'); |
|
|
|
|
|
$module.removeClass(className.success); |
|
|
|
|
|
}, |
|
|
|
|
|
warning: function() { |
|
|
|
|
|
module.verbose('Removing warning state'); |
|
|
|
|
|
$module.removeClass(className.warning); |
|
|
|
|
|
}, |
|
|
|
|
|
error: function() { |
|
|
|
|
|
module.verbose('Removing error state'); |
|
|
|
|
|
$module.removeClass(className.error); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
set: { |
|
|
set: { |
|
|
barWidth: function(value) { |
|
|
barWidth: function(value) { |
|
|
|
|
|
if(value > 100) { |
|
|
|
|
|
module.error(error.tooHigh, value); |
|
|
|
|
|
} |
|
|
$bar |
|
|
$bar |
|
|
.css('width', value + '%') |
|
|
.css('width', value + '%') |
|
|
; |
|
|
; |
|
@ -10657,12 +10693,17 @@ $.fn.progress = function(parameters) { |
|
|
} |
|
|
} |
|
|
module.set.barWidth(percent); |
|
|
module.set.barWidth(percent); |
|
|
module.set.barLabel(); |
|
|
module.set.barLabel(); |
|
|
if(percent === 100 && settings.autoSuccess) { |
|
|
if(percent === 100) { |
|
|
module.debug('Automatically triggering success at 100%'); |
|
|
if(settings.autoSuccess && !(module.is.warning() || module.is.error())) { |
|
|
module.set.success(); |
|
|
module.set.success(); |
|
|
|
|
|
module.debug('Automatically triggering success at 100%'); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
module.remove.active(); |
|
|
} |
|
|
} |
|
|
else if(settings.text.active) { |
|
|
} |
|
|
module.set.label(settings.text.active); |
|
|
else { |
|
|
|
|
|
module.set.active(); |
|
|
} |
|
|
} |
|
|
$.proxy(settings.onChange, element)(percent, module.value, module.total); |
|
|
$.proxy(settings.onChange, element)(percent, module.value, module.total); |
|
|
}, |
|
|
}, |
|
@ -10687,10 +10728,26 @@ $.fn.progress = function(parameters) { |
|
|
$progress.text( module.get.text(settings.text.percent) ); |
|
|
$progress.text( module.get.text(settings.text.percent) ); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
active: function(text) { |
|
|
|
|
|
text = text || settings.text.active; |
|
|
|
|
|
module.debug('Setting active state'); |
|
|
|
|
|
if(settings.showActivity) { |
|
|
|
|
|
$module.addClass(className.active); |
|
|
|
|
|
} |
|
|
|
|
|
module.remove.warning(); |
|
|
|
|
|
module.remove.error(); |
|
|
|
|
|
module.remove.success(); |
|
|
|
|
|
if(text) { |
|
|
|
|
|
module.set.label(text); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
success : function(text) { |
|
|
success : function(text) { |
|
|
text = text || settings.text.success; |
|
|
text = text || settings.text.success; |
|
|
module.debug('Setting success state'); |
|
|
module.debug('Setting success state'); |
|
|
$module.addClass(className.success); |
|
|
$module.addClass(className.success); |
|
|
|
|
|
module.remove.active(); |
|
|
|
|
|
module.remove.warning(); |
|
|
|
|
|
module.remove.error(); |
|
|
module.complete(); |
|
|
module.complete(); |
|
|
if(text) { |
|
|
if(text) { |
|
|
module.set.label(text); |
|
|
module.set.label(text); |
|
@ -10700,6 +10757,9 @@ $.fn.progress = function(parameters) { |
|
|
text = text || settings.text.warning; |
|
|
text = text || settings.text.warning; |
|
|
module.debug('Setting warning state'); |
|
|
module.debug('Setting warning state'); |
|
|
$module.addClass(className.warning); |
|
|
$module.addClass(className.warning); |
|
|
|
|
|
module.remove.active(); |
|
|
|
|
|
module.remove.success(); |
|
|
|
|
|
module.remove.error(); |
|
|
module.complete(); |
|
|
module.complete(); |
|
|
if(text) { |
|
|
if(text) { |
|
|
module.set.label(text); |
|
|
module.set.label(text); |
|
@ -10709,6 +10769,9 @@ $.fn.progress = function(parameters) { |
|
|
text = text || settings.text.error; |
|
|
text = text || settings.text.error; |
|
|
module.debug('Setting error state'); |
|
|
module.debug('Setting error state'); |
|
|
$module.addClass(className.error); |
|
|
$module.addClass(className.error); |
|
|
|
|
|
module.remove.active(); |
|
|
|
|
|
module.remove.success(); |
|
|
|
|
|
module.remove.warning(); |
|
|
module.complete(); |
|
|
module.complete(); |
|
|
if(text) { |
|
|
if(text) { |
|
|
module.set.label(text); |
|
|
module.set.label(text); |
|
@ -10925,7 +10988,7 @@ $.fn.progress.settings = { |
|
|
name : 'Progress', |
|
|
name : 'Progress', |
|
|
namespace : 'progress', |
|
|
namespace : 'progress', |
|
|
|
|
|
|
|
|
debug : false, |
|
|
debug : true, |
|
|
verbose : true, |
|
|
verbose : true, |
|
|
performance : true, |
|
|
performance : true, |
|
|
|
|
|
|
|
@ -10934,8 +10997,10 @@ $.fn.progress.settings = { |
|
|
max : 3 |
|
|
max : 3 |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
label : 'percent', |
|
|
|
|
|
autoSuccess : true, |
|
|
autoSuccess : true, |
|
|
|
|
|
showActivity : true, |
|
|
|
|
|
|
|
|
|
|
|
label : 'percent', |
|
|
precision : 1, |
|
|
precision : 1, |
|
|
|
|
|
|
|
|
percent : false, |
|
|
percent : false, |
|
@ -10976,6 +11041,7 @@ $.fn.progress.settings = { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
className : { |
|
|
className : { |
|
|
|
|
|
active : 'active', |
|
|
error : 'error', |
|
|
error : 'error', |
|
|
success : 'success', |
|
|
success : 'success', |
|
|
warning : 'warning' |
|
|
warning : 'warning' |
|
|