From cc211254c511b88e8171069e5c8122d53229cd51 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Mon, 24 Nov 2014 17:23:23 +0200 Subject: add alt-ctrl-o and alt-ctrl-i keyboard shortcuts Considered using jquery.hotkeys, even tried that, but didn't actually work for me. This code seems to function under all browsers I tested (IE 11, chrome recent, FF recent - will test on IE 8). --- src/main.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main.js') diff --git a/src/main.js b/src/main.js index 17066ac3..f9d830e9 100644 --- a/src/main.js +++ b/src/main.js @@ -31,6 +31,18 @@ function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop, if (json) { rz_core.load_from_json(json); } + + document.body.onkeyup = function(e) { + var key = (e.key || (e.charCode && String.charCodeAt(e.charCode)) + || (e.which && String.charCodeAt(e.which))).toLowerCase(); + + if (e.altKey && e.ctrlKey && key == 'i') { + $('#textanalyser').focus(); + } + if (e.altKey && e.ctrlKey && key == 'o') { + $('#search').focus(); + } + }; // TODO: interaction between the hack above and this model_core.init(rz_config); textanalysis.init(); -- cgit v1.3.1