Javascript Trac Bookmark

Friday, 11. 07. 2008  –  Category: all, web

Substitute https://trac.example.com for your Trac instance and drop into a Firefox bookmark, perhaps on the toolbar:
javascript:q='%s';if(q=='%'+'s')void(q=prompt('Trac%20#',''));if(q)location.href='https://trac.example.com/trac/ticket/'+escape(q);else%20location.href='https://trac.example.com/trac/report/1'
Click / select the bookmark to be prompted for a Trac issue number, which you can leave blank to just load /report/1

Extra credit for assigning a keyword (eg ‘ktx’) in the bookmark properties, allowing you to just type, eg, ‘ktx 1234’ in the Location bar to achieve the same.

This is a rework of a similar hack for a much older ticketer, PTS, which is amazingly still in use at one of my previous workplaces. You can gauge its age by the fact that it was ported to PHP3 and was pretty open to most injection attacks!

Leave a Reply