Permalink
Browse files

v0.5.5 - Fix the facebook page feed

  • Loading branch information...
1 parent 4434931 commit d8ec650fd73d6314fdf391d370fe96b5bd175804 @christianvuerings committed Nov 22, 2015
Showing with 82 additions and 92 deletions.
  1. +37 −42 jquery.lifestream.js
  2. +2 −2 jquery.lifestream.min.js
  3. +1 −1 lifestream.jquery.json
  4. +1 −1 src/core.js
  5. +41 −46 src/services/facebook_page.js
View
@@ -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
@@ -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';
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -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": [
View
@@ -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
@@ -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.