diff --git a/client.js b/client.js index 8d425f0c..635ef41e 100644 --- a/client.js +++ b/client.js @@ -90,9 +90,9 @@ CloudClient._images={ if (!lE) lE = Util.anyload({ name : 'span', - class : 'icon loading', + className : 'icon loading', id : 'loading-image', - not_append : true, + not_append : true }); return lE; @@ -104,9 +104,9 @@ CloudClient._images={ if (!lE) lE = Util.anyload({ name : 'span', - class : 'icon error', + className : 'icon error', id : 'error-image', - not_append : true, + not_append : true }); return lE; @@ -188,7 +188,7 @@ CloudClient.Util = (function(){ this.anyload = function(pParams_o){ /* убираем путь к файлу, оставляя только название файла */ var lID = pParams_o.id; - var lClass = pParams_o.class; + var lClass = pParams_o.className; var lSrc = pParams_o.src; var lFunc = pParams_o.func; var lAsync = pParams_o.async; @@ -315,23 +315,32 @@ CloudClient.Util = (function(){ return lCurrent && lCurrent.id; }, - this.showLoad = function(){ - var lCurrent = this.getByClass(CloudCommander.CURRENT_FILE); - if(lCurrent.length){ - lCurrent = lCurrent[0]; - - var lLoadingImage = CloudCommander._images.loading(); - lLoadingImage.className = 'icon loading';/* показываем загрузку*/ - - /* show loading icon * - * if it not showed */ - var lCurrent = lCurrent.firstChild.nextSibling; - var lParent = lLoadingImage.parentElement; - if(!lParent || - (lParent && lParent !== lCurrent)) - lCurrent.appendChild(lLoadingImage); + /* + * Function shows loading spinner + * @pElem - top element of screen + */ + + this.showLoad = function(pElem){ + var lLoadingImage = CloudCommander._images.loading(); + + var lCurrent; + if(pElem) + lCurrent = pElem; + else + { + lCurrent = this.getByClass(CloudCommander.CURRENT_FILE); + lCurrent = lCurrent[0].firstChild.nextSibling; } - } + + /* show loading icon * + * if it not showed */ + var lParent = lLoadingImage.parentElement; + if(!lParent || + (lParent && lParent !== lCurrent)) + lCurrent.appendChild(lLoadingImage); + + lLoadingImage.className = 'icon loading'; /* показываем загрузку*/ + }; }); @@ -345,8 +354,7 @@ CloudClient.keyBinding=(function(){ }); /* function loads and shows editor */ -CloudClient.Editor = (function() { - Util.showLoad(); +CloudClient.Editor = (function() { /* loading CloudMirror plagin */ Util.jsload(CloudClient.LIBDIRCLIENT + 'editor.js',{ @@ -387,21 +395,8 @@ CloudClient._loadDir=(function(pLink,pNeedRefresh){ */ return function(){ /* показываем гиф загрузки возле пути папки сверху*/ - LoadingImage.className='icon loading';/* показываем загрузку*/ - ErrorImage.className='icon error hidden';/* прячем ошибку */ - /* если элемент задан - - * работаем с ним - */ - /* если мы попали сюда с таблицы файлов*/ - try{ - this.firstChild.nextSibling.appendChild(LoadingImage); - }catch(error){ - /* если + - * кнопка обновления - */ - try{this.firstChild.parentElement.appendChild(LoadingImage);} - catch(error){console.log(error);} - } + /* ctrl+r нажата? */ + Util.showLoad(pNeedRefresh ? this : null); var lCurrentFile=getByClass(CloudClient.CURRENT_FILE); /* получаем имя каталога в котором находимся*/ diff --git a/config.json b/config.json index 4a0dccf7..d58f0b2d 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { "cache" : {"allowed" : false}, "minification" : { - "js" : true, + "js" : false, "css" : true, "html" : true, "img" : true diff --git a/lib/client/editor.js b/lib/client/editor.js index bc62c32c..10ad9b5f 100644 --- a/lib/client/editor.js +++ b/lib/client/editor.js @@ -132,9 +132,7 @@ CloudCommander.Editor.CodeMirror.show = (function(){ var lLoadingImage = CloudCommander._images.loading(); var lErrorImage = CloudCommander._images.error(); - this.showLoad(); this.loading = true; - var lParent = this; /* reading data from current file */ $.ajax({ url:lA, diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index d9f4926a..0c61928f 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -52,9 +52,9 @@ CloudCommander.keyBinding=(function(){ } /* if f3 pressed */ - else if(event.keyCode===114){ + else if(event.keyCode===114){ if (typeof CloudCommander.Viewer === 'function') - CloudCommander.Viewer(); + CloudCommander.Viewer(); } /* if alt+f3 pressed */ else if(event.keyCode===114 && @@ -64,7 +64,9 @@ CloudCommander.keyBinding=(function(){ } /* if f4 pressed */ else if(event.keyCode === 115) { - if (typeof CloudCommander.Editor === 'function') + Util.showLoad(); + + if (typeof CloudCommander.Editor === 'function') CloudCommander.Editor(); } /* навигация по таблице файлов*/