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