Skip to content

Commit

Permalink
v0.5.5 - Fix the facebook page feed
Browse files Browse the repository at this point in the history
  • Loading branch information
christianvuerings committed Nov 22, 2015
1 parent 4434931 commit d8ec650
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 92 deletions.
79 changes: 37 additions & 42 deletions jquery.lifestream.js
@@ -1,7 +1,7 @@
/*!
* jQuery Lifestream Plug-in
* Show a stream of your online activity
* @version 0.5.4
* @version 0.5.5
* @author Christian Vuerings et al.
* @copyright Copyright 2014, Christian Vuerings - http://denbuzze.com
* @license https://github.com/christianvuerings/jquery-lifestream/blob/master/LICENSE MIT
Expand Down Expand Up @@ -692,55 +692,50 @@ $.fn.lifestream.feeds.dribbble = function( config, callback ) {
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.facebook_page = function( config, callback ) {
"use strict";

var template = $.extend({},
{
wall_post: 'post on wall <a href="${link}">${title}</a>'
},
config.template),
$.fn.lifestream.feeds.facebook_page = function( config, callback ) {

/**
* Parse the input from facebook
*/
parseFBPage = function( input ) {
var output = [], list, i = 0, j;
var template = $.extend({},
{
wall_post: 'posted <a href="${url}">${text}</a>'
},
config.template);

if (input.rss &&
input.rss.channel &&
input.rss.channel[0] &&
input.rss.channel[0].item) {
/**
* Parse the input from facebook
*/
var parseFacebooky = function(response) {
var output = [];

list = input.rss.channel[0].item;
j = list.length;
for( ; i<j; i++) {
var item = list[i];
if( $.trim( item.title ) ){
output.push({
date: new Date(item.pubDate),
config: config,
html: $.tmpl( template.wall_post, item )
});
}
if (!response.posts || !response.posts.length) {
return output;
}
}
return output;
};

$.ajax({
url: 'https://facebooky.herokuapp.com/' + config.user,
success: function( data ) {
callback(parseFBPage(data));
}
});
for (var i = 0 ;i < response.posts.length; i++){
var post = response.posts[i];

// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
output.push({
"date": new Date(post.time * 1000),
"config": config,
"html": $.tmpl(template.wall_post, post)
});
}
callback(output);
};

};
$.ajax({
url: 'https://facebooky.herokuapp.com/page/' + config.user,
success: parseFacebooky
});

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

};
})(jQuery);
(function($) {
'use strict';
Expand Down
4 changes: 2 additions & 2 deletions jquery.lifestream.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lifestream.jquery.json
@@ -1,6 +1,6 @@
{
"name": "lifestream",
"version": "0.5.4",
"version": "0.5.5",
"title": "jQuery Lifestream",
"description": "Show a stream of your online activity with jQuery",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/core.js
@@ -1,7 +1,7 @@
/*!
* jQuery Lifestream Plug-in
* Show a stream of your online activity
* @version 0.5.4
* @version 0.5.5
* @author Christian Vuerings et al.
* @copyright Copyright 2014, Christian Vuerings - http://denbuzze.com
* @license https://github.com/christianvuerings/jquery-lifestream/blob/master/LICENSE MIT
Expand Down
87 changes: 41 additions & 46 deletions src/services/facebook_page.js
@@ -1,51 +1,46 @@
(function($) {
$.fn.lifestream.feeds.facebook_page = function( config, callback ) {

var template = $.extend({},
{
wall_post: 'post on wall <a href="${link}">${title}</a>'
},
config.template),

/**
* Parse the input from facebook
*/
parseFBPage = function( input ) {
var output = [], list, i = 0, j;

if (input.rss &&
input.rss.channel &&
input.rss.channel[0] &&
input.rss.channel[0].item) {

list = input.rss.channel[0].item;
j = list.length;
for( ; i<j; i++) {
var item = list[i];
if( $.trim( item.title ) ){
output.push({
date: new Date(item.pubDate),
config: config,
html: $.tmpl( template.wall_post, item )
});
}
"use strict";

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

var template = $.extend({},
{
wall_post: 'posted <a href="${url}">${text}</a>'
},
config.template);

/**
* Parse the input from facebook
*/
var parseFacebooky = function(response) {
var output = [];

if (!response.posts || !response.posts.length) {
return output;
}
}
return output;
};

$.ajax({
url: 'https://facebooky.herokuapp.com/' + config.user,
success: function( data ) {
callback(parseFBPage(data));
}
});

// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
for (var i = 0 ;i < response.posts.length; i++){
var post = response.posts[i];

};
output.push({
"date": new Date(post.time * 1000),
"config": config,
"html": $.tmpl(template.wall_post, post)
});
}
callback(output);
};

$.ajax({
url: 'https://facebooky.herokuapp.com/page/' + config.user,
success: parseFacebooky
});

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

};
})(jQuery);

0 comments on commit d8ec650

Please sign in to comment.