I've tried Zen and Pixture_reload themes, the annotation bar on the page top disappeared. But when I switch back to Bartik(or Responsive Bartik), the bar comes back.

Comments

drupalok’s picture

same here. fully functional only in BARTIK

i can add annotations in ZEN but they are not stored... which annotation bar are you talking about?

BrockBoland’s picture

It's not the theme, but the selector. annotator.js enables annotator with this line:

Drupal.Annotator = $('.node .content').annotator();

The problem is that not all themes have divs (or other elements) with the node and content classes. node seems to be pretty standard, but content is often omitted (this is true in Zen).

There might be a couple issues in play here, though. For example, @drupalok: if this selector were the culprit, you wouldn't even be able to make annotations, let alone store them. And like you, I'm not sure what bar @fishfree is referring to.

If it's just plain not doing anything, though, this jQuery selector could be the problem. Here's one thing you can try: open js/annotator.js in the annotator module directory, and change that selector to only look for .node:

Drupal.Annotator = $('.node').annotator();

Clear your caches (to account for aggregated JS, if enabled), and check if you now get the annotation pop-up when you select text. Keep in mind that leaving this selector in place might not be a great idea: annotations will be available anywhere on your site that the node class is used, whether it's on the node page, in a teaser, or inside a View (and because of the way annotations are stored, adding them from the teaser or a View will not work correctly).

In order to more permanently solve this, I wonder if it would make sense to add an option in the config form to change the selector that's used.

shenzhuxi’s picture

Component: User interface » Code
Assigned: Unassigned » shenzhuxi
Issue summary: View changes
Status: Active » Fixed

I made it configurable now and set '.node' as the default value.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.