added a function to clear the widget. popcorn-port
authorhamidouk
Mon, 24 Oct 2011 12:42:45 +0200
branchpopcorn-port
changeset 125 960ce0b9f9f0
parent 124 2758dfb208b2
child 126 e007a7ad66b8
added a function to clear the widget.
src/js/widgets/annotationsWidget.js
--- a/src/js/widgets/annotationsWidget.js	Mon Oct 24 12:42:15 2011 +0200
+++ b/src/js/widgets/annotationsWidget.js	Mon Oct 24 12:42:45 2011 +0200
@@ -29,6 +29,13 @@
 
 };
 
+IriSP.AnnotationsWidget.prototype.clearWidget = function() {
+    /* retract the pane between two annotations */
+    IriSP.jQuery("#Ldt-SaTitle").text("");
+    IriSP.jQuery("#Ldt-SaDescription").text("");
+    IriSP.jQuery("#Ldt-SaKeywordText").html("");
+    IriSP.jQuery('#Ldt-ShowAnnotation').slideUp();
+}
 IriSP.AnnotationsWidget.prototype.draw = function() {
   var _this = this;
 
@@ -41,8 +48,12 @@
     var begin = Math.round((+ annotation.begin) / 1000);
     var end = Math.round((+ annotation.end) / 1000);
 
-    this._Popcorn = this._Popcorn.code({start: begin, end: end, 
-                                        onStart: 
-                                          function(annotation) { return function() { _this.displayAnnotation(annotation); } }(annotation) });                                             
+    var conf = {start: begin, end: end, 
+                onStart: 
+                       function(annotation) { return function() { _this.displayAnnotation(annotation); } }(annotation),
+                onEnd: 
+                       function() { _this.clearWidget(); },
+                };
+    this._Popcorn = this._Popcorn.code(conf);                                             
   }
 };