Friday, April 22, 2005

Adding Shortcuts to Yahoo! Mail

I find it annoying that Yahoo! Mail doesn't provide more keyboard shortcuts, especially for tasks performed all the time, like going to the previous/next message, or replying to an email. If you are using Firefox, you can fix this right now:

  1. Install the Greasemonkey plugin (click on the link for the latest version in the box in the upper right section of the page)
  2. Restart Firefox
  3. Load my Yahoo! Mail Keyboard Short Greasemonkey script (click on this link)
  4. Go to Tools / Install User Script and click OK

That's all. The available shortcuts are always displayed at the bottom of a page when you view an email. As shown in this screenshot.

Known bug: The shortcut list at the bottom of the page appears twice. If you figure why this is, please let me know!


Anonymous said...

Hey Alessandro,

I am using this GM script, but it does not appear to work. The legend does not appear on the bottom of the page.

i am using FF 1.0.3 on WinNT SP6.

Dave A.
david_awerbuch (at)

Anonymous said...

This script breaks all the buttons except spam.

Ben said...

Nice script. As another anon said, it does seem to break the buttons - you can use the shortcuts but not actually press the buttons, which is a bit weird. Can you add shortcuts for Forward, Delete and Spam? I modified the script for Forward but I can't get Delete to work.


ben (queeg500ATyahooDOTcom)

Anonymous said...

Thanks Alessandro. Thanks bigtime. You've just significantly improved my Yahoo! Mail experience.

Anonymous said...

They should do the same thing for gmail. Gmail made shortcuts but they're messed up. n for next and "p" for previous is the way it should be. Also, there should be shortcuts to forward and reply to emails in gmail.

Morac said...

I'm seeing the help info twice at the bottom of the page for some reason. Not sure why exactly since the code seems to write it out once.

Morac said...

I couldn't figure out why the help text was displaying twice, but I suspect it had something to do with the error message I kept getting in the javascript console window:
"Greasemonkey:! Mail Keyboard Shortcuts: Exception when injecting : {}" since that error went away when I commented out the addHelp() line.

I fixed both the error and the problem of the help text showing up twice (as well as the problem with the script breaking the buttons on the Yahoo Mail page) by changing where the help text was added to. Instead of adding it to document.body.innerHTML, I added it to botText.innerHTML, where:

var botText = document.getElementsByTagName("center")

Second, the reply and reply All commands generate a javascript error stating that parent.showCompose is not a function. I got reply to work by replacing the call to doInstacomposeReply() with a call to Reply_Click(), but haven't been able to get Reply All working.

Also you might want to add checks to see if shift, ctrl or alt is pressed as I've accidently triggered the keys when pressing combinations like ctrl-shift-B.

Finally, if you want to add the ability to delete a message by pressing "d", add the following else if condition:

} else if (event.keyCode == "D".charCodeAt(0)) {

Anonymous said...

I've adapted the gist of your script into a GPL-licensed script that I've been writing for fun, but as I was writing up the project page I noticed an inconsistency while re-checking my sources.

I thought that your code was licensed under the GPL. Did I just read wrong, or did you remove the licensing recently, or...? I don't see any licensing with the script at all, but if I've screwed up, may I use the modified code in my GPL'd script?

Thanks so much for making the script available. Please let me know if it's a problem so I can fix the issue.

Alessandro Vernet said...

I did not specify a license for the Yahoo! Mail Keyboard Short. Feel free to consider this code in the public domain, and to use it in whatever way you consider appropriate. Let us know here when your code becomes available.