[annotator-dev] changing the annotator-hl class or id
nick at whiteink.com
Thu Sep 1 14:22:12 UTC 2011
On Thu, Sep 1, 2011 at 14:37, Ewald Zietsman <ewald at siyavula.com> wrote:
> I am trying to assign different colours for different 'categories' of annotations but the mechanics behind the highlighting is a bit over my head.
No problem. The slicing and dicing of the DOM that annotator does is
pretty complicated, so don't worry about it!
> in annotator.coffee I have changed the following code to check whether an annotation has a category attribute and to assign the highlighting accordingly.
The code you've provided is a bit confused, as you've guessed. The
`annotation.highlights` array actually contains a list of DOM nodes,
so I think the easiest way to do what you want is add something like
the following after line 242 of annotator.coffee:
annotation.ranges.push normed.serialize(@wrapper, '.annotator-hl')
hlElems = this.highlightRange(normed)
$.merge annotation.highlights, hlElems
Let me know how you get on with that!
More information about the annotator-dev