updated player version.
authorhamidouk
Mon, 19 Dec 2011 11:01:02 +0100
changeset 22 11011b712cf2
parent 21 ec676b63b663
child 23 44945db9746a
updated player version.
web/LdtPlayer-release.js
web/LdtPlayer.css
--- a/web/LdtPlayer-release.js	Mon Dec 19 11:00:49 2011 +0100
+++ b/web/LdtPlayer-release.js	Mon Dec 19 11:01:02 2011 +0100
@@ -8827,12 +8827,13 @@
      var c = IriSP.PopcornReplacement.__codes[i];
      
      if (pos >= c.start && pos < c.end && 
-         pos - 0.1 <= c.start) {
+         pos - 0.1 <= c.start) {       
         c.onStart();
      }
  
-     if (pos >= c.start && pos >= c.end && 
+     if (pos > c.start && pos > c.end && 
          pos - 0.1 <= c.end) {
+         console.log("eonedn");
         c.onEnd();
      }
    
@@ -8841,18 +8842,24 @@
   IriSP.PopcornReplacement.trigger("timeupdate");
 };
 
-IriSP.PopcornReplacement.__seekHandler = function(event) { 
+IriSP.PopcornReplacement.__seekHandler = function(event) {
   var i = 0;
+  
   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
      var c = IriSP.PopcornReplacement.__codes[i];
     
-     if (event.position >= c.start && event.position < c.end) {
+     if (event.position >= c.start && event.position < c.end) {        
         c.onEnd();
-     }
-    
+     }         
+   }
+
+   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
+     var c = IriSP.PopcornReplacement.__codes[i];
+
      if (typeof(event.offset) === "undefined")
        event.offset = 0;
-     if (event.offset >= c.start && event.offset < c.end) {
+           
+     if (event.offset >= c.start && event.offset < c.end) { 
        c.onStart();
      }
      
@@ -10302,6 +10309,7 @@
 
                   this.svgElements[e.id] = e;
 
+                  /*
                   e.mouseover(function(element) { return function (event) {
                         // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.                        
                         self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.clientX - 106, event.clientY - 160);
@@ -10312,6 +10320,18 @@
                     self._Popcorn.currentTime(this.time/1000);
                     self._Popcorn.trigger("IriSP.PolemicTweet.click", this.id); 
                   });
+                  */
+                  
+                  IriSP.jQuery(e.node).mouseenter(function(element) { return function (event) {
+                        // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.                        
+                        self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.clientX - 106, event.clientY - 160);
+                        element.displayed = true;
+                  }}(e)).mouseleave(function(element) { return function () {                          
+                          self.TooltipWidget.hide.call(self.TooltipWidget);
+                  }}(e)).mousedown(function () {
+                    self._Popcorn.currentTime(this.time/1000);
+                    self._Popcorn.trigger("IriSP.PolemicTweet.click", this.id); 
+                  });                  
                   
                   IriSP.jQuery(e.node).attr('id', 't' + k + '');
                   IriSP.jQuery(e.node).attr('title', frames[i].mytweetsID[k].title);
@@ -10477,7 +10497,7 @@
     var end = Math.round((+ annotation.end) / 1000);
     var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
     var id = annotation.id;
-    var startPourcent 	= IriSP.timeToPourcent(begin, duration);
+    var startPourcent 	= IriSP.timeToPourcent(begin, duration) + onePxPercent;
     
     /* some sort of collapsing occurs, so we only have to substract one pixel to each box instead of
        two
@@ -10710,7 +10730,8 @@
 
   this.sliderBackground.animate({"height": "9px"}, 100);
   this.sliderForeground.animate({"height": "9px"}, 100);
-  this.positionMarker.animate({"height": "9px", "width": "9px", "margin-top": "-4px"}, 100);
+  this.positionMarker.animate({"height": "9px", "width": "9px"}, 100);
+  this.positionMarker.css("margin-top", "-4px");
   
 //  this.selector.removeClass("Ldt-SliderMinimized");
 //  this.selector.addClass("Ldt-SliderMaximized");
@@ -10726,8 +10747,8 @@
 IriSP.SliderWidget.prototype.minimizeOnTimeout = function(event) {
   this.sliderBackground.animate({"height": "5px"}, 100);
   this.sliderForeground.animate({"height": "5px"}, 100);
-  this.positionMarker.animate({"height": "5px", "width": "5px", "margin-top": "0px"}, 100);
-  
+  this.positionMarker.animate({"height": "5px", "width": "5px"}, 100);
+  this.positionMarker.css("margin-top", "0px");
   this.sliderMinimized = true;
   
 //  this.selector.removeClass("Ldt-SliderMaximized");
@@ -10758,6 +10779,8 @@
 IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
   IriSP.Widget.call(this, Popcorn, config, Serializer);
   this._shown = false;
+  this._displayedText = "";
+  this._hideTimeout = -1;
 };
 
 
@@ -10776,21 +10799,31 @@
 };
 
 IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
-  if (this._shown === true || this.selector.find(".tiptext").text() == text)
+  if (this._shown === true || this._displayedText == text)
     return;
-
+    
+  // cancel the timeout for the previously displayed element.
+  if (this._hideTimeout != -1) {
+    window.clearTimeout(this._hideTimeout);
+    this._hideTimeout = -1;
+    console.log(text === this._displayedText);
+  }
+  debugger;
+  
   this.selector.find(".tipcolor").css("background-color", color);
+  this._displayedText = text;
 	this.selector.find(".tiptext").text(text);
-  this.selector.find(".tip").css("left", x).css("top", y);
-  
+  //this.selector.find(".tip").css("left", x).css("top", y);  
+  this.selector.find(".tip").css("left", x).css("top", "-160px");
+  this.selector.find(".tip").show();
   this._shown = true;
 };
 
-IriSP.TooltipWidget.prototype.hide = function() {
-  this.clear();
-  this.selector.find(".tip").css("left", -10000).css("top", -100000);
+IriSP.TooltipWidget.prototype.hide = function() {  
+  this._hideTimeout = window.setTimeout(IriSP.wrap(this, function() {                                                  
+                                                  this.selector.find(".tip").hide();
+                                                  this._shown = false; }), 1000);
   
-  this._shown = false;
 };
 /* a widget that displays tweet - used in conjunction with the polemicWidget */
 
--- a/web/LdtPlayer.css	Mon Dec 19 11:00:49 2011 +0100
+++ b/web/LdtPlayer.css	Mon Dec 19 11:01:02 2011 +0100
@@ -289,8 +289,10 @@
     }
 
     .tip{
-      position : fixed; /* why not absolute instead of fixed ? because the div containing the tooltip widget is not a subdiv of its parent
+    /* why not absolute instead of fixed ? because the div containing the tooltip widget is not a subdiv of its parent
                            widget */
+      /*position : fixed;  */
+      position: absolute;
       padding : 3px;
       z-index: 10000000000;
       max-width: 200px;