Optimise focusNearest for pages with 500+ links.

Was seeing stuttering scroll on the files index page with a slower
machine. Seems the link offset look-ups were a bottle-neck, so I've
added an offset cache. Which will of course need updating if any
ajax stuff is added affecting the number of links or their position.