diff --git a/lib/client/dom.js b/lib/client/dom.js index d9cfc9fb..a34b1a62 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -44,36 +44,35 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * Function shows loading spinner * pPosition = {top: true}; */ - this.showLoad = function(pPosition) { - var lCurrent, - lLoadingImage = lImages.loading(), - lErrorImage = lImages.error(); + this.showLoad = function(position) { + var top = position && position.top, + current, + loadingImage = lImages.loading(), + errorImage = lImages.error(), + parent = loadingImage.parentElement; - DOM.hide(lErrorImage); + DOM.hide(errorImage); - if (pPosition && pPosition.top) - lCurrent = DOM.getRefreshButton().parentElement; + if (top) + current = DOM.getRefreshButton().parentElement; else { - lCurrent = DOM.getCurrentFile(); - lCurrent = DOM.getByClass('name', lCurrent); + current = DOM.getCurrentFile(); + current = DOM.getByClass('name', current); } - /* show loading icon if it not showed */ + if (!parent || (parent && parent !== current)) + current.appendChild(loadingImage); - var lParent = lLoadingImage.parentElement; - if (!lParent || (lParent && lParent !== lCurrent)) - lCurrent.appendChild(lLoadingImage); + DOM.show(loadingImage); - DOM.show(lLoadingImage); /* показываем загрузку*/ - - return lLoadingImage; + return loadingImage; }; /** * hide load image */ this.hideLoad = function() { - DOM.hide( lImages.loading()); + DOM.hide(lImages.loading()); }; /**