Fixing your trac with greasemonkey
Posted by Jorge Bernal June 15, 2007
One of the basic advantages of using open source software is having the ability to change its behaviour to suit your needs. That’s awesome, but what happens when it’s a web application like trac? Sure you could change it, but if it’s your company trac you might be the only one wanting fo change a specific behaviour.

One of the things that most annoys me is having to use the mouse to create a ticket. If I fill the fields using only the keyboard (the day I learned to use the Tab key to switch between fields was a major breakthrough in my digital life) and hit Enter to submit the ticket, trac does a preview instead of creating it. I’m not sure if you can override this behaviour using some special attribute, but the button used with Enter is the first one to appear in the HTML. So I had to turn it into this:

I’ve used Greasemonkey for this. Greasemonkey is a Firefox extension which lets you write JavaScript code to modify the pages you visit, so I did a quite simple user script to switch the buttons order in any trac ticket page.
If you find this interesting, download the script:
[switchtracpreview.user.js]

First, you can do it like this, or you can leave the buttons where they are and set the tabindex to your liking: http://www.w3.org/TR/html401/interact/forms.html#adef-tabindex
Second, for a much nicer fonts, you might want to add
deb http://www.telemail.fi/mlind/ubuntu feisty fonts
to your repos (details at Ubuntu Forums, IIRC).
What’s wrong with the fonts?
Nothing’s really wrong, but they can look like these: http://shot.pl/ticket.png