From a33de82db2e93c62eb7463d2c615ec22e7ca729f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 15 Aug 2012 15:48:17 +0300 Subject: [PATCH] added condition of pth and fm_header to setCurrentFile --- client.js | 75 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/client.js b/client.js index 93c7d43d..bb958162 100644 --- a/client.js +++ b/client.js @@ -5,7 +5,7 @@ * клиентский и серверный */ -var CloudCommander=(function(){ +var CloudCommander = (function(){ "use strict"; /* Клиентский обьект, содержащий функциональную часть*/ @@ -493,19 +493,39 @@ CloudClient.Util = (function(){ }; this.setCurrentFile = function(pCurrentFile){ - if(!pCurrentFile) + var lRet_b = true; + + if(!pCurrentFile){ this.addCloudStatus({ code : -1, msg : 'Error pCurrentFile in' + 'setCurrentFile' + 'could not be none' }); - + + lRet_b = false; + } var lCurrentFileWas = this.getCurrentFile(); if(lCurrentFileWas) this.unSetCurrentFile(lCurrentFileWas); + + var lClass = pCurrentFile.className; + if (lClass !== 'path' && + lClass !== 'fm_header'){ + pCurrentFile.className = CloudCommander.CURRENT_FILE; + } else { + this.addCloudStatus({ + code : -2, + msg : 'Error pCurrentFile in' + + 'setCurrentFile' + + 'could not be ' + + 'path or fm_header'; + }); + + lRet_b = false; + } - return pCurrentFile.className = CloudCommander.CURRENT_FILE; + return lRet_b; }; this.unSetCurrentFile = function(pCurrentFile){ @@ -758,33 +778,26 @@ CloudClient._setCurrent=(function(){ */ return function(pFromEnter){ var lCurrentFile = Util.getCurrentFile(); - if(lCurrentFile){ - /* если мы находимся не на - * пути и не на заголовках - */ - if(this.className!=='path' && - this.className!=='fm_header'){ - - if (Util.isCurrentFile(this) && - typeof pFromEnter !== 'boolean'){ - var lParent = this; - - setTimeout(function(){ - /* waiting a few seconds - * and if classes still equal - * make file name editable - * in other case - * double click event happend - */ - if(Util.isCurrentFile(lParent)) - CloudClient._editFileName(lParent); - },400); - } - else{ - /* устанавливаем курсор на файл, - * на который нажали */ - Util.setCurrentFile(this); - } + if(lCurrentFile){ + if (Util.isCurrentFile(this) && + typeof pFromEnter !== 'boolean'){ + var lParent = this; + + setTimeout(function(){ + /* waiting a few seconds + * and if classes still equal + * make file name editable + * in other case + * double click event happend + */ + if(Util.isCurrentFile(lParent)) + CloudClient._editFileName(lParent); + },400); + } + else{ + /* устанавливаем курсор на файл, + * на который нажали */ + Util.setCurrentFile(this); } } /* если мы попали сюда с энтера*/