mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fixed Util.time and Util.timeEnd
This commit is contained in:
parent
081a325fe3
commit
428d9492ef
3 changed files with 44 additions and 35 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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() === '<dir>' )
|
||||
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();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
24
lib/util.js
24
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue