Stackedit/res/extensions/shortcutRecorder.js

24 lines
673 B
JavaScript
Raw Normal View History

2013-09-28 16:34:29 +00:00
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;
});