Greg's Annozilla Patch Page

I've been scaling up the Mozilla/Firefox Annozilla Extension for making phrase-level semantic annotations. This typically involves hundreds of annotated spans per document, preferably viewed with multi-color highlighting.

Latest Patches:

Files:
[patch121306_annozilla-chrome-content.patch] for annozilla-0.7.0.a.2.xpi
[patch121306_annozilla-services-components.patch] for annotations-0.4.0.a.1.xpi
[patch121306_xpointerlib-components.patch] for xpointerlib-0.2.5.xpi

Cryptic notes:

  • IconManager: **Look at global/page annotation for "Use-Stylesheet:" directive**
  • IconManager: update annotation-type for spans as well as icons
  • Annozilla: consolidated addAnnotations(formerly "Asynch", now always)
  • Annozilla: initAnnozilla called from overlay load listener, init tab observer
  • Annozilla: restored unload listener (else reload chrome doesn't work so well)
  • Annozilla: function def args have to be on one line or Venkman gets confused?
  • Annozilla: (untabified)
  • Annozilla: _addNext skip annotations of other pages (in case there are)
  • IconManager, Highlight: a little craziness for global/page annotations
  • IconManager: delete spans on deleteAnnotationOnSuccess, _removeHighlight
  • Highlight: Don't warn about annotations.css, TODO: Document ways to provide custom css (eg shadow or via a page annotation)
  • Highlight: Tricky endRangeIncluded patch to evaluateNode to maintain order
  • (and no, we generally don't want condition/recommendation on context menu)
  • ContextMenu: nonModalPostAnnotation TODO: still (really annoying) problems getting prefs with new scheme: defaultPostServer, creator
  • Editor delete button: CommonEditor.prototype.deeleet()
  • CommonEditor, PostObserver allow annotation arg to be type of new annotation
  • nsXPointerlib: comment out resolveXPointerToRange (normal case) dump
  • nsAnnotationService: Don't reject until after notifying observers onBeginLoad
  • nsLocalAnnotationServer: Init method overload hack to load alternate datasource files, when provided and toggle path invariant annotations mode
  • nsLocalAnnotationServer: Path invariant annotations, when secretly toggled getresources also for filename alone w/o path (allows for caches/mirrors, moving local files around)

    Upcoming AnnoTools Teaser:

  • Drag and droppable dropdown toolbar button!
  • Footnotes!
  • Tagsets!
  • Toolbar

    112006 Patches:

    Files:
    [patch112006_annotations.css]
    [patch112006_annozilla-chrome-content.patch]
    [patch112006_annozilla-chrome-locale.patch]
    [patch112006_annozilla-services.patch]
    [patch112006_xpointerlib-components.patch]
    (toolbar update, maybe to follow)

    Cryptic notes:

    (patches relative to Annozilla 0.6.7 and xpointerlib 0.2.4, or so)

  • IconManager: Highlight possible without Icons
  • ContextMenu: editSelectedAnnotation called by popup menu option, toolbar button (now we can really live without sbar or icons!)
  • IconManager: annotations not reset during page load so that other page annotations can still be edited (via editSelectedAnnotation) still going to have to remove them when not needed: on TabClose, or new load into same tab
  • Annozilla..tabSelected calls userLoadCommand on autoload, subject to sites
  • nsAnnotationsService: now checks auto load sites onBeginLoad (autoload) passed via new autoLoadSites function when updated in prefs added to nsIAnnotations.idl,.xpt
  • nsLocalAnnotationsServer refresh datasource funcall (for toolbar button) rather than automatically on every load added to nsIAnnotationsInternal.idl,.xpt
  • xpointerlib parseStringRangeFunction: startInput=1 lengthInput=1 case in case text node is just whitespace
  • include xpointerlib.0.2.4 update to create_string_range
  • Sidebar delete key
  • Annozilla..postOnCommand xptrCreateXPointer no longer plural (was typo)
  • annotations.css: default annotation background changed to yellow
  • INCLUDES 101906 Patches:

    101906 Patches: Summary

    [Jump to patches! patch101906]

    I've completed the implementation of highlighting by insertion of CSS-distinguishable spans. Doing so seems to require that xpointers be resolved individually just before highlighting, so highlighting and icons are added before adding to sidebar in all of the various and sundry load/post cases (which was pretty tedious).

    Resolving xpointers for so many annotations also raises speed issues, so I've also added an asynchronous load feature. As well as an efficiency improvement to the xpointerlib service and catching a few cases involving ignoring marked elements during xpointer creation and resolution. (And an extra creation case for element text content, eg selectNodeContents of a heading for an outline, till range-inside might be implemented.)

    And while we're at it...

    Previously inserted icons and highlights are detected on [re-]load, perhaps allowing for some future file caching feature, or at least when the sidebar is closed and re-opened.
    Highlight spans aren't removed on close (yet), only on delete
    Don't remove icons on sbarUserLoadBegin (at least)
    - don't remove icons in other cases? (you can always reload the page)
    - problem with IconManager._removeIcon: removeChild doesn't dispose?
    (Want to load annotations on sbarOnLoad? - ought to be a preference?)
    (Insert highlights without icons?
    Maybe after a context routine for listing annotations at selection.)

    Delete annotation button from updating editor dialog.

    Sidebar entry popup function to scroll the document to the given annotation.
    And sidebar entries start out closed
    - there ought to be a preference.
    Preferences for highlighting and asynchronous load.
    - still need labels for other locales.
    Additional (contextMenu) functions for adding an annotation, possibly non-modally, initialized with a given type name
    - allowing for one-click annotation with arbitrary annotation types.
    LocalServer annotations datasource refreshed before reload
    - there ought to be a preference.
    A supplemental Phoenix browser overlay (currently a separate development extension) adding a toolbar and context menu items:
    Non-modal posting of "Condition" and "Recommendation" annotations
    Load[/StopLoad] button
    - Sidebar? we don't need no stinking sidebar
    - But have IconManager keep a pointer so the button works on sbar reopen
    Outline/table of contents out of annotations for a page from HTML headers
    - A good use for the sidebar after all.
    - note: with the exception of asynchronous load _addNext, most calls
    to xptrResolveAnnotation (particularly in postAnnotationOnSuccess)
    use window._content.document, so pointers won't resolve if we go
    off looking at another document while outline annotations are posted,
    though we can always reload them
    A few unresolved bugs to note:
    - problem with IconManager._removeIcon: removeChild doesn't dispose? that means re-opening sbar, deleting annotations, eats memory
    - xpointer memory leak on resolve failure (throw) eg. if element text content (newly addressible case) is shortened in revised document

    The above are available as 4 patch files, 1 new (css) file, 1 new zip file:

    All of the above require the following three patches and new css file:

    [annozilla-chrome-content.patch]
    annozilla/src/chrome/content/annozilla->extensions/{annozilla}/chrome/content
    [annozilla-chrome-locale.patch]
    annozilla/src/locale->extensions/{annozilla}/chrome/locale
    [xpointerlib-components.patch]
    xpointerlib/src/components->extensions/{xpointer-service}/components
    [annotations.css] - css for highlighted spans
    annozilla/src/chrome/content/->extensions/{annozilla}/chrome/content

    And optionally:

    LocalServer Reload in lieu of preference:
    [annozilla-services-components.patch]
    annozilla/service/components->extensions/{annozilla-services}/components
    Toolbar with Load button, Outline, Non-modal annotation examples
    [annozilla-tools.zip]
    (as an independent extension) ->extensions/{annozilla-tools@infolab.umdnj.edu}/components
    Questions, comments, suggestions?
    Let me know! cgreg at cgreg.com
    or use the Annozilla mailing list