Create keyboard shortcuts for plugin
dalmaer opened this issue · comments
Enable keyboard shortcuts for actions (e.g. Apple-S to shorten).
one simple example:
$("p").bind("myCustomEvent", function(e, myName, myValue){
$(this).text(myName + ", hi there!");
$("span").stop().css("opacity", 1)
.text("myName = " + myName)
.fadeIn(30).fadeOut(1000);
});
$("button").click(function () {
$("p").trigger("myCustomEvent", [ "John" ]);
});
Thinking of using jquery.hotkeys to handle keyboard mapping. Sound right to you? Doesn't seem to support Apple+key combos, just Ctrl+ or Alt/Option+, etc. See https://github.com/jeresig/jquery.hotkeys and let me know what you think
Added support for shrink tweet (Ctrl/Meta+s). Need to add others; be nice to alias CMD, and perhaps there's a better way to encapsulate all this so not so much code. Using the jquery.trigger event mechanism which isn't too bad.