43 } else { |
43 } else { |
44 var newVal = contents + keyword; |
44 var newVal = contents + keyword; |
45 } |
45 } |
46 |
46 |
47 _this.selector.find(".Ldt-createAnnotation-Description").val(newVal); |
47 _this.selector.find(".Ldt-createAnnotation-Description").val(newVal); |
|
48 // we use a custom event because there's no simple way to test for a js |
|
49 // change in a textfield. |
|
50 _this.selector.find(".Ldt-createAnnotation-Description").trigger("js_mod"); |
48 // also call our update function. |
51 // also call our update function. |
49 _this.handleTextChanges(); |
52 _this.handleTextChanges(); |
50 } |
53 } |
51 }(keyword)); |
54 }(keyword)); |
52 } |
55 } |
66 /* reinit the fields */ |
69 /* reinit the fields */ |
67 |
70 |
68 this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().show(); |
71 this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().show(); |
69 this.selector.find("Ldt-createAnnotation-Description").val(""); |
72 this.selector.find("Ldt-createAnnotation-Description").val(""); |
70 this.selector.find(".Ldt-createAnnotation-endScreen").hide(); |
73 this.selector.find(".Ldt-createAnnotation-endScreen").hide(); |
|
74 |
|
75 // free the arrow. |
|
76 this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow"); |
71 } else { |
77 } else { |
72 if (this.cinecast_version) { |
78 if (this.cinecast_version) { |
73 var currentTime = this._Popcorn.currentTime(); |
79 var currentTime = this._Popcorn.currentTime(); |
74 var currentAnnotation = this._serializer.currentAnnotations(currentTime)[0]; |
80 var currentAnnotation = this._serializer.currentAnnotations(currentTime)[0]; |
75 var beginTime = IriSP.msToTime(currentAnnotation.begin); |
81 var beginTime = IriSP.msToTime(currentAnnotation.begin); |
117 IriSP.createAnnotationWidget.prototype.handleButtonClick = function(event) { |
123 IriSP.createAnnotationWidget.prototype.handleButtonClick = function(event) { |
118 var textfield = this.selector.find(".Ldt-createAnnotation-Description"); |
124 var textfield = this.selector.find(".Ldt-createAnnotation-Description"); |
119 var contents = textfield.val(); |
125 var contents = textfield.val(); |
120 |
126 |
121 if (contents === "") { |
127 if (contents === "") { |
122 textfield.after(IriSP.templToHTML(IriSP.createAnnotation_errorMessage_template)); |
128 |
123 textfield.css("background-color", "#d93c71"); |
129 if (this.selector.find(".Ldt-createAnnotation-errorMessage").length === 0) { |
124 |
130 this.selector.find(".Ldt-createAnnotation-Container") |
125 // use namespaced events to be able to unbind them quickly and without unbinding |
131 .after(IriSP.templToHTML(IriSP.createAnnotation_errorMessage_template)); |
126 // the other event handlers. |
132 textfield.css("background-color", "#d93c71"); |
127 textfield.bind("propertychange.tmp keyup.tmp input.tmp paste.tmp", IriSP.wrap(this, function() { |
133 |
128 var contents = textfield.val(); |
134 // use namespaced events to be able to unbind them quickly and without unbinding |
129 console.log(contents); |
135 // the other event handlers. |
130 if (contents !== "") { |
136 textfield.bind("js_mod.tmp propertychange.tmp keyup.tmp input.tmp paste.tmp", IriSP.wrap(this, function() { |
131 this.selector.find(".Ldt-createAnnotation-errorMessage").hide(); |
137 var contents = textfield.val(); |
132 textfield.css("background-color", ""); |
138 console.log(contents); |
133 textfield.unbind(".tmp"); |
139 if (contents !== "") { |
134 } |
140 this.selector.find(".Ldt-createAnnotation-errorMessage").hide(); |
135 })); |
141 textfield.css("background-color", ""); |
|
142 textfield.unbind(".tmp"); |
|
143 } |
|
144 })); |
|
145 } |
136 } else { |
146 } else { |
137 this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide(); |
147 this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide(); |
138 this.selector.find(".Ldt-createAnnotation-endScreen").show(); |
148 |
139 this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow"); |
149 if (this.cinecast_version) { |
|
150 this.selector.find(".Ldt-createAnnotation-Title").parent().show(); |
|
151 } |
|
152 |
|
153 this.selector.find(".Ldt-createAnnotation-endScreen").show(); |
140 } |
154 } |
141 }; |
155 }; |