diff --git a/common/static/js/vendor/ova/catch/js/catch.js b/common/static/js/vendor/ova/catch/js/catch.js index a5da7106a8..0a3a35f432 100644 --- a/common/static/js/vendor/ova/catch/js/catch.js +++ b/common/static/js/vendor/ova/catch/js/catch.js @@ -546,9 +546,11 @@ CatchAnnotation.prototype = { // public or is equal to the person with update access, then we leave it alone, // otherwise we need to clean them up (i.e. disable them). if (self.options.userId !== '' && self.options.userId !== value.permissions.update[0]) { - $.each(value.highlights, function(key1, value1){ - $(value1).removeClass('annotator-hl'); - }); + if (value.highlights !== undefined) { + $.each(value.highlights, function(key1, value1){ + $(value1).removeClass('annotator-hl'); + }); + } } }); }, @@ -1196,11 +1198,11 @@ CatchAnnotation.prototype = { annotations.forEach(function(ann){ var child, h, _i, _len, _ref; - if (ann.highlights !== null) { + if (ann.highlights !== undefined) { _ref = ann.highlights; for (_i = 0, _len = _ref.length; _i < _len; _i++) { h = _ref[_i]; - if (!(h.parentNode !== null)) { + if (!(h.parentNode !== undefined)) { continue; } child = h.childNodes[0]; diff --git a/common/static/js/vendor/ova/grouping-annotator.js b/common/static/js/vendor/ova/grouping-annotator.js index a17fb63ffb..51ea410a1f 100644 --- a/common/static/js/vendor/ova/grouping-annotator.js +++ b/common/static/js/vendor/ova/grouping-annotator.js @@ -145,15 +145,19 @@ Annotator.Plugin.Grouping = (function(_super) { $.each(lineAnnDict, function(key, val) { if (val.length > self.groupthreshold) { val.forEach(function(anno){ - $.each(anno.highlights, function(key, anno) { - $(anno).css("background-color", "inherit"); - }); + if (anno.highlights !== undefined) { + $.each(anno.highlights, function(key, anno) { + $(anno).css("background-color", "inherit"); + }); + } }); } else { val.forEach(function(anno) { - $.each(anno.highlights, function(key, anno) { - $(anno).css("background-color", "rgba(255, 255, 10, .3)"); - }); + if (anno.highlights !== undefined) { + $.each(anno.highlights, function(key, anno) { + $(anno).css("background-color", "rgba(255, 255, 10, .3)"); + }); + } }); } }); @@ -187,14 +191,18 @@ Annotator.Plugin.Grouping = (function(_super) { $(newdiv).click(function(evt){ if($(evt.srcElement).attr("data-selected") === '0') { annotations.forEach(function(annot){ - $.each(annot.highlights, function(key, ann) { - $(ann).css("background-color", "inherit"); - }); + if (annot.highlights !== undefined) { + $.each(annot.highlights, function(key, ann) { + $(ann).css("background-color", "inherit"); + }); + } }); self.groupedAnnotations[$(evt.srcElement).css("top").replace("px", "")].forEach(function(item) { - $.each(item.highlights, function(key, ann) { - $(ann).css("background-color", "rgba(255, 255, 10, 0.3)"); - }); + if (item.highlights !== undefined) { + $.each(item.highlights, function(key, ann) { + $(ann).css("background-color", "rgba(255, 255, 10, 0.3)"); + }); + } }); $(evt.srcElement).attr("data-selected", '1'); } else { @@ -237,9 +245,11 @@ Annotator.Plugin.Grouping = (function(_super) { $(".onOffGroupButton").html("Annotation Grouping: OFF"); $(".onOffGroupButton").addClass("buttonOff"); this.annotator.plugins.Store.annotations.forEach(function(annot) { - $.each(annot.highlights, function(key, ann) { - $(ann).css("background-color", ""); - }); + if (annot.highlights !== undefined) { + $.each(annot.highlights, function(key, ann) { + $(ann).css("background-color", ""); + }); + } }); // deals with the HighlightTags Plug-In