mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
added ability to move with Page Up and Page Down
This commit is contained in:
parent
a1eca3b089
commit
42dac77eb9
1 changed files with 44 additions and 8 deletions
|
|
@ -11,8 +11,8 @@ CloudCommander.keyBinding=(function(){
|
|||
|
||||
};
|
||||
var key_event=function(event){
|
||||
var lCurrentFile;
|
||||
var lName, lTop;
|
||||
var lCurrentFile,
|
||||
lName, lTop, i;
|
||||
/* если клавиши можно обрабатывать*/
|
||||
if(CloudCommander.keyBinded){
|
||||
/* если нажали таб:
|
||||
|
|
@ -129,11 +129,11 @@ CloudCommander.keyBinding=(function(){
|
|||
.scrollByLines(2) || '!');
|
||||
}
|
||||
}
|
||||
/* если нажали клавишу page up или Home
|
||||
/* если нажали клавишу Home
|
||||
* переходим к самому верхнему
|
||||
* элементу
|
||||
*/
|
||||
else if(/*event.keyCode===33 ||*/ event.keyCode===36){
|
||||
else if(event.keyCode === 36){
|
||||
lCurrentFile = Util.getCurrentFile();
|
||||
/* убираем выделение с текущего файла*/
|
||||
lCurrentFile.className='';
|
||||
|
|
@ -146,11 +146,11 @@ CloudCommander.keyBinding=(function(){
|
|||
|
||||
/* move scrollbar to top */
|
||||
Util.getPanel().scrollByLines(-100000000000000);
|
||||
}
|
||||
/* если нажали клавишу page down или End
|
||||
}
|
||||
/* если нажали клавишу End
|
||||
* выделяем последний элемент
|
||||
*/
|
||||
else if(/*event.keyCode===34 ||*/ event.keyCode===35){
|
||||
else if( event.keyCode === 35){
|
||||
lCurrentFile = Util.getCurrentFile();
|
||||
/* снимаем выделение с текущего файла*/
|
||||
lCurrentFile.className='';
|
||||
|
|
@ -161,8 +161,44 @@ CloudCommander.keyBinding=(function(){
|
|||
/* move scrollbar to bottom*/
|
||||
Util.getPanel().scrollByLines(100000000000000);
|
||||
}
|
||||
/* если нажали клавишу page down
|
||||
* проматываем экран
|
||||
*/
|
||||
else if(event.keyCode === 34){
|
||||
Util.getPanel().scrollByPages(1);
|
||||
|
||||
lCurrentFile = Util.getCurrentFile();
|
||||
for(i=0; i<30; i++){
|
||||
if(!lCurrentFile.nextSibling) break;
|
||||
|
||||
lCurrentFile = lCurrentFile.nextSibling;
|
||||
}
|
||||
Util.getCurrentFile().className = '';
|
||||
lCurrentFile.className = CloudCommander.CURRENT_FILE;
|
||||
}
|
||||
/* если нажали клавишу page up
|
||||
* проматываем экран
|
||||
*/
|
||||
else if(event.keyCode === 33){
|
||||
Util.getPanel().scrollByPages(-1);
|
||||
|
||||
lCurrentFile = Util.getCurrentFile();
|
||||
for(i=0; i<30; i++){
|
||||
if(!lCurrentFile.previousSibling) break;
|
||||
else try{
|
||||
lCurrentFile
|
||||
.previousSibling
|
||||
.previousSibling
|
||||
.previousSibling
|
||||
.previousSibling;
|
||||
} catch(pError){break};
|
||||
lCurrentFile = lCurrentFile.previousSibling;
|
||||
}
|
||||
Util.getCurrentFile().className = '';
|
||||
lCurrentFile.className = CloudCommander.CURRENT_FILE;
|
||||
}
|
||||
/* если нажали Enter - открываем папку*/
|
||||
else if(event.keyCode===13){
|
||||
else if(event.keyCode === 13){
|
||||
lCurrentFile = Util.getByClass(CloudCommander.CURRENT_FILE);
|
||||
/* если ненайдены выделенные файлы - выходим*/
|
||||
if(!lCurrentFile.length)return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue