mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactored
This commit is contained in:
parent
ff9e099f88
commit
397a548c15
2 changed files with 14 additions and 13 deletions
|
|
@ -85,11 +85,14 @@ CloudCmd._loadDir = function(pLink, pNeedRefresh){
|
|||
|
||||
DOM.Images.showLoad(pNeedRefresh ? {top:true} : null);
|
||||
|
||||
var lParent = DOM.getCurrentLink().textContent,
|
||||
lDir = DOM.getCurrentDir();
|
||||
var lCurrentLink = DOM.getCurrentLink(),
|
||||
lHref = lCurrentLink.href,
|
||||
lParent = lCurrentLink.textContent,
|
||||
lLink = pLink || Util.removeStr(lHref, CloudCmd.HOST),
|
||||
lDir = DOM.getCurrentDir();
|
||||
|
||||
/* загружаем содержимое каталога */
|
||||
CloudCmd._ajaxLoad(pLink, { refresh: pNeedRefresh });
|
||||
CloudCmd._ajaxLoad(lLink, { refresh: pNeedRefresh });
|
||||
|
||||
/* если нажали на ссылку на верхний каталог*/
|
||||
if(lParent === '..' && lDir !== '/')
|
||||
|
|
@ -489,6 +492,7 @@ CloudCmd._changeLinks = function(pPanelID){
|
|||
|
||||
lUrl = CloudCmd.HOST;
|
||||
|
||||
var lLoadDirOnce = CloudCmd._loadDir();
|
||||
for(var i = 0, n = a.length; i < n ; i++){
|
||||
/* убираем адрес хоста*/
|
||||
var ai = a[i],
|
||||
|
|
@ -497,10 +501,8 @@ CloudCmd._changeLinks = function(pPanelID){
|
|||
lLoadDir = CloudCmd._loadDir(link, lNEADREFRESH);
|
||||
|
||||
/* ставим загрузку гифа на клик*/
|
||||
if(lNEADREFRESH){
|
||||
DOM.addClickListener( lLoadDir, ai );
|
||||
if(lNEADREFRESH)
|
||||
DOM.addClickListener( lLoadDir, ai.parentElement );
|
||||
}
|
||||
|
||||
/* устанавливаем обработчики на строку
|
||||
* на двойное нажатие на левую кнопку мышки */
|
||||
|
|
@ -511,9 +513,7 @@ CloudCmd._changeLinks = function(pPanelID){
|
|||
if (lLi.className === 'path')
|
||||
DOM.addClickListener( lLoadDir, ai );
|
||||
else {
|
||||
DOM.addClickListener( function(pEvent){
|
||||
pEvent.preventDefault();
|
||||
}, ai);
|
||||
DOM.addClickListener( DOM.preventDefault, lLi);
|
||||
DOM.addListener('mousedown', lSetCurrentFile_f, lLi);
|
||||
DOM.addListener('ondragstart', lOnDragStart_f, ai);
|
||||
/* if right button clicked menu will
|
||||
|
|
@ -523,8 +523,8 @@ CloudCmd._changeLinks = function(pPanelID){
|
|||
|
||||
/* если ссылка на папку, а не файл */
|
||||
if(ai.target !== '_blank'){
|
||||
DOM.addListener('dblclick', lLoadDir, lLi);
|
||||
DOM.addListener('touchend', lLoadDir, lLi);
|
||||
DOM.addListener('dblclick', lLoadDirOnce, lLi);
|
||||
DOM.addListener('touchend', lLoadDirOnce, lLi);
|
||||
}
|
||||
|
||||
lLi.id = (ai.title ? ai.title : ai.textContent) +
|
||||
|
|
|
|||
|
|
@ -1066,9 +1066,10 @@ var CloudCommander, Util,
|
|||
|
||||
/** prevent default event */
|
||||
DOM.preventDefault = function(pEvent){
|
||||
var lRet;
|
||||
var lRet,
|
||||
lFunc = Util.bind(pEvent.preventDefault, pEvent);
|
||||
|
||||
lRet = Util.exec(pEvent.preventDefault);
|
||||
lRet = Util.exec(lFunc);
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue