src/js/widgets/createAnnotationWidget.js
changeset 855 1be5beb4b196
parent 852 eefb64f74a3f
child 863 dc5e0ea0093c
--- a/src/js/widgets/createAnnotationWidget.js	Fri Apr 06 19:00:00 2012 +0200
+++ b/src/js/widgets/createAnnotationWidget.js	Tue Apr 10 14:17:42 2012 +0200
@@ -491,9 +491,14 @@
                     } else {
                         annotation.type = "cinecast:UserAnnotation";
                     }
-                    annotation.is_new = true;
                     // everything is shared so there's no need to propagate the change
-                    _this._serializer._data.annotations.push(annotation);
+                    var _an_ids = IriSP.underscore(this._serializer._data.annotations).map(function(_a) {
+                        return _a.id.toLowerCase();
+                    });
+                    if (_an_ids.indexOf(annotation.id.toLowerCase()) == -1) {
+                        _this._serializer._data.annotations.push(annotation);
+                    }
+                    
                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation);
                     this.selector.find(".Ldt-createAnnotation-Description").val("").trigger("js_mod");
                     callback(annotation);