1var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false; 2if(!sbi_js_exists){ 3 4 (function(){var e,t;e=function(){function e(e,t){var n,r;this.options={target:"instafeed",get:"popular",resolution:"thumbnail",sortBy:"none",links:!0,mock:!1,useHttp:!1};if(typeof e=="object")for(n in e)r=e[n],this.options[n]=r;this.context=t!=null?t:this,this.unique=this._genKey()}return e.prototype.hasNext=function(){return typeof this.context.nextUrl=="string"&&this.context.nextUrl.length>0},e.prototype.next=function(){return this.hasNext()?this.run(this.context.nextUrl):!1},e.prototype.run=function(t){var n,r,i;if(typeof this.options.clientId!="string"&&typeof this.options.accessToken!="string")throw new Error("Missing clientId or accessToken.");if(typeof this.options.accessToken!="string"&&typeof this.options.clientId!="string")throw new Error("Missing clientId or accessToken.");return this.options.before!=null&&typeof this.options.before=="function"&&this.options.before.call(this),typeof document!="undefined"&&document!==null&&(i=document.createElement("script"),i.id="instafeed-fetcher",i.src=t||this._buildUrl(),n=document.getElementsByTagName("head"),n[0].appendChild(i),r="instafeedCache"+this.unique,window[r]=new e(this.options,this),window[r].unique=this.unique),!0},e.prototype.parse=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S;if(typeof e!="object"){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"Invalid JSON data"),!1;throw new Error("Invalid JSON response")}if(e.meta.code!==200){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,e.meta.error_message),!1;throw new Error("Error from Instagram: "+e.meta.error_message)}if(e.data.length===0){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"No images were returned from Instagram"),!1;throw new Error("No images were returned from Instagram")}this.options.success!=null&&typeof this.options.success=="function"&&this.options.success.call(this,e),this.context.nextUrl="",e.pagination!=null&&(this.context.nextUrl=e.pagination.next_url);if(this.options.sortBy!=="none"){this.options.sortBy==="random"?d=["","random"]:d=this.options.sortBy.split("-"),p=d[0]==="least"?!0:!1;switch(d[1]){case"random":e.data.sort(function(){return.5-Math.random()});break;case"recent":e.data=this._sortBy(e.data,"created_time",p);break;case"liked":e.data=this._sortBy(e.data,"likes.count",p);break;case"commented":e.data=this._sortBy(e.data,"comments.count",p);break;default:throw new Error("Invalid option for sortBy: '"+this.options.sortBy+"'.")}}if(typeof document!="undefined"&&document!==null&&this.options.mock===!1){a=e.data,this.options.limit!=null&&a.length>this.options.limit&&(a=a.slice(0,this.options.limit+1||9e9)),n=document.createDocumentFragment(),this.options.filter!=null&&typeof this.options.filter=="function"&&(a=this._filter(a,this.options.filter));if(this.options.template!=null&&typeof this.options.template=="string"){i="",o="",l="",v=document.createElement("div");for(m=0,b=a.length;m<b;m++)s=a[m],u=s.images[this.options.resolution].url,this.options.useHttp||(u=u.replace("http://","//")),o=this._makeTemplate(this.options.template,{model:s,id:s.id,link:s.link,image:u,caption:this._getObjectProperty(s,"caption.text"),likes:s.likes.count,comments:s.comments.count,location:this._getObjectProperty(s,"location.name")}),i+=o;v.innerHTML=i,S=[].slice.call(v.childNodes);for(g=0,w=S.length;g<w;g++)h=S[g],n.appendChild(h)}else for(y=0,E=a.length;y<E;y++)s=a[y],f=document.createElement("img"),u=s.images[this.options.resolution].url,this.options.useHttp||(u=u.replace("http://","//")),f.src=u,this.options.links===!0?(t=document.createElement("a"),t.href=s.link,t.appendChild(f),n.appendChild(t)):n.appendChild(f);this.options.target.append(n),r=document.getElementsByTagName("head")[0],r.removeChild(document.getElementById("instafeed-fetcher")),c="instafeedCache"+this.unique,window[c]=void 0;try{delete window[c]}catch(x){}}return this.options.after!=null&&typeof this.options.after=="function"&&this.options.after.call(this),!0},e.prototype._buildUrl=function(){var e,t,n;e="https://api.instagram.com/v1";switch(this.options.get){case"popular":t="media/popular";break;case"tagged":if(typeof this.options.tagName!="string")throw new Error("No tag name specified. Use the 'tagName' option.");t="tags/"+this.options.tagName+"/media/recent";break;case"location":if(typeof this.options.locationId!="number")throw new Error("No location specified. Use the 'locationId' option.");t="locations/"+this.options.locationId+"/media/recent";break;case"user":if(typeof this.options.userId!="number")throw new Error("No user specified. Use the 'userId' option.");
4if(typeof this.options.accessToken!="string")throw new Error("No access token. Use the 'accessToken' option.");t="users/"+this.options.userId+"/media/recent";break;default:throw new Error("Invalid option for get: '"+this.options.get+"'.")}return n=""+e+"/"+t,this.options.accessToken!=null?n+="?access_token="+this.options.accessToken:n+="?client_id="+this.options.clientId,this.options.limit!=null&&(n+="&count="+this.options.limit),n+="&callback=instafeedCache"+this.unique+".parse",n},e.prototype._genKey=function(){var e;return e=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},""+e()+e()+e()+e()},e.prototype._makeTemplate=function(e,t){var n,r,i,s,o;r=/(?:\{{2})([\w\[\]\.]+)(?:\}{2})/,n=e;while(r.test(n))i=n.match(r)[1],s=(o=this._getObjectProperty(t,i))!=null?o:"",n=n.replace(r,""+s);return n},e.prototype._getObjectProperty=function(e,t){var n,r;t=t.replace(/\[(\w+)\]/g,".$1"),r=t.split(".");while(r.length){n=r.shift();if(!(e!=null&&n in e))return null;e=e[n]}return e},e.prototype._sortBy=function(e,t,n){var r;return r=function(e,r){var i,s;return i=this._getObjectProperty(e,t),s=this._getObjectProperty(r,t),n?i>s?1:-1:i<s?1:-1},e.sort(r.bind(this)),e},e.prototype._filter=function(e,t){var n,r,i,s,o;n=[],i=function(e){if(t(e))return n.push(e)};for(s=0,o=e.length;s<o;s++)r=e[s],i(r);return n},e}(),t=typeof exports!="undefined"&&exports!==null?exports:window,t.instagramfeed=e}).call(this); 5 6 //Shim for "fixing" IE's lack of support (IE < 9) for applying slice on host objects like NamedNodeMap, NodeList, and HTMLCollection) https://github.com/stevenschobert/instafeed.js/issues/84 7 (function(){"use strict";var e=Array.prototype.slice;try{e.call(document.documentElement)}catch(t){Array.prototype.slice=function(t,n){n=typeof n!=="undefined"?n:this.length;if(Object.prototype.toString.call(this)==="[object Array]"){return e.call(this,t,n)}var r,i=[],s,o=this.length;var u=t||0;u=u>=0?u:o+u;var a=n?n:o;if(n<0){a=o+n}s=a-u;if(s>0){i=new Array(s);if(this.charAt){for(r=0;r<s;r++){i[r]=this.charAt(u+r)}}else{for(r=0;r<s;r++){i[r]=this[u+r]}}}return i}}})() 8 9 //IE8 also doesn't offer the .bind() method triggered by the 'sortBy' property. Copy and paste the polyfill offered here: 10 if(!Function.prototype.bind){Function.prototype.bind=function(e){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable")}var t=Array.prototype.slice.call(arguments,1),n=this,r=function(){},i=function(){return n.apply(this instanceof r&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};r.prototype=this.prototype;i.prototype=new r;return i}} 11 12 function sbi_init(){ 13 14 jQuery('#sb_instagram.sbi').each(function(){ 15 16 var $self = jQuery(this), 17 $target = $self.find('#sbi_images'), 18 $loadBtn = $self.find("#sbi_load .sbi_load_btn"), 19 imgRes = 'standard_resolution', 20 cols = parseInt( this.getAttribute('data-cols'), 10 ), 21 num = this.getAttribute('data-num'), 22 //Convert styles JSON string to an object 23 feedOptions = JSON.parse( this.getAttribute('data-options') ), 24 getType = 'user', 25 sortby = 'none', 26 user_id = this.getAttribute('data-id'), 27 num = this.getAttribute('data-num'), 28 posts_arr = [], 29 $header = '', 30 morePosts = []; //Used to determine whether to show the Load More button when displaying posts from more than one id/hashtag. If one of the ids/hashtags has more posts then still show button. 31 32 if( feedOptions.sortby !== '' ) sortby = feedOptions.sortby; 33 34 switch( this.getAttribute('data-res') ) { 35 case 'auto': 36 var feedWidth = $self.innerWidth(), 37 colWidth = $self.innerWidth() / cols; 38 39 //Check if page width is less than 640. If it is then use the script above 40 var sbiWindowWidth = jQuery(window).width(); 41 if( sbiWindowWidth < 640 ){ 42 //Need this for mobile so that image res is right on mobile, as the number of cols isn't always accurate on mobile as they are changed using CSS 43 if( feedWidth < 640 && $self.is('.sbi_col_3, .sbi_col_4, .sbi_col_5, .sbi_col_6') ) colWidth = 300; //Use medium images 44 if( feedWidth < 640 && $self.is('.sbi_col_7, .sbi_col_8, .sbi_col_9, .sbi_col_10') ) colWidth = 100; //Use thumbnail images 45 if( (feedWidth > 320 && feedWidth < 480) && sbiWindowWidth < 480 ) colWidth = 480; //Use full size images 46 if( feedWidth < 320 && sbiWindowWidth < 480 ) colWidth = 300; //Use medium size images 47 } 48 49 if( colWidth < 150 ){ 50 imgRes = 'thumbnail'; 51 } else if( colWidth < 320 ){ 52 imgRes = 'low_resolution'; 53 } else { 54 imgRes = 'standard_resolution'; 55 } 56
57 //If the feed is hidden (eg; in a tab) then the width is returned as 100, and so auto set the res to be medium to cover most bases 58 if( feedWidth <= 100 ) imgRes = 'low_resolution'; 59 60 break; 61 case 'thumb': 62 imgRes = 'thumbnail'; 63 break; 64 case 'medium': 65 imgRes = 'low_resolution'; 66 break; 67 default: 68 imgRes = 'standard_resolution'; 69 } 70 71 //Split comma separated hashtags into array 72 var ids_arr = user_id.replace(/ /g,'').split(","); 73 var looparray = ids_arr; 74 75 //Get page info for first User ID 76 var headerStyles = '', 77 sbi_page_url = 'https://api.instagram.com/v1/users/' + ids_arr[0] + '?access_token=' + sb_instagram_js_options.sb_instagram_at; 78 79 if(feedOptions.headercolor.length) headerStyles = 'style="color: #'+feedOptions.headercolor+'"'; 80 81 jQuery.ajax({ 82 method: "GET", 83 url: sbi_page_url, 84 dataType: "jsonp", 85 success: function(data) { 86 $header = '<a href="http://instagram.com/'+data.data.username+'" target="_blank" title="@'+data.data.username+'" class="sbi_header_link">'; 87 $header += '<div class="sbi_header_text">'; 88 $header += '<h3 ' + headerStyles; 89 if( data.data.bio.length == 0 ) $header += ' class="sbi_no_bio"'; 90 $header += '>
90@'+data.data.username+'</h3>'; 91 if( data.data.bio.length ) $header += '<p class="sbi_bio" '+headerStyles+'>'+data.data.bio+'</p>'; 92 $header += '</div>'; 93 $header += '<div class="sbi_header_img">'; 94 $header += '<div class="sbi_header_img_hover"><i class="fa fa-instagram"></i></div>'; 95 $header += '<img src="'+data.data.profile_picture+'" alt="'+data.data.full_name+'" width="50" height="50">'; 96 $header += '</div>'; 97 $header += '</a>'; 98 //Add the header 99 $self.find('.sb_instagram_header').prepend( $header ); 100 //Change the URL of the follow button 101 if( $self.find('.sbi_follow_btn').length ) $self.find('.sbi_follow_btn a').attr('href', 'http://instagram.com/' + data.data.username ) 102 } 103 }); 104 105 //Loop through User IDs 106 jQuery.each( looparray, function( index, entry ) { 107 108 var userFeed = new instagramfeed({ 109 target: $target, 110 get: getType, 111 sortBy: sortby, 112 resolution: imgRes, 113 limit: parseInt( num, 10 ), 114 template: '<div class="sbi_item sbi_type_{{model.type}} sbi_new" id="sbi_{{id}}" data-date="{{model.created_time_raw}}"><div class="sbi_photo_wrap"><a class="sbi_photo" href="{{link}}" target="_blank"><img src="{{image}}" alt="{{caption}}" /></a></div></div>', 115 filter: function(image) { 116 //Create time for sorting 117 var date = new Date(image.created_time*1000), 118 time = date.getTime(); 119 image.created_time_raw = time; 120 121 //Replace double quotes in the captions with the HTML symbol 122 //Always check to make sure it exists 123 if(image.caption != null) image.caption.text = image.caption.text.replace(/"/g, """); 124 125 return true; 126 }, 127 userId: parseInt( entry, 10 ), 128 accessToken: sb_instagram_js_options.sb_instagram_at, 129 after: function() { 130 131 $self.find('.sbi_loader').remove(); 132 133 /* Load more button */ 134 if (this.hasNext()) morePosts.push('1'); 135 136 if(morePosts.length > 0){ 137 $loadBtn.show(); 138 } else { 139 $loadBtn.hide(); 140 $self.css('padding-bottom', 0); 141 } 142 143 144 // Call Custom JS if it exists 145 if (typeof sbi_custom_js == 'function') setTimeout(function(){ sbi_custom_js(); }, 100); 146 147 if( imgRes !== 'thumbnail' ){ 148 //This needs to be here otherwise it results in the following error for some sites: $self.find(...).sbi_imgLiquid() is not a function. 149 /*! imgLiquid v0.9.944 / 03-05-2013 https://github.com/karacas/imgLiquid */ 150 var sbi_imgLiquid=sbi_imgLiquid||{VER:"0.9.944"};sbi_imgLiquid.bgs_Available=!1,sbi_imgLiquid.bgs_CheckRunned=!1,function(i){function t(){if(!sbi_imgLiquid.bgs_CheckRunned){sbi_imgLiquid.bgs_CheckRunned=!0;var t=i('<span style="background-size:cover" />');i("body").append(t),!function(){var i=t[0];if(i&&window.getComputedStyle){var e=window.getComputedStyle(i,null);e&&e.backgroundSize&&(sbi_imgLiquid.bgs_Available="cover"===e.backgroundSize)}}(),t.remove()}}i.fn.extend({sbi_imgLiquid:function(e){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},t();var a=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(t){function e(){-1===u.css("background-image").indexOf(encodeURI(c.attr("src")))&&u.css({"background-image":'url("'+encodeURI(c.attr("src"))+'")'}),u.css({"background-size":g.fill?"cover":"contain","background-position":(g.horizontalAlign+" "+g.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",u).css({display:"block",width:"100%",height:"100%"}),i("img",u).css({display:"none"}),g.onItemFinish&&g.onItemFinish(t,u,c),u.addClass("sbi_imgLiquid_bgSize"),u.addClass("sbi_imgLiquid_ready"),l()}function o(){function e(){c.data("sbi_imgLiquid_error")||c.data("sbi_imgLiquid_loaded")||c.data("sbi_imgLiquid_oldProcessed")||(u.is(":visible")&&c[0].complete&&c[0].width>0&&c[0].height>0?(c.data("sbi_imgLiquid_loaded",!0),setTimeout(r,t*g.delay)):setTimeout(e,g.timecheckvisibility))}if(c.data("oldSrc")&&c.data("oldSrc")!==c.attr("src")){var a=c.clone().removeAttr("style");return a.data("sbi_imgLiquid_settings",c.data("sbi_imgLiquid_settings")),c.parent().prepend(a),c.remove(),c=a,c[0].width=0,void setTimeout(o,10)}return c.data("sbi_imgLiquid_oldProcessed")?void r():(c.data("sbi_imgLiquid_oldProcessed",!1),c.data("oldSrc",c.attr("src")),i("img:not(:first)",u).css("display","none"),u.css({overflow:"hidden"}),c.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),c.on("error",n),c[0].onerror=n,e(),void d())}function d(){(g.responsive||c.data("sbi_imgLiquid_oldProcessed"))&&c.data("sbi_imgLiquid_settings")&&(g=c.data("sbi_imgLiquid_settings"),u.actualSize=u.get(0).offsetWidth+u.get(0).offsetHeight/1e4,u.sizeOld&&u.actualSize!==u.sizeOld&&r(),u.sizeOld=u.actualSize,setTimeout(d,g.responsiveCheckTime))}function n(){c.data("sbi_imgLiquid_error",!0),u.addClass("sbi_imgLiquid_error"),g.onItemError&&g.onItemError(t,u,c),l()}function s(){var i={};if(a.settings.useDataHtmlAttr){var t=u.attr("data-sbi_imgLiquid-fill"),e=u.attr("data-sbi_imgLiquid-horizontalAlign"),o=u.attr("data-sbi_imgLiquid-verticalAlign");("true"===t||"false"===t)&&(i.fill=Boolean("true"===t)),void 0===e||"left"!==e&&"center"!==e&&"right"!==e&&-1===e.indexOf("%")||(i.horizontalAlign=e),void 0===o||"top"!==o&&"bottom"!==o&&"center"!==o&&-1===o.indexOf("%")||(i.verticalAlign=o)}return sbi_imgLiquid.isIE&&a.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}function r(){var i,e,a,o,d,n,s,r,m=0,h=0,f=u.width(),v=u.height();void 0===c.data("owidth")&&c.data("owidth",c[0].width),void 0===c.data("oheight")&&c.data("oheight",c[0].height),g.fill===f/v>=c.data("owidth")/c.data("oheight")?(i="100%",e="auto",a=Math.floor(f),o=Math.floor(f*(c.data("oheight")/c.data("owidth")))):(i="auto",e="
150100%",a=Math.floor(v*(c.data("owidth")/c.data("oheight"))),o=Math.floor(v)),d=g.horizontalAlign.toLowerCase(),s=f-a,"left"===d&&(h=0),"center"===d&&(h=.5*s),"right"===d&&(h=s),-1!==d.indexOf("%")&&(d=parseInt(d.replace("%",""),10),d>0&&(h=s*d*.01)),n=g.verticalAlign.toLowerCase(),r=v-o,"left"===n&&(m=0),"center"===n&&(m=.5*r),"bottom"===n&&(m=r),-1!==n.indexOf("%")&&(n=parseInt(n.replace("%",""),10),n>0&&(m=r*n*.01)),g.hardPixels&&(i=a,e=o),c.css({width:i,height:e,"margin-left":Math.floor(h),"margin-top":Math.floor(m)}),c.data("sbi_imgLiquid_oldProcessed")||(c.fadeTo(g.fadeInTime,1),c.data("sbi_imgLiquid_oldProcessed",!0),g.removeBoxBackground&&u.css("background-image","none"),u.addClass("sbi_imgLiquid_nobgSize"),u.addClass("sbi_imgLiquid_ready")),g.onItemFinish&&g.onItemFinish(t,u,c),l()}function l(){t===a.length-1&&a.settings.onFinish&&a.settings.onFinish()}var g=a.settings,u=i(this),c=i("img:first",u);return c.length?(c.data("sbi_imgLiquid_settings")?(u.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"),g=i.extend({},c.data("sbi_imgLiquid_settings"),a.options)):g=i.extend({},a.settings,s()),c.data("sbi_imgLiquid_settings",g),g.onItemStart&&g.onItemStart(t,u,c),void(sbi_imgLiquid.bgs_Available&&g.useBackgroundSize?e():o())):void n()})}})}(jQuery); 151 152 // Use imagefill to set the images as backgrounds so they can be square 153 !function () { 154 var css = sbi_imgLiquid.injectCss, 155 head = document.getElementsByTagName('head')[0], 156 style = document.createElement('style'); 157 style.type = 'text/css'; 158 if (style.styleSheet) { 159 style.styleSheet.cssText = css; 160 } else { 161 style.appendChild(document.createTextNode(css)); 162 } 163 head.appendChild(style); 164 }(); 165 $self.find(".sbi_photo").sbi_imgLiquid({fill:true}); 166 } // End: ( imgRes !== 'thumbnail' ) check 167 168 //Only check the width once the resize event is over 169 var sbi_delay = (function(){ 170 var sbi_timer = 0; 171 return function(sbi_callback, sbi_ms){ 172 clearTimeout (sbi_timer); 173 sbi_timer = setTimeout(sbi_callback, sbi_ms); 174 }; 175 })(); 176 177 jQuery(window).resize(function(){ 178 sbi_delay(function(){ 179 sbiSetPhotoHeight(); 180 }, 500); 181 }); 182 183 //Resize image height 184 function sbiSetPhotoHeight(){ 185 186 if( imgRes !== 'thumbnail' ){ 187 var sbi_photo_width = $self.find('.sbi_photo').eq(0).innerWidth(); 188 189 //Figure out number of columns for either desktop or mobile 190 var sbi_num_cols = parseInt(cols); 191 192 if( !$self.hasClass('sbi_disable_mobile') ){ 193 var sbiWindowWidth = jQuery(window).width(); 194 if( sbiWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7 ) ) sbi_num_cols = 2; 195 if( sbiWindowWidth < 640 && (parseInt(cols) > 6 && parseInt(cols) < 11 ) ) sbi_num_cols = 4; 196 if( sbiWindowWidth <= 480 && parseInt(cols) > 2 ) sbi_num_cols = 1; 197 } 198 199 //Figure out what the width should be using the number of cols 200 var sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - (feedOptions.imagepadding*2); 201 202 //If the width is less than it should be then set it manually 203 if( sbi_photo_width <= (sbi_photo_width_manual) ) sbi_photo_width = sbi_photo_width_manual; 204 205 $self.find('.sbi_photo').css('height', sbi_photo_width); 206 } 207 208 } 209 sbiSetPhotoHeight(); 210 211 /* Detect when element becomes visible. Used for when the feed
211is initially hidden, in a tab for example. https://github.com/shaunbowe/jquery.visibilityChanged */ 212 !function(i){var n={callback:function(){},runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},c={};c.sbiCheckVisibility=function(i,n){if(jQuery.contains(document,i[0])){var e=n.sbiPreviousVisibility,t=i.is(":visible");n.sbiPreviousVisibility=t,null==e?n.runOnLoad&&n.callback(i,t):e!==t&&n.callback(i,t),setTimeout(function(){c.sbiCheckVisibility(i,n)},n.frequency)}},i.fn.sbiVisibilityChanged=function(e){var t=i.extend({},n,e);return this.each(function(){c.sbiCheckVisibility(i(this),t)})}}(jQuery); 213 214 //If the feed is initially hidden (in a tab for example) then check for when it becomes visible and set then set the height 215 jQuery(".sbi").filter(':hidden').sbiVisibilityChanged({ 216 callback: function(element, visible) { 217 sbiSetPhotoHeight(); 218 }, 219 runOnLoad: false 220 }); 221 222 223 //Fade photos on hover 224 jQuery('#sb_instagram .sbi_photo').each(function(){ 225 jQuery(this).hover(function(){ 226 jQuery(this).fadeTo(200, 0.85); 227 }, function(){ 228 jQuery(this).stop().fadeTo(500, 1); 229 }); 230 }); 231 232 //Sort posts by date 233 //only sort the new posts that are loaded in, not the whole feed, otherwise some photos will switch positions due to dates 234 $self.find('#sbi_images .sbi_item.sbi_new').sort(function (a, b) { 235 var aComp = jQuery(a).data('date'), 236 bComp = jQuery(b).data('date'); 237 238 if(sortby == 'none'){ 239 //Order by date 240 return bComp - aComp; 241 } else { 242 //Randomize 243 return (Math.round(Math.random())-0.5); 244 } 245 246 }).appendTo( $self.find("#sbi_images") ); 247 248 //Remove the new class after 500ms, once the sorting is done 249 setTimeout(function(){ 250 jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new'); 251 //Reset the morePosts variable so we can check whether there are more posts every time the Load More button is clicked 252 morePosts = []; 253 }, 500); 254 255 256 }, // End 'after' function 257 error: function(data) { 258 var sbiErrorMsg = '', 259 sbiErrorDir = ''; 260 261 if( data.indexOf('access_token') > -1 ){ 262 sbiErrorMsg += '<p><b>Error: Access Token is not valid</b><br /><span>This error message is only visible to WordPress admins</span>'; 263 sbiErrorDir = "<p>There's an issue with the Instagram Access Token that you are using. Please obtain a new Access Token on the plugin's Settings page."; 264 } else if( data.indexOf('user does not exist') > -1 ){ 265 sbiErrorMsg += '<p><b>Error: The User ID does not exist</b><br /><span>This error is only visible to WordPress admins</span>'; 266 sbiErrorDir = "<p>Please double check the Instagram User ID that you are using. To find your User ID simply enter your Instagram user name into this <a href='http://www.otzberg.net/iguserid/' target='_blank'>tool</a>.</p>"; 267 } 268 269 //Add the error message to the page unless the user is displaying multiple ids or hashtags 270 if(looparray.length < 2) jQuery('#sb_instagram').empty().append( '<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>'); 271 } 272 }); 273 274 $loadBtn.click(function() { 275 userFeed.next(); 276 }); 277 278 userFeed.run(); 279 280 }); //End User ID array loop 281 282 283 }); 284 285 } 286 287 jQuery( document ).ready(function() { 288 sbi_init(); 289 });
290 291} // end sbi_js_exists check
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.