Better history lookup performance.

Don't generate the list of matching item if we step through the items.
Generate the active list only one time and use it to step through the matching
history items.
Allow to run user scripts on every page.