src/js/widgets/tweetsWidget.js
branchpopcorn-port
changeset 293 314e6a13f841
parent 285 b7aa28af2c10
child 298 eccdc619ede3
equal deleted inserted replaced
292:31773b5deb26 293:314e6a13f841
    16     var title = IriSP.formatTweet(annotation.content.title);
    16     var title = IriSP.formatTweet(annotation.content.title);
    17     var img = annotation.content.img.src;
    17     var img = annotation.content.img.src;
    18     if (typeof(img) === "undefined" || img === "" || img === "None") {
    18     if (typeof(img) === "undefined" || img === "" || img === "None") {
    19       img = IriSP.widgetsDefaults.TweetsWidget.default_profile_picture;
    19       img = IriSP.widgetsDefaults.TweetsWidget.default_profile_picture;
    20     }
    20     }
       
    21 
       
    22     var imageMarkup = Mustache.to_html("<img src='{{src}}' alt='user image'></img>", 
       
    23                                        {src : img});
    21     
    24     
    22     var imageMarkup = Mustache.to_html("<img src='{{src}}' alt='avatar'></img>", 
    25     if (typeof(annotation.meta["dc:source"].content) !== "undefined") {
    23                                        {src : img});
    26       var tweetContents = JSON.parse(annotation.meta["dc:source"].content);
       
    27       var creator = tweetContents.user.screen_name;
       
    28       
       
    29       imageMarkup = Mustache.to_html("<a href='http://twitter.com/{{creator}}'><img src='{{src}}' alt='user image'></img></a>", 
       
    30                                        {src : img, creator: creator});
       
    31             
       
    32       title = Mustache.to_html(IriSP.rich_tweet_template, {contents : title, date : tweetContents.created_at});
       
    33       console.log(title);
       
    34     }
    24 
    35 
    25     this.selector.find(".Ldt-tweetContents").html(title);
    36     this.selector.find(".Ldt-tweetContents").html(title);
    26     this.selector.find(".Ldt-tweetAvatar").html(imageMarkup);
    37     this.selector.find(".Ldt-tweetAvatar").html(imageMarkup);
    27     this.selector.show("blind", 250); 
    38     this.selector.show("blind", 250); 
    28 };
    39 };