"function"!==typeof Object.create&&(Object.create=function(e){function m(){}m.prototype=e;return new m}); (function(e,m,u,n){e.fn.socialfeed=function(m){function g(a,b){this.content=b;this.content.social_network=a;this.content.attachment=this.content.attachment===n?"":this.content.attachment;this.content.time_ago=b.dt_create.fromNow();this.content.date=b.dt_create.format(c.date_format);this.content.dt_create=this.content.dt_create.valueOf();this.content.text=f.wrapLinks(f.shorten(b.message+" "+b.description),b.social_network);this.content.moderation_passed=c.moderation?c.moderation(this.content):!0;d[a].posts.push(this)} var c=e.extend({plugin_folder:"",template:"template.html",show_media:!1,media_min_width:300,length:500,date_format:"ll"},m),k=e(this),r="facebook instagram vk google blogspot twitter pinterest rss youtube".split(" "),p=0,t=0;(function(){r.forEach(function(a){c[a]&&(p=c[a].accounts?p+c[a].limit*c[a].accounts.length:p+c[a].limit)})})();var f={request:function(a,b){e.ajax({url:a,dataType:"jsonp",success:b})},get_request:function(a,b){e.get(a,b,"json")},wrapLinks:function(a,b){var c=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; return a="google-plus"===b?a.replace(/(@|#)([a-z0-9_]+['])/ig,f.wrapGoogleplusTagTemplate):a.replace(c,f.wrapLinkTemplate)},wrapLinkTemplate:function(a){return''+a+""},wrapGoogleplusTagTemplate:function(a){return''+a+""},shorten:function(a){a=e.trim(a);return a.length>c.length?jQuery.trim(a).substring(0,c.length).split(" ").slice(0,-1).join(" ")+"...":a},stripHTML:function(a){return"undefined"===typeof a|| null===a?"":a.replace(/(<([^>]+)>)|nbsp;|\s{2,}|/ig,"")}};g.prototype={render:function(){"google"==this.content.social_network&&(this.content.social_network="google-plus");var a=d.template(this.content),b=this.content;if(0!==e(k).children("[social-feed-id="+b.id+"]").length)return!1;if(0===e(k).children().length)e(k).append(a);else{var l=0,h=-1;e.each(e(k).children(),function(){if(e(this).attr("dt-create")');return b}}},facebook:{posts:[],graph:"https://graph.facebook.com/",loaded:!1,getData:function(a){var b=function(a){f.request(a,d.facebook.utility.getPosts)},l="?fields=id,from,name,message,created_time,story,description,link", l=l+(!0===c.show_media?",picture,object_id":""),e,g="&limit="+c.facebook.limit,k="&access_token="+c.facebook.access_token+"&callback=?";switch(a[0]){case "@":a=a.substr(1);d.facebook.utility.getUserId(a,function(a){""!==a.id&&(e=d.facebook.graph+"v2.4/"+a.id+"/posts"+l+g+k,b(e))});break;case "!":a=a.substr(1);e=d.facebook.graph+"v2.4/"+a+"/feed"+l+g+k;b(e);break;default:b(e)}},utility:{getUserId:function(a,b){e.get("https://graph.facebook.com/"+a+"?"+("&access_token="+c.facebook.access_token+"&callback=?"), b,"json")},prepareAttachment:function(a){var b=a.picture;-1===b.indexOf("_b.")&&(-1!==b.indexOf("safe_image.php")?b=d.facebook.utility.getExternalImageURL(b,"url"):-1!==b.indexOf("app_full_proxy.php")?b=d.facebook.utility.getExternalImageURL(b,"src"):a.object_id&&(b=d.facebook.graph+a.object_id+"/picture/?type=normal"));return''},getExternalImageURL:function(a,b){a=decodeURIComponent(a).split(b+"=")[1];return-1===a.indexOf("fbcdn-sphotos")?a.split("&")[0]:a}, getPosts:function(a){a.data&&a.data.forEach(function(a){(new g("facebook",d.facebook.utility.unifyPostData(a))).render()})},unifyPostData:function(a){var b={},l=a.message?a.message:a.story;b.id=a.id;b.dt_create=moment(a.created_time);b.author_link="http://facebook.com/"+a.from.id;b.author_picture=d.facebook.graph+a.from.id+"/picture";b.author_name=a.from.name;b.name=a.name||"";b.message=l?l:"";b.description=a.description?a.description:"";b.link=a.link?a.link:"http://facebook.com/"+a.from.id;!0=== c.show_media&&a.picture&&(a=d.facebook.utility.prepareAttachment(a))&&(b.attachment=a);return b}}},google:{posts:[],loaded:!1,api:"https://www.googleapis.com/plus/v1/",getData:function(a){switch(a[0]){case "#":a=a.substr(1);a=d.google.api+"activities?query="+a+"&key="+c.google.access_token+"&maxResults="+c.google.limit;f.get_request(a,d.google.utility.getPosts);break;case "@":a=a.substr(1),a=d.google.api+"people/"+a+"/activities/public?key="+c.google.access_token+"&maxResults="+c.google.limit,f.get_request(a, d.google.utility.getPosts)}},utility:{getPosts:function(a){a.items&&e.each(a.items,function(b){(new g("google",d.google.utility.unifyPostData(a.items[b]))).render()})},unifyPostData:function(a){var b={};b.id=a.id;b.attachment="";b.description="";b.dt_create=moment(a.published);b.author_link=a.actor.url;b.author_picture=a.actor.image.url;b.author_name=a.actor.displayName;!0===c.show_media&&a.object.attachments&&e.each(a.object.attachments,function(){var a="";this.fullImage?a=this.fullImage.url:("album"=== this.objectType&&this.thumbnails&&0'});b.message=a.title;b.link=a.url;return b}}},youtube:{posts:[],loaded:!1,api:"https://www.googleapis.com/youtube/v3/",getData:function(a){f.get_request(d.youtube.api+"search?part=snippet,id&order=date&channelId="+a+"&key="+c.youtube.access_token+ "&maxResults="+c.youtube.limit,d.youtube.utility.getVideos)},utility:{getVideos:function(a){a.items&&e.each(a.items,function(b){(new g("youtube",d.youtube.utility.unifyPostData(a.items[b]))).render()})},unifyPostData:function(a){var b={};b.channelId=a.snippet.channelId;b.id=a.id.videoId;b.attachment="";b.description=a.snippet.description;b.dt_create=moment(a.snippet.publishedAt);b.author_link="https://www.youtube.com/channel/"+b.channelId;b.author_name=a.snippet.channelTitle;!0===c.show_media&&a.snippet.thumbnails&& e.each(a.snippet.thumbnails,function(){b.attachment=''});b.message=a.snippet.title;b.link="https://www.youtube.com/watch?v="+b.id;channel_url=d.youtube.api+"channels?part=snippet&id="+b.channelId+"&key="+c.youtube.access_token;e.ajax({url:channel_url,success:function(a){b.author_picture=a.items[0].snippet.thumbnails.high.url},dataType:"json",async:!1});return b}}},instagram:{posts:[],api:"https://api.instagram.com/v1/", loaded:!1,accessType:function(){if("undefined"===typeof c.instagram.access_token&&"undefined"===typeof c.instagram.client_id)return console.log("You need to define a client_id or access_token to authenticate with Instagram's API."),n;c.instagram.access_token&&(c.instagram.client_id=n);c.instagram.access_type="undefined"===typeof c.instagram.client_id?"access_token":"client_id";return c.instagram.access_type},getData:function(a){var b;"undefined"!==this.accessType()&&(b=c.instagram.access_type+"="+ c.instagram[c.instagram.access_type]);switch(a[0]){case "@":a=a.substr(1);b=d.instagram.api+"users/search/?q="+a+"&"+b+"&count=1&callback=?";f.request(b,d.instagram.utility.getUsers);break;case "#":a=a.substr(1);b=d.instagram.api+"tags/"+a+"/media/recent/?"+b+"&count="+c.instagram.limit+"&callback=?";f.request(b,d.instagram.utility.getImages);break;case "&":a=a.substr(1),b=d.instagram.api+"users/"+a+"/?"+b+"&count="+c.instagram.limit+"&callback=?",f.request(b,d.instagram.utility.getUsers)}},utility:{getImages:function(a){a.data&& a.data.forEach(function(a){(new g("instagram",d.instagram.utility.unifyPostData(a))).render()})},getUsers:function(a){if("undefined"!==c.instagram.access_type)var b=c.instagram.access_type+"="+c.instagram[c.instagram.access_type];jQuery.isArray(a.data)||(a.data=[a.data]);a.data.forEach(function(a){f.request(d.instagram.api+"users/"+a.id+"/media/recent/?"+b+"&count="+c.instagram.limit+"&callback=?",d.instagram.utility.getImages)})},unifyPostData:function(a){var b={};b.id=a.id;b.dt_create=moment(1E3* a.created_time);b.author_link="http://instagram.com/"+a.user.username;b.author_picture=a.user.profile_picture;b.author_name=a.user.full_name||a.user.username;b.message=a.caption&&a.caption?a.caption.text:"";b.description="";b.link=a.link;c.show_media&&(b.attachment='');return b}}},vk:{posts:[],loaded:!1,base:"http://vk.com/",api:"https://api.vk.com/method/",user_json_template:"https://api.vk.com/method/users.get?fields=first_name,%20last_name,%20screen_name,%20photo&uid=", group_json_template:"https://api.vk.com/method/groups.getById?fields=first_name,%20last_name,%20screen_name,%20photo&gid=",getData:function(a){switch(a[0]){case "@":a=a.substr(1);a=d.vk.api+"wall.get?owner_id="+a+"&filter="+c.vk.source+"&count="+c.vk.limit+"&callback=?";f.get_request(a,d.vk.utility.getPosts);break;case "#":a=a.substr(1),a=d.vk.api+"newsfeed.search?q="+a+"&count="+c.vk.limit+"&callback=?",f.get_request(a,d.vk.utility.getPosts)}},utility:{getPosts:function(a){a.response&&e.each(a.response, function(){if(this!=parseInt(this)&&"post"===this.post_type){var b=this.owner_id?this.owner_id:this.from_id,c=this;f.get_request(0'),"video"===b.attachment.type&&(h.attachment=''),"photo"===b.attachment.type&&(h.attachment=''));0
"+ stripHTML(this.content.$t);a.description="";a.link=this.link.pop().href;c.show_media&&this.media$thumbnail&&(a.attachment='');a.render()})}}},pinterest:{posts:[],loaded:!1,apiv1:"https://api.pinterest.com/v1/",getData:function(a){var b,e="fields=id,created_at,link,note,creator(url,first_name,last_name,image),image&access_token="+c.pinterest.access_token+"&"+("limit="+c.pinterest.limit)+"&callback=?";switch(a[0]){case "@":a=a.substr(1),b= "me"===a?d.pinterest.apiv1+"me/pins/?"+e:d.pinterest.apiv1+"boards/"+a+"/pins?"+e}f.request(b,d.pinterest.utility.getPosts)},utility:{getPosts:function(a){a.data.forEach(function(a){(new g("pinterest",d.pinterest.utility.unifyPostData(a))).render()})},unifyPostData:function(a){var b={};b.id=a.id;b.dt_create=moment(a.created_at);b.author_link=a.creator.url;b.author_picture=a.creator.image["60x60"].url;b.author_name=a.creator.first_name+a.creator.last_name;b.message=a.note;b.description="";b.social_network= "pinterest";b.link=a.link?a.link:"https://www.pinterest.com/pin/"+a.id;c.show_media&&(b.attachment='');return b}}},rss:{posts:[],loaded:!1,api:"https://ajax.googleapis.com/ajax/services/feed/load?v=1.0",getData:function(a){a=d.rss.api+("&num="+c.rss.limit)+"&q="+encodeURIComponent(a);f.request(a,d.rss.utility.getPosts)},utility:{getPosts:function(a){e.each(a.responseData.feed.entries,function(a,c){(new g("rss",d.rss.utility.unifyPostData(a, c))).render()})},unifyPostData:function(a,b){var d={};d.id=a;d.dt_create=moment(b.publishedDate,"ddd, DD MMM YYYY HH:mm:ss ZZ","en");d.author_link="";d.author_picture="";d.author_name=b.author;d.message=f.stripHTML(b.title);d.description=f.stripHTML(b.content);d.social_network="rss";d.link=b.link;c.show_media&&b.mediaGroups&&(d.attachment='');return d}}}};return this.each(function(){d.init();c.update_period&&setInterval(function(){return d.init()}, c.update_period)})}})(jQuery);