/* jquery.instagramFeed @version 1.2.1 @author Javier Sanahuja Liebana @contributor csanahuja https://github.com/jsanahuja/jquery.instagramFeed */ !function(e){var a={host:"https://www.instagram.com/",username:"",tag:"",container:"",display_profile:!0,display_biography:!0,display_gallery:!0,display_igtv:!1,get_data:!1,callback:null,styling:!0,items:8,items_per_row:4,margin:.5,image_size:640},r={150:0,240:1,320:2,480:3,640:4};e.fn.instagramFeed=function(i){var t=e.fn.extend({},a,i);if(""==t.username&&""==t.tag)return console.error("Instagram Feed: Error, no username or tag found."),!1;if(void 0!==t.get_raw_json&&(console.warn("Instagram Feed: get_raw_json is deprecated. See use get_data instead"),t.get_data=t.get_raw_json),!t.get_data&&""==t.container)return console.error("Instagram Feed: Error, no container found."),!1;if(t.get_data&&null==t.callback)return console.error("Instagram Feed: Error, no callback defined to get the raw json"),!1;var n=""==t.username,s=n?t.host+"explore/tags/"+t.tag:t.host+t.username;return this.each(function(){var a=this;return e.get(s,function(i){if(i=i.split("window._sharedData = ")[1].split("<\/script>")[0],i=(i=(i=JSON.parse(i.substr(0,i.length-1))).entry_data.ProfilePage||i.entry_data.TagPage)[0].graphql.user||i[0].graphql.hashtag,t.get_data)t.callback(i,a);else{var s={profile_container:"",profile_image:"",profile_name:"",profile_biography:"",gallery_image:""};if(t.styling){s.profile_container=" style='text-align:center;'",s.profile_image=" style='border-radius:10em;width:15%;max-width:125px;min-width:50px;'",s.profile_name=" style='font-size:1.2em;'",s.profile_biography=" style='font-size:1em;'";var o=(100-2*t.margin*t.items_per_row)/t.items_per_row;s.gallery_image=" style='margin:"+t.margin+"% "+t.margin+"%;width:"+o+"%;float:left;'"}var l="";t.display_profile&&(l+="
",l+=""+(n?i.name+" tag pic":i.username+" profile pic")+"",l+=n?"

#"+t.tag+"

":"

@"+i.full_name+" (@"+t.username+")

",!n&&t.display_biography&&(l+="

"+i.biography+"

"),l+="
");var g=void 0!==r[t.image_size]?r[t.image_size]:r[640];if(t.display_gallery)if(void 0!==i.is_private&&!0===i.is_private)l+="

This profile is private

";else{var _=(i.edge_owner_to_timeline_media||i.edge_hashtag_to_media).edges;h=_.length>t.items?t.items:_.length,l+=""}if(t.display_igtv&&void 0!==i.edge_felix_video_timeline){var f=i.edge_felix_video_timeline.edges,h=f.length>t.items?t.items:f.length;if(f.length>0){l+="
";for(m=0;m",l+=""+t.username+" instagram image "+m+"",l+="";l+="
"}}e(t.container).html(l)}}).fail(function(e){console.error("Instagram Feed: Unable to fetch the given user/tag. Instagram responded with the status code: ",e.status)}),!0})}}(jQuery);