setdirection / twinput

Rich twitter input
http://setdirection.com/
1 stars 0 forks source link

Create keyboard shortcuts for plugin #13

Open dalmaer opened 13 years ago

dalmaer commented 13 years ago

Enable keyboard shortcuts for actions (e.g. Apple-S to shorten).

dalmaer commented 13 years ago

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" ]); });

ewpreston commented 13 years ago

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

ewpreston commented 13 years ago

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.