Scrolls when using the browser’s back/forward button

The reason this was not included since the beginning is that when used on my website it worked without reimplementing it in InstantClick. No idea why.
Remove pId (only one http request at a time)

Previously, if we clicked on a link and it was still loading, hovering over another link would preload this latter link in parallel.

This added huge (HUGE) complexity to the InstantClick’s equation, now in the rare case that a link is stuck, if we click on another one (or the same) it just redirects the user with location.href. Big win in simplicity, and a win in usability in the case that the page is stuck: clicking on another link gives back the browser’s loading indicator.
Bugfix: Scroll wasn’t remembered on popstate

Previously, if you went back then forward in history, the scroll would be at the top of the document instead of where you were.

Also, hovering over a link when this link is already in pHistory doesn’t override the scroll position anymore.
[Minor] Use currentLocationWithoutHash where appropriate
[Minor] xhr.open: remove optional async param
[Minor] !!arg_useBlacklist
[Minor] `triggerEvent` becomes `triggerPageEvent`
[Minor] Improve minified size + add semicolon at the end

Passing `document` and `location` as parameters to `InstantClick` shaves 6 bytes off the minified & gzipped file size. Yay!
Shaves 151 bytes off the minified non-gzipped size.
Simplify scroll handling on display

Gets rid of handling <a name="hash"></a> (HTML4)
[Minor] Comment about lack of href attribute
Remove displayed state

This “state” thing is confusing enough without an useless fourth state.

Also in this commit:
- Conditions in preload ordered in states’ chronological order
- Use currentLocationWithoutHash to check if InstantClick hasn’t been initialized already (so that we gain in minified file size)
Get rid of “states”

Those were confusing.
[Minor] move !p.hasBody condition, + remove mouseout’s target
Get/set body’s outerHTML instead on innerHTML

So that body’s attributes are applied when you change page.
Bugfix (regression): No redirect if displaying a bit later

Because of the first condition in `display` (introduced in df56c1908222809a0587699610b931ac3d69136c) the page would redirect (location.href = url).
[Minor] Reorder functions’ place in source code by their “categories”
Add option to set a delay before preloading kicks in.

To use: InstantClick.init(<delay in ms>)
Or, with blacklist mode: InstantClick.init(true, <delay in ms>)
(The order of InstantClick.init’s arguments doesn’t matter)
Prevent preloading 100 ms after page display

Prevents fetching the link your mouse’s cursor is over after a new page is displayed. The most common case for this is when you’ve clicked on an item that have the same position on the previous and current page.

Thanks to quchen on Reddit for the idea.

This commit also changes p.timing and p.timingStart:
- p.timingStart is now p.timing.start
- p.timing is now p.timing.ready
- p.timing.display is when a page is displayed

Also in this commit: detect in `readystatechange()` if a request is aborted.
Add preload on mousedown support
Don’t preload links with a `download` attribute