src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 474 c1998d5d552e
parent 473 1a09ab7e7163
child 477 1e51d638e7ea
equal deleted inserted replaced
473:1a09ab7e7163 474:c1998d5d552e
    61     var startPourcent 	= IriSP.timeToPourcent(begin, duration);
    61     var startPourcent 	= IriSP.timeToPourcent(begin, duration);
    62     
    62     
    63     /* some sort of collapsing occurs, so we only have to substract one pixel to each box instead of
    63     /* some sort of collapsing occurs, so we only have to substract one pixel to each box instead of
    64        two
    64        two
    65     */
    65     */
    66     var endPourcent 	= IriSP.timeToPourcent(end, duration) - startPourcent - onePxPercent * 1;
    66     var endPourcent 	= IriSP.timeToPourcent(end, duration) - startPourcent - onePxPercent * 1.5;
    67     
    67     
    68     /* on the other hand, we have to substract one pixel from the first box because it's the only
    68     /* on the other hand, we have to substract one pixel from the first box because it's the only
    69        one to have to effective 1px margins */
    69        one to have to effective 1px margins */
    70     if (i == 0) {
    70     if (i == 0) {
    71 
    71 
    72       endPourcent -= onePxPercent;
    72       endPourcent -= onePxPercent;
    73     }
    73     }
    74     
    74     
    75     var divTitle = annotation.content.title.substr(0,55);
    75     var divTitle = (annotation.content.title + " - " + annotation.content.description).substr(0,55);
    76 
    76 
    77     if (typeof(annotation.content.color) !== "undefined")
    77     if (typeof(annotation.content.color) !== "undefined")
    78       var color = annotation.content.color;
    78       var color = annotation.content.color;
    79     else
    79     else
    80       var color = annotation.color;
    80       var color = annotation.color;
    81     
    81     
    82     var hexa_color = IriSP.DEC_HEXA_COLOR(color);
    82     var hexa_color = IriSP.DEC_HEXA_COLOR(color);
    83     console.log(hexa_color);
    83     
    84     if (hexa_color === "FFCC00")
    84     if (hexa_color === "FFCC00")
    85       hexa_color = "333";
    85       hexa_color = "333";
    86     
    86     
    87     var annotationTemplate = Mustache.to_html(IriSP.annotation_template,
    87     var annotationTemplate = Mustache.to_html(IriSP.annotation_template,
    88         {"divTitle" : divTitle, "id" : id, "startPourcent" : startPourcent,
    88         {"divTitle" : divTitle, "id" : id, "startPourcent" : startPourcent,
   109           var correction = IriSP.jQuery(this).outerWidth() / 2;
   109           var correction = IriSP.jQuery(this).outerWidth() / 2;
   110 
   110 
   111           var offset_x = offset.left + correction - 106;
   111           var offset_x = offset.left + correction - 106;
   112           if (offset_x < 0)
   112           if (offset_x < 0)
   113             offset_x = 0;
   113             offset_x = 0;
   114 
   114                     
   115           self.TooltipWidget.show(divTitle, color, offset_x, event.pageY - 160);
   115           self.TooltipWidget.show(divTitle, color, offset_x, event.pageY - 160);
   116     } })(divTitle)).mouseout(function(){
   116     } })(divTitle)).mouseout(function(){
   117       IriSP.jQuery(this).animate({opacity: 0.3}, 5);
   117       IriSP.jQuery(this).animate({opacity: 0.3}, 5);
   118       self.TooltipWidget.hide();
   118       self.TooltipWidget.hide();
   119     });
   119     });