From f2cc685d87f89c715fd9d88639b87cc8751d33fd Mon Sep 17 00:00:00 2001 From: coderaiaser Date: Tue, 17 Jul 2012 07:15:36 -0700 Subject: [PATCH] added event listener on f4 key pressed --- lib/client/editor.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/client/editor.js b/lib/client/editor.js index cec1d745..29314290 100644 --- a/lib/client/editor.js +++ b/lib/client/editor.js @@ -58,6 +58,9 @@ CloudCommander.Editor.CloudMirror = { load: (function(){ } }), show : (function(){ + /* if CloudEditor is not loaded - loading him */ + document.getElementById('CloudEditor') || + this.load(); /* removing keyBinding if set */ CloudCommander.keyBinded = false; left.className = 'panel hidden'; @@ -72,4 +75,23 @@ CloudCommander.Editor.CloudMirror = { load: (function(){ CloudEditor.className='hidden'; left.className = 'panel'; }) -}; \ No newline at end of file +}; +CloudCommander.Editor.Keys = (function(){ + "use strict"; + var key_event=function(event){ + /* если клавиши можно обрабатывать*/ + if(CloudCommander.keyBinded){ + /* if f4 pressed */ + if(event.keyCode===115){ + CloudCommander.Edititor.CloudMirror.show(); + } + } + }; + + /* добавляем обработчик клавишь */ + if(document.addEventListener) + document.addEventListener('exec_editor', key_event,false); + else document.onkeypress=key_event; + /* клавиши назначены*/ + CloudCommander.keyBinded=true; +}); \ No newline at end of file