src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 771 0a5194b39ffb
parent 687 3583e8b447f5
child 820 7968346b9689
--- a/src/js/widgets/segmentsWidget.js	Fri Feb 03 14:19:41 2012 +0100
+++ b/src/js/widgets/segmentsWidget.js	Fri Feb 03 15:11:03 2012 +0100
@@ -53,7 +53,7 @@
   this.positionMarker = this.selector.children(":first");
   
   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater));
-  
+
   
   var i = 0;
   
@@ -148,10 +148,33 @@
       self.TooltipWidget.hide();
     });
 
+    // react to mediafragment messages.
+    this._Popcorn.listen("IriSP.Mediafragment.showAnnotation", 
+      function(id, divTitle) { 
+      return function(annotation_id) { 
+        if (annotation_id !== id)
+          return;
+        
+          var divObject = IriSP.jQuery("#" + id);
+          divObject.animate({opacity: 0.6}, 5);
+          var offset = divObject.offset();
+          var correction = divObject.outerWidth() / 2;
+
+          var offset_x = offset.left + correction - 106;
+          if (offset_x < 0)
+            offset_x = 0;
+          
+          var offset_y = offset.top;          
+
+          self.TooltipWidget.show(divTitle, color, offset_x, offset_y - 160);
+          IriSP.jQuery(document).one("mousemove", function() { divObject.animate({opacity: 0.3}, 5);
+                                                                self.TooltipWidget.hide(); });
+      }; }(id, divTitle));
+    
     IriSP.jQuery("#" + id).click(function(_this, annotation) {
                                     return function() { _this.clickHandler(annotation)};
                                  }(this, annotation));
-  }
+    }
 };
 
 /* restores the view after a search */
@@ -208,3 +231,7 @@
 
   this.positionMarker.css("left", position + "%");  
 };
+
+IriSP.SegmentsWidget.prototype.showAnnotation = function() {
+
+};