mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(listeners) changeLinks Events.add calls: 3 -> 1
This commit is contained in:
parent
b4f39d8797
commit
86cbe86f60
1 changed files with 21 additions and 21 deletions
|
|
@ -75,9 +75,13 @@ var Util, DOM, CloudCmd;
|
|||
* @param pPanelID
|
||||
*/
|
||||
this.changeLinks = function(pPanelID) {
|
||||
/* назначаем кнопку очистить кэш и показываем её */
|
||||
var lPanel = DOM.getById(pPanelID),
|
||||
pathElement = DOM.getByClass('js-path', lPanel),
|
||||
var i, n, a, ai, current, link, loadDir, events,
|
||||
filesElement = DOM.getByClass('files', panel),
|
||||
files = filesElement.children,
|
||||
url = CloudCmd.HOST,
|
||||
loadDirOnce = CloudCmd.loadDir(),
|
||||
panel = DOM.getById(pPanelID),
|
||||
pathElement = DOM.getByClass('js-path', panel),
|
||||
pathLinks = DOM.getByClass('links', pathElement).children,
|
||||
clearStorage = DOM.getByClass('clear-storage', pathElement),
|
||||
refresh = DOM.getByClass('refresh-icon', pathElement),
|
||||
|
|
@ -150,13 +154,7 @@ var Util, DOM, CloudCmd;
|
|||
} while(lTag !== 'LI');
|
||||
|
||||
DOM.setCurrentFile(pElement);
|
||||
},
|
||||
|
||||
i, n, a, ai, current, link, loadDir,
|
||||
filesElement = DOM.getByClass('files', lPanel),
|
||||
files = filesElement.children,
|
||||
url = CloudCmd.HOST,
|
||||
loadDirOnce = CloudCmd.loadDir();
|
||||
};
|
||||
|
||||
/* ставим загрузку гифа на клик*/
|
||||
Events.addClick(CloudCmd.refresh, refresh);
|
||||
|
|
@ -176,25 +174,27 @@ var Util, DOM, CloudCmd;
|
|||
n = a.length;
|
||||
for (i = 0; i < n ; i++) {
|
||||
current = files[i];
|
||||
ai = a[i],
|
||||
|
||||
Events.add({
|
||||
'mousedown' : setCurrentFile,
|
||||
'contextmenu' : onContextMenu,
|
||||
'dragstart' : onDragStart
|
||||
}, current);
|
||||
ai = a[i];
|
||||
|
||||
/* если на файл, а не на папку */
|
||||
if (ai.target === '_blank')
|
||||
Events.add({
|
||||
events = {
|
||||
'click' : fileClick
|
||||
}, current);
|
||||
};
|
||||
else
|
||||
Events.add({
|
||||
events = {
|
||||
'dblclick' : loadDirOnce,
|
||||
'touchend' : loadDirOnce,
|
||||
'click' : DOM.preventDefault,
|
||||
}, current);
|
||||
};
|
||||
|
||||
Util.copyObj({
|
||||
'mousedown' : setCurrentFile,
|
||||
'contextmenu' : onContextMenu,
|
||||
'dragstart' : onDragStart
|
||||
}, events);
|
||||
|
||||
Events.add(events, current);
|
||||
|
||||
current.id = (ai.title ? ai.title : ai.textContent) +
|
||||
'(' + pPanelID + ')';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue