January 29, 2011 at 9:48 PM by Dr. Drang
I’ve been meaning to add a feature to Dr. Twoot for a long time: the ability to submit a tweet via Cmd-Return in addition to clicking the Update button. Today I finally sat down and did it.
Some Twitter clients use just the Return or Enter key to submit a tweet. That would have been easy to implement, but I didn’t want it to work that way because I often use embedded line feeds in my tweets.1
How many Jewish conservatives will follow Palin in using “blood libel”?
Aside from Bill Kristol, of course.
As you can see, I’m using JQuery to bind an unnamed function to the status field. The function continually checks keypresses in that field. When it detects one in which both the Return key (
e.which == 13) and the Command key (
e.metaKey is true) were pressed, it runs the
setStatus function, which submits the tweet. This is the same function that’s run when the Update key is pressed.
Now I can tweet faster. Expect to see even more typos.