diff --git a/ChangeLog b/ChangeLog index 07402793..4cef859b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -48,6 +48,8 @@ from storage folder. * Updated socket.io to v0.9.14. +* Fixed Util.time and Util.timeEnd + 2012.03.01, Version 0.1.9 diff --git a/lib/client/editor/_codemirror.js b/lib/client/editor/_codemirror.js index 7271828f..7a58cd42 100644 --- a/lib/client/editor/_codemirror.js +++ b/lib/client/editor/_codemirror.js @@ -96,7 +96,7 @@ var CloudCommander, Util, DOM, CodeMirror; * function loads CodeMirror js and css files */ function load(pCallBack){ - console.time('codemirror load'); + Util.time('codemirror load'); var lDir = CloudCmd.LIBDIRCLIENT + 'editor/codemirror/', lFiles = [ @@ -110,7 +110,7 @@ var CloudCommander, Util, DOM, CodeMirror; ]; DOM.anyLoadOnLoad(lFiles, function(){ - console.timeEnd('codemirror load'); + Util.timeEnd('codemirror load'); CodeMirrorLoaded = true; Util.exec(pCallBack); }); @@ -125,33 +125,30 @@ var CloudCommander, Util, DOM, CodeMirror; * called do not call it again * if f4 key pressed couple times */ - if(Loading) - return; - - /* checking is this link is to directory - * when folder view is no need to edit data - */ - if ( DOM.getCurrentSize() === '' ) - ReadOnly = true; - - Loading = true; - - var lFalseLoading = function(){ Loading = false; }; - - setTimeout(lFalseLoading, 400); - /* reading data from current file */ - DOM.getCurrentData({ - error : lFalseLoading, - success : function(data){ - if( DOM.hidePanel() ){ - Util.exec(pCallBack, data); - KeyBinding.unSet(); + if(!Loading){ + /* checking is this link is to directory + * when folder view is no need to edit data */ + ReadOnly = DOM.isCurrentIsDir(); + + Loading = true; + + var lFalseLoading = function(){ Loading = false; }; + + setTimeout(lFalseLoading, 400); + + DOM.getCurrentData({ + error : lFalseLoading, + success : function(data){ + if( DOM.hidePanel() ){ + Util.exec(pCallBack, data); + KeyBinding.unSet(); + } + + DOM.Images.hideLoad(); + lFalseLoading(); } - - DOM.Images.hideLoad(); - lFalseLoading(); - } - }); + }); + } } /** diff --git a/lib/util.js b/lib/util.js index f7cfdea3..1d0533d9 100644 --- a/lib/util.js +++ b/lib/util.js @@ -7,7 +7,7 @@ Util = exports || {}; (function(Util){ 'use strict'; - + var Scope = exports ? global : window; /** setting function context @@ -51,9 +51,8 @@ Util = exports || {}; Util.checkExtension = function(pName, pExt){ var lRet = false, lLength = pName.length; /* длина имени*/ - /* если длина имени больше - * длинны расширения - - * имеет смысл продолжать + + /* если длина имени больше длинны расширения - имеет смысл продолжать */ if (Util.isString(pExt) && pName.length > pExt.length) { var lExtNum = pName.lastIndexOf(pExt), /* последнее вхождение расширения*/ @@ -537,6 +536,14 @@ Util = exports || {}; return Util.isType(pVarible, 'function'); }; + /** + * functions check is pVarible is number + * @param pVarible + */ + Util.isNumber = function(pVarible){ + return Util.isType(pVarible, 'number'); + }; + /** * functions check is pVarible is object * @param pVarible @@ -759,8 +766,11 @@ Util = exports || {}; */ Util.execIfExist = function(pObj, pName, pArg){ var lRet; - if(pObj) - lRet = Util.exec(pObj[pName], pArg); + + if(pObj){ + var lFunc = Util.bind(pObj[pName], pObj); + lRet = Util.exec(lFunc, pArg); + } return lRet; }; @@ -876,7 +886,7 @@ Util = exports || {}; lRet = Util.execIfExist(lConsole, 'timeEnd', pArg); - return this; + return lRet; }; /** * Gets current date in format yy.mm.dd hh:mm:ss