mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Added "P" hotkey to post list
This commit is contained in:
27
public_html/js/Keyboard.js
Normal file
27
public_html/js/Keyboard.js
Normal 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);
|
Reference in New Issue
Block a user