src/widgets/Tweet.js
branchnew-model
changeset 918 5cd368dba1b9
parent 909 aa0e42229784
child 957 4da0a5740b6c
child 1019 3ab36f402b0c
equal deleted inserted replaced
917:eb8677d3a663 918:5cd368dba1b9
    22         },
    22         },
    23         {
    23         {
    24             "keywords" : [ "??" ],
    24             "keywords" : [ "??" ],
    25             "color" : "#05aae6"
    25             "color" : "#05aae6"
    26         }
    26         }
    27     ]
    27     ],
       
    28     pin_at_start: false
    28 }
    29 }
    29 
    30 
    30 IriSP.Widgets.Tweet.prototype.messages = {
    31 IriSP.Widgets.Tweet.prototype.messages = {
    31     "fr": {
    32     "fr": {
    32         retweet: "Retweeter",
    33         retweet: "Retweeter",
    33         reply: "Répondre",
    34         reply: "Répondre",
    34         keep_visible: "Garder visible",
    35         keep_visible: "Garder visible",
    35         dont_keep_visible: "Permettre la fermeture automatique",
    36         dont_keep_visible: "Permettre la fermeture automatique",
    36         close_widget: "Fermer l'affichage du tweet",
    37         close_widget: "Fermer l'affichage du tweet",
    37         original_time: "Heure d'envoi  ",
    38         original_time: "Heure d'envoi : ",
    38         video_time: "Temps de la vidéo : "
    39         video_time: "Temps de la vidéo : ",
       
    40         show_original: "Voir l'original"
    39     },
    41     },
    40     "en": {
    42     "en": {
    41         retweet: "Retweet",
    43         retweet: "Retweet",
    42         reply: "Reply",
    44         reply: "Reply",
    43         keep_visible: "Keep visible",
    45         keep_visible: "Keep visible",
    44         dont_keep_visible: "Don't keep visible",
    46         dont_keep_visible: "Don't keep visible",
    45         close_widget: "Close tweet display",
    47         close_widget: "Close tweet display",
    46         original_time: "Tweet sent at: ",
    48         original_time: "Tweet sent at: ",
    47         video_time: "Video time: "
    49         video_time: "Video time: ",
       
    50         show_original: "Show original"
    48     }
    51     }
    49 }
    52 }
    50 
    53 
    51 IriSP.Widgets.Tweet.prototype.template =
    54 IriSP.Widgets.Tweet.prototype.template =
    52     '<div class="Ldt-Tweet-Widget"><div class="Ldt-Tweet-Inner"><div class="Ldt-Tweet-PinClose-Buttons">'
    55     '<div class="Ldt-Tweet-Widget"><div class="Ldt-Tweet-Inner"><div class="Ldt-Tweet-PinClose-Buttons">'
    53     + '<a href="#" class="Ldt-Tweet-Pin Ldt-TraceMe" title="{{l10n.keep_visible}}"></a>'
    56     + '<a href="#" class="Ldt-Tweet-Pin Ldt-TraceMe{{#pin_at_start}} active" title="{{l10n.dont_keep_visible}}{{/pin_at_start}}{{^pin_at_start}}" title="{{l10n.keep_visible}}{{/pin_at_start}}"></a>'
    54     + '<a href="#" class="Ldt-Tweet-Close Ldt-TraceMe" title="{{l10n.close_widget}}"></a>'
    57     + '<a href="#" class="Ldt-Tweet-Close Ldt-TraceMe" title="{{l10n.close_widget}}"></a>'
    55     + '</div><div class="Ldt-Tweet-AvatarContainer"><a href="#" class="Ldt-Tweet-ProfileLink" target="_blank">'
    58     + '</div><div class="Ldt-Tweet-AvatarContainer"><a href="#" class="Ldt-Tweet-ProfileLink" target="_blank">'
    56     + '<img src="" class="Ldt-Tweet-Avatar"/></a></div><h3><a href="#" class="Ldt-Tweet-ProfileLink Ldt-Tweet-ScreenName" target="_blank">'
    59     + '<img src="" class="Ldt-Tweet-Avatar"/></a></div><h3><a href="#" class="Ldt-Tweet-ProfileLink Ldt-Tweet-ScreenName" target="_blank">'
    57     + '</a> (<span class="Ldt-Tweet-FullName"></span>)</h3><p class="Ldt-Tweet-Contents"></p><div class="Ldt-Tweet-Bottom">'
    60     + '</a> (<span class="Ldt-Tweet-FullName"></span>)</h3><p class="Ldt-Tweet-Contents"></p><div class="Ldt-Tweet-Bottom">'
    58     + '<span class="Ldt-Tweet-Time"></span><a href="" target="_blank" class="Ldt-Tweet-Retweet"><div class="Ldt-Tweet-Icon"></div>{{l10n.retweet}}</a>'
    61     + '<span class="Ldt-Tweet-Time"></span>'
       
    62     + '<a class="Ldt-Tweet-Original" href="" target="_blank">{{l10n.show_original}}</a>'
       
    63     + '<a href="" target="_blank" class="Ldt-Tweet-Retweet"><div class="Ldt-Tweet-Icon"></div>{{l10n.retweet}}</a>'
    59     + '<a href="" target="_blank" class="Ldt-Tweet-Reply"><div class="Ldt-Tweet-Icon"></div>{{l10n.reply}}</a></div></div></div>';
    64     + '<a href="" target="_blank" class="Ldt-Tweet-Reply"><div class="Ldt-Tweet-Icon"></div>{{l10n.reply}}</a></div></div></div>';
    60     
    65     
    61 
    66 
    62 IriSP.Widgets.Tweet.prototype.draw = function() {
    67 IriSP.Widgets.Tweet.prototype.draw = function() {
    63     this.renderTemplate();
    68     this.renderTemplate();
    64     this.bindPopcorn("IriSP.Tweet.show","show");
    69     this.bindPopcorn("IriSP.Tweet.show","show");
    65     this.pinned = false;
    70     this.pinned = this.pin_at_start;
    66     var _this = this;
    71     var _this = this;
    67     this.$.find(".Ldt-Tweet-Pin").click(function() {
    72     this.$.find(".Ldt-Tweet-Pin").click(function() {
    68         _this.pinned = !_this.pinned;
    73         _this.pinned = !_this.pinned;
    69         var _el = IriSP.jQuery(this)
    74         var _el = IriSP.jQuery(this)
    70         if (_this.pinned) {
    75         if (_this.pinned) {
   156             }
   161             }
   157         }
   162         }
   158         _txt += _tweet.source.text.substring(_currentPos);
   163         _txt += _tweet.source.text.substring(_currentPos);
   159         this.$.find(".Ldt-Tweet-Avatar").attr("src",_tweet.source.user.profile_image_url);
   164         this.$.find(".Ldt-Tweet-Avatar").attr("src",_tweet.source.user.profile_image_url);
   160         this.$.find(".Ldt-Tweet-ScreenName").html('@'+_tweet.source.user.screen_name);
   165         this.$.find(".Ldt-Tweet-ScreenName").html('@'+_tweet.source.user.screen_name);
   161         this.$.find(".Ldt-Tweet-ProfileLink").attr("href", "http://twitter.com/" + _tweet.source.user.screen_name);
   166         this.$.find(".Ldt-Tweet-ProfileLink").attr("href", "https://twitter.com/" + _tweet.source.user.screen_name);
   162         this.$.find(".Ldt-Tweet-FullName").html(_tweet.source.user.name);
   167         this.$.find(".Ldt-Tweet-FullName").html(_tweet.source.user.name);
   163         this.$.find(".Ldt-Tweet-Contents").html(_txt);
   168         this.$.find(".Ldt-Tweet-Contents").html(_txt);
   164         this.$.find(".Ldt-Tweet-Time").html(this.l10n.original_time + new Date(_tweet.source.created_at).toLocaleTimeString() + " / " + this.l10n.video_time + _tweet.begin.toString());
   169         this.$.find(".Ldt-Tweet-Time").html(this.l10n.original_time + new Date(_tweet.source.created_at).toLocaleTimeString() + " / " + this.l10n.video_time + _tweet.begin.toString());
       
   170         this.$.find(".Ldt-Tweet-Retweet").attr("href", "https://twitter.com/intent/retweet?tweet_id=" + _tweet.source.id_str);
       
   171         this.$.find(".Ldt-Tweet-Reply").attr("href", "https://twitter.com/intent/tweet?in_reply_to=" + _tweet.source.id_str);
       
   172         this.$.find(".Ldt-Tweet-Original").attr("href", "https://twitter.com/" + _tweet.source.user.screen_name + "/status/" + _tweet.source.id_str);
   165         this.player.popcorn.trigger("IriSP.Annotation.minimize");
   173         this.player.popcorn.trigger("IriSP.Annotation.minimize");
   166         this.$.slideDown();
   174         this.$.slideDown();
   167         this.cancelTimeout();
   175         this.cancelTimeout();
   168         if (!this.pinned) {
   176         if (!this.pinned) {
   169             this.hideTimeout();
   177             this.hideTimeout();