mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
tweaking progress...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5dc21690da
commit
2bbac274c1
@ -1181,28 +1181,27 @@ var WidgetTestActions = actions.Actions({
|
|||||||
var timeout = widget.attr('close-timeout')
|
var timeout = widget.attr('close-timeout')
|
||||||
timeout && clearTimeout(JSON.parse(timeout))
|
timeout && clearTimeout(JSON.parse(timeout))
|
||||||
|
|
||||||
|
// get the widget parts we are updating...
|
||||||
var bar = widget.find('progress')
|
var bar = widget.find('progress')
|
||||||
var state = widget.find('.progress-details')
|
var state = widget.find('.progress-details')
|
||||||
|
|
||||||
// XXX stub???
|
// XXX stub???
|
||||||
max = max ?
|
// normalize max and value...
|
||||||
|
max = max != null ?
|
||||||
(typeof(max) == typeof('str') && /[+-][0-9]+/.test(max) ?
|
(typeof(max) == typeof('str') && /[+-][0-9]+/.test(max) ?
|
||||||
parseInt(bar.attr('max') || 0) + parseInt(max)
|
parseInt(bar.attr('max') || 0) + parseInt(max)
|
||||||
: parseInt(max))
|
: parseInt(max))
|
||||||
: bar.attr('max')
|
: bar.attr('max')
|
||||||
|
value = value != null ?
|
||||||
value = value ?
|
|
||||||
(typeof(value) == typeof('str') && /[+-][0-9]+/.test(value) ?
|
(typeof(value) == typeof('str') && /[+-][0-9]+/.test(value) ?
|
||||||
parseInt(bar.attr('value') || 0) + parseInt(value)
|
parseInt(bar.attr('value') || 0) + parseInt(value)
|
||||||
: parseInt(value))
|
: parseInt(value))
|
||||||
: bar.attr('value')
|
: bar.attr('value')
|
||||||
// ignore value if not max is present + handle overflow...
|
|
||||||
value = max ? Math.min(value, max) : null
|
|
||||||
|
|
||||||
|
// format the message...
|
||||||
msg = msg ? ': '+msg : ''
|
msg = msg ? ': '+msg : ''
|
||||||
msg = ' '+ msg
|
msg = ' '+ msg
|
||||||
+ (value && value >= max ? ' ('+max+' done)'
|
+ (value && value >= (max || 0) ? ' ('+value+' done)'
|
||||||
: value && max && value != max ? ' ('+ value +' of '+ max +')'
|
: value && max && value != max ? ' ('+ value +' of '+ max +')'
|
||||||
: ' (ready)')
|
: ' (ready)')
|
||||||
|
|
||||||
@ -1215,14 +1214,15 @@ var WidgetTestActions = actions.Actions({
|
|||||||
|
|
||||||
// auto-close...
|
// auto-close...
|
||||||
// XXX make this optional...
|
// XXX make this optional...
|
||||||
if(value && value >= max){
|
if(value && value >= (max || 0)){
|
||||||
widget.attr('close-timeout',
|
widget.attr('close-timeout',
|
||||||
JSON.stringify(setTimeout(function(){
|
JSON.stringify(setTimeout(function(){
|
||||||
widget.trigger('progressClose')
|
widget.trigger('progressClose')
|
||||||
}, 1000)))
|
}, 1000)))
|
||||||
}
|
}
|
||||||
}],
|
|
||||||
|
|
||||||
|
// XXX what should we return??? (state, self, controller?)
|
||||||
|
}],
|
||||||
testProgress: ['Test/Demo progress bar...',
|
testProgress: ['Test/Demo progress bar...',
|
||||||
function(text){
|
function(text){
|
||||||
var done = 0
|
var done = 0
|
||||||
|
|||||||
@ -150,7 +150,7 @@ $(function(){
|
|||||||
if(e == 'queued'){
|
if(e == 'queued'){
|
||||||
ig.showProgress('Progress', '+0', '+1')
|
ig.showProgress('Progress', '+0', '+1')
|
||||||
|
|
||||||
} else if(e == 'loaded' || e == 'done'){
|
} else if(e == 'loaded' || e == 'done' || e == 'written'){
|
||||||
ig.showProgress('Progress', '+1')
|
ig.showProgress('Progress', '+1')
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user