diff --git a/.gitignore b/.gitignore
index 94cfa74..afdd652 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
+.gitignore
/sass/.sass-cache
-.idea/
\ No newline at end of file
+.idea/
+*example*
+bower_components
diff --git a/README.md b/README.md
index 3026b7b..4882f02 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# Social-feed
+[![Join the chat at https://gitter.im/pavelk2/social-feed](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pavelk2/social-feed?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Code Climate](https://codeclimate.com/github/pavelk2/social-feed/badges/gpa.svg)](https://codeclimate.com/github/pavelk2/social-feed)
The jQuery plugin which shows user feeds from the most popular social networks.
@@ -186,4 +187,4 @@ If you use this plugin, please ';
},
@@ -355,8 +347,8 @@ if (typeof Object.create !== 'function') {
},
getPosts: function(json) {
- if (json['data']) {
- json['data'].forEach(function(element) {
+ if (json.data) {
+ json.data.forEach(function(element) {
var post = new SocialFeedPost('facebook', Feed.facebook.utility.unifyPostData(element));
post.render();
});
@@ -471,11 +463,11 @@ if (typeof Object.create !== 'function') {
return options.instagram.access_type;
},
getData: function(account) {
- var url;
+ var url, authTokenParams;
// API endpoint URL depends on which authentication type we're using.
if (this.accessType() !== 'undefined') {
- var authTokenParams = options.instagram.access_type + '=' + options.instagram[options.instagram.access_type];
+ authTokenParams = options.instagram.access_type + '=' + options.instagram[options.instagram.access_type];
}
switch (account[0]) {
@@ -506,12 +498,13 @@ if (typeof Object.create !== 'function') {
}
},
getUsers: function(json) {
+ var authTokenParams;
// API endpoint URL depends on which authentication type we're using.
if (options.instagram.access_type !== 'undefined') {
- var authTokenParams = options.instagram.access_type + '=' + options.instagram[options.instagram.access_type];
+ authTokenParams = options.instagram.access_type + '=' + options.instagram[options.instagram.access_type];
}
- if (!jQuery.isArray(json.data)) json.data = [json.data]
+ if (!jQuery.isArray(json.data)){json.data = [json.data];}
json.data.forEach(function(user) {
var url = Feed.instagram.api + 'users/' + user.id + '/media/recent/?' + authTokenParams + '&' + 'count=' + options.instagram.limit + '&callback=?';
Utility.request(url, Feed.instagram.utility.getImages);
@@ -563,7 +556,7 @@ if (typeof Object.create !== 'function') {
getPosts: function(json) {
if (json.response) {
$.each(json.response, function() {
- if (this != parseInt(this) && this.post_type === 'post') {
+ if (this !== parseInt(this) && this.post_type === 'post') {
var owner_id = (this.owner_id) ? this.owner_id : this.from_id,
vk_wall_owner_url = (owner_id > 0) ? (Feed.vk.user_json_template + owner_id + '&callback=?') : (Feed.vk.group_json_template + (-1) * owner_id + '&callback=?'),
element = this;
@@ -583,12 +576,13 @@ if (typeof Object.create !== 'function') {
post.message = Utility.stripHTML(element.text);
if (options.show_media) {
if (element.attachment) {
- if (element.attachment.type === 'link')
+ if (element.attachment.type === 'link'){
post.attachment = '';
- if (element.attachment.type === 'video')
+ }else if (element.attachment.type === 'video'){
post.attachment = '';
- if (element.attachment.type === 'photo')
+ }else if (element.attachment.type === 'photo'){
post.attachment = '';
+ }
}
}
@@ -634,7 +628,7 @@ if (typeof Object.create !== 'function') {
case '@':
var username = account.substr(1);
url = 'http://' + username + '.blogspot.com/feeds/posts/default?alt=json-in-script&callback=?';
- request(url, getPosts);
+ Utility.request(url, Feed.blogpost.utility.getPosts);
break;
default:
}
@@ -644,18 +638,18 @@ if (typeof Object.create !== 'function') {
$.each(json.feed.entry, function() {
var post = {},
element = this;
- post.id = element.id['$t'].replace(/[^a-z0-9]/gi, '');
- post.dt_create = moment((element.published['$t']));
- post.author_link = element.author[0]['uri']['$t'];
- post.author_picture = 'http:' + element.author[0]['gd$image']['src'];
- post.author_name = element.author[0]['name']['$t'];
- post.message = element.title['$t'] + '' + stripHTML(element.content['$t']);
+ post.id = element.id.$t.replace(/[^a-z0-9]/gi, '');
+ post.dt_create = moment((element.published.$t));
+ post.author_link = element.author[0].uri.$t;
+ post.author_picture = 'http:' + element.author[0].gd$image.src;
+ post.author_name = element.author[0].name.$t;
+ post.message = element.title.$t + '' + Utility.stripHTML(element.content.$t);
post.description = '';
post.link = element.link.pop().href;
if (options.show_media) {
- if (element['media$thumbnail']) {
- post.attachment = '';
+ if (element.media$thumbnail) {
+ post.attachment = '';
}
}
@@ -710,7 +704,7 @@ if (typeof Object.create !== 'function') {
post.social_network = 'pinterest';
post.link = element.link ? element.link : 'https://www.pinterest.com/pin/' + element.id;
if (options.show_media) {
- post.attachment = '';
+ post.attachment = '';
}
return post;
}
@@ -784,7 +778,7 @@ if (typeof Object.create !== 'function') {
return Feed.init();
}, options.update_period);
}
- })
+ });
};
})(jQuery);