Links and Annotations

Volume 9, Issue 3; 05 Jan 2006; last modified 08 Oct 2010

Firefox extensions for linking and annotations. The former not used enough, the latter coming on strong.

I've been a fan of the of “site navigation” links for a long time. The various link types available allow an author to express a fair set of relationships within and between documents. The problem is that the UI that exposes these links to the reader has never been well or consistently deployed. The latest Firefox extension to do it is the cmSiteNavigation Toolbar. It works very nicely, providing a new toolbar containing menus which expose the document's links. (I had a slight preference for the previous extension, which placed the menus in the browser status bar, but I can see how it's getting a bit crowded down there.)

Now we have the classic chicken-and-egg problem. The extension would be more appealing if more sites made good use of the links and more authors would be inclined, I imagine, to make good use of the links if readers were taking advantage of them.

I plan to start introducing them into the documents I publish. I even experimented with them in the current draft of XDM but, apparently lead astray by a bug in the extension I was using previously, I misspelled the link relationship.

But no matter how many documents I put them in, there will still be a lot of legacy that doesn't contain them. But what if there was a way to add them after the fact? Greasemonkey to the rescue!

The linkbookmarks.user.js script scans the document for section titles marked with anchors and adds them as “bookmark” links (assuming the document has no links of type bookmark already).

Unfortunately, adding nodes to a document is painfully slow so the script never tries to add more than 50 links. Given that a document like F&O has more than 400 sections, it'd be a tad more useful if it could do more than 50. Is there a Greasemonkey technique for asynchrony or some faster way to update a document?

Another extension that I hope will soon be among my favorites is Annozilla. Annozilla is an annotation extension for Firefox.

I have been wanting an annotation tool for my web browser for a long time. I review lots and lots of documents. I desperately want a convenient mechanism for associating editorial comments with sections of a document. Annozilla's a bit rough around the edges right now, but it shows real promise.


If modifying the document is the slowest part, you could try adding all the links to a temporary document fragment, then adding that to the document.

—Posted by Carey Evans on 05 Jan 2006 @ 06:52 UTC #

Good idea, Carey! Alas, while it might be marginally faster, it's definitely still way too slow. It appears that the implementation of appendChild() with a document fragment is to iterate over the nodes in the fragment, adding each one :-(

—Posted by Norman Walsh on 05 Jan 2006 @ 10:22 UTC #

According to PPK's benchmarks, innerHTML is thrice as fast as the DOM in Mozilla. Maybe you could try that to add the links. (You may have heard it didn't work in XHTML pages, but that's been fixed in Firefox 1.5.)

As for asynchrony, there's always window.setTimeout() . Though it's unlikely an extension would notice links added to the page after it's done loading, unless the author specifically expected such a thing to happen.

(P.S. Along with the article itself, could you also show the previous comments as well in the comment editing page? Oh, and the cmSiteNavigation link and the images are broken here, though they're OK in the original article, and most other URLs are fine here as well... That's strange.)

—Posted by Rahul on 06 Jan 2006 @ 04:17 UTC #

Thanks, Rahul, I'll take a look when I can.

Regarding your P.S.: No. The way the essay that you're commenting on is displayed on the comments page is a complete hack. I don't think there's a practical way for me to improve it. Well, I'm sure it could be done, but not easily. It's a long way down on my list of things to do :-(

—Posted by Norman Walsh on 06 Jan 2006 @ 04:55 UTC #

FYI: using innerHTML didn't help.

—Posted by Norman Walsh on 09 Jan 2006 @ 06:29 UTC #