Skip to content

Commit

Permalink
added fancy support
Browse files Browse the repository at this point in the history
  • Loading branch information
arminrosu committed Jun 30, 2013
1 parent 71345f0 commit b66edee
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -24,6 +24,7 @@ Currently supports the following feeds:
* [Disqus](http://disqus.com)
* [Dribbble](http://dribbble.com)
* [Facebook Pages](http://www.facebook.com/pages)
* [Fancy](http://www.fancy.com)
* [Flickr](http://flickr.com)
* [Foomark](http://foomark.com)
* [Formspring](http://formspring.com)
Expand Down
Binary file added src/favicons/fancy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions src/services/fancy.js
@@ -0,0 +1,47 @@
(function($) {
'use strict';

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

var template = $.extend({},
{
fancied: 'fancy\'d <a href="${link}">${title}</a>'
},
config.template),

parseFancy = function( input ) {
var output = [], i = 0, j;

if(input.query && input.query.count && input.query.count > 0) {
j = input.query.count;
for( ; i<j; i++) {
var item = input.query.results.item[i];
output.push({
date: new Date(item.pubDate),
config: config,
html: $.tmpl( template.fancied, item )
});
}
}

return output;
};

$.ajax({
url: $.fn.lifestream.createYqlUrl('SELECT * FROM xml ' +
'WHERE url="http://www.fancy.com/rss/' + config.user +
'" AND itemPath="/rss/channel/item"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseFancy(data));
}
});

// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};

};
})(jQuery);

0 comments on commit b66edee

Please sign in to comment.