moved bind function to util.js from dom.js

This commit is contained in:
coderaiser 2012-11-07 04:26:09 -05:00
parent 47d2b8e119
commit b67744e495
4 changed files with 28 additions and 21 deletions

View file

@ -200,6 +200,7 @@ CloudClient._loadDir = function(pLink,pNeedRefresh){
* выполнить загрузку
*/
return function(){
var lRet = true;
/* показываем гиф загрузки возле пути папки сверху*/
/* ctrl+r нажата? */
@ -240,7 +241,7 @@ CloudClient._loadDir = function(pLink,pNeedRefresh){
* возвращаем false на событие
* onclick
*/
return true;
return lRet;
};
};
@ -297,7 +298,7 @@ CloudClient._setCurrent = function(){
var lCurrentFile = DOM.getCurrentFile();
if(lCurrentFile){
if (DOM.isCurrentFile(this) &&
typeof pFromEnter !== 'boolean'){
!Util.isBoolean(pFromEnter)){
//var lParent = this;
//setTimeout(function(){
@ -312,18 +313,17 @@ CloudClient._setCurrent = function(){
// },1000);
}
else{
/* устанавливаем курсор на файл,
* на который нажали */
/* устанавливаем курсор на файл, на который нажали */
DOM.setCurrentFile(this);
}
}
/* если мы попали сюда с энтера*/
/* если мы попали сюда с энтера */
if(pFromEnter===true){
var lResult = Util.exec( DOM.bind(this.ondblclick, this) );
var lResult = Util.exec( Util.bind(this.ondblclick, this) );
/* enter pressed on file */
if(!lResult){
var lA = DOM.getCurrentLink(this);
Util.exec( DOM.bind(lA.ondblclick, this) );
Util.exec( Util.bind(lA.ondblclick, this) );
}
}/* если мы попали сюда от клика мышки */
else

View file

@ -127,12 +127,7 @@ var CloudCommander, $, Util, DOM;
}
else $.ajax(pParams);
};
/* setting function context (DOM) */
DOM.bind = function(pFunction, pContext){
return pFunction.bind(pContext);
};
/*
* Function gets id by src
* from http://domain.com/1.js to
@ -159,8 +154,7 @@ var CloudCommander, $, Util, DOM;
return DOM.loadOnload(pFunc_a);
}
else if( Util.isFunction(pFunc_a) )
return pFunc_a();
else return Util.exec(pFunc_a);
};
DOM.anyLoadOnLoad = function(pParams_a, pFunc){
@ -178,8 +172,7 @@ var CloudCommander, $, Util, DOM;
DOM.anyload(lParam);
}else if( Util.isFunction(pFunc) )
pFunc();
}else Util.exec(pFunc);
}
};
@ -295,8 +288,7 @@ var CloudCommander, $, Util, DOM;
status : 404
});
if( Util.isFunction(lOnError) )
lFunc();
Util.exec(lOnError);
});
if(pParams_o.style){
@ -316,7 +308,8 @@ var CloudCommander, $, Util, DOM;
/* если js-файл уже загружен
* запускаем функцию onload
*/
else if( Util.isFunction(lFunc) ) lFunc();
else
Util.exec(lFunc);
return element;
},

View file

@ -204,7 +204,7 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
/* if f4 or f3 pressed */
var lF3 = cloudcmd.KEY.F3;
var lF4 = cloudcmd.KEY.F4;
var lShow = DOM.bind( CodeMirrorEditor.show, CodeMirrorEditor );
var lShow = Util.bind( CodeMirrorEditor.show, CodeMirrorEditor );
if(!pEvent.shiftKey){
switch(pEvent.keyCode)

View file

@ -6,6 +6,20 @@ var Util, exports;
Util = exports || {};
/** setting function context
* @param {function} pFunction
* @param {object} pContext
*/
Util.bind = function(pFunction, pContext){
var lRet = false;
if( Util.isFunction(pFunction) )
lRet = pFunction.bind(pContext);
return lRet;
};
/* STRINGS */
/**
* function check is strings are equal