Fixing your trac with greasemonkey

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.

Trac before

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:

Trac after

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]

3 thoughts on “Fixing your trac with greasemonkey

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s