diff --git a/client.js b/client.js index a67b14fe..a067f7d0 100644 --- a/client.js +++ b/client.js @@ -635,11 +635,11 @@ CloudClient._changeLinks = function(pPanelID){ if(a[i].target !== '_blank'){ lLi.ondblclick = CloudClient._loadDir(link); - var lListener = lLi.addEventListener; - if(lListener) - lLi.addEventListener('touchend', - CloudClient._loadDir(link), - false); + DOM.addListener('touchend', + CloudClient._loadDir(link), + false, + lLi + ); } lLi.id = (a[i].title ? a[i].title : a[i].textContent) + diff --git a/lib/client/dom.js b/lib/client/dom.js index a7b35376..ab9c1229 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -72,8 +72,8 @@ var CloudCommander, $, Util, DOM, CloudFunc; * @param pListener * @param pUseCapture */ - DOM.addListener = function(pType, pListener, pUseCapture){ - return document.addEventListener( + DOM.addListener = function(pType, pListener, pUseCapture, pElement){ + return (pElement || document).addEventListener( pType, pListener, pUseCapture || false @@ -635,9 +635,16 @@ var CloudCommander, $, Util, DOM, CloudFunc; return lLink; }; - /* function getting panel active, or passive - * @pPanel_o = {active: true} - */ + /** function getting FM + * @param pPanel_o = {active: true} + */ + DOM.getFM = function(){ + return DOM.getPanel().parentElement; + }; + + /** function getting panel active, or passive + * @param pPanel_o = {active: true} + */ DOM.getPanel = function(pActive){ var lPanel = DOM.getCurrentFile().parentElement; diff --git a/lib/client/editor/_codemirror.js b/lib/client/editor/_codemirror.js index ce04852d..b3550b83 100644 --- a/lib/client/editor/_codemirror.js +++ b/lib/client/editor/_codemirror.js @@ -224,7 +224,7 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror; }; /* добавляем обработчик клавишь */ - DOM.addKeyListener(lKeyListener); + DOM.addKeyListener( lKeyListener ); }; cloudcmd.Editor.CodeMirror = CodeMirrorEditor; diff --git a/lib/client/menu.js b/lib/client/menu.js index 3f13f8df..9585bcdf 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -200,9 +200,10 @@ var CloudCommander, Util, DOM, CloudFunc, $; Menu.Keys = function(pPosition){ Position = pPosition; - DOM.jqueryLoad(function(){ - Util.loadOnLoad([Menu.show, load]); - }); + DOM.jqueryLoad( Util.retLoadOnLoad([ + Menu.show, + load + ])); var lFunc = document.oncontextmenu; document.oncontextmenu = function(){ diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index 7bd9e6dc..42359d26 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -92,9 +92,11 @@ var CloudCommander, Util, DOM, $, Github; }; cloudcmd.Storage.Keys = function(){ - DOM.jqueryLoad(function(){ - Util.loadOnLoad([ init, setConfig, load ]); - }); + DOM.jqueryLoad( Util.retLoadOnLoad([ + init, + setConfig, + load + ])); }; cloudcmd.Storage.Github = GithubStore; diff --git a/lib/client/terminal.js b/lib/client/terminal.js index 571c3eb5..5ce4b421 100644 --- a/lib/client/terminal.js +++ b/lib/client/terminal.js @@ -56,18 +56,13 @@ var CloudCommander, Util, DOM, $; * function do basic initialization */ function init(){ - if(!TerminalId){ - var lFM = DOM.getById('fm'); - if(lFM) - TerminalId = DOM.anyload({ - name : 'div', - id : 'terminal', - className : 'panel', - parent : lFM - }); - } - else - console.log('Error. Something went wrong FM not found'); + if(!TerminalId) + TerminalId = DOM.anyload({ + name : 'div', + id : 'terminal', + className : 'panel', + parent : DOM.getFM() + }); } /* PUBLIC FUNCTIONS */ diff --git a/lib/client/viewer.js b/lib/client/viewer.js index 898daebc..6bcbfceb 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -197,9 +197,10 @@ var CloudCommander, Util, DOM, CloudFunc, $; }; cloudcmd.Viewer.Keys = function(){ - DOM.jqueryLoad(function(){ - Util.loadOnLoad([FancyBox.show, FancyBox.load]); - }); + DOM.jqueryLoad( Util.retLoadOnLoad([ + FancyBox.show, + FancyBox.load + ])); /* добавляем обработчик клавишь */ DOM.addKeyListener(function(){ diff --git a/lib/util.js b/lib/util.js index 610f59a9..7127e16e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -76,7 +76,7 @@ var Util, exports; data : pData, callback : lCallBack }; - + Util.exec(lFunc , pData || lCallBack); } }; @@ -225,7 +225,7 @@ var Util, exports; return lRet; }; - /** + /** * function gets time */ Util.getTime = function(){