src/js/widgets/annotationsWidget.js
branchpopcorn-port
changeset 470 19389e221722
parent 393 54947acf2770
child 493 f7333cdf5320
equal deleted inserted replaced
469:154c049e0c06 470:19389e221722
    10     this.selector.find(".Ldt-SaTitle").text("");
    10     this.selector.find(".Ldt-SaTitle").text("");
    11     this.selector.find(".Ldt-SaDescription").text("");
    11     this.selector.find(".Ldt-SaDescription").text("");
    12     this.selector.find(".Ldt-SaKeywordText").text("");
    12     this.selector.find(".Ldt-SaKeywordText").text("");
    13 };
    13 };
    14 
    14 
    15 IriSP.AnnotationsWidget.prototype.displayAnnotation = function(annotation) {
    15 IriSP.AnnotationsWidget.prototype.displayAnnotation = function(annotation) {   
    16 
    16 
    17     var title = annotation.content.title;
    17     var title = annotation.content.title;
    18     var description = annotation.content.description;
    18     var description = annotation.content.description;
    19     var keywords =  "" // FIXME;
    19     var keywords =  "" // FIXME;
    20     var begin = +annotation.begin / 1000;
    20     var begin = +annotation.begin / 1000;
    21     var end = +annotation.end / 1000;
    21     var end = +annotation.end / 1000;
    22     var duration = +this._serializer.currentMedia().meta["dc:duration"];
    22     var duration = +this._serializer.currentMedia().meta["dc:duration"];
    23 
    23     
    24     var title_templ = "{{title}} - ( {{begin}} - {{end}} )";
    24     var title_templ = "{{title}} - ( {{begin}} - {{end}} )";
    25     var endstr = Mustache.to_html(title_templ, {title: title, begin: IriSP.secondsToTime(begin), end: IriSP.secondsToTime(end)});
    25     var endstr = Mustache.to_html(title_templ, {title: title, begin: IriSP.secondsToTime(begin), end: IriSP.secondsToTime(end)});
    26 
    26 
    27     this.selector.find(".Ldt-SaTitle").text(endstr);
    27     this.selector.find(".Ldt-SaTitle").text(endstr);
    28     this.selector.find(".Ldt-SaDescription").text(description);
    28     this.selector.find(".Ldt-SaDescription").text(description);
       
    29     
       
    30     // update sharing buttons
       
    31     var defaults = IriSP.widgetsDefaults.AnnotationsWidget;
       
    32     var text = defaults.share_text;
       
    33     var fb_link = defaults.fb_link;
       
    34     var tw_link = defaults.tw_link;
       
    35     var gplus_link = defaults.gplus_link;
       
    36     var url = document.location.href + "#a=" + annotation.id;
       
    37     this.selector.find(".Ldt-fbShare").attr("href", fb_link + IriSP.encodeURI(text) + IriSP.encodeURI(url));
       
    38     this.selector.find(".Ldt-TwShare").attr("href", tw_link + IriSP.encodeURI(text) + IriSP.encodeURI(url));
       
    39     this.selector.find(".Ldt-GplusShare").attr("href", fb_link + IriSP.encodeURI(text) + IriSP.encodeURI(url));
    29 };
    40 };
    30 
    41 
    31 IriSP.AnnotationsWidget.prototype.clearWidget = function() {
    42 IriSP.AnnotationsWidget.prototype.clearWidget = function() {
    32 
    43 
    33     
    44