# HG changeset patch # User hamidouk # Date 1324288414 -3600 # Node ID 1e51d638e7ea2c6a91637b84db1e88e834ee00b7 # Parent 3957157b7f96b702178143081a867a86989894c9 fixes in a rush. diff -r 3957157b7f96 -r 1e51d638e7ea src/css/LdtPlayer.css --- a/src/css/LdtPlayer.css Mon Dec 19 08:59:45 2011 +0100 +++ b/src/css/LdtPlayer.css Mon Dec 19 10:53:34 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; diff -r 3957157b7f96 -r 1e51d638e7ea src/js/pop.js --- a/src/js/pop.js Mon Dec 19 08:59:45 2011 +0100 +++ b/src/js/pop.js Mon Dec 19 10:53:34 2011 +0100 @@ -160,8 +160,6 @@ }; IriSP.PopcornReplacement.__seekHandler = function(event) { - console.log(IriSP.PopcornReplacement.__codes.length); - var i = 0; for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) { diff -r 3957157b7f96 -r 1e51d638e7ea src/js/widgets/polemicWidget.js --- a/src/js/widgets/polemicWidget.js Mon Dec 19 08:59:45 2011 +0100 +++ b/src/js/widgets/polemicWidget.js Mon Dec 19 10:53:34 2011 +0100 @@ -287,6 +287,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); @@ -297,6 +298,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); diff -r 3957157b7f96 -r 1e51d638e7ea src/js/widgets/segmentsWidget.js --- a/src/js/widgets/segmentsWidget.js Mon Dec 19 08:59:45 2011 +0100 +++ b/src/js/widgets/segmentsWidget.js Mon Dec 19 10:53:34 2011 +0100 @@ -58,7 +58,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 diff -r 3957157b7f96 -r 1e51d638e7ea src/js/widgets/tooltipWidget.js --- a/src/js/widgets/tooltipWidget.js Mon Dec 19 08:59:45 2011 +0100 +++ b/src/js/widgets/tooltipWidget.js Mon Dec 19 10:53:34 2011 +0100 @@ -2,6 +2,8 @@ IriSP.TooltipWidget = function(Popcorn, config, Serializer) { IriSP.Widget.call(this, Popcorn, config, Serializer); this._shown = false; + this._displayedText = ""; + this._hideTimeout = -1; }; @@ -20,19 +22,29 @@ }; 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; };