Use a delegated event handler to catch links in delay-loaded history

This requires jQuery 1.9's .on() method.  Older jQuery versions can
replace it with .live() after slight adjustment (and taking a minor
performance decrease).

Diff best viewed with ignored whitespace.