[annotator-dev] color-coding annotated text by tagtype

Missy a3gndu at yahoo.com
Sun Feb 16 07:54:31 UTC 2014


Hi Randall,
Just closing this out per our offline conversation excerpted below.

Indeed, the annotationsLoaded event works (and can be subscribed to just like the events that are documented on the link below - it may be very helpful to add this to the documentation, along with any other important annotator functions). 
I assume there is a way to modify the number of annotations loaded at one time?

Thanks so much for all your help!
regards

------

On Saturday, February 15, 2014 2:11 PM, Randall Leeds <tilgovi at hypothes.is> wrote:
 
'annotationsLoaded' appears to be not documented there, but should work on a recent copy of Annotator.

It won't be guaranteed that *all* annotations are loaded at that time, since they may be loaded in batches.

The argument for that event is an array of the annotations which have been loaded.

You can access the highlights directly from those via `annotation.highlights`, which is a jQuery object encompassing all the highlight spans for that annotation.




On Sat, Feb 15, 2014 at 1:49 PM, Missy <a3gndu at yahoo.com> wrote:

Thanks. The filter is the easy part - I can write it manually if I can grab the annotations/tags etc, or I can use the shortcut you suggested based on classname.
>
>
>The harder part is figuring out how/where to grab the annotations. 
>I can do this one annotation at a time using events listed on http://docs.annotatorjs.org/en/latest/hacking/plugin-development.html#annotator-events
>Is there an equivalent event that notifies the loading of ALL annotations?
>
> 
> 
On Friday, February 14, 2014 3:56 PM, Randall Leeds <tilgovi at hypothes.is> wrote:
  
Does `$('.annotator-hl').each(function () { this.data('annotation').tags })` give you what you need?

In that function block you could set an additional class on the annotation based on the tags and color via CSS.




On Tue, Feb 11, 2014 at 2:31 PM, Missy <a3gndu at yahoo.com> wrote:

Hi,
>I am a newbie to HTML/CSS/JS - looking for the fastest way to modify the annotator to: color code the annotated text (not the annotations) by tag type. Eventually, I would also like to present a preset menu of tags and associated colors to the user. 
>If I could get a hold of all annotations and their tags, I can simply write a function that changes the color of each annotation based on its tag. This sort of works (if I don't refresh the webpage) but the class "annotator-hl" may conflict with my newly defined color classes "annotator-hl-color_j."
>
>Related questions: 
>(1) Using precompiled files in annotator-full-1.2.7, how can I grab all the annotations on a page when the page reloads? (note that i can grab individual annotations using annotator events - instead I am looking to grab all annotations). How do I create the path to where my annotations are stored on http://annotateit.org/ ?
>(2) How do I compile the annotator-master makefile using Webstorm 7.0 (or other compilers)? What is the best way to convert coffee files to javascript.
>thanks much!
>_______________________________________________
>annotator-dev mailing list
>annotator-dev at lists.okfn.org
>https://lists.okfn.org/mailman/listinfo/annotator-dev
>Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140215/0783c236/attachment-0004.html>


More information about the annotator-dev mailing list