mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(index) add "f9 - menu" button
This commit is contained in:
parent
96351e0027
commit
1892a263f4
7 changed files with 32 additions and 19 deletions
|
|
@ -136,6 +136,8 @@ getJSONfromFileTable.
|
|||
|
||||
* chore(css) .cmd-button {width: 10% -> 8%}
|
||||
|
||||
* feature(index) add "f9 - menu" button
|
||||
|
||||
|
||||
2012.04.22, v0.2.0
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ There is a short list:
|
|||
- **F6** - rename/move
|
||||
- **F7** - new dir
|
||||
- **F8, Delete** - remove current file
|
||||
- **F9** = menu
|
||||
- **Ctrl + r** - reload dir content
|
||||
- **Ctrl + d** - clear local cache (wich contains dir contents)
|
||||
- **Alt + q** - disable key bindings
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
<button id=f6 class=cmd-button>F6 - move</button>
|
||||
<button id=f7 class=cmd-button>F7 - make dir</button>
|
||||
<button id=f8 class=cmd-button>F8 - delete</button>
|
||||
<button id=f9 class=cmd-button>F9 - menu</button>
|
||||
<button id=~ class=cmd-button>~ - console</button>
|
||||
</div>
|
||||
<script src=/lib/util.js></script>
|
||||
|
|
|
|||
|
|
@ -234,14 +234,15 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
DOM.moveCurrent, /* f6 */
|
||||
DOM.promptNewDir, /* f7 */
|
||||
DOM.promptDeleteSelected, /* f8 */
|
||||
CloudCmd.Menu, /* f9 */
|
||||
];
|
||||
|
||||
for (i = 1; i <= 8; i++) {
|
||||
for (i = 1; i <= 9; i++) {
|
||||
lButton = 'f' + i,
|
||||
lEl = DOM.getById('f' + i);
|
||||
lKeysPanel[lButton] = lEl;
|
||||
|
||||
if( i === 1 || i === 3 || i === 4)
|
||||
if (i === 1 || i === 3 || i === 4 || i === 9)
|
||||
Events.addOneTime('click', lFuncs[i], lEl);
|
||||
else
|
||||
Events.addClick(lFuncs[i], lEl);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
]);
|
||||
|
||||
DOM.Events.addKey(listener);
|
||||
DOM.setButtonKey('f4', Edit.show);
|
||||
|
||||
delete Edit.init;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ var CloudCmd, Util, DOM;
|
|||
F6 : 117,
|
||||
F7 : 118,
|
||||
F8 : 119,
|
||||
F10 : 121,
|
||||
F9 : 120,
|
||||
|
||||
TRA : 192 /* Typewritten Reverse Apostrophe (`) */
|
||||
};
|
||||
|
|
@ -161,11 +161,9 @@ var CloudCmd, Util, DOM;
|
|||
DOM.promptDeleteCurrent(lCurrent);
|
||||
break;
|
||||
|
||||
case Key.F10:
|
||||
if(lShift){
|
||||
Util.exec(CloudCmd.Menu);
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
case Key.F9:
|
||||
Util.exec(CloudCmd.Menu);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.TRA:
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@
|
|||
* https://github.com/medialize/jQuery-contextMenu
|
||||
*/
|
||||
var CloudCmd, Util, DOM, CloudFunc, $;
|
||||
|
||||
(function(CloudCmd, Util, DOM, CloudFunc){
|
||||
'use strict';
|
||||
|
||||
var Key = CloudCmd.Key,
|
||||
Events = DOM.Events,
|
||||
MenuSeted = false,
|
||||
Menu = {},
|
||||
Position,
|
||||
|
|
@ -212,7 +214,6 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
|
||||
DOM.anyLoadInParallel(lFiles, function(){
|
||||
Util.timeEnd('menu load');
|
||||
$.contextMenu.handle.keyStop = $.noop;
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
}
|
||||
|
|
@ -224,7 +225,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
* layer wich hides all elements of
|
||||
* Cloud Commander so it could not handle
|
||||
* onclick events. To get every thing work
|
||||
* how expected we remove invisible layer
|
||||
* how expected we hide invisible layer
|
||||
* so for observer it is nothing special
|
||||
* is not going on. All magic happening in
|
||||
* DOM tree.
|
||||
|
|
@ -232,7 +233,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
function clickProcessing(){
|
||||
var lLayer = DOM.getById('context-menu-layer');
|
||||
if(lLayer){
|
||||
document.body.removeChild(lLayer);
|
||||
DOM.hide(lLayer);
|
||||
|
||||
var lElement = document.elementFromPoint(Position.x, Position.y),
|
||||
lTag = lElement.tagName;
|
||||
|
|
@ -247,6 +248,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
DOM.setCurrentFile(lElement);
|
||||
}
|
||||
|
||||
DOM.show(lLayer);
|
||||
Key.setBind();
|
||||
}
|
||||
}
|
||||
|
|
@ -290,20 +292,27 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
DOM.jqueryLoad
|
||||
]);
|
||||
|
||||
DOM.Events.addKey( lListener );
|
||||
Events.addKey( lListener );
|
||||
|
||||
DOM.setButtonKey('f9', function(){
|
||||
var lCurrent = DOM.getCurrentFile(),
|
||||
lEvent = Events.create('contextmenu');
|
||||
|
||||
Events.dispatch(lEvent, lCurrent);
|
||||
});
|
||||
|
||||
function lListener(pEvent){
|
||||
var lF10 = Key.F10,
|
||||
var lCurrent,
|
||||
lF9 = Key.F9,
|
||||
lESC = Key.ESC,
|
||||
lKey = pEvent.keyCode,
|
||||
lShift = pEvent.shiftKey,
|
||||
lIsBind = Key.isBind();
|
||||
|
||||
if( lIsBind ){
|
||||
if(lKey === lF10 && lShift){
|
||||
$( DOM.getCurrentFile() ).contextMenu();
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
if (lIsBind && lKey === lF9) {
|
||||
lCurrent = DOM.getCurrentFile();
|
||||
$(lCurrent).contextmenu();
|
||||
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
else if (lKey === lESC)
|
||||
Key.setBind();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue