Tweak where Annotator is applied
authorCharles Connell <charles@connells.org>
Sun, 13 Apr 2014 21:05:41 +0000 (17:05 -0400)
committerCharles Connell <charles@connells.org>
Sun, 13 Apr 2014 21:05:41 +0000 (17:05 -0400)
karmaworld/assets/js/note-detail.js

index 263811aef0b79fab71db0aa8ed0a6ce0c8dc674e..d340b76cc4a2fdbe5e7350fc4099eb9bfa5d1e15 100644 (file)
@@ -236,8 +236,13 @@ $(function() {
             injectRemoteScript(setup_ajax_url, noteframe);
             injectRemoteScript(annotator_js_url, noteframe,
               function() {
-                var js = "$(function() {   $('#page-container').annotator(); \
-                  $('#page-container').annotator('addPlugin', 'Store', { \
+                var js = "$(function() { \
+                  var document_selector = $('body'); \
+                  if ($('#page-container').length > 0) { \
+                    document_selector = $('#page-container'); \
+                  } \
+                  document_selector.annotator(); \
+                  document_selector.annotator('addPlugin', 'Store', { \
                     prefix: '/ajax/annotations', \
                     loadFromSearch: { \
                     'uri': " + note_id + " \