diff --git a/lib/client.js b/lib/client.js index 560c7026..b6534d82 100644 --- a/lib/client.js +++ b/lib/client.js @@ -185,16 +185,14 @@ CloudCmd._editFileName = function(pParent){ * в верх по файловой структуре * @param pDirName - имя каталога с которого мы пришли */ -CloudCmd._currentToParent = function(pDirName){ - /* опредиляем в какой мы панели: - * правой или левой - */ - var lPanel = DOM.getPanel(); - - /* убираем слэш с имени каталога*/ - pDirName = pDirName.replace('/',''); +CloudCmd._currentToParent = function(pDirName){ + /* убираем слэш с имени каталога */ + pDirName = pDirName.replace('/',''); - var lRootDir = DOM.getById(pDirName + '(' + lPanel.id + ')'); + /* опредиляем в какой мы панели: * + * правой или левой */ + var lPanel = DOM.getPanel(), + lRootDir = DOM.getById(pDirName + '(' + lPanel.id + ')'); /* if found li element with ID directory name * set it to current file @@ -210,25 +208,25 @@ CloudCmd._currentToParent = function(pDirName){ * инициализации */ CloudCmd.init = function(){ - var lFunc = function(){ - Util.loadOnLoad([ - initKeysPanel, - initModules, - baseInit - ]); - }; + var lCallBack = function(){ + Util.loadOnLoad([ + initKeysPanel, + initModules, + baseInit + ]); + }, + lFunc = function(pCallBack){ + this.OLD_BROWSER = true; + var lSrc = CloudCmd.LIBDIRCLIENT + 'ie.js'; + + DOM.jqueryLoad( + DOM.retJSLoad(lSrc, pCallBack) + ); + }; //Util.socketLoad(); - if(!document.body.scrollIntoViewIfNeeded){ - this.OLD_BROWSER = true; - var lSrc = CloudCmd.LIBDIRCLIENT + 'ie.js'; - - DOM.jqueryLoad( - DOM.retJSLoad(lSrc, lFunc) - ); - }else - lFunc(); + Util.ifExec(document.body.scrollIntoViewIfNeeded, lCallBack, lFunc); }; function initModules(pCallBack){ diff --git a/lib/client/editor/_codemirror.js b/lib/client/editor/_codemirror.js index c60727f2..1a6409ff 100644 --- a/lib/client/editor/_codemirror.js +++ b/lib/client/editor/_codemirror.js @@ -1,6 +1,6 @@ var CloudCommander, Util, DOM, CodeMirror; /* object contains editors CodeMirror */ - (function(){ + (function(CloudCommander, Util, DOM){ "use strict"; var cloudcmd = CloudCommander, KeyBinding = CloudCommander.KeyBinding, @@ -207,4 +207,5 @@ var CloudCommander, Util, DOM, CodeMirror; }; cloudcmd.Editor.CodeMirror = CodeMirrorEditor; -})(); \ No newline at end of file + +})(CloudCommander, Util, DOM); \ No newline at end of file diff --git a/lib/util.js b/lib/util.js index 8772fbe0..591076fd 100644 --- a/lib/util.js +++ b/lib/util.js @@ -395,7 +395,7 @@ Util = exports || {}; * @param pArg */ Util.exec = function(pCallBack, pArg){ - var lRet = false; + var lRet; if(pCallBack){ if( Util.isFunction(pCallBack) ) @@ -409,6 +409,23 @@ Util = exports || {}; return lRet; }; + /** + * function do conditional save exec of function + * @param pCondition + * @param pCallBack + * @param pFunc + */ + Util.ifExec = function(pCondition, pCallBack, pFunc){ + var lRet; + + if(pCondition) + Util.exec(pCallBack); + else + Util.exec(pFunc, pCallBack); + + return lRet; + }; + /** * Gets current time in format hh:mm:ss */