Stackedit/res/extensions/shortcutRecorder.js
2013-09-28 17:34:29 +01:00

24 lines
673 B
JavaScript

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(['<div class="alert alert-dismissable">',
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>',
sequence.join(' '),
'</div>'].join());
});
});
};
return shortcutRecorder;
});