Shortcuts/Hotkeys in jQuery

I had to search for a while to find a nice way to be able to do Hotkeys in jQuery, and thought I would post what I found that finally worked.

Jeresig adapted what comes up as the top result for searching for jQuery hotkeys, however it’s out of date and partially functional now.

This one worked:
http://www.stepanreznikov.com/js-shortcuts/

Sample syntax is better summed up in the link, but uses the following syntax:

$.Shortcuts.add({
    type: 'down',
    mask: 'Ctrl+A',
    handler: function() {
        debug('Ctrl+A');
    }
});

// Dont forget to start it!
$.Shortcuts.start();

And that’s it. Worked happily once I added in the reference to it, and trying it out now.

The project I’m using it for is a live titling scoreboard, with the difference being is that it’s made in html and jQuery. Shortcuts are a quicker way to update the score, and any score updates will make the board animate to show, then slide the text away.

Ideally, I would have loved to be able to send hotkeys to a webpage while focus is on a separate program, but have not found any proprietary ways to be able to do it. Even sending a hashtag to the webpage so I can act from it would be sufficient.