mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
refactor(listeners) initKeysPanel
This commit is contained in:
parent
77e539b225
commit
16a242f468
1 changed files with 28 additions and 28 deletions
|
|
@ -39,50 +39,50 @@ var Util, DOM, CloudCmd;
|
|||
};
|
||||
|
||||
this.initKeysPanel = function() {
|
||||
var button, id, name, func,
|
||||
var button, id, func,
|
||||
keysElement = DOM.getByClass('keyspanel')[0],
|
||||
keysPanel = {},
|
||||
|
||||
clickFuncs = {
|
||||
'f2' : DOM.renameCurrent,
|
||||
'f5' : DOM.copyCurrent,
|
||||
'f6' : DOM.moveCurrent,
|
||||
'f7' : DOM.promptNewDir,
|
||||
'f8' : DOM.promptDeleteSelected
|
||||
},
|
||||
|
||||
onceClickFuncs = {
|
||||
'f1' : 'Help',
|
||||
'f3' : 'View',
|
||||
'f4' : 'Edit',
|
||||
'f9' : 'Menu',
|
||||
'f10' : 'Config',
|
||||
'~' : 'Console',
|
||||
'contact' : 'Contact'
|
||||
'f1' : CloudCmd.Help,
|
||||
'f3' : CloudCmd.View,
|
||||
'f4' : CloudCmd.Edit,
|
||||
'f9' : CloudCmd.Menu,
|
||||
'f10' : CloudCmd.Config,
|
||||
'~' : CloudCmd.Console,
|
||||
'contact' : CloudCmd.Contact
|
||||
};
|
||||
|
||||
for (id in onceClickFuncs) {
|
||||
button = DOM.getById(id);
|
||||
|
||||
if (button) {
|
||||
func = onceClickFuncs[id];
|
||||
keysPanel[id] = button;
|
||||
|
||||
Events.addOnce('click', func, button);
|
||||
}
|
||||
}
|
||||
|
||||
if (keysElement)
|
||||
Events.addClick(function(event) {
|
||||
var element = event.target,
|
||||
id = element.id,
|
||||
|
||||
clickFuncs = {
|
||||
'f2' : DOM.renameCurrent,
|
||||
'f5' : DOM.copyCurrent,
|
||||
'f6' : DOM.moveCurrent,
|
||||
'f7' : DOM.promptNewDir,
|
||||
'f8' : DOM.promptDeleteSelected
|
||||
},
|
||||
|
||||
func = clickFuncs[id];
|
||||
|
||||
Util.exec(func);
|
||||
|
||||
}, keysElement);
|
||||
|
||||
for (id in onceClickFuncs) {
|
||||
button = DOM.getById(id);
|
||||
|
||||
if (button) {
|
||||
name = onceClickFuncs[id];
|
||||
func = CloudCmd[name];
|
||||
keysPanel[id] = button;
|
||||
|
||||
Events.addOnce('click', func, button);
|
||||
}
|
||||
}
|
||||
|
||||
return keysPanel;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue