diff --git a/client.js b/client.js index 44305a93..f417765e 100644 --- a/client.js +++ b/client.js @@ -1051,26 +1051,27 @@ CloudClient.baseInit = (function(){ if(lTitle.length > 0) lTitle[0].textContent = 'Cloud Commander'; - /* загружаем общие функции для клиента и сервера*/ + /* загружаем общие функции для клиента и сервера */ Util.jsload(CloudClient.LIBDIR+'cloudfunc.js',function(){ - /* берём из обьекта window общий с сервером функционал */ + /* берём из обьекта window общий с сервером функционал */ CloudFunc=window.CloudFunc; - /* меняем ссылки на ajax'овые*/ + /* меняем ссылки на ajax'овые */ CloudClient._changeLinks(CloudFunc.LEFTPANEL); CloudClient._changeLinks(CloudFunc.RIGHTPANEL); - /* устанавливаем переменную доступности кэша*/ + /* устанавливаем переменную доступности кэша */ CloudClient.Cache.isAllowed(); - /* Устанавливаем кэш корневого каталога */ - if(!CloudClient.Cache.get('/'))CloudClient.Cache.set('/',CloudClient._getJSONfromFileTable()); + /* Устанавливаем кэш корневого каталога */ + if(!CloudClient.Cache.get('/')) + CloudClient.Cache.set('/', CloudClient._getJSONfromFileTable()); }); /* устанавливаем размер высоты таблицы файлов * исходя из размеров разрешения экрана */ - /* выделяем строку с первым файлом */ + /* выделяем строку с первым файлом */ var lFmHeader = getByClass('fm_header'); if(lFmHeader && lFmHeader[0].nextSibling) Util.setCurrentFile(lFmHeader[0].nextSibling); @@ -1080,7 +1081,7 @@ CloudClient.baseInit = (function(){ if(lFM) lFM.className='localstorage'; - /* если есть js - показываем правую панель*/ + /* если есть js - показываем правую панель */ var lRight=getById('right'); if(lRight) lRight.className = lRight.className.replace('hidden',''); diff --git a/lib/client/viewer.js b/lib/client/viewer.js index ff36ddcb..43594983 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -93,16 +93,19 @@ var CloudCommander, CloudFunc, $; }); }); - - FancyBox.loadData = (function(pA){ + /* function loads data an put it to pSuccess_f + * @pA - link to data + * @pSucces_f - function, thet process data (@data) + * + * Example: loadData('index.html', function(pData){console.log(pData)}); + */ + FancyBox.loadData = (function(pA, pSuccess_f){ Util.Images.showLoad(); - var lThis = this; - var lConfig = this.getConfig(); - + var lThis = this; var lLink = pA.href; - /* убираем адрес хоста*/ + /* убираем адрес хоста */ lLink = '/' + lLink.replace(document.location.href,''); if (lLink.indexOf(CloudFunc.NOJS) === CloudFunc.FS.length) @@ -116,17 +119,24 @@ var CloudCommander, CloudFunc, $; }), success:function(data, textStatus, jqXHR){ - /* if we got json - show it */ - if(typeof data === 'object') - data = JSON.stringify(data, null, 4); - - $.fancybox('
' + data + '
', lConfig); - + if(typeof pSuccess_f === 'function') + pSuccess_f(data); + Util.Images.hideLoad(); } }); }); + FancyBox.onDataLoaded = (function(pData){ + var lConfig = FancyBox.getConfig(); + + /* if we got json - show it */ + if(typeof pData === 'object') + pData = JSON.stringify(pData, null, 4); + + $.fancybox('
' + pData + '
', lConfig); + }); + FancyBox.set = (function(){ if(Util.getByClass('fancybox').length) @@ -147,7 +157,7 @@ var CloudCommander, CloudFunc, $; if(pA.rel) $.fancybox(lConfig); else - lThis.loadData(pA); + lThis.loadData(pA, lThis.onDataLoaded); }; }; @@ -180,7 +190,7 @@ var CloudCommander, CloudFunc, $; if(lA.rel) $.fancybox.open({ href : lA.href }, lConfig); - else this.loadData(lA); + else this.loadData(lA, this.onDataLoaded); } } else {