Added "P" hotkey to post list

This commit is contained in:
Marcin Kurczewski
2014-09-19 17:37:10 +02:00
parent e0bee3b78c
commit 57fb6da4b3
6 changed files with 42 additions and 26 deletions

View File

@ -0,0 +1,27 @@
var App = App || {};
App.Keyboard = function(mousetrap) {
function keyup(key, callback) {
mousetrap.bind(key, simpleKeyPressed(callback), 'keyup');
}
function keydown(key, callback) {
mousetrap.bind(key, simpleKeyPressed(callback));
}
function simpleKeyPressed(callback) {
return function(e) {
if (!e.altKey && !e.ctrlKey) {
callback();
}
};
}
return {
keydown: keydown,
keyup: keyup,
};
};
App.DI.register('keyboard', ['mousetrap'], App.Keyboard);