added support for a default profile picture in case it's not defined.
--- a/src/js/site.js Fri Nov 18 11:01:13 2011 +0100
+++ b/src/js/site.js Fri Nov 18 11:06:55 2011 +0100
@@ -20,6 +20,9 @@
IriSP.widgetsDefaults = {
"PlayerWidget" : {},
- "AnnotationsWidget": {}
+ "AnnotationsWidget": {},
+ "TweetsWidget" : {
+ default_profile_picture : "https://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_3_bigger.png"
+ }
};
--- a/src/js/widgets/tweetsWidget.js Fri Nov 18 11:01:13 2011 +0100
+++ b/src/js/widgets/tweetsWidget.js Fri Nov 18 11:06:55 2011 +0100
@@ -10,8 +10,14 @@
IriSP.TweetsWidget.prototype.displayTweet = function(annotation) {
var title = annotation.content.title;
+ var img = annotation.content.img.src;
+ if (typeof(img) === "undefined" || img === "" || img === "None") {
+ img = IriSP.widgetsDefaults.TweetsWidget.default_profile_picture;
+ }
+
var imageMarkup = Mustache.to_html("<img src='{{src}}' alt='avatar'></img>",
- {src : annotation.content.img.src});
+ {src : img});
+
this.selector.find(".Ldt-tweetContents").text(title);
this.selector.find(".Ldt-tweetAvatar").html(imageMarkup);
this.selector.show(50);