src/js/widgets/createAnnotationWidget.js
changeset 863 dc5e0ea0093c
parent 855 1be5beb4b196
child 867 43f615b4dc48
equal deleted inserted replaced
859:002a16ff171b 863:dc5e0ea0093c
   185 IriSP.createAnnotationWidget.prototype.addKeyword = function(_keyword) {
   185 IriSP.createAnnotationWidget.prototype.addKeyword = function(_keyword) {
   186     var _field = this.selector.find(".Ldt-createAnnotation-Description"),
   186     var _field = this.selector.find(".Ldt-createAnnotation-Description"),
   187         _rx = IriSP.regexpFromText(_keyword),
   187         _rx = IriSP.regexpFromText(_keyword),
   188         _contents = _field.val();
   188         _contents = _field.val();
   189     _contents = ( _rx.test(_contents)
   189     _contents = ( _rx.test(_contents)
   190         ? _contents.replace(_rx,"").replace("  "," ").trim()
   190         ? _contents.replace(_rx,"").replace("  "," ").replace(/(^\s+|\s+$)/g,'')
   191         : _contents.trim() + " " + _keyword
   191         : _contents.replace(/(^\s+|\s+$)/g,'') + " " + _keyword
   192     );
   192     );
   193     _field.val(_contents.trim()).trigger("js_mod");
   193     _field.val(_contents.replace(/(^\s+|\s+$)/g,'')).trigger("js_mod");
   194 }
   194 }
   195 
   195 
   196 /** handles clicks on the annotate button. Works only for the non-cinecast version */
   196 /** handles clicks on the annotate button. Works only for the non-cinecast version */
   197 IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() {
   197 IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() {
   198   
   198   
   493                     }
   493                     }
   494                     // everything is shared so there's no need to propagate the change
   494                     // everything is shared so there's no need to propagate the change
   495                     var _an_ids = IriSP.underscore(this._serializer._data.annotations).map(function(_a) {
   495                     var _an_ids = IriSP.underscore(this._serializer._data.annotations).map(function(_a) {
   496                         return _a.id.toLowerCase();
   496                         return _a.id.toLowerCase();
   497                     });
   497                     });
   498                     if (_an_ids.indexOf(annotation.id.toLowerCase()) == -1) {
   498                     if (IriSP._(_an_ids).indexOf(annotation.id.toLowerCase()) == -1) {
   499                         _this._serializer._data.annotations.push(annotation);
   499                         _this._serializer._data.annotations.push(annotation);
   500                     }
   500                     }
   501                     
   501                     
   502                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation);
   502                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation);
   503                     this.selector.find(".Ldt-createAnnotation-Description").val("").trigger("js_mod");
   503                     this.selector.find(".Ldt-createAnnotation-Description").val("").trigger("js_mod");