[annotator-dev] linking to annotations within annotated document

Shauna Gordon-McKeon shaunagm at gmail.com
Wed Feb 25 23:15:14 UTC 2015

Thanks for the quick reply.

> First question is whether you've built your own annotator from the source
> or if you've used a pre-packaged version. Since we haven't yet had a 2.0
> release the code you linked to has not been published as a built
> annotator.js yet. If you've built it yourself from git, that's great and
> I'm really glad to see people kicking the tires on master. If you're
> working from a 1.2 series release, then the code is a bit different.

I've been using the pre-packaged version.  It seems like there's no way to
do what I want with the existing code, so it probably makes sense for me to
try building from git.

>> Do folks have any suggestions?  I'm new to JQuery and pretty
>> inexperienced with Javascript generally, so my apologies if these are
>> questions with obvious answers.
> I've stayed away from assigning ids to highlights because there is
> sometimes more than one highlight span associated with an annotation. This
> happens frequently when annotations overlap and the text needs to be split
> into several spans. Technically, there should only be one element with a
> given id on any page. Browsers are pretty tolerant, but I've nonetheless
> avoided adding ids for this reason.
> However, it might be very reasonable to add another attribute. For
> instance, maybe using jQuery to select for a different attribute would make
> this work for you.
> $('[annotation-id^=12345]')
> or something like this.

Are you suggesting that a new attribute, annotation-id, be added to span?
I think that's what you're saying, but I want to make sure we're on the
same page.  If attribute-id got duplicated due to dicing and splitting of
spans, that would be fine for my purposes -- I could easily use the first
and ignore any subsequent ones.

> Unfortunately, that would not get the scroll-to behavior that having an id
> / anchor gets, where the URL can simply be set to #someid. However, since
> Annotator loads after the page is rendered this would not allow linking
> users directly to an annotation using the built-in browser support for
> anchors anyway. That may not be a concern, though.

That would be the simplest way to do it, but it seems like one could link
directly by using JQuery again, something like scrollIntoView?

> Hopefully, that helps explain the problem space a bit and gives you a
> sense of where to look next. If there's anything we can add to the
> highlighter to make this easier, I'd be glad to help with those
> modifications.

It does help, thank you.  If an annotation-id was added to the highlighted
spans, then I think I could create the functionality I need via a plugin.
Without it, I'm not sure where I'd begin.

How would you like to proceed?  It seems like until 2.0 is released I'm
going to have to build from git to get this functionality, so I might as
well go ahead and do that.  I can take a stab at modifying the highlighter
once I've done that, although I'm also perfectly happy to have you add it
in - I bet you'd be much faster.  :)

- Shauna

> Randall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20150225/29af5796/attachment-0004.html>

More information about the annotator-dev mailing list