[annotator-dev] changing the annotator-hl class or id

Ewald Zietsman ewald at siyavula.com
Thu Sep 1 13:37:30 UTC 2011


Hi,

I am trying to assign different colours for different 'categories' of
annotations but the mechanics behind the highlighting is a bit over my head.

in annotator.coffee I have changed the following code to check whether an
annotation has a category attribute and to assign the highlighting
accordingly.

    annotation.quote      = []
    annotation.ranges     = []
    annotation.highlights = []

    for normed in normedRanges
      annotation.quote.push      $.trim(normed.text())
      highlight = null

      console.log(annotation.category)
      # check what kind of annotation are loaded.
      if annotation.category is null
        highlight  = '.annotator-hl'
        console.log(highlight)
      else
        switch (annotation.category)
          when 'errata'         then highlight = '.annotator-hl-errata'
          when 'comment'        then highlight = '.annotator-hl-comment'
          when 'suggestion'     then highlight = '.annotator-hl-suggestion'
        console.log(highlight)

      annotation.ranges.push     normed.serialize(@wrapper[0], highlight)
      $.merge annotation.highlights, this.highlightRange(normed)


I've also added the following to annotator.css

.annotator-hl-errata {
    background: rgba(213, 112, 112, 0.3)
}

.annotator-hl-comment {
    background: rgba(142, 213, 112, 0.3)
}

.annotator-hl-suggestion {
    background: rgba(112, 146, 213, 0.3)
}


this does nothing to the way my annotations are highlighted, even if they
have categories assigned to them. I'm missing something somewhere. A nudge
in the right direction will be much appreciated.







-- 
*
Ewald Zietsman

Technical Coor**dinator*
*
*
*
*
Website: www.siyavula.com
The Open Innovation Studio, 27 Buitenkant Street, Cape Town, 8001

A Shuttleworth Foundation Seeded Project
Website: www.shuttleworthfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20110901/e8e68a14/attachment-0001.html>


More information about the annotator-dev mailing list