I thought that might be neat, so I already worked it out:
Code:
var socialfeed=new gfeedfetcher("example2", "example2class", "_new")
socialfeed.addFeed("CXC News & PR", "http://cxcnewsfeed.wordpress.com/feed/atom/") //Specify "label" plus URL to RSS feed
socialfeed.addFeed("CXC Team Blog", "http://cxceliteblog.com/feed/atom")
socialfeed.displayoptions("label snippet") //show the specified additional fields
socialfeed.setentrycontainer("div") //Display each entry as a DIV
socialfeed.filterfeed(6, "label") //Show 6 entries, sort by label
socialfeed.onfeedload = function(){
var $ = jQuery, $title = $(this.feedcontainer).find('.titlefield'), mw = $(this.feedcontainer).children().innerWidth() - 5, $p, $r;
$.each(this.feeds, function(i, feed){
$p = $(feed.content).find('img').eq(0).css({maxWidth: mw, height: 'auto', maxHeight: 210, width: 'auto'});
$r = $p.parent('a').length? $p.parent('a') : $p;
if($r.length){$title.eq(i).before($('<div class="feedimage"></div>').append($r));}
});
};
socialfeed.init() //Always call this last
Notes: The code sets a max width to 5px less than the width of the items and a max height of 210px:
Code:
.css({maxWidth: mw, height: 'auto', maxHeight: 210, width: 'auto'})
You can adjust that or remove it. The images may be styled in a stylesheet via the added class (feedimage):
Code:
.feedimage img {
margin: 0 auto;
display: block;
}
Bookmarks