src/widgets/Annotation.js
branchnew-model
changeset 902 14022f1d49ab
parent 880 4c7b33bf2795
child 904 510ebab76fa3
equal deleted inserted replaced
900:7673d645a8e0 902:14022f1d49ab
    10 IriSP.Widgets.Annotation.prototype.messages = {
    10 IriSP.Widgets.Annotation.prototype.messages = {
    11     "fr": {
    11     "fr": {
    12         share_on: "Partager sur",
    12         share_on: "Partager sur",
    13         watching: "Je regarde ",
    13         watching: "Je regarde ",
    14         on_site: " sur ",
    14         on_site: " sur ",
    15         tags: "Mots-clés :"
    15         tags: "Mots-clés :",
       
    16         excerpt_from: "Extrait de :"
    16     },
    17     },
    17     "en": {
    18     "en": {
    18         share_on: "Share on",
    19         share_on: "Share on",
    19         watching: "I'm watching ",
    20         watching: "I'm watching ",
    20         on_site: " on ",
    21         on_site: " on ",
    21         tags: "Keywords:"
    22         tags: "Keywords:",
       
    23         excerpt_from: "Excerpt from:"
    22     }
    24     }
    23 }
    25 }
    24 
    26 
    25 IriSP.Widgets.Annotation.prototype.template =
    27 IriSP.Widgets.Annotation.prototype.template =
    26     '<div class="Ldt-Annotation-Widget {{#show_top_border}}Ldt-Annotation-ShowTop{{/show_top_border}}">'
    28     '<div class="Ldt-Annotation-Widget {{#show_top_border}}Ldt-Annotation-ShowTop{{/show_top_border}}">'
    28     + '<a href="#" target="_blank" class="Ldt-Annotation-Share Ldt-Annotation-Fb" title="{{l10n.share_on}} Facebook"></a>'
    30     + '<a href="#" target="_blank" class="Ldt-Annotation-Share Ldt-Annotation-Fb" title="{{l10n.share_on}} Facebook"></a>'
    29     + '<a href="#" target="_blank" class="Ldt-Annotation-Share Ldt-Annotation-Twitter" title="{{l10n.share_on}} Twitter"></a>'
    31     + '<a href="#" target="_blank" class="Ldt-Annotation-Share Ldt-Annotation-Twitter" title="{{l10n.share_on}} Twitter"></a>'
    30     + '<a href="#" target="_blank" class="Ldt-Annotation-Share Ldt-Annotation-Gplus" title="{{l10n.share_on}} Google+"></a>'
    32     + '<a href="#" target="_blank" class="Ldt-Annotation-Share Ldt-Annotation-Gplus" title="{{l10n.share_on}} Google+"></a>'
    31     + '</div><h3 class="Ldt-Annotation-HiddenWhenEmpty"><span class="Ldt-Annotation-Title"></span> <span class="Ldt-Annotation-Time">'
    33     + '</div><h3 class="Ldt-Annotation-HiddenWhenEmpty"><span class="Ldt-Annotation-Title"></span> <span class="Ldt-Annotation-Time">'
    32     + '( <span class="Ldt-Annotation-Begin"></span> - <span class="Ldt-Annotation-End"></span> )</span></h3>'
    34     + '( <span class="Ldt-Annotation-Begin"></span> - <span class="Ldt-Annotation-End"></span> )</span></h3>'
       
    35     + '<h3 class="Ldt-Annotation-MashupOrigin Ldt-Annotation-HiddenWhenEmpty">{{l10n.excerpt_from}} <span class="Ldt-Annotation-MashupMedia"></span> <span class="Ldt-Annotation-Time">'
       
    36     + '( <span class="Ldt-Annotation-MashupBegin"></span> - <span class="Ldt-Annotation-MashupEnd"></span> )</span></h3>'
    33     + '<p class="Ldt-Annotation-Description Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty"></p>'
    37     + '<p class="Ldt-Annotation-Description Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty"></p>'
    34     + '<div class="Ldt-Annotation-Tags-Block Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-NoTags">{{l10n.tags}}<ul class="Ldt-Annotation-Tags"></ul></div></div></div>';
    38     + '<div class="Ldt-Annotation-Tags-Block Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-NoTags"><span class="Ldt-Annotation-TagTitle">{{l10n.tags}}</span><ul class="Ldt-Annotation-Tags"></ul></div></div></div>';
    35 
    39 
    36 IriSP.Widgets.Annotation.prototype.defaults = {
    40 IriSP.Widgets.Annotation.prototype.defaults = {
    37     annotation_type : "chap",
    41     annotation_type : "chap",
    38     show_top_border : false,
    42     show_top_border : false,
    39     site_name : "Lignes de Temps"
    43     site_name : "Lignes de Temps"
    76             : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.namespacedId.name));
    80             : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.namespacedId.name));
    77     var _text = this.l10n.watching + _annotation.title + (this.site_name ? this.l10n.on_site + this.site_name : '');
    81     var _text = this.l10n.watching + _annotation.title + (this.site_name ? this.l10n.on_site + this.site_name : '');
    78     var _tags = _annotation.getTagTexts();
    82     var _tags = _annotation.getTagTexts();
    79     if (_tags.length) {
    83     if (_tags.length) {
    80         var _html = IriSP._(_tags).map(function(_tag) {
    84         var _html = IriSP._(_tags).map(function(_tag) {
    81             return '<li class="Ldt-Annotation-TagLabel">' + _tag + '</li>';
    85             return '<li class="Ldt-Annotation-TagLabel"><span>' + _tag + '</span></li>';
    82         }).join("");
    86         }).join("");
    83         this.$.find(".Ldt-Annotation-Tags").html(_html);
    87         this.$.find(".Ldt-Annotation-Tags").html(_html);
    84         this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-NoTags");
    88         this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-NoTags");
    85     } else {
    89     } else {
    86         this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-NoTags");
    90         this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-NoTags");
    87     }
    91     }
    88     this.$.find(".Ldt-Annotation-Title").html(_annotation.title);
    92     this.$.find(".Ldt-Annotation-Title").html(_annotation.title);
    89     this.$.find(".Ldt-Annotation-Description").html(_annotation.description);
    93     this.$.find(".Ldt-Annotation-Description").html(_annotation.description);
    90     this.$.find(".Ldt-Annotation-Begin").html(_annotation.begin.toString());
    94     this.$.find(".Ldt-Annotation-Begin").html(_annotation.begin.toString());
    91     this.$.find(".Ldt-Annotation-End").html(_annotation.end.toString());
    95     this.$.find(".Ldt-Annotation-End").html(_annotation.end.toString());
       
    96     if (_annotation.elementType === "mashedAnnotation") {
       
    97         this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup");
       
    98         this.$.find(".Ldt-Annotation-MashupMedia").html(_annotation.getMedia().title);
       
    99         this.$.find(".Ldt-Annotation-MashupBegin").html(_annotation.annotation.begin.toString());
       
   100         this.$.find(".Ldt-Annotation-MashupEnd").html(_annotation.annotation.end.toString());
       
   101     } else {
       
   102         this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup");
       
   103     }
    92     this.$.find(".Ldt-Annotation-Fb").attr("href", "http://www.facebook.com/share.php?" + IriSP.jQuery.param({ u: _url, t: _text }));
   104     this.$.find(".Ldt-Annotation-Fb").attr("href", "http://www.facebook.com/share.php?" + IriSP.jQuery.param({ u: _url, t: _text }));
    93     this.$.find(".Ldt-Annotation-Twitter").attr("href", "https://twitter.com/intent/tweet?" + IriSP.jQuery.param({ url: _url, text: _text }));
   105     this.$.find(".Ldt-Annotation-Twitter").attr("href", "https://twitter.com/intent/tweet?" + IriSP.jQuery.param({ url: _url, text: _text }));
    94     this.$.find(".Ldt-Annotation-Gplus").attr("href", "https://plusone.google.com/_/+1/confirm?" + IriSP.jQuery.param({ url: _url, title: _text }));
   106     this.$.find(".Ldt-Annotation-Gplus").attr("href", "https://plusone.google.com/_/+1/confirm?" + IriSP.jQuery.param({ url: _url, title: _text }));
    95     this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty");
   107     this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty");
    96 }
   108 }