Commit abb2c6bc by Sarina Canelake

Merge pull request #5146 from lduarte1991/lduarte-harvardx-pr23

Text Annotation Tool: Reply/Grouping Bug Fix
parents 698c9b59 5dc9e79d
......@@ -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');
});
}
}
});
},
......@@ -1199,11 +1201,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];
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment