Skip to content

Commit

Permalink
Merge remote branch 'numericr/Snipplr' into snipplr
Browse files Browse the repository at this point in the history
* numericr/Snipplr:
  Added Snipplr icon
  Added Snipplr support
  • Loading branch information
christianvuerings committed Jul 9, 2011
2 parents d57010f + c9385c6 commit a25df78
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions css/lifestream.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions jquery.lifestream.js
Expand Up @@ -1253,6 +1253,46 @@

};

$.fn.lifestream.feeds.snipplr = function( config, callback ) {

var template = $.extend({},
{
posted: 'posted a snippet <a href="${link}">${title}</a>'
},
config.template);

var parseSnipplr = function ( input ) {
var output = [], list, i = 0, j, item;

if ( input.query && input.query.count && input.query.count > 0
&& input.query.results.rss.channel.item ) {
list = input.query.results.rss.channel.item;
j = list.length;
for ( ; i < j; i++) {
item = list[i];

output.push({
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}

return output;
};

$.ajax({
url: createYqlUrl('select * from xml where '
+ 'url="http://snipplr.com/rss/users/' + config.user + '"'),
dataType: "jsonp",
success: function ( data ) {
callback(parseSnipplr(data));
}
});

};

$.fn.lifestream.feeds.stackoverflow = function( config, callback ) {

var template = $.extend({},
Expand Down

0 comments on commit a25df78

Please sign in to comment.