From: Charles Connell Date: Sun, 13 Apr 2014 21:05:41 +0000 (-0400) Subject: Tweak where Annotator is applied X-Git-Tag: release-20150131~144^2~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8a4bf48bc6ff433bb725abca6cbb0b70a9a31434;p=oweals%2Fkarmaworld.git Tweak where Annotator is applied --- diff --git a/karmaworld/assets/js/note-detail.js b/karmaworld/assets/js/note-detail.js index 263811a..d340b76 100644 --- a/karmaworld/assets/js/note-detail.js +++ b/karmaworld/assets/js/note-detail.js @@ -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 + " \