Train Times Bookmarklets

A bookmarklet to easily access UK train times

Train Times Bookmarklet

For some explanation of how this bookmarklet came about please read this blog post (you can comment there too). For an explanation of what a bookmarklet actually is see the bookmarklet page. This whole thing got moved here when I wrote "version 2" of the train times bookmarklet.

Originally traintimes.org.uk's hackable URLs only dealt with trains for the current day. As Matthew comments there is now support for times in the future and return journeys. Furture, return! Oh well, what else have I got to do. Things I learnt: Javascript probably isn't my natural programming language—it's enough like C to confuse me is half the trouble—and parsing "nautral language" input like this is hard. I got the basics working and then kept adding bits again. Due to this and my laziness (and the fact I was learning as I went) the code is still hackish ;-)

The Bookmarklet

There are now two versions of the bookmarklet. The load page version simply loads the traintimes.org.uk page as you'd expect (by the way, alt+enter to open in a new tab does work). The times in a frame version I was inspired to write because quite often you may want to know the train times to some event your reading about on a web page…so it inserts a partially transparent iframe on top of the current page, fixed at the bottom (third of the available height) and loads the page in that (it has a close button and a link to the full page too, so it's now the version I use). To use either of these monsters you need to drag the appropriate link to your bookmark toolbar (or right click, Bookmark This Link…). You have to give it a keyword, which is sort of the whole point (look under the bookmark's properties) train is suggested (though I used tootoo ;-) ) Having set the keyword test it by entering a simple example in the location bar (eg train from newcastle to york) and hitting enter. You should get taken to http://www.traintimes.org.uk/newcastle/york/

Syntax and Notes

The syntax has been updated to support things other than today and return journeys. Old examples still work of course, the default is for the next available train today

In the syntax examples replace train with your chosen keyword, [start] with the starting station and [destination] with the destination station.

Remember this was just a proof of concept exercise I did for my own amusement! Thanks to Matthew for making the accessible timetables which make it possible (and those maps!), and I just wish National Railway, The Trainline and the train companies would get their acts together so buying a ticket online were as painless as it ought to be

More examples: