web/LdtPlayer-release.js
changeset 22 11011b712cf2
parent 17 283abdcf7134
child 23 44945db9746a
equal deleted inserted replaced
21:ec676b63b663 22:11011b712cf2
  8825   var i = 0;
  8825   var i = 0;
  8826   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
  8826   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
  8827      var c = IriSP.PopcornReplacement.__codes[i];
  8827      var c = IriSP.PopcornReplacement.__codes[i];
  8828      
  8828      
  8829      if (pos >= c.start && pos < c.end && 
  8829      if (pos >= c.start && pos < c.end && 
  8830          pos - 0.1 <= c.start) {
  8830          pos - 0.1 <= c.start) {       
  8831         c.onStart();
  8831         c.onStart();
  8832      }
  8832      }
  8833  
  8833  
  8834      if (pos >= c.start && pos >= c.end && 
  8834      if (pos > c.start && pos > c.end && 
  8835          pos - 0.1 <= c.end) {
  8835          pos - 0.1 <= c.end) {
       
  8836          console.log("eonedn");
  8836         c.onEnd();
  8837         c.onEnd();
  8837      }
  8838      }
  8838    
  8839    
  8839   }
  8840   }
  8840  
  8841  
  8841   IriSP.PopcornReplacement.trigger("timeupdate");
  8842   IriSP.PopcornReplacement.trigger("timeupdate");
  8842 };
  8843 };
  8843 
  8844 
  8844 IriSP.PopcornReplacement.__seekHandler = function(event) { 
  8845 IriSP.PopcornReplacement.__seekHandler = function(event) {
  8845   var i = 0;
  8846   var i = 0;
       
  8847   
  8846   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
  8848   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
  8847      var c = IriSP.PopcornReplacement.__codes[i];
  8849      var c = IriSP.PopcornReplacement.__codes[i];
  8848     
  8850     
  8849      if (event.position >= c.start && event.position < c.end) {
  8851      if (event.position >= c.start && event.position < c.end) {        
  8850         c.onEnd();
  8852         c.onEnd();
  8851      }
  8853      }         
  8852     
  8854    }
       
  8855 
       
  8856    for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
       
  8857      var c = IriSP.PopcornReplacement.__codes[i];
       
  8858 
  8853      if (typeof(event.offset) === "undefined")
  8859      if (typeof(event.offset) === "undefined")
  8854        event.offset = 0;
  8860        event.offset = 0;
  8855      if (event.offset >= c.start && event.offset < c.end) {
  8861            
       
  8862      if (event.offset >= c.start && event.offset < c.end) { 
  8856        c.onStart();
  8863        c.onStart();
  8857      }
  8864      }
  8858      
  8865      
  8859    }
  8866    }
  8860 
  8867 
 10300                   e.title = frames[i].mytweetsID[k].title;
 10307                   e.title = frames[i].mytweetsID[k].title;
 10301                   e.id = frames[i].mytweetsID[k].cinecast_id;
 10308                   e.id = frames[i].mytweetsID[k].cinecast_id;
 10302 
 10309 
 10303                   this.svgElements[e.id] = e;
 10310                   this.svgElements[e.id] = e;
 10304 
 10311 
       
 10312                   /*
 10305                   e.mouseover(function(element) { return function (event) {
 10313                   e.mouseover(function(element) { return function (event) {
 10306                         // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.                        
 10314                         // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.                        
 10307                         self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.clientX - 106, event.clientY - 160);
 10315                         self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.clientX - 106, event.clientY - 160);
 10308                         element.displayed = true;
 10316                         element.displayed = true;
 10309                   }}(e)).mouseout(function(element) { return function () {                          
 10317                   }}(e)).mouseout(function(element) { return function () {                          
 10310                           self.TooltipWidget.hide.call(self.TooltipWidget);
 10318                           self.TooltipWidget.hide.call(self.TooltipWidget);
 10311                   }}(e)).mousedown(function () {
 10319                   }}(e)).mousedown(function () {
 10312                     self._Popcorn.currentTime(this.time/1000);
 10320                     self._Popcorn.currentTime(this.time/1000);
 10313                     self._Popcorn.trigger("IriSP.PolemicTweet.click", this.id); 
 10321                     self._Popcorn.trigger("IriSP.PolemicTweet.click", this.id); 
 10314                   });
 10322                   });
       
 10323                   */
       
 10324                   
       
 10325                   IriSP.jQuery(e.node).mouseenter(function(element) { return function (event) {
       
 10326                         // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.                        
       
 10327                         self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.clientX - 106, event.clientY - 160);
       
 10328                         element.displayed = true;
       
 10329                   }}(e)).mouseleave(function(element) { return function () {                          
       
 10330                           self.TooltipWidget.hide.call(self.TooltipWidget);
       
 10331                   }}(e)).mousedown(function () {
       
 10332                     self._Popcorn.currentTime(this.time/1000);
       
 10333                     self._Popcorn.trigger("IriSP.PolemicTweet.click", this.id); 
       
 10334                   });                  
 10315                   
 10335                   
 10316                   IriSP.jQuery(e.node).attr('id', 't' + k + '');
 10336                   IriSP.jQuery(e.node).attr('id', 't' + k + '');
 10317                   IriSP.jQuery(e.node).attr('title', frames[i].mytweetsID[k].title);
 10337                   IriSP.jQuery(e.node).attr('title', frames[i].mytweetsID[k].title);
 10318                   IriSP.jQuery(e.node).attr('begin',  frames[i].mytweetsID[k].timeframe);                  
 10338                   IriSP.jQuery(e.node).attr('begin',  frames[i].mytweetsID[k].timeframe);                  
 10319                 }
 10339                 }
 10475 
 10495 
 10476     var begin = Math.round((+ annotation.begin) / 1000);
 10496     var begin = Math.round((+ annotation.begin) / 1000);
 10477     var end = Math.round((+ annotation.end) / 1000);
 10497     var end = Math.round((+ annotation.end) / 1000);
 10478     var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
 10498     var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
 10479     var id = annotation.id;
 10499     var id = annotation.id;
 10480     var startPourcent 	= IriSP.timeToPourcent(begin, duration);
 10500     var startPourcent 	= IriSP.timeToPourcent(begin, duration) + onePxPercent;
 10481     
 10501     
 10482     /* some sort of collapsing occurs, so we only have to substract one pixel to each box instead of
 10502     /* some sort of collapsing occurs, so we only have to substract one pixel to each box instead of
 10483        two
 10503        two
 10484     */
 10504     */
 10485     var endPourcent 	= IriSP.timeToPourcent(end, duration) - startPourcent - onePxPercent * 1.5;
 10505     var endPourcent 	= IriSP.timeToPourcent(end, duration) - startPourcent - onePxPercent * 1.5;
 10708  
 10728  
 10709   this.sliderMaximized = true;
 10729   this.sliderMaximized = true;
 10710 
 10730 
 10711   this.sliderBackground.animate({"height": "9px"}, 100);
 10731   this.sliderBackground.animate({"height": "9px"}, 100);
 10712   this.sliderForeground.animate({"height": "9px"}, 100);
 10732   this.sliderForeground.animate({"height": "9px"}, 100);
 10713   this.positionMarker.animate({"height": "9px", "width": "9px", "margin-top": "-4px"}, 100);
 10733   this.positionMarker.animate({"height": "9px", "width": "9px"}, 100);
       
 10734   this.positionMarker.css("margin-top", "-4px");
 10714   
 10735   
 10715 //  this.selector.removeClass("Ldt-SliderMinimized");
 10736 //  this.selector.removeClass("Ldt-SliderMinimized");
 10716 //  this.selector.addClass("Ldt-SliderMaximized");
 10737 //  this.selector.addClass("Ldt-SliderMaximized");
 10717 };
 10738 };
 10718 
 10739 
 10724 };
 10745 };
 10725 
 10746 
 10726 IriSP.SliderWidget.prototype.minimizeOnTimeout = function(event) {
 10747 IriSP.SliderWidget.prototype.minimizeOnTimeout = function(event) {
 10727   this.sliderBackground.animate({"height": "5px"}, 100);
 10748   this.sliderBackground.animate({"height": "5px"}, 100);
 10728   this.sliderForeground.animate({"height": "5px"}, 100);
 10749   this.sliderForeground.animate({"height": "5px"}, 100);
 10729   this.positionMarker.animate({"height": "5px", "width": "5px", "margin-top": "0px"}, 100);
 10750   this.positionMarker.animate({"height": "5px", "width": "5px"}, 100);
 10730   
 10751   this.positionMarker.css("margin-top", "0px");
 10731   this.sliderMinimized = true;
 10752   this.sliderMinimized = true;
 10732   
 10753   
 10733 //  this.selector.removeClass("Ldt-SliderMaximized");
 10754 //  this.selector.removeClass("Ldt-SliderMaximized");
 10734 //  this.selector.addClass("Ldt-SliderMinimized");
 10755 //  this.selector.addClass("Ldt-SliderMinimized");
 10735 
 10756 
 10756 
 10777 
 10757 /* this widget displays a small tooltip */
 10778 /* this widget displays a small tooltip */
 10758 IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
 10779 IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
 10759   IriSP.Widget.call(this, Popcorn, config, Serializer);
 10780   IriSP.Widget.call(this, Popcorn, config, Serializer);
 10760   this._shown = false;
 10781   this._shown = false;
       
 10782   this._displayedText = "";
       
 10783   this._hideTimeout = -1;
 10761 };
 10784 };
 10762 
 10785 
 10763 
 10786 
 10764 IriSP.TooltipWidget.prototype = new IriSP.Widget();
 10787 IriSP.TooltipWidget.prototype = new IriSP.Widget();
 10765 
 10788 
 10774 IriSP.TooltipWidget.prototype.clear = function() {
 10797 IriSP.TooltipWidget.prototype.clear = function() {
 10775 	this.selector.find(".tiptext").text("");
 10798 	this.selector.find(".tiptext").text("");
 10776 };
 10799 };
 10777 
 10800 
 10778 IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
 10801 IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
 10779   if (this._shown === true || this.selector.find(".tiptext").text() == text)
 10802   if (this._shown === true || this._displayedText == text)
 10780     return;
 10803     return;
 10781 
 10804     
       
 10805   // cancel the timeout for the previously displayed element.
       
 10806   if (this._hideTimeout != -1) {
       
 10807     window.clearTimeout(this._hideTimeout);
       
 10808     this._hideTimeout = -1;
       
 10809     console.log(text === this._displayedText);
       
 10810   }
       
 10811   debugger;
       
 10812   
 10782   this.selector.find(".tipcolor").css("background-color", color);
 10813   this.selector.find(".tipcolor").css("background-color", color);
       
 10814   this._displayedText = text;
 10783 	this.selector.find(".tiptext").text(text);
 10815 	this.selector.find(".tiptext").text(text);
 10784   this.selector.find(".tip").css("left", x).css("top", y);
 10816   //this.selector.find(".tip").css("left", x).css("top", y);  
       
 10817   this.selector.find(".tip").css("left", x).css("top", "-160px");
       
 10818   this.selector.find(".tip").show();
       
 10819   this._shown = true;
       
 10820 };
       
 10821 
       
 10822 IriSP.TooltipWidget.prototype.hide = function() {  
       
 10823   this._hideTimeout = window.setTimeout(IriSP.wrap(this, function() {                                                  
       
 10824                                                   this.selector.find(".tip").hide();
       
 10825                                                   this._shown = false; }), 1000);
 10785   
 10826   
 10786   this._shown = true;
       
 10787 };
       
 10788 
       
 10789 IriSP.TooltipWidget.prototype.hide = function() {
       
 10790   this.clear();
       
 10791   this.selector.find(".tip").css("left", -10000).css("top", -100000);
       
 10792   
       
 10793   this._shown = false;
       
 10794 };
 10827 };
 10795 /* a widget that displays tweet - used in conjunction with the polemicWidget */
 10828 /* a widget that displays tweet - used in conjunction with the polemicWidget */
 10796 
 10829 
 10797 IriSP.TweetsWidget = function(Popcorn, config, Serializer) {
 10830 IriSP.TweetsWidget = function(Popcorn, config, Serializer) {
 10798   IriSP.Widget.call(this, Popcorn, config, Serializer);
 10831   IriSP.Widget.call(this, Popcorn, config, Serializer);