Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix callback not fired #173

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions js/jquery.socialfeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ if (typeof Object.create !== 'function') {
utility: {
getPosts: function(json) {
if (json) {
if(json.length<options.twitter.limit)
posts_to_load_count -= options.twitter.limit - json.length;
$.each(json, function() {
var element = this;
var post = new SocialFeedPost('twitter', Feed.twitter.utility.unifyPostData(element));
Expand Down Expand Up @@ -355,6 +357,8 @@ if (typeof Object.create !== 'function') {
},
getPosts: function(json) {
if (json['data']) {
if(json['data'].length<options.facebook.limit)
posts_to_load_count -= options.facebook.limit - json['data'].length;
json['data'].forEach(function(element) {
var post = new SocialFeedPost('facebook', Feed.facebook.utility.unifyPostData(element));
post.render();
Expand Down Expand Up @@ -410,6 +414,8 @@ if (typeof Object.create !== 'function') {
utility: {
getPosts: function(json) {
if (json.items) {
if(json.items.length<options.google.limit)
posts_to_load_count -= options.google.limit - json.items.length;
$.each(json.items, function(i) {
var post = new SocialFeedPost('google', Feed.google.utility.unifyPostData(json.items[i]));
post.render();
Expand Down Expand Up @@ -498,6 +504,8 @@ if (typeof Object.create !== 'function') {
utility: {
getImages: function(json) {
if (json.data) {
if(json.data.length<options.instagram.limit)
posts_to_load_count -= options.instagram.limit - json.data.length;
json.data.forEach(function(element) {
var post = new SocialFeedPost('instagram', Feed.instagram.utility.unifyPostData(element));
post.render();
Expand Down Expand Up @@ -561,6 +569,8 @@ if (typeof Object.create !== 'function') {
utility: {
getPosts: function(json) {
if (json.response) {
if(json.response.length<options.vk.limit)
posts_to_load_count -= options.vk.limit - json.response.length;
$.each(json.response, function() {
if (this != parseInt(this) && this.post_type === 'post') {
var owner_id = (this.owner_id) ? this.owner_id : this.from_id,
Expand Down Expand Up @@ -690,10 +700,14 @@ if (typeof Object.create !== 'function') {
utility: {

getPosts: function(json) {
json.data.forEach(function(element) {
var post = new SocialFeedPost('pinterest', Feed.pinterest.utility.unifyPostData(element));
post.render();
});
if(json.data) {
if(json.data.length<options.pinterest.limit)
posts_to_load_count -= options.pinterest.limit - json.data.length;
json.data.forEach(function(element) {
var post = new SocialFeedPost('pinterest', Feed.pinterest.utility.unifyPostData(element));
post.render();
});
}
},

unifyPostData: function(element){
Expand Down Expand Up @@ -732,6 +746,8 @@ if (typeof Object.create !== 'function') {

getPosts: function(json) {
console.log(json);
if(json.query.count < options.rss.limit)
posts_to_load_count -= options.rss.limit - json.query.count;
if (json.query.count > 0 ){
$.each(json.query.results.feed, function(index, element) {
var post = new SocialFeedPost('rss', Feed.rss.utility.unifyPostData(index, element));
Expand Down