diff --git a/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js b/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js index 8995eccbb2..14ee8cf167 100644 --- a/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js +++ b/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js @@ -1053,6 +1053,14 @@ OpenSeadragonAnnotation = function (element, options) { document.addEventListener("msfullscreenchange", function () { reloadEditor(); }, false); + + // for some reason the above doesn't work when person hits ESC to exit full screen... + $(document).keyup(function(e) { + // esc key reloads editor as well + if (e.keyCode == 27) { + reloadEditor(); + } + }); this.options = options; diff --git a/common/static/js/vendor/ova/reply-annotator.js b/common/static/js/vendor/ova/reply-annotator.js index cf3f31daa1..b75d43b597 100644 --- a/common/static/js/vendor/ova/reply-annotator.js +++ b/common/static/js/vendor/ova/reply-annotator.js @@ -64,14 +64,24 @@ Annotator.Plugin.Reply = (function(_super) { // New JSON for the database Reply.prototype.pluginSubmit = function(field, annotation) { - var replyItem = $(this.annotator.editor.element).find(".reply-item span.parent-annotation"), - parent = replyItem.html()!=''?replyItem.html():'0'; - console.log(parent); - console.log(replyItem.html()); - if (parent!='0') annotation.media = 'comment'; - annotation.parent = parent;//set 0, because it is not a reply - console.log(annotation.parent); - return annotation.parent; + // since each annotation has their own reply item, this "find" is element specific + var replyItem = $(this.annotator.editor.element).find(".reply-item span.parent-annotation"); + // checks to see if the current annotation is a reply by checking parent numbers + var parent = replyItem.html() !== '' ? replyItem.html() : '0'; + // if the parent number is not empty or zero, we know that this is a comment + if (parent !== '0') { + annotation.media = 'comment'; + } + + // apparently some browsers continue adding tags here for nonreplies + // this will check and set to 0 (nonreply) if it fails + if (parseInt(parent, 10) === NaN){ + parent = '0'; + } + + // set 0, because it is not a reply + annotation.parent = parent; + return annotation.parent; }; diff --git a/common/static/js/vendor/ova/tags-annotator.js b/common/static/js/vendor/ova/tags-annotator.js index 0597d1c6e6..8b76f8b0fc 100644 --- a/common/static/js/vendor/ova/tags-annotator.js +++ b/common/static/js/vendor/ova/tags-annotator.js @@ -293,6 +293,8 @@ $.TokenList = function (input, url_or_data, settings) { case KEY.COMMA: if(selected_dropdown_item) { add_token($(selected_dropdown_item).data("tokeninput")); + // this allows for tags to be color-coded based on instructor set-up + annotator.publish("colorEditorTags") hidden_input.change(); return false; } else{ @@ -903,6 +905,7 @@ Annotator.Plugin.HighlightTags = (function(_super) { this.colorize = __bind(this.colorize, this); this.updateField = __bind(this.updateField, this); this.externalCall = __bind(this.externalCall, this); + this.colorizeEditorTags = __bind(this.colorizeEditorTags, this); this.options = options; _ref = HighlightTags.__super__.constructor.apply(this, arguments); @@ -954,7 +957,7 @@ Annotator.Plugin.HighlightTags = (function(_super) { this.annotator.subscribe('flaggedAnnotation', this.updateViewer); this.annotator.subscribe('annotationCreated', function(){setTimeout(function(){self.colorize()}, 1000)}); this.annotator.subscribe('externalCallToHighlightTags', function(){setTimeout(function(){self.externalCall()}, 1000)}); - + this.annotator.subscribe('colorEditorTags', this.colorizeEditorTags); }; HighlightTags.prototype.getHighlightTags = function(){