From 368767eb8ef3acd2d3032c067bc7102972a83eee Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 7 Aug 2012 11:10:10 -0400 Subject: [PATCH] minor changes --- lib/client/editor.js | 4 ++-- lib/client/keyBinding.js | 41 +++++++++------------------------------- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/lib/client/editor.js b/lib/client/editor.js index 3cae9137..b060518a 100644 --- a/lib/client/editor.js +++ b/lib/client/editor.js @@ -13,12 +13,12 @@ CloudCommander.Editor.CodeMirror.load = (function(pParent){ /* function shows editor */ var createEditorDiv = function(){ if (!pParent.getById('CloudEditor')) { - var lFM = document.getElementById('fm'); + var lFM = pParent.getById('fm'); if(lFM) pParent.anyload({ name : 'div', id : 'CloudEditor', - element : lFM + parent : lFM }); else console.log('Error. Something went wrong FM not found'); diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index 8321cc58..f7a916e9 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -92,53 +92,30 @@ CloudCommander.keyBinding=(function(){ /* scrolling to current file*/ if(lCurrentFile.previousSibling) - lCurrentFile.previousSibling.scrollIntoViewIfNeeded(); - - /* if we on the top of - * the screan then - * moving down the scroolbar - */ - /* - lTop = lCurrentFile.previousSibling.offsetTop; - lTop % - (CloudCommander.HEIGHT - - CloudCommander.HEIGHT/10) < 70 && - lCurrentFile.parentElement.scrollByLines(-2); - */ + lCurrentFile.previousSibling + .scrollIntoViewIfNeeded(); } } /* если нажали клавишу в низ*/ else if(event.keyCode===40){ /* получаем выдленный файл*/ lCurrentFile = Util.getCurrentFile(); - + /* если ненайдены выделенные файлы - выходим*/ if(!lCurrentFile)return; - + /* если это не последняя строка */ if(lCurrentFile.nextSibling){ + /* убираем с него выделение */ lCurrentFile.className=''; + /* выделяем следующую строку*/ - lCurrentFile.nextSibling.className = CloudCommander.CURRENT_FILE; + lCurrentFile.nextSibling.className = + CloudCommander.CURRENT_FILE; /* scrolling to current file*/ - lCurrentFile.scrollIntoViewIfNeeded(); - - /* if we on the bottom of - * the screan then - * moving down the scroolbar - */ - /* - lTop = lCurrentFile.previousSibling.offsetTop; - var lHeight = CloudCommander.HEIGHT; - var lMod = lTop % (lHeight - lHeight/10) < 70; - lTop > (lHeight/10) && - lMod < 70 && lMod > 50 && - console.log(lCurrentFile - .parentElement - .scrollByLines(2) || '!'); - */ + lCurrentFile.nextSibling.scrollIntoViewIfNeeded(); } } /* если нажали клавишу Home