added function setButtonKey

This commit is contained in:
coderaiser 2012-11-14 09:48:01 -05:00
parent cb06154faa
commit 1c8accbcac
4 changed files with 27 additions and 12 deletions

View file

@ -14,6 +14,7 @@ var CloudClient = {
init : null, /* start initialization */
KeyBinding : null, /* обьект обработки нажатий клавишь */
KeysPanel : null, /* panel with key buttons f1-f8 */
Config : null, /* function loads and shows config */
Editor : null, /* function loads and shows editor */
Storage : null, /* function loads storage */
@ -382,7 +383,7 @@ CloudClient._currentToParent = function(pDirName){
CloudClient.init = function(){
var lFunc = function(){
Util.loadOnLoad([
initCmdButtons,
initKeysPanel,
initModules,
baseInit
]);
@ -439,8 +440,10 @@ function initModules(pCallBack){
});
}
function initCmdButtons(pCallBack){
var lFuncs =[
function initKeysPanel(pCallBack){
var lKeysPanel = {},
lFuncs =[
null,
null, /* f1 */
null, /* f2 */
@ -451,9 +454,16 @@ function initCmdButtons(pCallBack){
null, /* f7 */
null, /* f8 */
];
for(var i = 1; i <= 8; i++)
getById('f' + i).onclick = lFuncs[i];
for(var i = 1; i <= 8; i++){
var lButton = 'f' + i,
lEl = getById('f' + i);
lEl.onclick = lFuncs[i];
lKeysPanel[lButton] = lEl;
}
cloudcmd.KeysPanel = lKeysPanel;
Util.exec(pCallBack);
}

View file

@ -3,12 +3,13 @@ var CloudCommander, $, Util, DOM, CloudFunc;
(function(){
"use strict";
var cloudcmd = CloudCommander;
DOM = {};
/* PRIVATE */
function getCurrentFile(){
return CloudCommander.CURRENT_FILE;
return cloudcmd.CURRENT_FILE;
}
/* private members */
@ -541,7 +542,7 @@ var CloudCommander, $, Util, DOM, CloudFunc;
return lRefresh;
};
DOM.setCurrentFile = function(pCurrentFile){
DOM.setCurrentFile = function(pCurrentFile){
var lRet_b = true;
if(!pCurrentFile){
@ -573,6 +574,10 @@ var CloudCommander, $, Util, DOM, CloudFunc;
return lRet_b;
};
DOM.setButtonKey = function(pKey, pFunc){
cloudcmd.KeysPanel[pKey].onclick = pFunc;
};
var lUnSetCurrentFile = function(pCurrentFile){
if(!pCurrentFile)
DOM.addCloudStatus({
@ -590,7 +595,7 @@ var CloudCommander, $, Util, DOM, CloudFunc;
return lRet_b;
};
DOM.isCurrentFile = function(pCurrentFile){
DOM.isCurrentFile = function(pCurrentFile){
if(!pCurrentFile)
DOM.addCloudStatus({
code : -1,
@ -658,7 +663,7 @@ var CloudCommander, $, Util, DOM, CloudFunc;
* then always work with passive
* panel
*/
if(window.innerWidth < CloudCommander.MIN_ONE_PANEL_WIDTH)
if(window.innerWidth < cloudcmd.MIN_ONE_PANEL_WIDTH)
lPanel = DOM.getById('left');

View file

@ -231,7 +231,7 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
/* добавляем обработчик клавишь */
DOM.addKeyListener( lKeyListener );
DOM.getById('f4').onclick = lEditor;
DOM.setButtonKey('f4', lEditor);
};
cloudcmd.Editor.CodeMirror = CodeMirrorEditor;

View file

@ -209,7 +209,7 @@ var CloudCommander, Util, DOM, CloudFunc, $;
var lF3 = cloudcmd.KEY.F3,
lKeyBinded = KeyBinding.get(),
lKey = event.keyCode,
lShift = event.shiftKey;
lShift = event.shiftKey;
/* если клавиши можно обрабатывать */
if( lKeyBinded && lKey === lF3 && lShift ){
@ -221,7 +221,7 @@ var CloudCommander, Util, DOM, CloudFunc, $;
/* добавляем обработчик клавишь */
DOM.addKeyListener(lKeyListener);
DOM.getById('f3').onclick = lView;
DOM.setButtonKey('f3', lView);
};
cloudcmd.Viewer.FancyBox = FancyBox;