mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(operation) loading image
This commit is contained in:
parent
73dbba8f17
commit
54bf705240
1 changed files with 34 additions and 23 deletions
|
|
@ -22,6 +22,8 @@
|
|||
Images = DOM.Images,
|
||||
Dialog = DOM.Dialog,
|
||||
|
||||
showLoad = Images.show.load.bind(null, 'top'),
|
||||
|
||||
Operation = this;
|
||||
|
||||
function rmLastSlash(str) {
|
||||
|
|
@ -29,7 +31,7 @@
|
|||
}
|
||||
|
||||
function init() {
|
||||
Images.show.load();
|
||||
showLoad();
|
||||
|
||||
Util.exec.series([
|
||||
DOM.loadSocket,
|
||||
|
|
@ -88,27 +90,36 @@
|
|||
}
|
||||
|
||||
function setListeners(emitter, callback) {
|
||||
var listeners = {
|
||||
progress: function(value) {
|
||||
Images.setProgress(value);
|
||||
},
|
||||
|
||||
end: function() {
|
||||
callback();
|
||||
events.forEach(function(name) {
|
||||
emitter.removeListener(name, listeners[name]);
|
||||
});
|
||||
},
|
||||
|
||||
error: function(data) {
|
||||
var msg = data + '\n Continue?',
|
||||
is = confirm(msg);
|
||||
var wasError,
|
||||
listeners = {
|
||||
progress: function(value) {
|
||||
Images.setProgress(value);
|
||||
},
|
||||
|
||||
if (is)
|
||||
spero.continue();
|
||||
else
|
||||
spero.abort();
|
||||
}
|
||||
end: function() {
|
||||
if (!wasError)
|
||||
callback();
|
||||
|
||||
Images
|
||||
.hide()
|
||||
.clearProgress();
|
||||
|
||||
events.forEach(function(name) {
|
||||
emitter.removeListener(name, listeners[name]);
|
||||
});
|
||||
},
|
||||
|
||||
error: function(error) {
|
||||
var msg = error + '\n Continue?',
|
||||
is = confirm(msg);
|
||||
|
||||
if (is) {
|
||||
emitter.continue();
|
||||
} else {
|
||||
wasError = true;
|
||||
emitter.abort();
|
||||
}
|
||||
}
|
||||
},
|
||||
events = Object.keys(listeners);
|
||||
|
||||
|
|
@ -217,7 +228,7 @@
|
|||
path = Info.dirPath,
|
||||
current = Info.element;
|
||||
|
||||
Images.show();
|
||||
showLoad();
|
||||
|
||||
if (!files)
|
||||
files = DOM.getSelectedFiles();
|
||||
|
|
@ -296,7 +307,7 @@
|
|||
}));
|
||||
|
||||
if (ok) {
|
||||
Images.show.load('top');
|
||||
showLoad();
|
||||
|
||||
files = {
|
||||
from : from,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue