mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-03 21:00:14 +00:00
added default close action to progress bar...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b4e7de0f5b
commit
33fcc249f4
23
ui/ui.js
23
ui/ui.js
@ -18,6 +18,8 @@ var CONTEXT_INDICATOR_UPDATERS = []
|
|||||||
// - 'floating'
|
// - 'floating'
|
||||||
// - 'panel'
|
// - 'panel'
|
||||||
var PROGRESS_WIDGET_CONTAINER = 'floating'
|
var PROGRESS_WIDGET_CONTAINER = 'floating'
|
||||||
|
// can be between 0 and 3000
|
||||||
|
var PROGRESS_HIDE_TIMEOUT = 1500
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -468,16 +470,24 @@ function getProgressContainer(mode, parent){
|
|||||||
|
|
||||||
// Make or get progress bar by name...
|
// Make or get progress bar by name...
|
||||||
//
|
//
|
||||||
function progressBar(name, container){
|
function progressBar(name, container, close, hide_timeout){
|
||||||
container = container == null
|
container = container == null
|
||||||
? getProgressContainer()
|
? getProgressContainer()
|
||||||
: container
|
: container
|
||||||
|
close = close === undefined
|
||||||
|
? function(){
|
||||||
|
$(this).trigger('progressDone') }
|
||||||
|
: close
|
||||||
|
hide_timeout = hide_timeout == null ? PROGRESS_HIDE_TIMEOUT
|
||||||
|
: hide_timeout < 0 ? 0
|
||||||
|
: hide_timeout > 3000 ? 3000
|
||||||
|
: hide_timeout
|
||||||
|
|
||||||
var widget = getProgressBar(name)
|
var widget = getProgressBar(name)
|
||||||
|
|
||||||
// a progress bar already exists, reset it and return...
|
// a progress bar already exists, reset it and return...
|
||||||
// XXX should we re-bind the event handlers here???
|
// XXX should we re-bind the event handlers here???
|
||||||
if(widget.length > 0){
|
if(widget.length > 0 && widget.css('display') == 'none'){
|
||||||
return widget.trigger('progressReset')
|
return widget.trigger('progressReset')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,7 +523,7 @@ function progressBar(name, container){
|
|||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
widget.hide()
|
widget.hide()
|
||||||
}, 1500)
|
}, hide_timeout)
|
||||||
})
|
})
|
||||||
.on('progressReset', function(){
|
.on('progressReset', function(){
|
||||||
widget
|
widget
|
||||||
@ -527,6 +537,10 @@ function progressBar(name, container){
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if(close != null){
|
||||||
|
widget.on('progressClose', close)
|
||||||
|
}
|
||||||
|
|
||||||
bar = $(bar[0])
|
bar = $(bar[0])
|
||||||
state = $(state[0])
|
state = $(state[0])
|
||||||
widget = $(widget[0])
|
widget = $(widget[0])
|
||||||
@ -540,6 +554,9 @@ function getProgressBar(name){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************* Event trigger helpers ***/
|
||||||
|
|
||||||
function resetProgressBar(name){
|
function resetProgressBar(name){
|
||||||
var widget = typeof(name) == typeof('str')
|
var widget = typeof(name) == typeof('str')
|
||||||
? getProgressBar(name)
|
? getProgressBar(name)
|
||||||
|
|||||||
@ -29,8 +29,10 @@ function getWorkerProgressBar(name, worker, container){
|
|||||||
var widget = getProgressBar(name)
|
var widget = getProgressBar(name)
|
||||||
|
|
||||||
if(widget.length == 0){
|
if(widget.length == 0){
|
||||||
widget = progressBar(name, container)
|
widget = progressBar(
|
||||||
.on('progressClose', function(){
|
name,
|
||||||
|
container,
|
||||||
|
function(){
|
||||||
WORKERS[name].dropQueue()
|
WORKERS[name].dropQueue()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user