mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactored
This commit is contained in:
parent
490c48d5ce
commit
67e32118d9
1 changed files with 11 additions and 28 deletions
|
|
@ -537,39 +537,22 @@ CloudCmd._changeLinks = function(pPanelID){
|
|||
* @param pOptions
|
||||
* { refresh, nohistory } - необходимость обновить данные о каталоге
|
||||
*/
|
||||
CloudCmd._ajaxLoad = function(pFullPath, pOptions){
|
||||
CloudCmd._ajaxLoad = function(pPath, pOptions){
|
||||
if(!pOptions)
|
||||
pOptions = {};
|
||||
/* Отображаем красивые пути */
|
||||
/* added supporting of russian language */
|
||||
pFullPath = decodeURI(pFullPath);
|
||||
|
||||
var lPath = pFullPath,
|
||||
lFSPath = pFullPath,
|
||||
|
||||
lFS_s = CloudFunc.FS,
|
||||
lNoJS_s = CloudFunc.NOJS;
|
||||
/*
|
||||
* убираем значения, которые,
|
||||
* говорят об отсутствии js
|
||||
*/
|
||||
if(lPath.indexOf(lNoJS_s) === lFS_s.length)
|
||||
lPath = lFSPath = Util.removeStr(lPath, lNoJS_s);
|
||||
/* Отображаем красивые пути */
|
||||
var lFSPath = decodeURI(pPath);
|
||||
|
||||
if(lPath.indexOf(lFS_s) === 0){
|
||||
lPath = lPath.replace(lFS_s,'');
|
||||
|
||||
if(lPath === '/')
|
||||
pFullPath = '/';
|
||||
}
|
||||
|
||||
Util.log ('reading dir: "' + lPath + '";');
|
||||
lFSPath = Util.removeStr( lFSPath, CloudFunc.NOJS );
|
||||
pPath = Util.removeStr( lFSPath, CloudFunc.FS );
|
||||
|
||||
Util.log ('reading dir: "' + pPath + '";');
|
||||
|
||||
if(!pOptions.nohistory)
|
||||
DOM.setHistory(pFullPath, null, pFullPath);
|
||||
DOM.setHistory(pPath, null, pPath);
|
||||
|
||||
DOM.setTitle( CloudFunc.getTitle(lPath) );
|
||||
DOM.setTitle( CloudFunc.getTitle(pPath) );
|
||||
|
||||
/* если доступен localStorage и
|
||||
* в нём есть нужная нам директория -
|
||||
|
|
@ -585,7 +568,7 @@ CloudCmd._ajaxLoad = function(pFullPath, pOptions){
|
|||
var lPanel = DOM.getPanel().id;
|
||||
|
||||
if(!pOptions.refresh && lPanel){
|
||||
var lJSON = DOM.Cache.get(lPath);
|
||||
var lJSON = DOM.Cache.get(pPath);
|
||||
|
||||
if (lJSON){
|
||||
/* переводим из текста в JSON */
|
||||
|
|
@ -599,7 +582,7 @@ CloudCmd._ajaxLoad = function(pFullPath, pOptions){
|
|||
|
||||
DOM.getCurrentFileContent({
|
||||
url : lFSPath,
|
||||
success :function(pData){
|
||||
success : function(pData){
|
||||
CloudCmd._createFileTable(lPanel, pData);
|
||||
CloudCmd._changeLinks(lPanel);
|
||||
|
||||
|
|
@ -611,7 +594,7 @@ CloudCmd._ajaxLoad = function(pFullPath, pOptions){
|
|||
/* если размер данных не очень бошьой *
|
||||
* сохраняем их в кэше */
|
||||
if(lJSON_s.length < 50000 )
|
||||
DOM.Cache.set(lPath, lJSON_s);
|
||||
DOM.Cache.set(pPath, lJSON_s);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue