src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 836 526f91f5253e
parent 835 a8af9da7c622
child 842 4ae2247a59f4
equal deleted inserted replaced
835:a8af9da7c622 836:526f91f5253e
    79       /* the last segment has no segment following it */
    79       /* the last segment has no segment following it */
    80       var pxWidth = endPixel - startPixel;
    80       var pxWidth = endPixel - startPixel;
    81     
    81     
    82     var divTitle = this.cinecast_version
    82     var divTitle = this.cinecast_version
    83         ? annotation.content.data
    83         ? annotation.content.data
    84         : IriSP.clean_substr(annotation.content.title + " -<br>" + annotation.content.description, 0, 132) + "...";
    84         : annotation.content.title + ( annotation.content.title ? "<br />" : "" ) + annotation.content.description.replace(/(^.{120,140})[\s].+$/,'$1&hellip;');
       
    85     
       
    86     var thumbUrl = annotation.meta.thumbnail || '';
    85     
    87     
    86     var hexa_color = typeof(annotation.content.color) !== "undefined"
    88     var hexa_color = typeof(annotation.content.color) !== "undefined"
    87         ? '#' + IriSP.DEC_HEXA_COLOR(annotation.content.color)
    89         ? '#' + IriSP.DEC_HEXA_COLOR(annotation.content.color)
    88         : typeof(annotation.color) !== "undefined"
    90         : typeof(annotation.color) !== "undefined"
    89             ? '#' + IriSP.DEC_HEXA_COLOR(annotation.color)
    91             ? '#' + IriSP.DEC_HEXA_COLOR(annotation.color)
    98     
   100     
    99     
   101     
   100     var annotationTemplate = Mustache.to_html(IriSP.annotation_template,
   102     var annotationTemplate = Mustache.to_html(IriSP.annotation_template,
   101         {"divTitle" : divTitle, "id" : id, "startPixel" : startPixel,
   103         {"divTitle" : divTitle, "id" : id, "startPixel" : startPixel,
   102         "pxWidth" : pxWidth, "hexa_color" : hexa_color,
   104         "pxWidth" : pxWidth, "hexa_color" : hexa_color,
   103         "seekPlace" : Math.round(begin/1000)});
   105         "seekPlace" : Math.round(begin/1000), "thumbnailUrl": thumbUrl});
   104 
   106 
   105         
   107         
   106     this.selector.append(annotationTemplate);
   108     this.selector.append(annotationTemplate);
   107     
   109     
   108     /* add a special class to the last segment and change its border */
   110     /* add a special class to the last segment and change its border */
   132         })
   134         })
   133         .mouseover( function(event) {
   135         .mouseover( function(event) {
   134             var divObject = IriSP.jQuery(this);
   136             var divObject = IriSP.jQuery(this);
   135             divObject.fadeTo(0,1);
   137             divObject.fadeTo(0,1);
   136             var offset_x = divObject.position().left + divObject.outerWidth() / 2;
   138             var offset_x = divObject.position().left + divObject.outerWidth() / 2;
   137             self.TooltipWidget.show(divObject.attr("title"), IriSP.jQuery(this).css("background-color"), offset_x, 0);
   139             var thumb = divObject.attr("thumbnail-url");
       
   140             var txt = divObject.attr("title") + (thumb && thumb.length ? '<br /><img src="' + thumb + '" />' : '');
       
   141             self.TooltipWidget.show(txt, IriSP.jQuery(this).css("background-color"), offset_x, 0);
   138         })
   142         })
   139         .mouseout(function(){
   143         .mouseout(function(){
   140             IriSP.jQuery(this).fadeTo(0,.5);
   144             IriSP.jQuery(this).fadeTo(0,.5);
   141             self.TooltipWidget.hide();
   145             self.TooltipWidget.hide();
   142         });
   146         });