From 82581cfd361649b944f8aed3a6f4dbe12581219e Mon Sep 17 00:00:00 2001 From: benweet Date: Sat, 28 Sep 2013 17:34:29 +0100 Subject: [PATCH] Shortcuts settings --- res/eventMgr.js | 1 + res/extensions/shortcutRecorder.js | 24 ++++++++++++++++++++++++ res/html/bodyIndex.html | 13 +++++++++++++ res/main.js | 4 ++++ res/styles/main.less | 30 +++++++++++++++--------------- 5 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 res/extensions/shortcutRecorder.js diff --git a/res/eventMgr.js b/res/eventMgr.js index f5a56792..afa59654 100644 --- a/res/eventMgr.js +++ b/res/eventMgr.js @@ -34,6 +34,7 @@ define([ "extensions/buttonHtmlCode", "extensions/buttonViewer", "extensions/welcomeTour", + "extensions/shortcutRecorder", "extensions/userCustom", "bootstrap", "jquery-waitforimages" diff --git a/res/extensions/shortcutRecorder.js b/res/extensions/shortcutRecorder.js new file mode 100644 index 00000000..695d5a65 --- /dev/null +++ b/res/extensions/shortcutRecorder.js @@ -0,0 +1,24 @@ +define([ + "jquery", + "underscore", + "classes/Extension", + "mousetrap", + "mousetrap-record", +], function($, _, Extension, mousetrap) { + + var shortcutRecorder = new Extension("shortcutRecorder", "Shortcut recorder"); + + shortcutRecorder.onReady = function() { + $('.button-record-shortcut').click(function() { + var $button = $(this); + Mousetrap.record(function(sequence) { + $button.before(['
', +'', +sequence.join(' '), +'
'].join()); + }); + }); + }; + + return shortcutRecorder; +}); \ No newline at end of file diff --git a/res/html/bodyIndex.html b/res/html/bodyIndex.html index bdd49b6f..b93ef481 100644 --- a/res/html/bodyIndex.html +++ b/res/html/bodyIndex.html @@ -885,6 +885,8 @@