hypothesis/h — pull request #924 by csillag (2013-11-15 18:01:46+00:00)
Title: Introducing typed anchor support

* Updated Annotator to de4c0dfc (maintenance branch), which has
typed anchors support merged.
See https://github.com/hypothesis/annotator/pull/18 for explanation.

See also this diagram about how the components work together: http://hypothes.is/wp-content/uploads/2013/11/components.png

This diagram is annotated; [open the image](http://hypothes.is/wp-content/uploads/2013/11/components.png) in a new frame, and launch the bookmarklet from [image3.dokku](http://image3.dokku.hypothes.is/) (or any later dokku instance which has image support).

The H specific parts:

* Following Annotator API and packaging changes
* The heatmap got a lot trickier. Since it can no longer make any assumption about
the actual implementation of the highlights and anchors, now it does not rely on
any data inside them. That includes the start and stop character offsets, too,
which was previously used to find the nearest anchor for the up/down arrows on.
We can't assume that all anchors have that data.
Unfortunately, the Y coordinates are not always available either, because
the required part of the DOM might not be rendered yet.
So the only data we always have (at this point) is the page number.
(All anchors have page numbers). In the first phase, if the pages in question are
not rendered yet, we collect all the anchors from the nearest page.
Then we go there, to assure that it's rendered.
When all the anchors have been realized, we select the nearest one,
and actually scroll to it. This way, we can make it work with
all kinds of anchors/highlights.