diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index c465d1c9..1282ea07 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -23,6 +23,8 @@ CloudCommander.keyBinding=(function(){ else if(event.keyCode===114){ if (typeof CloudCommander.Viewer === 'function'){ CloudCommander.Viewer(); + + event.preventDefault(); } } /* навигация по таблице файлов*/ diff --git a/lib/client/viewer.js b/lib/client/viewer.js index cc967908..752ad63d 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -92,17 +92,18 @@ CloudCommander.Viewer.FancyBox = { show : (function(pParent){ CloudCommander.Viewer.FancyBox.set(); - var lCurrent = pParent.getByClass('current-file'); - lCurrent.length && - (lCurrent = lCurrent[0]); - - var lA = lCurrent.getElementsByClassName('fancybox'); - - var lConfig = pParent.FancyBox.getConfig(); - - lA.length && - $.fancybox.open({ href : lA[0].href }, - lConfig); + + var lCurrent = this.getByClass('current-file'); + lCurrent.length && + (lCurrent = lCurrent[0]); + + var lA = lCurrent.getElementsByClassName('fancybox'); + + var lConfig = this.getConfig(); + + lA.length && + $.fancybox.open({ href : lA[0].href }, + lConfig); }), getById : function(pId){return document.getElementById(pId);}, @@ -114,31 +115,29 @@ CloudCommander.Viewer.FancyBox = { CloudCommander.Viewer.Keys = (function(){ "use strict"; - var lCallBack_f = (function(pParent){ - var key_event = function(){ - return function(event){ - /* если клавиши можно обрабатывать */ - if(CloudCommander.keyBinded){ - /* if f3 pressed */ - if(event.keyCode===114){ - CloudCommander.Viewer.FancyBox.show(); - - event.preventDefault(pParent); - } + var lCallBack_f = (function(){ + var key_event = function(event){ + /* если клавиши можно обрабатывать */ + if(CloudCommander.keyBinded){ + /* if f3 pressed */ + if(event.keyCode===114){ + CloudCommander.Viewer.FancyBox.show(); + + event.preventDefault(); } - }; + } }; /* добавляем обработчик клавишь */ if (document.addEventListener) - document.addEventListener('keydown', key_event(pParent),false); + document.addEventListener('keydown', key_event(),false); else document.onkeypress=key_event; - /* showing image previewer */ + /* showing images preview*/ CloudCommander.Viewer.FancyBox.show(); }); - CloudCommander.Viewer.FancyBox.load(this.FancyBox, lCallBack_f(this)); + CloudCommander.Viewer.FancyBox.load(this.FancyBox, lCallBack_f()); }); \ No newline at end of file