refactored

This commit is contained in:
coderaiser 2013-01-23 07:56:55 -05:00
parent d3c8122ad0
commit 7f33f3a0e3

View file

@ -211,8 +211,6 @@ var CloudCommander, Util, DOM, $;
function set(){
if(!MenuSeted){
$.contextMenu(getConfig());
var lFunc_f = document.onclick;
/*
* Menu works in some crazy way so need a
* little hack to get every thing work out.
@ -225,7 +223,7 @@ var CloudCommander, Util, DOM, $;
* is not going on. All magic happening in
* DOM tree
*/
document.onclick = function(pEvent){
DOM.addClickListener(function(pEvent){
/* if clicked on menu item */
var lClassName = pEvent.target.parentElement.className;
switch(lClassName){
@ -235,7 +233,7 @@ var CloudCommander, Util, DOM, $;
return;
}
if(pEvent && pEvent.x && pEvent.y){
if(pEvent && pEvent.x){
var lLayer = DOM.getById('context-menu-layer');
if(lLayer){
var lStyle;
@ -266,15 +264,10 @@ var CloudCommander, Util, DOM, $;
if(lLayer && lStyle)
lLayer.style.cssText = lStyle;
/* if document.onclick was set up
* before us, it's best time to call it
*/
Util.exec(lFunc_f);
KeyBinding.set();
}
}
};
});
MenuSeted = true;
}