{"id":3004,"date":"2013-09-17T14:59:59","date_gmt":"2013-09-17T20:59:59","guid":{"rendered":"http:\/\/bililite.com\/blog\/?p=3004"},"modified":"2013-09-17T14:59:59","modified_gmt":"2013-09-17T20:59:59","slug":"new-version-of-keymap-hotkeys","status":"publish","type":"post","link":"https:\/\/bililite.com\/blog\/2013\/09\/17\/new-version-of-keymap-hotkeys\/","title":{"rendered":"New Version of <code>keymap<\/code> Hotkeys"},"content":{"rendered":"<p>I never really liked how my <a href=\"http:\/\/bililite.com\/blog\/2013\/03\/20\/hotkeys-with-keymap\/\" title=\"hotkeys with keymap\">hotkeys plugin<\/a> (that allows things like <code class=\"language-javascript\" >$('body').on('keydown', {keys: '^A'}, function() {alert ('Control-A!'); })<\/code>) worked internally, and it didn't allow multiple handlers on a single element for a given key combination, and required initialization. I went back and looked at it some more, and studied John Resig's <a href=\"https:\/\/github.com\/jeresig\/jquery.hotkeys\">hotkeys<\/a>, and came up with a simpler, better version. Use is largely the same, but there's no <code class=\"language-javascript\" >$.keymap.hotkeys('keydown')<\/code> to initialize, and you have to explicitly remove handlers with <code class=\"language-javascript\" >$().off()<\/code> rather than replacing with a new handler.<\/p>\r\n<p>See the <a href=\"https:\/\/github.com\/dwachss\/bililiteRange\/blob\/master\/jquery.keymap.js\">code<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"I never really liked how my hotkeys plugin (that allows things like $('body').on('keydown', {keys: '^A'}, function() {alert ('Control-A!'); })) worked internally, and it didn't allow multiple handlers on a single element for a given key combination, and required initialization. I went back and looked at it some more, and studied John Resig's hotkeys, and came [&hellip;]","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/3004"}],"collection":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/comments?post=3004"}],"version-history":[{"count":4,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/3004\/revisions"}],"predecessor-version":[{"id":3008,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/3004\/revisions\/3008"}],"wp:attachment":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/media?parent=3004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/categories?post=3004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/tags?post=3004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}