mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
fixed bug with showing spinner
This commit is contained in:
parent
b5c30c0a92
commit
991d7516af
4 changed files with 39 additions and 44 deletions
71
client.js
71
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){
|
||||
/* если <ctrl>+<r>
|
||||
* кнопка обновления
|
||||
*/
|
||||
try{this.firstChild.parentElement.appendChild(LoadingImage);}
|
||||
catch(error){console.log(error);}
|
||||
}
|
||||
/* ctrl+r нажата? */
|
||||
Util.showLoad(pNeedRefresh ? this : null);
|
||||
|
||||
var lCurrentFile=getByClass(CloudClient.CURRENT_FILE);
|
||||
/* получаем имя каталога в котором находимся*/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"cache" : {"allowed" : false},
|
||||
"minification" : {
|
||||
"js" : true,
|
||||
"js" : false,
|
||||
"css" : true,
|
||||
"html" : true,
|
||||
"img" : true
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
/* навигация по таблице файлов*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue