src/widgets/Tweet.js
changeset 964 d7d56ea2d0a6
parent 957 4da0a5740b6c
child 982 cfcbac34d020
equal deleted inserted replaced
963:d58d0dcdb640 964:d7d56ea2d0a6
    23         {
    23         {
    24             "keywords" : [ "??" ],
    24             "keywords" : [ "??" ],
    25             "color" : "#05aae6"
    25             "color" : "#05aae6"
    26         }
    26         }
    27     ],
    27     ],
       
    28     annotation_type: "tweet",
    28     pin_at_start: false
    29     pin_at_start: false
    29 }
    30 }
    30 
    31 
    31 IriSP.Widgets.Tweet.prototype.messages = {
    32 IriSP.Widgets.Tweet.prototype.messages = {
    32     "fr": {
    33     "fr": {
    64     + '<a href="" target="_blank" class="Ldt-Tweet-Reply"><div class="Ldt-Tweet-Icon"></div>{{l10n.reply}}</a></div></div></div>';
    65     + '<a href="" target="_blank" class="Ldt-Tweet-Reply"><div class="Ldt-Tweet-Icon"></div>{{l10n.reply}}</a></div></div></div>';
    65     
    66     
    66 
    67 
    67 IriSP.Widgets.Tweet.prototype.draw = function() {
    68 IriSP.Widgets.Tweet.prototype.draw = function() {
    68     this.renderTemplate();
    69     this.renderTemplate();
    69     this.onMdpEvent("Tweet.show","show");
       
    70     this.pinned = this.pin_at_start;
    70     this.pinned = this.pin_at_start;
    71     var _this = this;
    71     var _this = this;
    72     this.$.find(".Ldt-Tweet-Pin").click(function() {
    72     this.$.find(".Ldt-Tweet-Pin").click(function() {
    73         _this.pinned = !_this.pinned;
    73         _this.pinned = !_this.pinned;
    74         var _el = IriSP.jQuery(this)
    74         var _el = IriSP.jQuery(this)
    82     });
    82     });
    83     this.$.find(".Ldt-Tweet-Close").click(function() {
    83     this.$.find(".Ldt-Tweet-Close").click(function() {
    84         _this.hide();
    84         _this.hide();
    85     });
    85     });
    86     this.$.hide();
    86     this.$.hide();
    87 }
    87     this.getWidgetAnnotations().forEach(function(_annotation) {
    88 
    88         _annotation.on("click", function() {
    89 IriSP.Widgets.Tweet.prototype.show = function(_id) {
    89             _this.show(_annotation);
    90     var _tweet = this.source.getElement(_id);
    90         });
       
    91     });
       
    92 }
       
    93 
       
    94 IriSP.Widgets.Tweet.prototype.show = function(_tweet) {
    91     if (typeof _tweet !== "undefined" && typeof _tweet.source !== "undefined") {
    95     if (typeof _tweet !== "undefined" && typeof _tweet.source !== "undefined") {
    92         var _entities = [];
    96         var _entities = [];
    93         for (var _i = 0; _i < _tweet.source.entities.hashtags.length; _i++) {
    97         for (var _i = 0; _i < _tweet.source.entities.hashtags.length; _i++) {
    94             var _hash = _tweet.source.entities.hashtags[_i];
    98             var _hash = _tweet.source.entities.hashtags[_i];
    95             _entities.push({
    99             _entities.push({