From d748bf3b0630636c8071cf55c536cd9e8f9e4398 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Sep 2012 08:51:12 -0400 Subject: [PATCH] fixed bug in setCurentFile --- client.js | 26 +++++++++----------------- lib/client/keyBinding.js | 8 ++++---- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/client.js b/client.js index 9884d564..0f199286 100644 --- a/client.js +++ b/client.js @@ -652,24 +652,16 @@ CloudClient.Util = (function(){ } var lCurrentFileWas = this.getCurrentFile(); - var lClass = pCurrentFile.className; - if (lClass !== 'path' && - lClass !== 'fm_header'){ - if(lCurrentFileWas) - this.unSetCurrentFile(lCurrentFileWas); - - pCurrentFile.className = CloudCommander.CURRENT_FILE; - } else { - this.addCloudStatus({ - code : -2, - msg : 'Error pCurrentFile in' + - 'setCurrentFile' + - 'could not be ' + - 'path or fm_header' - }); + if (pCurrentFile.className === 'path') + pCurrentFile = pCurrentFile.nextSibling; + + if (pCurrentFile.className == 'fm_header') + pCurrentFile = pCurrentFile.nextSibling; + + if(lCurrentFileWas) + this.unSetCurrentFile(lCurrentFileWas); - lRet_b = false; - } + pCurrentFile.className = CloudCommander.CURRENT_FILE; return lRet_b; }; diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index f9a3d917..2c07e5be 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -196,8 +196,8 @@ var CloudCommander; * пропускаем путь и заголовки столбиков * выделяем верхий файл */ - lCurrentFile = lCurrentFile - .parentElement.children[2]; + lCurrentFile = lCurrentFile. + parentElement.firstChild; Util.setCurrentFile(lCurrentFile); @@ -212,8 +212,8 @@ var CloudCommander; */ else if( event.keyCode === lKEY.END){ /* выделяем самый нижний файл */ - lCurrentFile = lCurrentFile - .parentElement.lastElementChild; + lCurrentFile = lCurrentFile. + parentElement.lastElementChild; Util.setCurrentFile(lCurrentFile);