code: function displayAllAnnos(treeItems) {
      var items = [], selector, newHTML, i;
      // two passes; first assign offsets and add to array with the same selector
      for (i in treeItems.map) {
        var anno = treeItems.map[i];
        console.log(anno);
        if (anno.selector === 'body') {
          anno.selector = '#SBEnclosure';
        }
        if (anno.instance && (!selector || selector === anno.selector)) {
          if (!newHTML) {
            selector = anno.selector;
            newHTML = $(selector, doc).html();
          }
          anno.offset = findInstanceOffset(anno, newHTML);
          items.push(anno);
        }
      }
      console.log(items.length, 'eligible in', selector, 'out of', i);
      // second pass, sort and display annotations, later first.
      var latest = 1, item;
      while (latest > -1) {
        latest = -1;
        for (i = 0; i < items.length; i++) {
          item = items[i];
          if (item && item.offset > latest) {
            latest = i;
          }
        }
  
        if (latest > -1) {
          newHTML = insertAnno(items[latest], newHTML);
          delete items[latest];
        }
      }
      try {
        $(selector, doc).html(newHTML);
      } catch (e) {
        console.log('failed for', selector, newHTML.length);
        console.log(e);
      }
    }
docs: prepare and display eligible annotations