From 017e48470b9568455a3721797a1341a6bfaa07e5 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 15 Aug 2012 14:07:38 +0300 Subject: [PATCH] fixed bug with setting up current file on click when menu is open MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Menu works in some crazy way so need a little hack to get every thing work out. When menu shows up, it drawing invisible  layer wich hides all elements of Cloud Commander so it could not handle onclick events. To get every thing work how expected we hide out invisible layer so for observer it is nothing special is not going on. All magic happening in DOM tree --- lib/client/menu.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/client/menu.js b/lib/client/menu.js index 28639102..51a48e28 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -76,6 +76,18 @@ CloudCommander.Menu.set = (function(){ var lThis = this; var lFunc_f = document.onclick; + /* + * Menu works in some crazy way so need a + * little hack to get every thing work out. + * When menu shows up, it drawing invisible + * layer wich hides all elements of + * Cloud Commander so it could not handle + * onclick events. To get every thing work + * how expected we hide out invisible layer + * so for observer it is nothing special + * is not going on. All magic happening in + * DOM tree + */ document.onclick = function(pEvent){ if(pEvent.x && pEvent.y){ var lLayer = lThis.getById('context-menu-layer') @@ -96,6 +108,9 @@ CloudCommander.Menu.set = (function(){ lLayer.style.cssText = lLayer.style.cssText .replace('z-index: -1', 'z-index: 1') + /* if document.onclick was set up + * before us, it's best time to call it + */ if(typeof lFunc_f === 'function') lFunc_f(); }