diff --git a/lib/client/editor.js b/lib/client/editor.js index dd16bfaf..1476df59 100644 --- a/lib/client/editor.js +++ b/lib/client/editor.js @@ -62,7 +62,8 @@ CloudCommander.Editor.CodeMirror = { '}' }); - CloudCommander.jsload('http://codemirror.net/mode/xml/xml.js', showEditor(pParent)); + CloudCommander.jsload('http://codemirror.net/mode/xml/xml.js', + showEditor(pParent)); }; }; diff --git a/lib/client/viewer.js b/lib/client/viewer.js index 42a15254..6bead242 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -21,6 +21,8 @@ CloudCommander.Viewer.FuncyBox = { }, set: function(){ + if(this.getByClass('fancybox').length) + return; try{ /* get current panel (left or right) */ var lPanel = this.getByClass('current-file'); @@ -46,4 +48,37 @@ CloudCommander.Viewer.FuncyBox = { getByClass : function(pClass){ return document.getElementsByClassName(pClass); } -}; \ No newline at end of file +}; +CloudCommander.Viewer.Keys = (function(){ + "use strict"; + + /* loading js and css of CodeMirror */ + CloudCommander.Editor.CodeMirror.load(); + + var key_event=function(event){ + + /* если клавиши можно обрабатывать */ + if(CloudCommander.keyBinded){ + /* if f4 pressed */ + if(event.keyCode===114){ + CloudCommander.Viewer.FuncyBox.set(); + var lCurrent = this.getByClass('current-file'); + lCurrent.length && + (lCurrent = lCurrent[0]); + + lCurrent.getElementsByClassName('fancybox') && + lCurrent.click(); + } + } + }; + + /* добавляем обработчик клавишь */ + if (document.addEventListener) + document.addEventListener('keydown', key_event,false); + + else + document.onkeypress=key_event; + + /* клавиши назначены*/ + CloudCommander.keyBinded=true; +}); \ No newline at end of file