src/js/widgets/tweetsWidget.js
branchtweet-widget
changeset 274 fe02d003c6c4
parent 271 41258988e132
child 275 a4d2dd99187b
equal deleted inserted replaced
273:c32065f5e297 274:fe02d003c6c4
     8 
     8 
     9 IriSP.TweetsWidget.prototype = new IriSP.Widget();
     9 IriSP.TweetsWidget.prototype = new IriSP.Widget();
    10 
    10 
    11 IriSP.TweetsWidget.prototype.displayTweet = function(annotation) {    
    11 IriSP.TweetsWidget.prototype.displayTweet = function(annotation) {    
    12     var title = annotation.content.title;
    12     var title = annotation.content.title;
       
    13     var img = annotation.content.img.src;
       
    14     if (typeof(img) === "undefined" || img === "" || img === "None") {
       
    15       img = IriSP.widgetsDefaults.TweetsWidget.default_profile_picture;
       
    16     }
       
    17     
    13     var imageMarkup = Mustache.to_html("<img src='{{src}}' alt='avatar'></img>", 
    18     var imageMarkup = Mustache.to_html("<img src='{{src}}' alt='avatar'></img>", 
    14                                        {src : annotation.content.img.src});
    19                                        {src : img});
       
    20 
    15     this.selector.find(".Ldt-tweetContents").text(title);
    21     this.selector.find(".Ldt-tweetContents").text(title);
    16     this.selector.find(".Ldt-tweetAvatar").html(imageMarkup);
    22     this.selector.find(".Ldt-tweetAvatar").html(imageMarkup);
    17     this.selector.show(50);
    23     this.selector.show(50);
    18     window.setTimeout(IriSP.wrap(this, function() { this.selector.hide(50) }), 10000);
    24     window.setTimeout(IriSP.wrap(this, function() { this.selector.hide(50) }), 10000);
    19 };
    25 };