mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
feature(dom) Images: improved access speed
This commit is contained in:
parent
6a9c4e36e9
commit
c1cfd872a1
1 changed files with 20 additions and 15 deletions
|
|
@ -13,20 +13,25 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
},
|
||||
|
||||
ImagesProto = function() {
|
||||
var LImagesProto = function() {
|
||||
function getImage(pName) {
|
||||
var lId = pName + '-image',
|
||||
lE = DOM.getById(lId);
|
||||
var ImagesProto = function() {
|
||||
var Images = {
|
||||
'image-loading' : null,
|
||||
'image-error' : null
|
||||
};
|
||||
|
||||
function getImage(name) {
|
||||
var id = 'image-' + name,
|
||||
element = Images[id];
|
||||
|
||||
if (!lE)
|
||||
lE = DOM.anyload({
|
||||
if (!element)
|
||||
element = Images[id] = DOM.anyload({
|
||||
name : 'span',
|
||||
className : 'icon ' + pName,
|
||||
id : lId,
|
||||
className : 'icon ' + name,
|
||||
id : id,
|
||||
not_append : true
|
||||
});
|
||||
|
||||
return lE;
|
||||
return element;
|
||||
}
|
||||
|
||||
/* Функция создаёт картинку загрузки */
|
||||
|
|
@ -39,7 +44,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
return getImage('error');
|
||||
};
|
||||
},
|
||||
lImages = new LImagesProto();
|
||||
Images = new ImagesProto();
|
||||
/**
|
||||
* Function shows loading spinner
|
||||
* pPosition = {top: true};
|
||||
|
|
@ -47,8 +52,8 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
this.showLoad = function(position) {
|
||||
var top = position && position.top,
|
||||
current,
|
||||
loadingImage = lImages.loading(),
|
||||
errorImage = lImages.error(),
|
||||
loadingImage = Images.loading(),
|
||||
errorImage = Images.error(),
|
||||
parent = loadingImage.parentElement;
|
||||
|
||||
DOM.hide(errorImage);
|
||||
|
|
@ -72,7 +77,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
* hide load image
|
||||
*/
|
||||
this.hideLoad = function() {
|
||||
DOM.hide(lImages.loading());
|
||||
DOM.hide(Images.loading());
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -80,8 +85,8 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
*/
|
||||
this.showError = function(jqXHR) {
|
||||
var func,
|
||||
lLoadingImage = lImages.loading(),
|
||||
lErrorImage = lImages.error(),
|
||||
lLoadingImage = Images.loading(),
|
||||
lErrorImage = Images.error(),
|
||||
lResponse = '',
|
||||
lStatusText = '',
|
||||
lStatus = 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue