diff --git a/ChangeLog b/ChangeLog index 9020b4d2..671076b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * From now jsload, cssload and anyload suport arrays. +* Added ability to move scrollbar, when Home and +End buttons pressed. + 2012.08.06, Version 0.1.5 diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index 55ea05f9..8d2f87cc 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -73,10 +73,11 @@ CloudCommander.keyBinding=(function(){ /* если нажали клавишу вверх*/ else if(event.keyCode===38){ /* получаем выдленный файл*/ - lCurrentFile=Util.getByClass(CloudCommander.CURRENT_FILE); + lCurrentFile = Util.getCurrentFile(); + /* если ненайдены выделенные файлы - выходим*/ - if(lCurrentFile.length===0)return; - lCurrentFile=lCurrentFile[0]; + if(!lCurrentFile) return; + /* если это строка существет и * если она не заголовок * файловой таблицы @@ -102,10 +103,11 @@ CloudCommander.keyBinding=(function(){ /* если нажали клавишу в низ*/ else if(event.keyCode===40){ /* получаем выдленный файл*/ - lCurrentFile = Util.getByClass(CloudCommander.CURRENT_FILE); + lCurrentFile = Util.getCurrentFile(); + /* если ненайдены выделенные файлы - выходим*/ - if(lCurrentFile.length===0)return; - lCurrentFile=lCurrentFile[0]; + if(!lCurrentFile)return; + /* если это не последняя строка */ if(lCurrentFile.nextSibling){ /* убираем с него выделение */ @@ -132,7 +134,7 @@ CloudCommander.keyBinding=(function(){ * элементу */ else if(/*event.keyCode===33 ||*/ event.keyCode===36){ - lCurrentFile = Util.getByClass(CloudCommander.CURRENT_FILE)[0]; + lCurrentFile = Util.getCurrentFile(); /* убираем выделение с текущего файла*/ lCurrentFile.className=''; /* получаем первый элемент*/ @@ -141,16 +143,23 @@ CloudCommander.keyBinding=(function(){ .nextElementSibling.nextElementSibling /* выделяем верхий файл */ .className=CloudCommander.CURRENT_FILE; + + /* move scrollbar to top */ + Util.getPanel().scrollByLines(-100000000000000); } /* если нажали клавишу page down или End * выделяем последний элемент */ else if(/*event.keyCode===34 ||*/ event.keyCode===35){ - lCurrentFile = Util.getByClass(CloudCommander.CURRENT_FILE)[0]; + lCurrentFile = Util.getCurrentFile(); /* снимаем выделение с текущего файла*/ lCurrentFile.className=''; /* выделяем самый нижний файл */ - lCurrentFile.parentElement.lastElementChild.className=CloudCommander.CURRENT_FILE; + lCurrentFile.parentElement.lastElementChild + .className = CloudCommander.CURRENT_FILE; + + /* move scrollbar to bottom*/ + Util.getPanel().scrollByLines(100000000000000); } /* если нажали Enter - открываем папку*/ else if(event.keyCode===13){