mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(listeners) onTouch
This commit is contained in:
parent
e840ceaf3b
commit
f625143fd6
1 changed files with 13 additions and 20 deletions
|
|
@ -12,7 +12,7 @@ var Util, DOM, CloudCmd;
|
|||
getConfig = CloudCmd.getConfig,
|
||||
OnPathLinks = [],
|
||||
EventsFiles = {
|
||||
'mousedown' : Util.bind(ifExecNotUL, setCurrentFile),
|
||||
'mousedown' : Util.bind(ifExecNotUL, setCurrentFileByEvent),
|
||||
'contextmenu' : Util.bind(ifExecNotUL, onContextMenu),
|
||||
'dragstart' : Util.bind(ifExecNotUL, onDragStart),
|
||||
'click' : Util.bind(ifExecNotUL, onClick),
|
||||
|
|
@ -185,22 +185,19 @@ var Util, DOM, CloudCmd;
|
|||
}
|
||||
|
||||
function onTouch(event) {
|
||||
var current = getLIElement(event.target),
|
||||
isDir = DOM.isCurrentIsDir(current);
|
||||
var isCurrent, loadDirOnce,
|
||||
element = getLIElement(event.target),
|
||||
isDir = DOM.isCurrentIsDir(element);
|
||||
|
||||
if (isDir)
|
||||
setCurrentFile(event, function(element) {
|
||||
var isCurrent = DOM.isCurrentFile(element),
|
||||
loadDirOnce = CloudCmd.loadDir();
|
||||
|
||||
if (isCurrent)
|
||||
loadDirOnce(event);
|
||||
else
|
||||
DOM.setCurrentFile(element);
|
||||
});
|
||||
if (isDir) {
|
||||
isCurrent = DOM.isCurrentFile(element),
|
||||
loadDirOnce = CloudCmd.loadDir();
|
||||
|
||||
if (isCurrent)
|
||||
loadDirOnce(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onContextMenu(event) {
|
||||
/* getting html element
|
||||
* currentTarget - DOM event
|
||||
|
|
@ -267,13 +264,9 @@ var Util, DOM, CloudCmd;
|
|||
}
|
||||
|
||||
|
||||
function setCurrentFile(event, callback) {
|
||||
function setCurrentFileByEvent(event) {
|
||||
var element = getLIElement(event.target);
|
||||
|
||||
if (callback)
|
||||
Util.exec(callback, element);
|
||||
else
|
||||
DOM.setCurrentFile(element);
|
||||
DOM.setCurrentFile(element);
|
||||
}
|
||||
|
||||
function appStorage() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue