feature(dom) showLoad, showError -> show.load, show.error

This commit is contained in:
coderaiser 2014-12-02 03:47:13 -05:00
parent 3896abe972
commit b7e979dae4
17 changed files with 47 additions and 42 deletions

View file

@ -58,7 +58,7 @@ var Util, DOM, CloudFunc, join;
top: true
};
Images.showLoad(imgPosition);
Images.show.load(imgPosition);
/* загружаем содержимое каталога */
ajaxLoad(link, {
@ -199,7 +199,7 @@ var Util, DOM, CloudFunc, join;
Files.get('modules', function(error, modules) {
var storageObj, mod, path,
STORAGE = 'storage',
showLoad = Images.showLoad.bind(Images),
showLoad = Images.show.load,
doBefore = {
'edit' : showLoad,

View file

@ -10,9 +10,11 @@ var CloudCmd, Util, DOM, io;
Key = CloudCmd.Key,
Images = DOM.Images,
Events = DOM.Events,
showLoad = Images.showLoad.bind(DOM, {
top: true
}),
showLoad = function() {
Images.show.load({
top: true
});
},
Element,
INPUT = 'INPUT',
CONFIG,

View file

@ -34,7 +34,7 @@ var CloudCmd, Util, DOM, olark;
function load(callback) {
var path = DIR + 'contact/olark.js';
Images.showLoad({top: true});
Images.show.load({top: true});
DOM.load.js(path, callback);
}

View file

@ -77,12 +77,17 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
};
};
Images = new ImageElementProto();
Images = new ImageElementProto();
this.show = load;
this.show.load = load;
this.show.error = error;
/**
* Function shows loading spinner
* pPosition = {top: true};
* position = {top: true};
*/
this.showLoad = function(position) {
function load(position) {
var top = position && position.top,
current,
image = Images.loading(),
@ -101,20 +106,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
DOM.show(image);
return image;
};
/**
* hide load image
*/
this.hide = function() {
var element = Images.get();
DOM.hide(element);
};
/**
* show error image (usualy after error on ajax request)
*/
this.showError = function(jqXHR, isQuiet) {
}
function error(jqXHR, isQuiet) {
var isStr = Util.type.string(jqXHR),
image = Images.error(),
response = '',
@ -144,6 +138,14 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
}, 100);
return image;
}
/**
* hide load image
*/
this.hide = function() {
var element = Images.get();
DOM.hide(element);
};
this.setProgress = function(value, title) {
@ -436,7 +438,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
name = file.name,
path = dir + name;
Images.showLoad({top: true});
Images.show.load({top: true});
Images.setProgress(0, name);
DOM.RESTful.write(path, file, callback);
@ -524,7 +526,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
nameFile = Util.rmStrOnce(name, '.gz');
}
Images.showLoad();
Images.show.load();
if (name && name !== '..')
op(fileFrom, function() {
@ -781,7 +783,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
query = '?size',
link = this.getCurrentPath(current);
Images.showLoad();
Images.show.load();
if (name !== '..')
RESTful.read(link + query, function(size) {
@ -1607,7 +1609,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
if (name === '..') {
Dialog.alert('No files selected!');
} else {
Images.showLoad({
Images.show.load({
top:true
});

View file

@ -123,7 +123,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M
var func = exec.ret(callback);
if (!Loading) {
Images.showLoad();
Images.show.load();
if (!Element) {
Element = DOM.load({

View file

@ -10,9 +10,10 @@ var CloudCmd, Util, DOM;
Help = this;
function init() {
Images.showLoad({
Images.show.load({
top: true
});
Help.show();
}

View file

@ -288,7 +288,7 @@ var CloudCmd, Util, DOM;
break;
case Key.TRA:
DOM.Images.showLoad({top: true});
DOM.Images.show.load({top: true});
if (shift)
obj = CloudCmd.Terminal;

View file

@ -15,7 +15,7 @@ var CloudCmd, Util, join, DOM, CloudFunc, Console;
Konsole = this;
function init() {
Images.showLoad({top:true});
Images.show.load({top:true});
Util.exec.series([
DOM.loadJquery,

View file

@ -62,7 +62,7 @@ var Util, DOM;
parent.removeChild(element);
Images.showError(msg, isQuit);
Images.show.error(msg, isQuit);
Util.exec(callback, error);
};

View file

@ -12,7 +12,7 @@ var CloudCmd, Util, DOM;
MD = this;
function init() {
Images.showLoad({
Images.show.load({
top:true
});
@ -34,7 +34,7 @@ var CloudCmd, Util, DOM;
options = optionsParam;
if (options) {
Images.showLoad({
Images.show.load({
top: o.topLoad
});

View file

@ -217,7 +217,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
}
function getFromPicker() {
Images.showLoad({
Images.show.load({
top: true
});

View file

@ -187,7 +187,7 @@ var Util, DOM, CloudFunc, CloudCmd;
url : p.url,
data : p.data,
dataType : p.dataType,
error : Images.showError,
error : Images.show.error,
success : function(data) {
Images.hide();

View file

@ -132,7 +132,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dropbox, cb, Client;
if (!name)
name = Util.getDate();
DOM.Images.showLoad();
DOM.Images.show.load();
Client.writeFile(name, data, function(error, data){
DOM.Images.hide();

View file

@ -127,7 +127,7 @@ var CloudCmd, Util, join, DOM, CloudFunc, Github, cb;
name = params.name;
if (content) {
DOM.Images.showLoad();
DOM.Images.show.load();
if (!name)
name = Util.getDate();

View file

@ -42,7 +42,7 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal, io;
function show(callback) {
if (!Loading) {
Images.showLoad({top:true});
Images.show.load({top:true});
if (!Element) {
Element = DOM.load({

View file

@ -12,7 +12,7 @@ var CloudCmd, Util, DOM;
Upload = this;
function init() {
Images.showLoad({
Images.show.load({
top: true
});
@ -23,7 +23,7 @@ var CloudCmd, Util, DOM;
}
this.show = function() {
Images.showLoad({
Images.show.load({
top: true
});

View file

@ -124,7 +124,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
$.fancybox(element, config);
} else {
Images.showLoad();
Images.show.load();
path = CloudFunc.FS + Info.path;
type = getType(path);