web/LdtPlayer-release.js
changeset 25 4f082f63e295
parent 24 36df3a25d7bd
child 26 b710fa62d522
equal deleted inserted replaced
24:36df3a25d7bd 25:4f082f63e295
  8668       });
  8668       });
  8669     }
  8669     }
  8670 };
  8670 };
  8671 
  8671 
  8672 
  8672 
  8673 IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}<div title='{{divTitle}}' id='{{id}}'	class='Ldt-iri-chapter' 	style='left: {{startPourcent}}%;          width: {{endPourcent}}%;          background-color:#{{hexa_color}};' 	></div>";
  8673 IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}<div title='{{divTitle}}' id='{{id}}'	class='Ldt-iri-chapter' 	style='left: {{startPourcent}}%;          width: {{endPixel}}px;          background-color:#{{hexa_color}};' 	></div>";
  8674 IriSP.annotationWidget_template = "{{! template for the annotation widget }}<div class='Ldt-AnnotationsWidget'>  <!-- ugly div because we want to have a double border -->  <div class='Ldt-Annotation-DoubleBorder'>      <div class='Ldt-AnnotationContent'>        <div class='Ldt-AnnotationShareIcons'>         <a class='Ldt-fbShare' href=''><img src='{{img_dir}}/facebook.png' alt='share on facebook'></img></a>         <a class='Ldt-TwShare' href=''><img src='{{img_dir}}/twitter.png' alt='share on twitter'></img></a>         <a class='Ldt-GplusShare' href=''><img src='{{img_dir}}/google.png' alt='share on google+'></img></a>      </div>		  <div class='Ldt-SaTitle'></div>	  	<div class='Ldt-SaDescription'></div>    </div>  </div></div>";
  8674 IriSP.annotationWidget_template = "{{! template for the annotation widget }}<div class='Ldt-AnnotationsWidget'>  <!-- ugly div because we want to have a double border -->  <div class='Ldt-Annotation-DoubleBorder'>      <div class='Ldt-AnnotationContent'>        <div class='Ldt-AnnotationShareIcons'>         <a class='Ldt-fbShare' href=''><img src='{{img_dir}}/facebook.png' alt='share on facebook'></img></a>         <a class='Ldt-TwShare' href=''><img src='{{img_dir}}/twitter.png' alt='share on twitter'></img></a>         <a class='Ldt-GplusShare' href=''><img src='{{img_dir}}/google.png' alt='share on google+'></img></a>      </div>		  <div class='Ldt-SaTitle'></div>	  	<div class='Ldt-SaDescription'></div>    </div>  </div></div>";
  8675 IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}<div id='Ldt-load-container'><div id='Ldt-loader'>&nbsp;</div> Chargement... </div>";
  8675 IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}<div id='Ldt-load-container'><div id='Ldt-loader'>&nbsp;</div> Chargement... </div>";
  8676 IriSP.arrowWidget_template = "<div class='Ldt-arrowWidget'></div>";
  8676 IriSP.arrowWidget_template = "<div class='Ldt-arrowWidget'></div>";
  8677 IriSP.overlay_marker_template = "{{! the template for the small white bars which is z-indexed over our segment widget }}<div class='positionMarker' style='background-color: #F7268E;'></div>";
  8677 IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}<div class='Ldt-SegmentPositionMarker' style='background-color: #F7268E;'></div>";
  8678 IriSP.player_template = "{{! template for the radio player }}<div class='Ldt-controler demo'>	<div class='Ldt-LeftPlayerControls'>    <div class='Ldt-button Ldt-CtrlPlay'></div>		<div class='Ldt-button Ldt-CtrlAnnotate'></div>    <div class='Ldt-button Ldt-CtrlSearch'></div>	</div>		<div class='Ldt-RightPlayerControls'>    <div class='Ldt-Time'>      <div class='Ldt-ElapsedTime'></div>      <div class='Ldt-TimeSeparator'>/</div>      <div class='Ldt-TotalTime'></div>    </div>		<div class='Ldt-button Ldt-CtrlSound'></div>	</div></div>";
  8678 IriSP.player_template = "{{! template for the radio player }}<div class='Ldt-controler demo'>	<div class='Ldt-LeftPlayerControls'>    <div class='Ldt-button Ldt-CtrlPlay'></div>		<div class='Ldt-button Ldt-CtrlAnnotate'></div>    <div class='Ldt-button Ldt-CtrlSearch'></div>	</div>		<div class='Ldt-RightPlayerControls'>    <div class='Ldt-Time'>      <div class='Ldt-ElapsedTime'></div>      <div class='Ldt-TimeSeparator'>/</div>      <div class='Ldt-TotalTime'></div>    </div>		<div class='Ldt-button Ldt-CtrlSound'></div>	</div></div>";
  8679 IriSP.search_template = "{{! template for the search container }}<div class='LdtSearchContainer'	style='margin-left: {{margin_left}}; position: absolute; margin-top: -60px;'>	<div class='LdtSearch'		style='display: none; background-color: #EEE; width: 165px; boder: 1px; border-color: #CFCFCF; position: absolute; text-align: center;'>		<input class='LdtSearchInput'			style='margin-top: 2px; margin-bottom: 2px;' />	</div></div><div class='cleaner'></div>";
  8679 IriSP.search_template = "{{! template for the search container }}<div class='LdtSearchContainer'	style='margin-left: {{margin_left}}; position: absolute; margin-top: -60px;'>	<div class='LdtSearch'		style='display: none; background-color: #EEE; width: 165px; boder: 1px; border-color: #CFCFCF; position: absolute; text-align: center;'>		<input class='LdtSearchInput'			style='margin-top: 2px; margin-bottom: 2px;' />	</div></div><div class='cleaner'></div>";
  8680 IriSP.share_template = "{{! social network sharing template }}<a onclick='__IriSP.MyApiPlayer.share(\'delicious\');' title='partager avec delicious'><span class='share shareDelicious'>&nbsp;</span></a>		<a onclick='__IriSP.MyApiPlayer.share(\'facebook\');' title='partager avec facebook'> <span class='share shareFacebook'>&nbsp;</span></a><a onclick='__IriSP.MyApiPlayer.share(\'twitter\');' title='partager avec twitter'>  <span class='share shareTwitter'>&nbsp;</span></a><a onclick='__IriSP.MyApiPlayer.share(\'myspace\');' title='partager avec Myspace'>  <span class='share shareMySpace'>&nbsp;</span></a>";
  8680 IriSP.share_template = "{{! social network sharing template }}<a onclick='__IriSP.MyApiPlayer.share(\'delicious\');' title='partager avec delicious'><span class='share shareDelicious'>&nbsp;</span></a>		<a onclick='__IriSP.MyApiPlayer.share(\'facebook\');' title='partager avec facebook'> <span class='share shareFacebook'>&nbsp;</span></a><a onclick='__IriSP.MyApiPlayer.share(\'twitter\');' title='partager avec twitter'>  <span class='share shareTwitter'>&nbsp;</span></a><a onclick='__IriSP.MyApiPlayer.share(\'myspace\');' title='partager avec Myspace'>  <span class='share shareMySpace'>&nbsp;</span></a>";
  8681 IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top    of the other }}<div class='Ldt-sliderBackground'></div><div class='Ldt-sliderForeground'></div><div class='Ldt-sliderPositionMarker'></div>";
  8681 IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top    of the other }}<div class='Ldt-sliderBackground'></div><div class='Ldt-sliderForeground'></div><div class='Ldt-sliderPositionMarker'></div>";
  8682 IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}<div class='Ldt-tooltip'>  <div class='title'>{{title}}</div>  <div class='time'>{{begin}} : {{end}} </div>  <div class='description'>{{description}}</div></div>";
  8682 IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}<div class='Ldt-tooltip'>  <div class='title'>{{title}}</div>  <div class='time'>{{begin}} : {{end}} </div>  <div class='description'>{{description}}</div></div>";
 10498     var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
 10498     var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
 10499     var id = annotation.id;
 10499     var id = annotation.id;
 10500     var startPourcent 	= IriSP.timeToPourcent(begin, duration);
 10500     var startPourcent 	= IriSP.timeToPourcent(begin, duration);
 10501     
 10501     
 10502     /* surprisingly, the following code doesn't work on webkit - for some reason, most of the 
 10502     /* surprisingly, the following code doesn't work on webkit - for some reason, most of the 
 10503        boxes are 3 pixels wider.
 10503        boxes are 3 pixels smaller.
 10504     */
 10504     */
 10505     if (IriSP.jQuery.browser.webkit) { console.log("webkit");
 10505     var endPourcent 	= Math.floor(IriSP.timeToPourcent(end, duration) - startPourcent);
 10506       var endPourcent 	= (IriSP.timeToPourcent(end, duration) - startPourcent - onePxPercent * 4.5).toFixed(1);
 10506     var endPixel = Math.floor(this.selector.parent().width() * (endPourcent / 100)) - 2;
 10507     }
 10507         
 10508     else
       
 10509       var endPourcent 	= (IriSP.timeToPourcent(end, duration) - startPourcent - onePxPercent * 1.5).toFixed(1);
       
 10510     
       
 10511     if (i == 0) {
 10508     if (i == 0) {
 10512 
 10509 
 10513       endPourcent -= onePxPercent;
 10510       endPourcent -= onePxPercent;
 10514     }
 10511     }
 10515     
 10512     
 10527     if (hexa_color.length == 4)
 10524     if (hexa_color.length == 4)
 10528       hexa_color = hexa_color + '00';
 10525       hexa_color = hexa_color + '00';
 10529     
 10526     
 10530     var annotationTemplate = Mustache.to_html(IriSP.annotation_template,
 10527     var annotationTemplate = Mustache.to_html(IriSP.annotation_template,
 10531         {"divTitle" : divTitle, "id" : id, "startPourcent" : startPourcent,
 10528         {"divTitle" : divTitle, "id" : id, "startPourcent" : startPourcent,
 10532         "endPourcent" : endPourcent, "hexa_color" : hexa_color,
 10529         "endPixel" : endPixel, "hexa_color" : hexa_color,
 10533         "seekPlace" : Math.round(begin/1000)});
 10530         "seekPlace" : Math.round(begin/1000)});
 10534 
       
 10535 
 10531 
 10536     this.selector.append(annotationTemplate);
 10532     this.selector.append(annotationTemplate);
 10537 
 10533 
 10538 //    IriSP.jQuery("#" + id).tooltip({ effect: 'slide'});
 10534 //    IriSP.jQuery("#" + id).tooltip({ effect: 'slide'});
 10539 
 10535 
 10615 };
 10611 };
 10616 
 10612 
 10617 IriSP.SegmentsWidget.prototype.positionUpdater = function() {  
 10613 IriSP.SegmentsWidget.prototype.positionUpdater = function() {  
 10618   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
 10614   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
 10619   var time = this._Popcorn.currentTime();
 10615   var time = this._Popcorn.currentTime();
       
 10616   //var position 	= ((time / duration) * 100).toFixed(2);
 10620   var position 	= ((time / duration) * 100).toFixed(2);
 10617   var position 	= ((time / duration) * 100).toFixed(2);
 10621 
 10618 
 10622   this.positionMarker.css("left", position + "%");  
 10619   this.positionMarker.css("left", position + "%");  
 10623 };
 10620 };
 10624 IriSP.SliderWidget = function(Popcorn, config, Serializer) {
 10621 IriSP.SliderWidget = function(Popcorn, config, Serializer) {
 10645   // another special variable used by the timeout handler to
 10642   // another special variable used by the timeout handler to
 10646   // open or close the slider.
 10643   // open or close the slider.
 10647   this.sliderMaximized = false;
 10644   this.sliderMaximized = false;
 10648   this.timeOutId = null;
 10645   this.timeOutId = null;
 10649 
 10646 
       
 10647   
 10650   this.positionMarker.draggable({axis: "x",
 10648   this.positionMarker.draggable({axis: "x",
 10651   start: IriSP.wrap(this, this.positionMarkerDraggingStartedHandler),
 10649   start: IriSP.wrap(this, this.positionMarkerDraggingStartedHandler),
 10652   stop: IriSP.wrap(this, this.positionMarkerDraggedHandler),
 10650   stop: IriSP.wrap(this, this.positionMarkerDraggedHandler),
 10653   containment: "parent"
 10651   containment: "parent"
 10654   });
 10652   });
 10655 
 10653   this.positionMarker.css("position", "absolute");
       
 10654   
 10656   this.sliderBackground.click(function(event) { self.backgroundClickHandler.call(self, event); });
 10655   this.sliderBackground.click(function(event) { self.backgroundClickHandler.call(self, event); });
 10657   this.sliderForeground.click(function(event) { self.foregroundClickHandler.call(self, event); });
 10656   this.sliderForeground.click(function(event) { self.foregroundClickHandler.call(self, event); });
 10658 
 10657 
 10659   this.selector.hover(IriSP.wrap(this, this.mouseOverHandler), IriSP.wrap(this, this.mouseOutHandler));
 10658   this.selector.hover(IriSP.wrap(this, this.mouseOverHandler), IriSP.wrap(this, this.mouseOutHandler));
 10660 
 10659 
 10733   this.sliderMaximized = true;
 10732   this.sliderMaximized = true;
 10734 
 10733 
 10735   this.sliderBackground.animate({"height": "9px"}, 100);
 10734   this.sliderBackground.animate({"height": "9px"}, 100);
 10736   this.sliderForeground.animate({"height": "9px"}, 100);
 10735   this.sliderForeground.animate({"height": "9px"}, 100);
 10737   this.positionMarker.animate({"height": "9px", "width": "9px"}, 100);
 10736   this.positionMarker.animate({"height": "9px", "width": "9px"}, 100);
 10738   this.positionMarker.css("margin-top", "-4px");
 10737   //this.positionMarker.css("margin-top", "-4px");
 10739   
 10738   
 10740 //  this.selector.removeClass("Ldt-SliderMinimized");
 10739 //  this.selector.removeClass("Ldt-SliderMinimized");
 10741 //  this.selector.addClass("Ldt-SliderMaximized");
 10740 //  this.selector.addClass("Ldt-SliderMaximized");
 10742 };
 10741 };
 10743 
 10742