https://rentonriveradventures.com/wp-content/plugins/instagram-feed-pro/js/sb-instagram.js?ver=2.9.7
vendor: 25,357 bytes, lines 1-52
1var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false; 2if(!sbi_js_exists){ 3 4 "function"!==typeof Object.create&&(Object.create=function(f){function g(){}g.prototype=f;return new g}); 5 (function(f,g,k){var l={init:function(a,b){this.$elem=f(b);this.options=f.extend({},f.fn.sbi_owlCarousel.options,this.$elem.data(),a);this.userOptions=a;this.loadContent()},loadContent:function(){function a(a){var d,e="";if("function"===typeof b.options.jsonSuccess)b.options.jsonSuccess.apply(this,[a]);else{for(d in a.sbi_owl)a.sbi_owl.hasOwnProperty(d)&&(e+=a.sbi_owl[d].item);b.$elem.html(e)}b.logIn()}var b=this,e;"function"===typeof b.options.beforeInit&&b.options.beforeInit.apply(this,[b.$elem]);"string"===typeof b.options.jsonPath? 6 (e=b.options.jsonPath,f.getJSON(e,a)):b.logIn()},logIn:function(){this.$elem.data("sbi_owl-originalStyles",this.$elem.attr("style"));this.$elem.data("sbi_owl-originalClasses",this.$elem.attr("class"));this.$elem.css({opacity:0});this.orignalItems=this.options.items;this.checkBrowser();this.wrapperWidth=0;this.checkVisible=null;this.setVars()},setVars:function(){if(0===this.$elem.children().length)return!1;this.baseClass();this.eventTypes();this.$userItems=this.$elem.children();this.itemsAmount=this.$userItems.length; 7 this.wrapItems();this.$sbi_owlItems=this.$elem.find(".sbi_owl-item");this.$sbi_owlWrapper=this.$elem.find(".sbi_owl-wrapper");this.playDirection="next";this.prevItem=0;this.prevArr=[0];this.currentItem=0;this.customEvents();this.onStartup()},onStartup:function(){this.updateItems();this.calculateAll();this.buildControls();this.updateControls();this.response();this.moveEvents();this.stopOnHover();this.sbi_owlStatus();!1!==this.options.transitionStyle&&this.transitionTypes(this.options.transitionStyle);!0===this.options.autoPlay&& 8 (this.options.autoPlay=5E3);this.play();this.$elem.find(".sbi_owl-wrapper").css("display","block");this.$elem.is(":visible")?this.$elem.css("opacity",1):this.watchVisibility();this.onstartup=!1;this.eachMoveUpdate();"function"===typeof this.options.afterInit&&this.options.afterInit.apply(this,[this.$elem])},eachMoveUpdate:function(){!0===this.options.lazyLoad&&this.lazyLoad();!0===this.options.autoHeight&&this.autoHeight();this.onVisibleItems();"function"===typeof this.options.afterAction&&this.options.afterAction.apply(this, 9 [this.$elem])},updateVars:function(){"function"===typeof this.options.beforeUpdate&&this.options.beforeUpdate.apply(this,[this.$elem]);this.watchVisibility();this.updateItems();this.calculateAll();this.updatePosition();this.updateControls();this.eachMoveUpdate();"function"===typeof this.options.afterUpdate&&this.options.afterUpdate.apply(this,[this.$elem])},reload:function(){var a=this;g.setTimeout(function(){a.updateVars()},0)},watchVisibility:function(){var a=this;if(!1===a.$elem.is(":visible"))a.$elem.css({opacity:0}), 10 g.clearInterval(a.autoPlayInterval),g.clearInterval(a.checkVisible);else return!1;a.checkVisible=g.setInterval(function(){a.$elem.is(":visible")&&(a.reload(),a.$elem.animate({opacity:1},200),g.clearInterval(a.checkVisible))},500)},wrapItems:function(){this.$userItems.wrapAll('<div class="sbi_owl-wrapper">').wrap('<div class="sbi_owl-item"></div>');this.$elem.find(".sbi_owl-wrapper").wrap('<div class="sbi_owl-wrapper-outer">');this.wrapperOuter=this.$elem.find(".sbi_owl-wrapper-outer");this.$elem.css("display","block")}, 11 baseClass:function(){var a=this.$elem.hasClass(this.options.baseClass),b=this.$elem.hasClass(this.options.theme);a||this.$elem.addClass(this.options.baseClass);b||this.$elem.addClass(this.options.theme)},updateItems:function(){var a,b;if(!1===this.options.responsive)return!1;if(!0===this.options.singleItem)return this.options.items=this.orignalItems=1,this.options.itemsCustom=!1,this.options.itemsDesktop=!1,this.options.itemsDesktopSmall=!1,this.options.itemsTablet=!1,this.options.itemsTabletSmall= 12 !1,this.options.itemsMobile=!1;a=f(this.options.responsiveBaseWidth).width();a>(this.options.itemsDesktop[0]||this.orignalItems)&&(this.options.items=this.orignalItems);if(!1!==this.options.itemsCustom)for(this.options.itemsCustom.sort(function(a,b){return a[0]-b[0]}),b=0;b<this.options.itemsCustom.length;b+=1)this.options.itemsCustom[b][0]<=a&&(this.options.items=this.options.itemsCustom[b][1]);else a<=this.options.itemsDesktop[0]&&!1!==this.options.itemsDesktop&&(this.options.items=this.options.itemsDesktop[1]), 13 a<=this.options.itemsDesktopSmall[0]&&!1!==this.options.itemsDesktopSmall&&(this.options.items=this.options.itemsDesktopSmall[1]),a<=this.options.itemsTablet[0]&&!1!==this.options.itemsTablet&&(this.options.items=this.options.itemsTablet[1]),a<=this.options.itemsTabletSmall[0]&&!1!==this.options.itemsTabletSmall&&(this.options.items=this.options.itemsTabletSmall[1]),a<=this.options.itemsMobile[0]&&!1!==this.options.itemsMobile&&(this.options.items=this.options.itemsMobile[1]);this.options.items>this.itemsAmount&& 14 !0===this.options.itemsScaleUp&&(this.options.items=this.itemsAmount)},response:function(){var a=this,b,e;if(!0!==a.options.responsive)return!1;e=f(g).width();a.resizer=function(){f(g).width()!==e&&(!1!==a.options.autoPlay&&g.clearInterval(a.autoPlayInterval),g.clearTimeout(b),b=g.setTimeout(function(){e=f(g).width();a.updateVars()},a.options.responsiveRefreshRate))};f(g).resize(a.resizer)},updatePosition:function(){this.jumpTo(this.currentItem);!1!==this.options.autoPlay&&this.checkAp()},appendItemsSizes:function(){var a= 15 this,b=0,e=a.itemsAmount-a.options.items;a.$sbi_owlItems.each(function(c){var d=f(this);d.css({width:a.itemWidth}).data("sbi_owl-item",Number(c));if(0===c%a.options.items||c===e)c>e||(b+=1);d.data("sbi_owl-roundPages",b)})},appendWrapperSizes:function(){this.$sbi_owlWrapper.css({width:this.$sbi_owlItems.length*this.itemWidth*2,left:0});this.appendItemsSizes()},calculateAll:function(){this.calculateWidth();this.appendWrapperSizes();this.loops();this.max()},calculateWidth:function(){this.itemWidth=Math.round(this.$elem.width()/ 16 this.options.items)},max:function(){var a=-1*(this.itemsAmount*this.itemWidth-this.options.items*this.itemWidth);this.options.items>this.itemsAmount?this.maximumPixels=a=this.maximumItem=0:(this.maximumItem=this.itemsAmount-this.options.items,this.maximumPixels=a);return a},min:function(){return 0},loops:function(){var a=0,b=0,e,c;this.positionsInArray=[0];this.pagesInArray=[];for(e=0;e<this.itemsAmount;e+=1)b+=this.itemWidth,this.positionsInArray.push(-b),!0===this.options.scrollPerPage&&(c=f(this.$sbi_owlItems[e]), 17 c=c.data("sbi_owl-roundPages"),c!==a&&(this.pagesInArray[a]=this.positionsInArray[e],a=c))},buildControls:function(){if(!0===this.options.navigation||!0===this.options.pagination)this.sbi_owlControls=f('<div class="sbi_owl-controls"/>').toggleClass("clickable",!this.browser.isTouch).appendTo(this.$elem);!0===this.options.pagination&&this.buildPagination();!0===this.options.navigation&&this.buildButtons()},buildButtons:function(){var a=this,b=f('<div class="sbi_owl-buttons"/>');a.sbi_owlControls.append(b);a.buttonPrev= 18 f("<div/>",{"class":"sbi_owl-prev",html:a.options.navigationText[0]||""});a.buttonNext=f("<div/>",{"class":"sbi_owl-next",html:a.options.navigationText[1]||""});b.append(a.buttonPrev).append(a.buttonNext);b.on("touchstart.sbi_owlControls mousedown.sbi_owlControls",'div[class^="sbi_owl"]',function(a){a.preventDefault()});b.on("touchend.sbi_owlControls mouseup.sbi_owlControls",'div[class^="sbi_owl"]',function(b){b.preventDefault();f(this).hasClass("sbi_owl-next")?a.next():a.prev()})},buildPagination:function(){var a=this;a.paginationWrapper= 19 f('<div class="sbi_owl-pagination"/>');a.sbi_owlControls.append(a.paginationWrapper);a.paginationWrapper.on("touchend.sbi_owlControls mouseup.sbi_owlControls",".sbi_owl-page",function(b){b.preventDefault();Number(f(this).data("sbi_owl-page"))!==a.currentItem&&a.goTo(Number(f(this).data("sbi_owl-page")),!0)})},updatePagination:function(){var a,b,e,c,d,g;if(!1===this.options.pagination)return!1;this.paginationWrapper.html("");a=0;b=this.itemsAmount-this.itemsAmount%this.options.items;for(c=0;c<this.itemsAmount;c+=1)0===c%this.options.items&& 20 (a+=1,b===c&&(e=this.itemsAmount-this.options.items),d=f("<div/>",{"class":"sbi_owl-page"}),g=f("<span></span>",{text:!0===this.options.paginationNumbers?a:"","class":!0===this.options.paginationNumbers?"sbi_owl-numbers":""}),d.append(g),d.data("sbi_owl-page",b===c?e:c),d.data("sbi_owl-roundPages",a),this.paginationWrapper.append(d));this.checkPagination()},checkPagination:function(){var a=this;if(!1===a.options.pagination)return!1;a.paginationWrapper.find(".sbi_owl-page").each(function(){f(this).data("sbi_owl-roundPages")=== 21 f(a.$sbi_owlItems[a.currentItem]).data("sbi_owl-roundPages")&&(a.paginationWrapper.find(".sbi_owl-page").removeClass("active"),f(this).addClass("active"))})},checkNavigation:function(){if(!1===this.options.navigation)return!1;!1===this.options.rewindNav&&(0===this.currentItem&&0===this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.addClass("disabled")):0===this.currentItem&&0!==this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.removeClass("disabled")):this.currentItem=== 22 this.maximumItem?(this.buttonPrev.removeClass("disabled"),this.buttonNext.addClass("disabled")):0!==this.currentItem&&this.currentItem!==this.maximumItem&&(this.buttonPrev.removeClass("disabled"),this.buttonNext.removeClass("disabled")))},updateControls:function(){this.updatePagination();this.checkNavigation();this.sbi_owlControls&&(this.options.items>=this.itemsAmount?this.sbi_owlControls.hide():this.sbi_owlControls.show())},destroyControls:function(){this.sbi_owlControls&&this.sbi_owlControls.remove()},next:function(a){if(this.isTransition)return!1; 23 this.currentItem+=!0===this.options.scrollPerPage?this.options.items:1;if(this.currentItem>this.maximumItem+(!0===this.options.scrollPerPage?this.options.items-1:0))if(!0===this.options.rewindNav)this.currentItem=0,a="rewind";else return this.currentItem=this.maximumItem,!1;this.goTo(this.currentItem,a)},prev:function(a){if(this.isTransition)return!1;this.currentItem=!0===this.options.scrollPerPage&&0<this.currentItem&&this.currentItem<this.options.items?0:this.currentItem-(!0===this.options.scrollPerPage? 24 this.options.items:1);if(0>this.currentItem)if(!0===this.options.rewindNav)this.currentItem=this.maximumItem,a="rewind";else return this.currentItem=0,!1;this.goTo(this.currentItem,a)},goTo:function(a,b,e){var c=this;if(c.isTransition)return!1;"function"===typeof c.options.beforeMove&&c.options.beforeMove.apply(this,[c.$elem]);a>=c.maximumItem?a=c.maximumItem:0>=a&&(a=0);c.currentItem=c.sbi_owl.currentItem=a;if(!1!==c.options.transitionStyle&&"drag"!==e&&1===c.options.items&&!0===c.browser.support3d)return c.swapSpeed(0), 25 !0===c.browser.support3d?c.transition3d(c.positionsInArray[a]):c.css2slide(c.positionsInArray[a],1),c.afterGo(),c.singleItemTransition(),!1;a=c.positionsInArray[a];!0===c.browser.support3d?(c.isCss3Finish=!1,!0===b?(c.swapSpeed("paginationSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},c.options.paginationSpeed)):"rewind"===b?(c.swapSpeed(c.options.rewindSpeed),g.setTimeout(function(){c.isCss3Finish=!0},c.options.rewindSpeed)):(c.swapSpeed("slideSpeed"),g.setTimeout(function(){c.isCss3Finish=!0}, 26 c.options.slideSpeed)),c.transition3d(a)):!0===b?c.css2slide(a,c.options.paginationSpeed):"rewind"===b?c.css2slide(a,c.options.rewindSpeed):c.css2slide(a,c.options.slideSpeed);c.afterGo()},jumpTo:function(a){"function"===typeof this.options.beforeMove&&this.options.beforeMove.apply(this,[this.$elem]);a>=this.maximumItem||-1===a?a=this.maximumItem:0>=a&&(a=0);this.swapSpeed(0);!0===this.browser.support3d?this.transition3d(this.positionsInArray[a]):this.css2slide(this.positionsInArray[a],1);this.currentItem= 27 this.sbi_owl.currentItem=a;this.afterGo()},afterGo:function(){this.prevArr.push(this.currentItem);this.prevItem=this.sbi_owl.prevItem=this.prevArr[this.prevArr.length-2];this.prevArr.shift(0);this.prevItem!==this.currentItem&&(this.checkPagination(),this.checkNavigation(),this.eachMoveUpdate(),!1!==this.options.autoPlay&&this.checkAp());"function"===typeof this.options.afterMove&&this.prevItem!==this.currentItem&&this.options.afterMove.apply(this,[this.$elem])},stop:function(){this.apStatus="stop";g.clearInterval(this.autoPlayInterval)}, 28 checkAp:function(){"stop"!==this.apStatus&&this.play()},play:function(){var a=this;a.apStatus="play";if(!1===a.options.autoPlay)return!1;g.clearInterval(a.autoPlayInterval);a.autoPlayInterval=g.setInterval(function(){a.next(!0)},a.options.autoPlay)},swapSpeed:function(a){"slideSpeed"===a?this.$sbi_owlWrapper.css(this.addCssSpeed(this.options.slideSpeed)):"paginationSpeed"===a?this.$sbi_owlWrapper.css(this.addCssSpeed(this.options.paginationSpeed)):"string"!==typeof a&&this.$sbi_owlWrapper.css(this.addCssSpeed(a))}, 29 addCssSpeed:function(a){return{"-webkit-transition":"all "+a+"ms ease","-moz-transition":"all "+a+"ms ease","-o-transition":"all "+a+"ms ease",transition:"all "+a+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(a){return{"-webkit-transform":"translate3d("+a+"px, 0px, 0px)","-moz-transform":"translate3d("+a+"px, 0px, 0px)","-o-transform":"translate3d("+a+"px, 0px, 0px)","-ms-transform":"translate3d("+ 30 a+"px, 0px, 0px)",transform:"translate3d("+a+"px, 0px,0px)"}},transition3d:function(a){this.$sbi_owlWrapper.css(this.doTranslate(a))},css2move:function(a){this.$sbi_owlWrapper.css({left:a})},css2slide:function(a,b){var e=this;e.isCssFinish=!1;e.$sbi_owlWrapper.stop(!0,!0).animate({left:a},{duration:b||e.options.slideSpeed,complete:function(){e.isCssFinish=!0}})},checkBrowser:function(){var a=k.createElement("div");a.style.cssText=" -moz-transform:translate3d(0px, 0px, 0px); -ms-transform:translate3d(0px, 0px, 0px); -o-transform:translate3d(0px, 0px, 0px); -webkit-transform:translate3d(0px, 0px, 0px); transform:translate3d(0px, 0px, 0px)"; 31 a=a.style.cssText.match(/translate3d\(0px, 0px, 0px\)/g);this.browser={support3d:null!==a&&1===a.length,isTouch:"ontouchstart"in g||g.navigator.msMaxTouchPoints}},moveEvents:function(){if(!1!==this.options.mouseDrag||!1!==this.options.touchDrag)this.gestures(),this.disabledEvents()},eventTypes:function(){var a=["s","e","x"];this.ev_types={};!0===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.sbi_owl mousedown.sbi_owl","touchmove.sbi_owl mousemove.sbi_owl","touchend.sbi_owl touchcancel.sbi_owl mouseup.sbi_owl"]: 32 !1===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.sbi_owl","touchmove.sbi_owl","touchend.sbi_owl touchcancel.sbi_owl"]:!0===this.options.mouseDrag&&!1===this.options.touchDrag&&(a=["mousedown.sbi_owl","mousemove.sbi_owl","mouseup.sbi_owl"]);this.ev_types.start=a[0];this.ev_types.move=a[1];this.ev_types.end=a[2]},disabledEvents:function(){this.$elem.on("dragstart.sbi_owl",function(a){a.preventDefault()});this.$elem.on("mousedown.disableTextSelect",function(a){return f(a.target).is("input, textarea, select, option")})}, 33 gestures:function(){function a(a){if(void 0!==a.touches)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(void 0===a.touches){if(void 0!==a.pageX)return{x:a.pageX,y:a.pageY};if(void 0===a.pageX)return{x:a.clientX,y:a.clientY}}}function b(a){"on"===a?(f(k).on(d.ev_types.move,e),f(k).on(d.ev_types.end,c)):"off"===a&&(f(k).off(d.ev_types.move),f(k).off(d.ev_types.end))}function e(b){b=b.originalEvent||b||g.event;d.newPosX=a(b).x-h.offsetX;d.newPosY=a(b).y-h.offsetY;d.newRelativeX=d.newPosX-h.relativePos; 34 "function"===typeof d.options.startDragging&&!0!==h.dragging&&0!==d.newRelativeX&&(h.dragging=!0,d.options.startDragging.apply(d,[d.$elem]));(8<d.newRelativeX||-8>d.newRelativeX)&&!0===d.browser.isTouch&&(void 0!==b.preventDefault?b.preventDefault():b.returnValue=!1,h.sliding=!0);(10<d.newPosY||-10>d.newPosY)&&!1===h.sliding&&f(k).off("touchmove.sbi_owl");d.newPosX=Math.max(Math.min(d.newPosX,d.newRelativeX/5),d.maximumPixels+d.newRelativeX/5);!0===d.browser.support3d?d.transition3d(d.newPosX):d.css2move(d.newPosX)} 35 function c(a){a=a.originalEvent||a||g.event;var c;a.target=a.target||a.srcElement;h.dragging=!1;!0!==d.browser.isTouch&&d.$sbi_owlWrapper.removeClass("grabbing");d.dragDirection=0>d.newRelativeX?d.sbi_owl.dragDirection="left":d.sbi_owl.dragDirection="right";0!==d.newRelativeX&&(c=d.getNewPosition(),d.goTo(c,!1,"drag"),h.targetElement===a.target&&!0!==d.browser.isTouch&&(f(a.target).on("click.disable",function(a){a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();f(a.target).off("click.disable")}), 36 a=f._data(a.target,"events").click,c=a.pop(),a.splice(0,0,c)));b("off")}var d=this,h={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};d.isCssFinish=!0;d.$elem.on(d.ev_types.start,".sbi_owl-wrapper",function(c){c=c.originalEvent||c||g.event;var e;if(3===c.which)return!1;if(!(d.itemsAmount<=d.options.items)){if(!1===d.isCssFinish&&!d.options.dragBeforeAnimFinish||!1===d.isCss3Finish&&!d.options.dragBeforeAnimFinish)return!1; 37 !1!==d.options.autoPlay&&g.clearInterval(d.autoPlayInterval);!0===d.browser.isTouch||d.$sbi_owlWrapper.hasClass("grabbing")||d.$sbi_owlWrapper.addClass("grabbing");d.newPosX=0;d.newRelativeX=0;f(this).css(d.removeTransition());e=f(this).position();h.relativePos=e.left;h.offsetX=a(c).x-e.left;h.offsetY=a(c).y-e.top;b("on");h.sliding=!1;h.targetElement=c.target||c.srcElement}})},getNewPosition:function(){var a=this.closestItem();a>this.maximumItem?a=this.currentItem=this.maximumItem:0<=this.newPosX&&(this.currentItem= 38 a=0);return a},closestItem:function(){var a=this,b=!0===a.options.scrollPerPage?a.pagesInArray:a.positionsInArray,e=a.newPosX,c=null;f.each(b,function(d,g){e-a.itemWidth/20>b[d+1]&&e-a.itemWidth/20<g&&"left"===a.moveDirection()?(c=g,a.currentItem=!0===a.options.scrollPerPage?f.inArray(c,a.positionsInArray):d):e+a.itemWidth/20<g&&e+a.itemWidth/20>(b[d+1]||b[d]-a.itemWidth)&&"right"===a.moveDirection()&&(!0===a.options.scrollPerPage?(c=b[d+1]||b[b.length-1],a.currentItem=f.inArray(c,a.positionsInArray)): 39 (c=b[d+1],a.currentItem=d+1))});return a.currentItem},moveDirection:function(){var a;0>this.newRelativeX?(a="right",this.playDirection="next"):(a="left",this.playDirection="prev");return a},customEvents:function(){var a=this;a.$elem.on("sbi_owl.next",function(){a.next()});a.$elem.on("sbi_owl.prev",function(){a.prev()});a.$elem.on("sbi_owl.play",function(b,e){a.options.autoPlay=e;a.play();a.hoverStatus="play"});a.$elem.on("sbi_owl.stop",function(){a.stop();a.hoverStatus="stop"});a.$elem.on("sbi_owl.goTo",function(b,e){a.goTo(e)}); 40 a.$elem.on("sbi_owl.jumpTo",function(b,e){a.jumpTo(e)})},stopOnHover:function(){var a=this;!0===a.options.stopOnHover&&!0!==a.browser.isTouch&&!1!==a.options.autoPlay&&(a.$elem.on("mouseover",function(){a.stop()}),a.$elem.on("mouseout",function(){"stop"!==a.hoverStatus&&a.play()}))},lazyLoad:function(){var a,b,e,c,d;if(!1===this.options.lazyLoad)return!1;for(a=0;a<this.itemsAmount;a+=1)b=f(this.$sbi_owlItems[a]),"loaded"!==b.data("sbi_owl-loaded")&&(e=b.data("sbi_owl-item"),c=b.find(".lazysbi_owl"),"string"!==typeof c.data("src")? 41 b.data("sbi_owl-loaded","loaded"):(void 0===b.data("sbi_owl-loaded")&&(c.hide(),b.addClass("loading").data("sbi_owl-loaded","checked")),(d=!0===this.options.lazyFollow?e>=this.currentItem:!0)&&e<this.currentItem+this.options.items&&c.length&&this.lazyPreload(b,c)))},lazyPreload:function(a,b){function e(){a.data("sbi_owl-loaded","loaded").removeClass("loading");b.removeAttr("data-src");"fade"===d.options.lazyEffect?b.fadeIn(400):b.show();"function"===typeof d.options.afterLazyLoad&&d.options.afterLazyLoad.apply(this, 42 [d.$elem])}function c(){f+=1;d.completeImg(b.get(0))||!0===k?e():100>=f?g.setTimeout(c,100):e()}var d=this,f=0,k;"DIV"===b.prop("tagName")?(b.css("background-image","url("+b.data("src")+")"),k=!0):b[0].src=b.data("src");c()},autoHeight:function(){function a(){var a=f(e.$sbi_owlItems[e.currentItem]).height();e.wrapperOuter.css("height",a+"px");e.wrapperOuter.hasClass("autoHeight")||g.setTimeout(function(){e.wrapperOuter.addClass("autoHeight")},0)}function b(){d+=1;e.completeImg(c.get(0))?a():100>=d?g.setTimeout(b, 43 100):e.wrapperOuter.css("height","")}var e=this,c=f(e.$sbi_owlItems[e.currentItem]).find("img"),d;void 0!==c.get(0)?(d=0,b()):a()},completeImg:function(a){return!a.complete||"undefined"!==typeof a.naturalWidth&&0===a.naturalWidth?!1:!0},onVisibleItems:function(){var a;!0===this.options.addClassActive&&this.$sbi_owlItems.removeClass("active");this.visibleItems=[];for(a=this.currentItem;a<this.currentItem+this.options.items;a+=1)this.visibleItems.push(a),!0===this.options.addClassActive&&f(this.$sbi_owlItems[a]).addClass("active"); 44 this.sbi_owl.visibleItems=this.visibleItems},transitionTypes:function(a){this.outClass="sbi_owl-"+a+"-out";this.inClass="sbi_owl-"+a+"-in"},singleItemTransition:function(){var a=this,b=a.outClass,e=a.inClass,c=a.$sbi_owlItems.eq(a.currentItem),d=a.$sbi_owlItems.eq(a.prevItem),f=Math.abs(a.positionsInArray[a.currentItem])+a.positionsInArray[a.prevItem],g=Math.abs(a.positionsInArray[a.currentItem])+a.itemWidth/2;a.isTransition=!0;a.$sbi_owlWrapper.addClass("sbi_owl-origin").css({"-webkit-transform-origin":g+"px","-moz-perspective-origin":g+ 45 "px","perspective-origin":g+"px"});d.css({position:"relative",left:f+"px"}).addClass(b).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endPrev=!0;d.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(d,b)});c.addClass(e).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endCurrent=!0;c.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(c,e)})},clearTransStyle:function(a,b){a.css({position:"",left:""}).removeClass(b);this.endPrev&&this.endCurrent&&(this.$sbi_owlWrapper.removeClass("sbi_owl-origin"),this.isTransition=this.endCurrent=this.endPrev=!1)},sbi_owlStatus:function(){this.sbi_owl={userOptions:this.userOptions,baseElement:this.$elem,userItems:this.$userItems,sbi_owlItems:this.$sbi_owlItems,currentItem:this.currentItem,prevItem:this.prevItem,visibleItems:this.visibleItems,isTouch:this.browser.isTouch,browser:this.browser,dragDirection:this.dragDirection}},clearEvents:function(){this.$elem.off(".sbi_owl sbi_owl mousedown.disableTextSelect"); 46 f(k).off(".sbi_owl sbi_owl"); f(g).off("resize",this.resizer)},unWrap:function(){0!==this.$elem.children().length&&(this.$sbi_owlWrapper.unwrap(),this.$userItems.unwrap().unwrap(),this.sbi_owlControls&&this.sbi_owlControls.remove());this.clearEvents();this.$elem.attr("style",this.$elem.data("sbi_owl-originalStyles")||"").attr("class",this.$elem.data("sbi_owl-originalClasses"))},destroy:function(){this.stop();g.clearInterval(this.checkVisible);this.unWrap();this.$elem.removeData()},reinit:function(a){a=f.extend({},this.userOptions, 47 a);this.unWrap();this.init(a,this.$elem)},addItem:function(a,b){var e;if(!a)return!1;if(0===this.$elem.children().length)return this.$elem.append(a),this.setVars(),!1;this.unWrap();e=void 0===b||-1===b?-1:b;e>=this.$userItems.length||-1===e?this.$userItems.eq(-1).after(a):this.$userItems.eq(e).before(a);this.setVars()},removeItem:function(a){if(0===this.$elem.children().length)return!1;a=void 0===a||-1===a?-1:a;this.unWrap();this.$userItems.eq(a).remove();this.setVars()}};f.fn.sbi_owlCarousel=function(a){return this.each(function(){if(!0=== 48 f(this).data("sbi_owl-init"))return!1;f(this).data("sbi_owl-init",!0);var b=Object.create(l);b.init(a,this);f.data(this,"sbi_owlCarousel",b)})};f.fn.sbi_owlCarousel.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1,itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1E3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1, 49 responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:g,baseClass:"sbi_owl-carousel",theme:"sbi_owl-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1,beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}})(jQuery,window,document); 50 51 /* JavaScript Linkify - v0.3 - 6/27/2009 - http://benalman.com/projects/javascript-linkify/ */ 52 window.sbiLinkify=(function(){var k="[a-z\\d.-]+://",h="(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])",c="(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>
52/?]+)\\.)+",n="(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)",f="(?:"+c+n+"|"+h+")",o="(?:[;/][^#?<>\\s]*)?",e="(?:\\?[^#<>\\s]*)?(?:#[^<>\\s]*)?",d="\\b"+k+"[^<>\\s]+",a="\\b"+f+o+e+"(?!\\w)",m="mailto:",j="(?:"+m+")?[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@"+f+e+"(?!\\w)",l=new RegExp("(?:"+d+"|"+a+"|"+j+")","ig"),g=new RegExp("^"+k,"i"),b={"'":"`",">":"<",")":"(","]":"[","}":"{","B;":"B+","b:":"b9"},i={callback:function(q,p){return p?'<a href="'+p+'" title="'+p+'" target="_blank">'+q+"</a>":q},punct_regexp:/(?:[!?.,:;'"]|(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)$/};return function(u,z){z=z||{};var w,v,A,p,x="",t=[],s,E,C,y,q,D,B,r;for(v in i){if(z[v]===undefined){z[v]=i[v]}}while(w=l.exec(u)){A=w[0];E=l.lastIndex;C=E-A.length;if(/[\/:]/.test(u.charAt(C-1))){continue}do{y=A;r=A.substr(-1);B=b[r];if(B){q=A.match(new RegExp("\\"+B+"(?!$)","g"));D=A.match(new RegExp("\\"+r,"g"));if((q?q.length:0)<(D?D.length:0)){A=A.substr(0,A.length-1);E--}}if(z.punct_regexp){A=A.replace(z.punct_regexp,function(F){E-=F.length;return""})}}while(A.length&&A!==y);p=A;if(!g.test(p)){p=(p.indexOf("@")!==-1?(!p.indexOf(m)?"":m):!p.indexOf("irc.")?"irc://":!p.indexOf("ftp.")?"ftp://":"http://")+p}if(s!=C){t.push([u.slice(s,C)]);s=E}t.push([A,p])}t.push([u.substr(s)]);for(v=0;v<t.length;v++){x+=z.callback.apply(window,t[v])}return x||u}})(); 53 54 //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 55 (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}}})() 56 57 //IE8 also doesn't offer the .bind() method triggered by the 'sortBy' property. Copy and paste the polyfill offered here: 58 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}} 59 60 /*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */ 61 if (typeof sb_instagram_js_options.no_mob_swipe === 'undefined') { 62 (function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d<v;d++)l=u[d],t[l]=h[l]}return t}function C(t){var n={},r,s;while(t){r=e.data(t,i);for(s in r)r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function k(t,n){var r;while(t){r=e.data(t,i);if(r&&(!n||r[n]))return t;t=t.parentNode}return null}function L(){g=!1}function A(){g=!0}function O(){E=0,v.length=0,m=!1,A()}function M(){L()}function _(){D(),c=setTimeout(function(){c=0,O()},e.vmouse.resetTimerDuration)}function D(){c&&(clearTimeout(c),c=0)}function P(t,n,r){var i;if(r&&r[t]||!r&&k(n.target,t))i=N(n,t),e(n.target).trigger(i);return i}function H(t){var n=e.data(t.target,s),r;!m&&(!E||E!==n)&&(r=P("v"+t.type,t),r&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function B(t){var n=T(t).touches,r,i,o;n&&n.length===1&&(r=t.target,i=C(r),i.hasVirtualBinding&&(E=w++,e.data(r,s,E),D(),M(),d=!1,o=T(t).touches[0],h=o.pageX,p=o.pageY,P("vmouseover",t,i),P("vmousedown",t,i)))}function j(e){if(g)return;
vendor: 9,000 bytes, lines 62-76
62d||P("vmousecancel",e,C(e.target)),d=!0,_()}function F(t){if(g)return;var n=T(t).touches[0],r=d,i=e.vmouse.moveDistanceThreshold,s=C(t.target);d=d||Math.abs(n.pageX-h)>i||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[]; 63 if (typeof e.event.props !== 'undefined') { 64 var f=e.event.props.concat(a); 65 } 66 var l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x; 67 e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;x<o.length;x++)e.event.special[o[x]]=U(o[x]);y&&n.addEventListener("click",function(t){var n=v.length,r=t.target,i,o,u,a,f,l;if(n){i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;while(u){for(a=0;a<n;a++){f=v[a],l=0;if(u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID){t.preventDefault(),t.stopPropagation();return}}u=u.parentNode}}},!0)})(e,t,n),function(e){e.mobile={}}(e),function(e,t){var r={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,r),e.extend(e.mobile.support,r)}(e),function(e,t,r){function l(t,n,i,s){var o=i.type;i.type=n,s?e.event.trigger(i,r,t):e.event.dispatch.call(t,i),i.type=o}var i=e(n),s=e.mobile.support.touch,o="touchmove scroll",u=s?"touchstart":"mousedown",a=s?"touchend":"mouseup",f=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function s(e,n){r=n,l(t,r?"scrollstart":"scrollstop",e)}var t=this,n=e(t),r,i;n.bind(o,function(t){if(!e.event.special.scrollstart.enabled)return;r||s(t,!0),clearTimeout(i),i=setTimeout(function(){s(t,!1)},50)})},teardown:function(){e(this).unbind(o)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,n=e(t),r=!1;n.bind("vmousedown",function(s){function a(){clearTimeout(u)}function f(){a(),n.unbind("vclick",c).unbind("vmouseup",a),i.unbind("vmousecancel",f)}function c(e){f(),!r&&o===e.target?l(t,"tap",e):r&&e.preventDefault()}r=!1;if(s.which&&s.which!==1)return!1;var o=s.target,u;n.bind("vmouseup",a).bind("vclick",c),i.bind("vmousecancel",f),u=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(r=!0),l(t,"taphold",e.Event("taphold",{target:o}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),i.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var n=t.pageXOffset,r=t.pageYOffset,i=e.clientX,s=e.clientY;if(e.pageY===0&&Math.floor(s)>Math.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(s<e.pageY-r||i<e.pageX-n)i=e.pageX-n,s=e.pageY-r;return{x:i,y:s}},start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y],origin:e(t.target)}},stop:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y]}},handleSwipe:function(t,n,r,i){if(n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)},r.on(u,s.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)}); 68 } 69 /* Font Awesome SVG implementation */ 70 var sbIconSVG = { 71 'fa-clock' : 'class="svg-inline--fa fa-clock fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="clock" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm61.8-104.4l-84.9-61.7c-3.1-2.3-4.9-5.9-4.9-9.7V116c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v141.7l66.8 48.6c5.4 3.9 6.5 11.4 2.6 16.8L334.6 349c-3.9 5.3-11.4 6.5-16.8 2.6z"></path></svg>', 72 'fa-play' : 'class="svg-inline--fa fa-play fa-w-14 sbi_playbtn" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="play" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg>', 73 'fa-image' : 'class="svg-inline--fa fa-image fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="image" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>', 74 'fa-user' : 'class="svg-inline--fa fa-user fa-w-16" style="margin-right: 3px;" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="user" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M96 160C96 71.634 167.635 0 256 0s160 71.634 160 160-71.635 160-160 160S96 248.366 96 160zm304 192h-28.556c-71.006 42.713-159.912 42.695-230.888 0H112C50.144 352 0 402.144 0 464v24c0 13.255 10.745 24 24 24h464c13.255 0 24-10.745 24-24v-24c0-61.856-50.144-112-112-112z"></path></svg>', 75 'fa-comment' : 'class="svg-inline--fa fa-comment fa-w-18" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="comment" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M576 240c0 115-129 208-288 208-48.3 0-93.9-8.6-133.9-23.8-40.3 31.2-89.8 50.3-142.4 55.7-5.2.6-10.2-2.8-11.5-7.7-1.3-5 2.7-8.1 6.6-11.8 19.3-18.4 42.7-32.8 51.9-94.6C21.9 330.9 0 287.3 0 240 0 125.1 129 32 288 32s288 93.1 288 208z"></path></svg>', 76 'fa-heart' : 'class="svg-inline--fa fa-heart fa-w-18" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="heart" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
76<path fill="currentColor" d="M414.9 24C361.8 24 312 65.7 288 89.3 264 65.7 214.2 24 161.1 24 70.3 24 16 76.9 16 165.5c0 72.6 66.8 133.3 69.2 135.4l187 180.8c8.8 8.5 22.8 8.5 31.6 0l186.7-180.2c2.7-2.7 69.5-63.5 69.5-136C560 76.9 505.7 24 414.9 24z"></path></svg>', 77 'fa-check' : 'class="svg-inline--fa fa-check fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="check" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"></path></svg>', 78 'fa-exclamation-circle' : 'class="svg-inline--fa fa-exclamation-circle fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="exclamation-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"></path></svg>',
79 'fa-map-marker' : 'class="svg-inline--fa fa-map-marker fa-w-12" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="map-marker" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0z"></path></svg>', 80 'fa-clone' : 'class="svg-inline--fa fa-clone fa-w-16 sbi_lightbox_carousel_icon" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="clone" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 0H144c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h320c26.51 0 48-21.49 48-48v-48h48c26.51 0 48-21.49 48-48V48c0-26.51-21.49-48-48-48zM362 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h42v224c0 26.51 21.49 48 48 48h224v42a6 6 0 0 1-6 6zm96-96H150a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h308a6 6 0 0 1 6 6v308a6 6 0 0 1-6 6z"></path></svg>', 81 'fa-chevron-right' : 'class="svg-inline--fa fa-chevron-right fa-w-10" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="chevron-right" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg>', 82 'fa-chevron-left' : 'class="svg-inline--fa fa-chevron-left fa-w-10" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="chevron-left" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"></path></svg>', 83 'fa-share' : 'class="svg-inline--fa fa-share fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="share" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"></path></svg>', 84 'fa-times' : 'class="svg-inline--fa fa-times fa-w-12" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="times" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M323.1 441l53.9-53.9c9.4-9.4 9.4-24.5 0-33.9L279.8 256l97.2-97.2c9.4-9.4 9.4-24.5 0-33.9L323.1 71c-9.4-9.4-24.5-9.4-33.9 0L192 168.2 94.8 71c-9.4-9.4-24.5-9.4-33.9 0L7 124.9c-9.4 9.4-9.4 24.5 0 33.9l97.2 97.2L7 353.2c-9.4 9.4-9.4 24.5 0 33.9L60.9 441c9.4 9.4 24.5 9.4 33.9 0l97.2-97.2 97.2 97.2c9.3 9.3 24.5 9.3 33.9 0z"></path></svg>', 85 'fa-envelope' : 'class="svg-inline--fa fa-envelope fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="envelope" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg>', 86 'fa-edit' : 'class="svg-inline--fa fa-edit fa-w-18" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="edit" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
86<path fill="currentColor" d="M402.3 344.9l32-32c5-5 13.7-1.5 13.7 5.7V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h273.5c7.1 0 10.7 8.6 5.7 13.7l-32 32c-1.5 1.5-3.5 2.3-5.7 2.3H48v352h352V350.5c0-2.1.8-4.1 2.3-5.6zm156.6-201.8L296.3 405.7l-90.4 10c-26.2 2.9-48.5-19.2-45.6-45.6l10-90.4L432.9 17.1c22.9-22.9 59.9-22.9 82.7 0l43.2 43.2c22.9 22.9 22.9 60 .1 82.8zM460.1 174L402 115.9 216.2 301.8l-7.3 65.3 65.3-7.3L460.1 174zm64.8-79.7l-43.2-43.2c-4.1-4.1-10.8-4.1-14.8 0L436 82l58.1 58.1 30.9-30.9c4-4.2 4-10.8-.1-14.9z"></path></svg>', 87 'fa-arrows-alt' : 'class="svg-inline--fa fa-arrows-alt fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="arrows-alt" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"></path></svg>', 88 'fa-check-circle' : 'class="svg-inline--fa fa-check-circle fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="check-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>', 89 'fa-ban' : 'class="svg-inline--fa fa-ban fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="ban" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z"></path></svg>', 90 'fa-facebook-square' : 'class="svg-inline--fa fa-facebook-square fa-w-14" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="facebook-square" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M448 80v352c0 26.5-21.5 48-48 48h-85.3V302.8h60.6l8.7-67.6h-69.3V192c0-19.6 5.4-32.9 33.5-32.9H384V98.7c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9H184v67.6h60.9V480H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"></path></svg>', 91 'fa-twitter' : 'class="svg-inline--fa fa-twitter fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path></svg>', 92 'fa-google-plus' : 'class="svg-inline--fa fa-google-plus fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="google-plus" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
92<path fill="currentColor" d="M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8zm-70.7 372c-68.8 0-124-55.5-124-124s55.2-124 124-124c31.3 0 60.1 11 83 32.3l-33.6 32.6c-13.2-12.9-31.3-19.1-49.4-19.1-42.9 0-77.2 35.5-77.2 78.1s34.2 78.1 77.2 78.1c32.6 0 64.9-19.1 70.1-53.3h-70.1v-42.6h116.9c1.3 6.8 1.9 13.6 1.9 20.7 0 70.8-47.5 121.2-118.8 121.2zm230.2-106.2v35.5H372v-35.5h-35.5v-35.5H372v-35.5h35.5v35.5h35.2v35.5h-35.2z"></path></svg>', 93 'fa-instagram' : 'class="svg-inline--fa fa-instagram fa-w-14" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg>', 94 'fa-linkedin' : 'class="svg-inline--fa fa-linkedin fa-w-14" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"></path></svg>', 95 'fa-pinterest' : 'class="svg-inline--fa fa-pinterest fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="pinterest" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M496 256c0 137-111 248-248 248-25.6 0-50.2-3.9-73.4-11.1 10.1-16.5 25.2-43.5 30.8-65 3-11.6 15.4-59 15.4-59 8.1 15.4 31.7 28.5 56.8 28.5 74.8 0 128.7-68.8 128.7-154.3 0-81.9-66.9-143.2-152.9-143.2-107 0-163.9 71.8-163.9 150.1 0 36.4 19.4 81.7 50.3 96.1 4.7 2.2 7.2 1.2 8.3-3.3.8-3.4 5-20.3 6.9-28.1.6-2.5.3-4.7-1.7-7.1-10.1-12.5-18.3-35.3-18.3-56.6 0-54.7 41.4-107.6 112-107.6 60.9 0 103.6 41.5 103.6 100.9 0 67.1-33.9 113.6-78 113.6-24.3 0-42.6-20.1-36.7-44.8 7-29.5 20.5-61.3 20.5-82.6 0-19-10.2-34.9-31.4-34.9-24.9 0-44.9 25.7-44.9 60.2 0 22 7.4 36.8 7.4 36.8s-24.5 103.8-29 123.2c-5 21.4-3 51.6-.9 71.2C65.4 450.9 0 361.1 0 256 0 119 111 8 248 8s248 111 248 248z"></path></svg>', 96 'fa-spinner' : 'class="svg-inline--fa fa-spinner fa-w-16 fa-pulse" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="spinner" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path></svg>', 97 'fa-spin' : 'class="svg-inline--fa fa-spin fa-w-16 fa-pulse" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="spinner" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
97<path fill="currentColor" d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path></svg>' 98 }; 99 100 function sbSVGify(elem) { 101 if (sb_instagram_js_options.font_method != 'fontfile') { 102 103 if (typeof elem === 'undefined') { 104 elem = jQuery('.sbi'); 105 } 106 107 elem.each(function() { 108 jQuery(this).find('i.fa').each(function() { 109 var faClass = jQuery(this).attr('class').match(/fa-[a-z-]+/), 110 styles = jQuery(this).attr('style'); 111 if (faClass && typeof sbIconSVG[faClass[0]] !== 'undefined') { 112 var theStyle = typeof styles !== 'undefined' ? 'style="'+styles+'" ' : ''; 113 jQuery(this).replaceWith('<svg '+theStyle+sbIconSVG[faClass[0]]); 114 } else { 115 console.log(faClass,'missing'); 116 } 117 }) 118 }); 119 } 120 } 121 122 // add links to page 123 var addLinks={regexString:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",hashtags:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=addLinks._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this.regexString.charAt(s)+this.regexString.charAt(o)+this.regexString.charAt(u)+this.regexString.charAt(a)}return t},handles:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");while(f<e.length){s=this.regexString.indexOf(e.charAt(f++));o=this.regexString.indexOf(e.charAt(f++));u=this.regexString.indexOf(e.charAt(f++));a=this.regexString.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=addLinks._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/rn/g,"n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}} 124 function addLinksToPage(s) { 125 if ( (s.match(/\./g) || []).length === 2) { 126 return s; 127 } 128 var a = s.split('.'), 129 b = a[0], 130 c = addLinks.handles(a[1]), 131 d = addLinks.handles(a[2]+a[3]); 132 133 return b+'.'+c+'.'+d; 134 } 135 136 /* Lightbox v2.7.1 by Lokesh Dhakar - http://lokeshdhakar.com/projects/lightbox2/ - Heavily modified specifically for this plugin */ 137 (function() { 138 var a = jQuery, 139 b = function() { 140 function a() { 141 this.fadeDuration = 500, this.fitImagesInViewport = !0, this.resizeDuration = 700, this.positionFromTop = 50, this.showImageNumberLabel = !0, this.alwaysShowNavOnTouchDevices = !1, this.wrapAround = !1 142 } 143 return a.prototype.albumLabel = function(a, b) { 144 return a + " / " + b 145 }, a 146 }(), 147 c = function() { 148 function b(a) { 149 this.options = a, this.album = [], this.currentImageIndex = void 0, this.init() 150 } 151 return b.prototype.init = function() { 152 this.enable(), this.build() 153 }, b.prototype.enable = function() { 154 var b = this; 155 a("body").on("click", "a[data-lightbox-sbi]", function(c) { 156 return b.start(a(c.currentTarget)), !1 157 }) 158 }, b.prototype.build = function() { 159 var b = this, 160 sbLbCarouselDestroy = function() { 161 jQuery('#sbi_lightbox .sbi_lb_lightbox-image').remove(); 162 if (jQuery('#sbi_lightbox .sbi_owl-carousel').length) { 163 if( jQuery('#sbi_lightbox .sbi_owl-carousel').data('sbi_owlCarousel') ) jQuery('#sbi_lightbox .sbi_owl-carousel').data('sbi_owlCarousel').destroy(); 164 jQuery('#sbi_lightbox .sbi_owl-item').remove(); 165 } 166 jQuery('#sbi_lightbox').find('video').remove();
167 jQuery('.sbi_lb-container').prepend("<video class='sbi_video' src='' poster='' controls></video>"); 168 }; 169 a("<div id='sbi_lightboxOverlay' class='sbi_lightboxOverlay'></div>" + 170 "<div id='sbi_lightbox' class='sbi_lightbox'>" + 171 "<div class='sbi_lb-outerContainer'>" + 172 "<div class='sbi_lb-nav'><a class='sbi_lb-prev' href='#' ><p class='sbi-screenreader'>Previous Slide</p><span></span></a><a class='sbi_lb-next' href='#' ><p class='sbi-screenreader'>Next Slide</p><span></span></a></div>" + 173 "<div class='sbi_lb-container-wrapper'>" + 174 "<div class='sbi_lb-container'>" + 175 "<div class='sbi_lb-image-wrap-outer'>" + 176 "<div class='sbi_lb-image-wrap'>" + 177 "<img class='sbi_lb-image' src='' alt='Lightbox image placeholder'/>" + 178 "</div>" + 179 "</div>" + 180 "<div class='sbi_lb-loader'><i class='fa fa-spin'></i></div>" + 181 "</div>" + 182 "<div class='sbi_lb-dataContainer'>" + 183 "<div class='sbi_lb-data'>" + 184 "<div class='sbi_lb-details'>" + 185 "<span class='sbi_lb-caption'></span>" + 186 "<span class='sbi_lb-number'></span>" + 187 "<div class='sbi_lightbox_action sbi_share'><a href='JavaScript:void(0);'><i class='fa fa-share'></i>"+sbiTranslate('Share')+"</a><p class='sbi_lightbox_tooltip sbi_tooltip_social'><a href='' target='_blank' id='sbi_facebook_icon'><span class='sbi-screenreader'>Facebook</span><i class='fa fa-facebook-square'></i></a><a href='' target='_blank' id='sbi_twitter_icon'><span class='sbi-screenreader'>Twitter</span><i class='fa fa-twitter'></i></a><a href='' target='_blank' id='sbi_google_icon'><span class='sbi-screenreader'>Google Plus</span><i class='fa fa-google-plus'></i></a><a href='' target='_blank' id='sbi_linkedin_icon'><span class='sbi-screenreader'>Linkedin</span><i class='fa fa-linkedin'></i></a><a href='' id='sbi_pinterest_icon' target='_blank'><span class='sbi-screenreader'>Pinterest</span><i class='fa fa-pinterest'></i></a><a href='' id='sbi_email_icon' target='_blank'><span class='sbi-screenreader'>Email</span><i class='fa fa-envelope'></i></a></p></div><div class='sbi_lightbox_action sbi_instagram'><a href='https://instagram.com/' target='_blank'><i class='fa fa-instagram'></i>Instagram</a></div>" + 188 "<div id='sbi_mod_link' class='sbi_lightbox_action'><a href='JavaScript:void(0);'><i class='fa fa-times'></i>Hide photo (admin)</a><p id='sbi_mod_box' class='sbi_lightbox_tooltip'>Add this ID to the plugin's <strong>Hide Photos</strong> setting: <span id='sbi_photo_id'></span></p></div></div><div class='sbi_lb-closeContainer'><a class='sbi_lb-close'><i class='fa fa-times'></i></a></div></div></div></div>").appendTo(a("body")), this.$lightbox = a("#sbi_lightbox"), this.$overlay = a("#sbi_lightboxOverlay"), this.$outerContainer = this.$lightbox.find(".sbi_lb-outerContainer"), this.$container = this.$lightbox.find(".sbi_lb-container"), this.containerTopPadding = parseInt(this.$container.css("padding-top"), 10), this.containerRightPadding = parseInt(this.$container.css("padding-right"), 10), this.containerBottomPadding = parseInt(this.$container.css("padding-bottom"), 10), this.containerLeftPadding = parseInt(this.$container.css("padding-left"), 10), this.$overlay.hide().on("click", function() { 189 return b.end(), !1 190 }), jQuery(document).on('click', function(event, b, c) { 191 //Fade out the lightbox if click anywhere outside of the two elements defined below 192 if (!jQuery(event.target).closest('.sbi_lb-outerContainer').length) { 193 if (!jQuery(event.target).closest('.sbi_lb-dataContainer').length) { 194 //Fade out lightbox 195 jQuery('#sbi_lightboxOverlay, #sbi_lightbox').fadeOut(); 196 //Pause video 197 if( sbi_supports_video() && jQuery('#sbi_lightbox video.sbi_video').length ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 198 sbLbCarouselDestroy(); 199 } 200 } 201 }), this.$lightbox.hide(), 202 jQuery('#sbi_lightboxOverlay').on("click", function(c) { 203 sbLbCarouselDestroy(); 204 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 205 return "sbi_lightbox" === a(c.target).attr("id") && b.end(), !1 206 }
206), this.$lightbox.find(".sbi_lb-prev").on("click", function() { 207 sbLbCarouselDestroy(); 208 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 209 return b.changeImage(0 === b.currentImageIndex ? b.album.length - 1 : b.currentImageIndex - 1), !1 210 }), this.$lightbox.find(".sbi_lb-container").on("swiperight", function() { 211 sbLbCarouselDestroy(); 212 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 213 return b.changeImage(0 === b.currentImageIndex ? b.album.length - 1 : b.currentImageIndex - 1), !1 214 }), this.$lightbox.find(".sbi_lb-next").on("click", function() { 215 sbLbCarouselDestroy(); 216 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 217 return b.changeImage(b.currentImageIndex === b.album.length - 1 ? 0 : b.currentImageIndex + 1), !1 218 }), this.$lightbox.find(".sbi_lb-container").on("swipeleft", function() { 219 sbLbCarouselDestroy(); 220 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 221 return b.changeImage(b.currentImageIndex === b.album.length - 1 ? 0 : b.currentImageIndex + 1), !1 222 }), this.$lightbox.find(".sbi_lb-loader, .sbi_lb-close").on("click", function() { 223 sbLbCarouselDestroy(); 224 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 225 return b.end(), !1 226 }) 227 }, b.prototype.start = function(b) { 228 function c(a) { 229 230 //Get the options for this feed 231 var sbiFeedOptions = a.closest('.sbi').attr('data-options'); 232 sbiFeedOptions = jQuery.parseJSON(sbiFeedOptions); 233 234 var carouselData = -1; 235 if(a.attr("data-carousel").length > 1) carouselData = jQuery.parseJSON(a.attr("data-carousel")); 236 if (!carouselData) { 237 carouselData = {}; 238 } 239 240 d.album.push({ 241 link: a.attr("href"), 242 title: a.attr("data-title") || a.attr("title"), 243 video: a.attr("data-video"), 244 id: a.attr("data-id"), 245 url: a.attr("data-url"), 246 user: a.attr("data-user"), 247 avatar: a.attr("data-avatar"), 248 lightboxcomments: sbiFeedOptions.lightboxcomments, 249 numcomments: sbiFeedOptions.numcomments, 250 carousel: carouselData 251 }); 252 253 } 254 var d = this, 255 e = a(window); 256 e.on("resize", a.proxy(this.sizeOverlay, this)), a("select, object, embed").css({ 257 visibility: "hidden" 258 }), this.sizeOverlay(), this.album = []; 259 var f, g = 0, 260 h = b.attr("data-lightbox-sbi"); 261 if (h) { 262 f = a(b.prop("tagName") + '[data-lightbox-sbi="' + h + '"]'); 263 for (var i = 0; i < f.length; i = ++i) c(a(f[i])), f[i] === b[0] && (g = i) 264 } else if ("lightbox" === b.attr("rel")) c(b); 265 else { 266 f = a(b.prop("tagName") + '[rel="' + b.attr("rel") + '"]'); 267 for (var j = 0; j < f.length; j = ++j) c(a(f[j])), f[j] === b[0] && (g = j) 268 } 269 var k = e.scrollTop() + this.options.positionFromTop, 270 l = e.scrollLeft(); 271 this.$lightbox.css({ 272 top: k + "px", 273 left: l + "px" 274 }).fadeIn(this.options.fadeDuration), this.changeImage(g) 275 }, b.prototype.changeImage = function(b) { 276 var c = this; 277 this.disableKeyboardNav();
278 var d = this.$lightbox.find(".sbi_lb-image"); 279 this.$overlay.fadeIn(this.options.fadeDuration), a(".sbi_lb-loader").fadeIn("slow"), this.$lightbox.find(".sbi_lb-image, .sbi_lb-nav, .sbi_lb-prev, .sbi_lb-next, .sbi_lb-dataContainer, .sbi_lb-numbers, .sbi_lb-caption").hide(), this.$outerContainer.addClass("animating"); 280 var e = new Image; 281 e.onload = function() { 282 283 //If this feed has lightbox comments enabled then add room for the sidebar 284 var sbi_lb_comments_width = 0, 285 sbiNavArrowsWidth = 0; 286 if((jQuery('.sbi').attr('data-sbi-lb-comments') === 'true') && window.innerWidth > 640) { 287 sbi_lb_comments_width = 300; 288 } 289 if(window.innerWidth < (740 + sbi_lb_comments_width) && window.innerWidth > 640) { 290 sbiNavArrowsWidth = 100; 291 } 292 293 var f, g, h, i, j, k, l; 294 d.attr("src", c.album[b].link), f = a(e), d.width(e.width), d.height(e.height), c.options.fitImagesInViewport && (l = a(window).width(), k = a(window).height(), j = l - c.containerLeftPadding - c.containerRightPadding - 20 - sbi_lb_comments_width - sbiNavArrowsWidth, i = k - c.containerTopPadding - c.containerBottomPadding - 150, (e.width > j || e.height > i) && (e.width / j > e.height / i ? (h = j, g = parseInt(e.height / (e.width / h), 10), d.width(h), d.height(g)) : (g = i, h = parseInt(e.width / (e.height / g), 10), d.width(h), d.height(g)))), c.sizeContainer(d.width(), d.height()) 295 }, e.src = this.album[b].link, this.currentImageIndex = b 296 }, b.prototype.sizeOverlay = function() { 297 this.$overlay.width(a(window).width()).height(a(document).height()) 298 }, b.prototype.sizeContainer = function(a, b) { 299 function c() { 300 d.$lightbox.find(".sbi_lb-dataContainer").width(g), d.$lightbox.find(".sbi_lb-prevLink").height(h), d.$lightbox.find(".sbi_lb-nextLink").height(h), d.showImage() 301 } 302 var d = this, 303 e = this.$outerContainer.outerWidth(), 304 f = this.$outerContainer.outerHeight(), 305 g = a + this.containerLeftPadding + this.containerRightPadding, 306 h = b + this.containerTopPadding + this.containerBottomPadding; 307 e !== g || f !== h ? this.$outerContainer.animate({ 308 width: g, 309 height: h 310 }, this.options.resizeDuration, "swing", function() { 311 c() 312 }) : c() 313 }, b.prototype.showImage = function() { 314 this.$lightbox.find(".sbi_lb-loader").hide(), this.$lightbox.find(".sbi_lb-image").fadeIn("slow"), this.updateNav(), this.updateDetails(), this.preloadNeighboringImages(), this.enableKeyboardNav() 315 }, b.prototype.updateNav = function() { 316 var a = !1; 317 try { 318 document.createEvent("TouchEvent"), a = this.options.alwaysShowNavOnTouchDevices ? !0 : !1 319 } catch (b) {} 320 this.$lightbox.find(".sbi_lb-nav").show(), this.album.length > 1 && (this.options.wrapAround ? (a && this.$lightbox.find(".sbi_lb-prev, .sbi_lb-next").css("opacity", "1"), this.$lightbox.find(".sbi_lb-prev, .sbi_lb-next").show()) : (this.currentImageIndex > 0 && (this.$lightbox.find(".sbi_lb-prev").show(), a && this.$lightbox.find(".sbi_lb-prev").css("opacity", "1")), this.currentImageIndex < this.album.length - 1 && (this.$lightbox.find(".sbi_lb-next").show(), a && this.$lightbox.find(".sbi_lb-next").css("opacity", "1")))) 321 }, b.prototype.updateDetails = function() { 322 var b = this; 323 /** NEW PHOTO ACTION **/ 324 //Switch video when either a new popup or navigating to new one 325 if( sbi_supports_video() ){ 326 jQuery('#sbi_lightbox').removeClass('sbi_video_lightbox'); 327 if( this.album[this.currentImageIndex].video.length ){ 328 329 jQuery('#sbi_lightbox').addClass('sbi_video_lightbox'); 330 if( jQuery('.sbi_lightbox .sbi_video').length == 0 ) {
331 jQuery('.sbi_lb-container').prepend("<video class='sbi_video' src='"+this.album[this.currentImageIndex].video+"' poster='"+this.album[this.currentImageIndex].link+"' controls autoplay></video>"); 332 } else { 333 jQuery('.sbi_video').attr({ 334 'src' : this.album[this.currentImageIndex].video, 335 'poster' : this.album[this.currentImageIndex].link, 336 'autoplay' : 'true' 337 }); 338 } /*jQuery('.sbi_video').attr({ 339 'src' : this.album[this.currentImageIndex].video, 340 'poster' : this.album[this.currentImageIndex].link, 341 'autoplay' : 'true' 342 });*/ 343 } else { 344 jQuery('.sbi_lb-container .sbi_video').remove(); 345 } 346 } 347 348 jQuery('.sbi_video').css('opacity','0'); 349 jQuery('#sbi_lightbox .sbi_instagram a').attr('href', this.album[this.currentImageIndex].url); 350 jQuery('#sbi_lightbox .sbi_lightbox_tooltip').hide(); 351 jQuery('#sbi_lightbox #sbi_mod_box').find('#sbi_photo_id').text( this.album[this.currentImageIndex].id ); 352 //Change social media sharing links on the fly 353 jQuery('#sbi_lightbox #sbi_facebook_icon').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=' + this.album[this.currentImageIndex].url+'&t=Text'); 354 jQuery('#sbi_lightbox #sbi_twitter_icon').attr('href', 'https://twitter.com/home?status='+this.album[this.currentImageIndex].url+' ' + this.album[this.currentImageIndex].title); 355 jQuery('#sbi_lightbox #sbi_google_icon').attr('href', 'https://plus.google.com/share?url='+this.album[this.currentImageIndex].url); 356 jQuery('#sbi_lightbox #sbi_linkedin_icon').attr('href', 'https://www.linkedin.com/shareArticle?mini=true&url='+this.album[this.currentImageIndex].url+'&title='+this.album[this.currentImageIndex].title); 357 jQuery('#sbi_lightbox #sbi_pinterest_icon').attr('href', 'https://pinterest.com/pin/create/button/?url='+this.album[this.currentImageIndex].url+'&media='+this.album[this.currentImageIndex].link+'&description='+this.album[this.currentImageIndex].title); 358 jQuery('#sbi_lightbox #sbi_email_icon').attr('href', 'mailto:?subject=Instagram&body='+this.album[this.currentImageIndex].title+' '+this.album[this.currentImageIndex].url); 359 jQuery('.sbi_lb-container-wrapper').find('.fa-clone').remove(); 360 361 // carousel in lightbox 362 if( this.album[this.currentImageIndex].carousel !== '' && typeof this.album[this.currentImageIndex].carousel[0] !== 'undefined' ) { 363 var wrapEl = jQuery('.sbi_lb-image-wrap'), 364 styles = jQuery('.sbi_lb-image').attr('style') + 'opacity: 1 !important', 365 thisPoster = this.album[this.currentImageIndex].link, 366 thisStartsWithVideo = (this.album[this.currentImageIndex].carousel[0].type == 'video'), 367 thisVideoUrl = ''; 368 369 jQuery.each(this.album[this.currentImageIndex].carousel,function(index,value) { 370 if (index > 0) { 371 if (value.type === 'image') { 372 wrapEl.append('<img class="sbi_lb-image sbi_lb_lightbox-image" src="'+value.media+'" style="'+styles+'" alt="Lightbox Image"/>'); 373 } else if (sbi_supports_video() && value.type === 'video') { 374 wrapEl.append( '<video class="sbi_video sbi_lb_lightbox-image sbi_lb_lightbox-carousel-video added" src="'+value.media+'" style="'+styles+'" poster="'+thisPoster+'" controls="" autoplay="autoplay"></video>'); 375 } 376 } 377 });
378 jQuery('.sbi_lb-image-wrap-outer').prepend('<i class="fa fa-clone sbi_lightbox_carousel_icon" aria-hidden="true"></i>'); 379 380 wrapEl.sbi_owlCarousel({ 381 items: 1, 382 navigation: true, 383 navigationText: ['<i class="fa fa-chevron-left"></i>','<i class="fa fa-chevron-right"></i>'], 384 pagination: true, 385 autoPlay: false, 386 stopOnHover: true, 387 itemsDesktop: 1, 388 itemsDesktopSmall: 1, 389 itemsTablet: 1, 390 itemsTabletSmall: 1, 391 itemsMobile: 1, 392 afterInit:function(el) { 393 if(thisStartsWithVideo) { 394 jQuery('.sbi_lb-image-wrap').find('.sbi_owl-item').first().find('img').before( jQuery('#sbi_lightbox .sbi_video').first() ); 395 jQuery('#sbi_lightbox .sbi_video').first().get(0).play(); 396 } 397 398 }, 399 afterAction:function(el) { 400 401 var $owlCarousel = jQuery(el).closest('.sbi_owl-carousel'), 402 $listItem = $owlCarousel.find('.sbi_owl-page.active'), 403 currentActiveIndex = $owlCarousel.find('.sbi_owl-page').index($listItem), 404 $maybeVideo = $owlCarousel.find('.sbi_owl-item:eq('+currentActiveIndex+')').find('video'); 405 406 if($owlCarousel.find('video').length) { 407 $owlCarousel.find('video').each(function() { 408 jQuery(this).get(0).pause(); 409 }); 410 } 411 412 if ($maybeVideo.length) { 413 $maybeVideo.get(0).play(); 414 } 415 416 } 417 }); 418 419 var $navElementsWrapper = wrapEl.find('.sbi_owl-buttons'); 420 if (window.width > 640) { 421 $navElementsWrapper.addClass('onhover').hide(); 422 wrapEl.on({ 423 mouseenter: function () { 424 $navElementsWrapper.fadeIn(); 425 }, 426 mouseleave: function () { 427 $navElementsWrapper.fadeOut(); 428 } 429 }); 430 } 431 432 } 433 setTimeout(function(){ 434 jQuery('.sbi_video').css('opacity','1'); 435 },500); 436 sbSVGify(jQuery('#sbi_lightbox')); 437 //start by removing any existing comments 438 jQuery('.sbi_lb-commentBox').remove(); 439 // check to see if comments are enabled for this feed 440 if((this.album[this.currentImageIndex].lightboxcomments === 'true' || this.album[this.currentImageIndex].lightboxcomments === true) && this.album[this.currentImageIndex].numcomments > 0) { 441 var sbiComments = { 442 postID: '', 443 maxNumComments: this.album[this.currentImageIndex].numcomments, 444 disableCache: (this.album[this.currentImageIndex].disablecache || this.album[this.currentImageIndex].disablecache === 'true'), 445 numCommentsOnPage: parseInt(jQuery('#'+this.album[this.currentImageIndex].id).find('.sbi_comments').text().replace(',', '')), // number of comments for this specific post, grabbed from feed html 446 commentObj: [], 447 448 getRemoteComments: function (missing) { 449 var cleanId = this.postID.replace('sbi_',''), 450 at = addLinksToPage(sb_instagram_js_options.sb_instagram_at), 451 url = 'https://api.instagram.com/v1/media/' + cleanId + '/comments?access_token='
451+ at; 452 jQuery.ajax({ 453 method: "GET", 454 url: url, 455 dataType: "jsonp", 456 success: function(data) { 457 sbiComments.commentObj = data.data; 458 var toBeCached = []; 459 jQuery.each(sbiComments.commentObj, function() { 460 var comment = { 461 created_time: this.created_time, 462 id: this.id, 463 text: this.text, 464 user_name: this.from.username 465 }; 466 toBeCached.push(comment); 467 }); 468 if ( typeof sb_instagram_js_options.sbiPageCommentCache === 'undefined' ) { 469 sb_instagram_js_options.sbiPageCommentCache = []; 470 } 471 sb_instagram_js_options.sbiPageCommentCache[cleanId] = [toBeCached, new Date().getTime() / 1000 + 100*60,sbiComments.numCommentsOnPage]; 472 473 if(missing !== 'all') { 474 sbiComments.replaceWithNewComments(sb_instagram_js_options.sbiPageCommentCache[cleanId][0]); 475 } else { 476 sbiComments.appendExistingComments(); 477 } 478 if (!sbiComments.disableCache && window.sbiStandalone.noDB !== true) { 479 sbiComments.cacheComments(toBeCached, sbiComments.numCommentsOnPage); 480 } 481 } 482 }); 483 }, 484 getCommentHtml: function (comment) { 485 var comHtml = '', 486 comText = comment.text.replace(/(\\')/g,"'").replace(/(\\")/g,'"'), 487 comText = this.stripScripts(comText); 488 489 comHtml += '<p class="sbi_lb-comment" id="sbi_com_'+comment.id+'" data-sbi-created="'+comment.created_time+'">'; 490 comHtml += '<a class="sbi_lb-commenter" href="https://www.instagram.com/'+comment.user_name+'/" target="_blank">'+comment.user_name+'</a>'; 491 comHtml += '<span class="sbi_lb-comment-text">'+comText+'</span>'; 492 comHtml += '</p>'; 493 494 return comHtml; 495 }, 496 appendExistingComments: function () { 497 var cleanId = this.postID.replace('sbi_',''), 498 comments = sb_instagram_js_options.sbiPageCommentCache[cleanId][0], 499 fifteenMinutesFromLastCache = sb_instagram_js_options.sbiPageCommentCache[cleanId][1], 500 nowInSeconds = new Date().getTime() / 1000, 501 maxNumComments = parseInt(this.maxNumComments), 502 commentsNeeded = sbiComments.numCommentsOnPage - parseInt(sb_instagram_js_options.sbiPageCommentCache[cleanId][2]); 503 504 var loadingHTML = ''; 505 // every time the comment cache is updated, a time 15 minutes in the future is also included in the saved data 506 // this checks to see if it's been at least 15 minutes since new comments were cached 507 if (fifteenMinutesFromLastCache > nowInSeconds) { 508 commentsNeeded = 0; 509 } else { 510 if (commentsNeeded > 0) { 511 loadingHTML = '<p class="sbi_loading_comments"><i class="fa fa-spinner fa-pulse"></i></p>'; 512 sbiComments.getRemoteComments(); 513 } 514 } 515 var comsHtml = ''; 516 //check to see if there is at least one comment to use 517 if (typeof comments[0] !== 'undefined') {
518 comsHtml += '<div class="sbi_lb-commentBox">'; 519 var lastIndex = -1; 520 // grab the maximum number of latest tweets available without going over the max 521 if ((comments.length + commentsNeeded) < maxNumComments) { 522 lastIndex = 0 - comments.length; 523 } else if ((maxNumComments - commentsNeeded) > 0) { 524 lastIndex = 0 - (maxNumComments - commentsNeeded); 525 } 526 // only append existing comments if there are less new comments than the max 527 if (commentsNeeded < maxNumComments) { 528 comments = comments.slice(lastIndex); 529 jQuery.each(comments, function() { 530 comsHtml += sbiComments.getCommentHtml(this); 531 }); 532 } 533 // let the visitor know that more comments are coming 534 comsHtml += loadingHTML; 535 comsHtml += '</div>'; 536 jQuery('.sbi_lb-dataContainer').append(comsHtml); 537 } 538 }, 539 replaceWithNewComments: function (comments) { 540 var comsHtml = '', 541 lastIndex = Math.max((0 - parseInt(this.maxNumComments)), (0 - comments.length)), 542 newComments = comments.slice(lastIndex); 543 544 jQuery.each(newComments, function() { 545 comsHtml += sbiComments.getCommentHtml(this); 546 }); 547 jQuery('.sbi_lb-commentBox').html(comsHtml); 548 }, 549 stripScripts: function (s) { 550 var div = document.createElement('div'); 551 div.innerHTML = s; 552 var scripts = div.getElementsByTagName('script'); 553 var i = scripts.length; 554 while (i--) { 555 scripts[i].parentNode.removeChild(scripts[i]); 556 } 557 return div.innerHTML; 558 }, 559 cacheComments: function (comments, totalComments) { 560 var submittedData = { 561 'action': 'sbi_update_comment_cache', 562 'post_id': this.postID, 563 'comments': comments, 564 'total_comments': totalComments 565 }; 566 567 jQuery.ajax({ 568 url: sbiajaxurl, 569 type: 'post', 570 data: submittedData, 571 success: function(data) { 572 } 573 }); // ajax*/ 574 } 575 }; 576 577 function sbiCommentsInit(id) { 578 // set the id of the current post in the lightbox console.log(jQuery('.sbi_lb-comment').length); 579 sbiComments.postID = id; 580 // append comments localized for this feed that apply to this post, otherwise retrieve new comments and use those 581 if (sb_instagram_js_options.sbiPageCommentCache && sb_instagram_js_options.sbiPageCommentCache.hasOwnProperty(sbiComments.postID.replace('sbi_',''))) { 582 sbiComments.appendExistingComments(); 583 } else { 584 sbiComments.getRemoteComments('all'); 585 } 586 } 587 588 // wait until the comments object is done being retrieved before displaying comments 589 if (typeof this.album[this.currentImageIndex].id !== 'undefined') { 590 sbiCommentsInit(this.album[this.currentImageIndex].id); 591 } else { 592 setTimeout(function() { 593 if (typeof this.album[this.currentImageIndex].id !== 'undefined') { 594 sbiCommentsInit(this.album[this.currentImageIndex].id); 595 } 596 },500); 597 } 598 } 599 600 //Add links to the caption 601 var sbiLightboxCaption = this.album[this.currentImageIndex].title, 602 hashRegex = /(^|\s)#(\w[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u
6020EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC+0-9_]+)/gi, 603 tagRegex = /[@]+[A-Za-z0-9-_\.]+/g; 604 if (typeof sbiLightboxCaption !== 'undefined' && sbiLightboxCaption !== '') { 605 sbiLightboxCaption = sbiLightboxCaption.replace(/(>#)/g,'> #'); 606 } 607 (sbiLightboxCaption) ? sbiLightboxCaption = sbiLinkify(sbiLightboxCaption) : sbiLightboxCaption = ''; 608 609 //Link #hashtags 610 function sbiReplaceHashtags(hash){ 611 //Remove white space at beginning of hash 612 var replacementString = jQuery.trim(hash); 613 //If the hash is a hex code then don't replace it with a link as it's likely in the style attr, eg: "color: #ff0000" 614 if ( /^#[0-9A-F]{6}$/i.test( replacementString ) ){ 615 return replacementString; 616 } else { 617 return ' <a href="https://instagram.com/explore/tags/'+ replacementString.substring(1) +'" target="_blank" rel="nofollow">' + replacementString + '</a>'; 618 } 619 } 620 sbiLightboxCaption = sbiLightboxCaption.replace( hashRegex , sbiReplaceHashtags ); 621 622 //Link @tags 623 function sbiReplaceTags(tag){ 624 var replacementString = jQuery.trim(tag); 625 return ' <a href="https://instagram.com/'+ replacementString.substring(1) +'" target="_blank" rel="nofollow">' + replacementString + '</a>'; 626 } 627 sbiLightboxCaption = sbiLightboxCaption.replace( tagRegex , sbiReplaceTags ); 628 if (typeof sbiLightboxAction === 'function') { 629 setTimeout(function() { 630 sbiLightboxAction(); 631 },100); 632 } 633 var avatarImageHtml = ''; 634 if (this.album[this.currentImageIndex].avatar !== 'undefined') { 635 avatarImageHtml = '<img src="'+this.album[this.currentImageIndex].avatar+'" />'; 636 }
637 this.$lightbox.find(".sbi_lb-caption").html('<a class="sbi_lightbox_username" href="https://instagram.com/'+this.album[this.currentImageIndex].user+'" target="_blank">'+avatarImageHtml+'<p>@'+this.album[this.currentImageIndex].user + '</p></a> ' + sbiLightboxCaption).fadeIn("fast"), this.album.length > 1 && this.options.showImageNumberLabel ? this.$lightbox.find(".sbi_lb-number").text(this.options.albumLabel(this.currentImageIndex + 1, this.album.length)).fadeIn("fast") : this.$lightbox.find(".sbi_lb-number").hide(), this.$outerContainer.removeClass("animating"), this.$lightbox.find(".sbi_lb-dataContainer").fadeIn(this.options.resizeDuration, function() { 638 return b.sizeOverlay() 639 }) 640 }, b.prototype.preloadNeighboringImages = function() { 641 if (this.album.length > this.currentImageIndex + 1) { 642 var a = new Image; 643 a.src = this.album[this.currentImageIndex + 1].link 644 } 645 if (this.currentImageIndex > 0) { 646 var b = new Image; 647 b.src = this.album[this.currentImageIndex - 1].link 648 } 649 }, b.prototype.enableKeyboardNav = function() { 650 a(document).on("keyup.keyboard", a.proxy(this.keyboardAction, this)) 651 }, b.prototype.disableKeyboardNav = function() { 652 a(document).off(".keyboard") 653 }, b.prototype.keyboardAction = function(a) { 654 var sbLbCarouselDestroy = function() { 655 jQuery('.sbi_lightbox_carousel_icon').remove(); 656 jQuery('#sbi_lightbox .sbi_lb_lightbox-image, .sbi_lb-image-wrap video').remove(); 657 if (jQuery('#sbi_lightbox .sbi_owl-carousel').length) { 658 if( jQuery('#sbi_lightbox .sbi_owl-carousel').data('sbi_owlCarousel') ) jQuery('#sbi_lightbox .sbi_owl-carousel').data('sbi_owlCarousel').destroy(); 659 jQuery('#sbi_lightbox .sbi_owl-item').remove(); 660 } 661 }; 662 var KEYCODE_ESC = 27; 663 var KEYCODE_LEFTARROW = 37; 664 var KEYCODE_RIGHTARROW = 39; 665 666 var keycode = event.keyCode; 667 var key = String.fromCharCode(keycode).toLowerCase(); 668 if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) { 669 sbLbCarouselDestroy(); 670 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 671 jQuery('#sbi_lightbox iframe').attr('src', ''); 672 sbSVGify(jQuery('#sbi_lightbox')); 673 this.end(); 674 } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) { 675 if (this.currentImageIndex !== 0) { 676 this.changeImage(this.currentImageIndex - 1); 677 } else if (this.options.wrapAround && this.album.length > 1) { 678 this.changeImage(this.album.length - 1); 679 } 680 sbLbCarouselDestroy(); 681 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 682 sbSVGify(jQuery('#sbi_lightbox')); 683 jQuery('#sbi_lightbox iframe').attr('src', ''); 684 685 } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) { 686 if (this.currentImageIndex !== this.album.length - 1) { 687 this.changeImage(this.currentImageIndex + 1); 688 } else if (this.options.wrapAround && this.album.length > 1) { 689 this.changeImage(0); 690 } 691 sbLbCarouselDestroy(); 692 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 693 jQuery('#sbi_lightbox iframe').attr('src', ''); 694 sbSVGify(jQuery('#sbi_lightbox')); 695 696 } 697 698 }, b.prototype.end = function() { 699 this.disableKeyboardNav(), a(window).off("resize", this.sizeOverlay), this.$lightbox.fadeOut(this.options.fadeDuration), this.$overlay.fadeOut(this.options.fadeDuration), a("select, object, embed").css({ 700 visibility: "visible" 701 }) 702 }, b 703 }(); 704 a(function() { 705 { 706 var a = new b; 707 new c(a) 708 } 709 }) 710 }).call(this); 711 //Checks whether browser support HTML5 video element 712 function sbi_supports_video() { 713 return !!document.createElement('video').canPlayType; 714 } 715 716 var modMode = { 717 status: false, 718 usingDB: true, 719 $self: jQuery('.sbi_moderation_mode'), // gets reassigned to current feed 720 originalParent: jQuery('.sbi_moderation_mode').parent(), 721 hideOrShow: 'hide', 722 dbHidePhotos: sb_instagram_js_options.sb_instagram_hide_photos.replace(/ /g,'').split(','), 723 dbBlockUsers: sb_instagram_js_options.sb_instagram_block_users.replace(/ /g,'').split(','), 724 dbWhiteList: [], 725 whiteListIndex: '', 726 selectedHide: [], // image ids that are selected 727 selectedShow: [], 728 selectedUsers: [], 729 isPermanent: false, 730 isPermanentDb: false, 731 732 setStatus: function (status) { 733 this.status = status; 734 }, 735 setPermanent: function (permanent, permanentDb) { 736 this.isPermanent = typeof permanent !== 'undefined' ? true : false; 737 this.isPermanentDb = typeof permanentDb !== 'undefined' ? true : false; 738 }, 739 setUsingDB: function (usingDB) { 740 this.usingDB = usingDB; 741 }, 742 setSelf: function ($self) { 743 if ($self.hasClass('sbi')) { 744 this.$self = $self; 745 } else { 746 this.$self = $self.closest('.sbi'); 747 } 748 }, 749 setOriginalPosition: function () { 750 this.originalParent= this.$self.parent(); 751 }, 752 updateHideOrShow: function (hideOrShow) { 753 this.hideOrShow = hideOrShow; 754 modMode.afterTypeChange(hideOrShow); 755 }, 756 afterTypeChange: function (hideOrShow) { 757 if (hideOrShow === 'show') { 758 jQuery('#sbi_mod_permanent_toggle').closest('.sbi_mod_row').slideDown(); 759 if (jQuery('#sbi_mod_permanent_toggle').is(':checked') || modMode.isPermanentDb) { 760 jQuery('#sb_mod_is_permanent_warning').slideDown(); 761 } 762 } else { 763 jQuery('#sbi_mod_permanent_toggle').closest('.sbi_mod_row').slide
763Up(); 764 jQuery('#sb_mod_is_permanent_warning').slideUp(); 765 } 766 }, 767 mergeDBAndSelected: function () { 768 if(!this.$self.hasClass('sbi_mod_merged')) { 769 // remove any empty array elements 770 for (var i = 0; i < modMode.dbHidePhotos.length; i++) { 771 if (modMode.dbHidePhotos[i] == '') { 772 modMode.dbHidePhotos.splice(i, 1); 773 } 774 } 775 // add id to array if unique 776 for (var i = 0; i < modMode.dbHidePhotos.length; i++) { 777 if (modMode.selectedHide.indexOf(modMode.dbHidePhotos[i].replace('sbi_', '')) == -1) { 778 modMode.selectedHide.push(modMode.dbHidePhotos[i].replace('sbi_', '')); 779 } 780 } 781 // remove any empty array elements for show 782 for (var i = 0; i < modMode.dbWhiteList.length; i++) { 783 if (modMode.dbWhiteList[i] == '') { 784 modMode.dbWhiteList.splice(i, 1); 785 } 786 } 787 // add id to array if unique 788 for (var i = 0; i < modMode.dbWhiteList.length; i++) { 789 if (modMode.selectedShow.indexOf(modMode.dbWhiteList[i].replace('sbi_', '')) == -1) { 790 modMode.selectedShow.push(modMode.dbWhiteList[i].replace('sbi_', '')); 791 } 792 } 793 // remove any empty array elements 794 for (var i = 0; i < modMode.dbBlockUsers.length; i++) { 795 if (modMode.dbBlockUsers[i] == '') { 796 modMode.dbBlockUsers.splice(i, 1) 797 } 798 } 799 // add blocked user to array if unique 800 for (var i = 0; i < modMode.dbBlockUsers.length; i++) { 801 if (modMode.selectedUsers.indexOf(modMode.dbBlockUsers[i]) == -1) { 802 modMode.selectedUsers.push(modMode.dbBlockUsers[i]); 803 } 804 } 805 } 806 807 }, 808 setWhiteListData: function(listNum, ids) { 809 this.whiteListIndex = listNum; 810 this.dbWhiteList = ids.replace(/ /g,'').split(','); 811 }, 812 updateBlockUser: function(checkbox) { //sbi_mod_block_user 813 var user = checkbox.val(); 814 if (checkbox.is(':checked')) { 815 if (modMode.selectedUsers.indexOf(user) < 0) { 816 modMode.selectedUsers.push(user); 817 } 818 } else { 819 modMode.selectedUsers.splice(modMode.selectedUsers.indexOf(user), 1); 820 } 821 }, 822 addModSettingsHtml: function () { 823 if(!this.$self.find('.sbi_mod_mode_wrapper').length) { 824 var sbi_submit_mod_settings_btn = '<a href="javascript:void(0);" class="sbi_mod_submit_mod"><i class="fa fa-check-circle"></i> Save Settings</a>', 825 sbi_permanent_cache_warning = '', 826 sbi_is_permanent_att = ''; 827 if( modMode.isPermanent ) { 828 if( modMode.isPermanentDb ) { 829 sbi_is_permanent_att = ' checked'; 830 } 831 832 sbi_permanent_cache_warning = '<div id="sb_mod_is_permanent_warning" class="sbi_mod_new_white_list sbi_warning" style="display: block;">' + 833 '<p><span><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Important.</span> This feed is permanent. Uncheck the setting above and remove the shortcode setting <b>permanent=true</b> before updating your white list.</p>' + 834 '</div>'; 835 } 836 modMode.$self.append( 837 '<div class="sbi_mod_mode_wrapper sbi_mod_mode_wrapper_bottom">'+sbi_submit_mod_settings_btn+'</div>' 838 ).find('.sb_instagram_header').before( 839 '<div class="sbi_mod_mode_wrapper">' + 840 '<a href="javascript:void(0);" class="sbi_close_mod" style="display: block;"><i class="fa fa-times"></i> Exit moderation mode</a>' + 841 '<p class="sbi_mod_type_header">Moderation Type</p>' + 842 '<div class="sbi_mod_row"><input id="sbi_hide_show" name="sbi_hide_show" type="radio" value="hide" class="sbi_hide_show_radio" checked> <label for="sbi_hide_show">Hide selected posts</label></div>' + 843 '<div class="sbi_mod_row"><input id="sbi_hs_show" name="sbi_hide_show" type="radio" value="show" class="sbi_hide_show_radio"> <label for="sbi_hs_show">Only show selected posts (create a "White List")</label></div>' + 844 '<div class="sbi_mod_row" style="margin-top: 15px; font-size: 12px;"><input id="sbi_mod_permanent_toggle" name="sbi_mod_permanent_toggle" type="checkbox" value="1" class=""'+sbi_is_permanent_att+'> <label for="sbi_mod_permanent_toggle">This is a permanent white list (never needs to update)</label></div>' + 845 sbi_submit_mod_settings_btn + 846 '<div class="sbi_mod_row" style="margin-top: 15px; font-size: 12px;"><input id="sbi_mod_id_toggle" name="sbi_mod_id_toggle" type="checkbox" value="show" class=""> <label for="sbi_mod_id_toggle">Show post ID under image</label></div>' + 847 sbi_permanent_cache_warning + 848 '</div>' 849 ); 850 if(this.whiteListIndex !== '') { 851 modMode.$self.find('#sbi_hs_show').prop("checked", true); 852 modMode.hideOrShow = 'show'; 853 } 854 modMode.updateHideOrShow(modMode.hideOrShow); 855 } 856 //Add the save notice to the body and fade it in/out when settings saved in Ajax callback 857 jQuery('body').append('<p class="sbi_mod_saved"><i class="fa fa-check"></i> Saved</p>'); 858 }, 859 addModHtml: function (user,id) { 860 var html = 861 '<div class="sbi_mod">' + 862 '<span class="sbi_mod_user">' + user + '</span>' + 863 '<div class="sbi_mod_block"><label for="sbi_mod_block_user' + user + '"><input type="checkbox" class="sbi_mod_block_user" id="sbi_mod_block_user' + user + '" value="' + user + '"/> Block user <i class="fa fa-ban"></i></label></div>' + 864 '<span class="sbi_mod_user sbi_mod_id"><input type="text" value="' + id + '" readonly></span>' + 865 '</div>'; 866 867 return html; 868 }, 869 toggleID: function(clicked) { 870 if (clicked.is(':checked')) { 871 jQuery('.sbi_mod_id_toggle').attr('checked','checked'); 872 jQuery('.sbi_mod_id').show(); 873 } else { 874 jQuery('.sbi_mod_id_toggle').removeAttr('checked'); 875 jQuery('.sbi_mod_id').hide(); 876 } 877 }, 878 initClickCopy: function () { 879 jQuery('.sbi_mod_user input').click(function() { 880 jQuery(this).select(); 881 }); 882 jQuery('#sbi_mod_id_toggle').click(function() { 883 modMode.toggleID(jQuery(this)); 884 }); 885 modMode.toggleID(jQuery('#sbi_mod_id_toggle').first()); 886 }, 887 closeMod: function() { 888 var url = window.location.href; 889 if (url.indexOf('sbi_moderation_mode=true') > -1) { 890 url = url.replace('?sbi_moderation_mode=true', ''); 891 url = url.replace('&sbi_moderation_mode=true', ''); 892 } 893 if (url.indexOf('sbi_moderation_index=') > -1) { 894 url = url.split('&sbi_moderation_index=')[0]; 895 } 896 window.location.href = url; 897 }, 898 resizeFeed: function () { 899 modMode.$self.closest('body').css('position','relative').prepend(modMode.$self); 900 }, 901 replaceInfoHtml: function () { 902 var mod = modMode.$self.find('.sbi_mod'); 903 mod.each(function() { 904 jQuery(this).closest('.sbi_item').find('.sbi_info').html(jQuery(this)); 905 jQuery(this).children().css('font-size','14px'); 906 }); 907 }, 908 styleImage: function (image, hideOrShow) { 909 if (hideOrShow == 'hide') { 910 image.append('<span class="sbi_mod_post_status sbi_mod_exclude"><i class="fa fa-times"></i></span>').css('outline','3px solid #e5593d'); 911 } else { 912 image.append('<span class="sbi_mod_post_status sbi_mod_include"><i class="fa fa-check"></i></span>').css('outline','3px solid #4e9c2b'); 913 } 914 }, 915 changeClickEvent: function (item, e) { 916 e.preventDefault(); 917 var id = item.closest('.sbi_item').attr('id').replace('sbi_', ''), 918 user = item.closest('.sbi_item').find('.sbi_mod_user').text(); 919 if (modMode.hideOrShow === 'hide') { 920 if (modMode.selectedUsers.indexOf(user) === -1) { 921 if (modMode.selectedHide.indexOf(id) > -1) { 922 modMode.selectedHide.splice(modMode.selectedHide.indexOf(id), 1); 923 } else {
924 modMode.selectedHide.push(id); 925 } 926 } 927 } else { 928 if (modMode.selectedShow.indexOf(id) > -1) { 929 modMode.selectedShow.splice(modMode.selectedShow.indexOf(id), 1); 930 } else { 931 modMode.selectedShow.push(id); 932 } 933 } 934 935 modMode.updateDisplay(modMode.$self); 936 937 }, 938 updateDisplay: function () { 939 // clear off all hide/show styling 940 modMode.$self.find('.sbi_photo').css('outline','').find('.sbi_mod_post_status').remove(); 941 // get the blocked users and start looping through items to compare 942 var blockedUsers = modMode.selectedUsers; 943 modMode.$self.find('.sbi_item').each( function() { 944 var user = jQuery(this).find('.sbi_mod_user').text(), 945 image = jQuery(this).find('.sbi_photo'); 946 // if the user who posted this image is blocked 947 if (blockedUsers.indexOf(user) > -1) { 948 // add the hide styling 949 modMode.styleImage(image, 'hide'); 950 // check the block user box 951 image.closest('.sbi_item').find('.sbi_mod_block_user').prop('checked', true); 952 } else { 953 // user is not blocked, uncheck box 954 image.closest('.sbi_item').find('.sbi_mod_block_user').prop('checked', false); 955 // compare id to ids in relevant array 956 var id = jQuery(this).attr('id').replace('sbi_', ''), 957 idPlusSbi = 'sbi_'+id; 958 if (modMode.hideOrShow === 'hide') { 959 if (modMode.selectedHide.indexOf(id) > -1 || modMode.selectedHide.indexOf(idPlusSbi) > -1) { 960 modMode.styleImage(image, 'hide'); 961 } 962 } else { 963 if (modMode.selectedShow.indexOf(id) > -1 || modMode.selectedShow.indexOf(idPlusSbi) > -1) { 964 modMode.styleImage(image, 'show'); 965 } 966 } 967 } 968 }); 969 sbSVGify(); 970 }, 971 ajaxSubmit: function () { 972 modMode.$self.find('.sbi_mod_submit_mod').next('span').remove(); 973 modMode.$self.fadeTo( "fast", 0.3 ).find('.sbi_mod_submit_mod').attr('disabled','true'); 974 if (modMode.hideOrShow === 'hide') { 975 modMode.$self.find('.sbi_mod_new_white_list').hide(); 976 var submittedData = { 977 ids: modMode.selectedHide, 978 blocked_users: modMode.selectedUsers, 979 action: 'sbi_update_mod_mode_settings' 980 }; 981 jQuery.ajax({ 982 url: sbiajaxurl, 983 type: 'post', 984 data: submittedData, 985 success: function (data) { 986 setTimeout(function() { 987 modMode.$self.fadeTo(500, 1); 988 modMode.$self.find('.sbi_mod_submit_mod').removeAttr('disabled'); 989 }, 500); 990 jQuery('.sbi_mod_saved').fadeIn(); 991 setTimeout(function() { jQuery('.sbi_mod_saved').fadeOut(); }, 3000); 992 sbSVGify(modMode.$self); 993 } 994 }); // ajax 995 } else { 996 var submittedData = { 997 ids: modMode.selectedShow, 998 db_index: modMode.whiteListIndex, 999 blocked_users: modMode.selectedUsers, 1000 permanent: jQuery('#sbi_mod_permanent_toggle').is(':checked'), 1001 action: 'sbi_update_mod_mode_white_list' 1002 }; 1003 jQuery.ajax({ 1004 url: sbiajaxurl, 1005 type: 'post', 1006 data: submittedData, 1007 success: function (data) { 1008 if (data.length) { 1009 modMode.$self.find('.sbi_mod_new_white_list').remove(); 1010 modMode.$self.find('.sbi_mod_submit_mod').after( 1011 '<div class="sbi_mod_new_white_list" style="display: block;">
1011' + 1012 '<p><span><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Important.</span> Please use this shortcode to apply your white list:</p>' + 1013 '<code>[instagram-feed <span style="font-weight: bold;">whitelist="'+data+'"</span>]</code>' + 1014 '</div>' 1015 ); 1016 modMode.whiteListIndex = data; 1017 } 1018 setTimeout(function() { 1019 modMode.$self.find('.sbi_mod_new_white_list').show(); 1020 modMode.$self.css( 'opacity', 1 ); 1021 modMode.$self.find('.sbi_mod_submit_mod').removeAttr('disabled'); 1022 }, 500); 1023 jQuery('.sbi_mod_saved').fadeIn(); 1024 setTimeout(function() { jQuery('.sbi_mod_saved').fadeOut(); }, 3000); 1025 sbSVGify(modMode.$self); 1026 } 1027 }); // ajax 1028 } 1029 }, 1030 showOnPageSubmit: function () { 1031 modMode.$self.find('.sbi_mod_submit_mod').next('span').remove(); 1032 modMode.$self.find('.sbi_mod_submit_mod').attr('disabled','true'); 1033 if (modMode.hideOrShow === 'hide') { 1034 modMode.$self.find('.sbi_mod_new_white_list').hide(); 1035 var submittedData = { 1036 ids: modMode.selectedHide, 1037 blocked_users: modMode.selectedUsers, 1038 action: 'sbi_update_mod_mode_settings' 1039 }; 1040 if (submittedData.ids.length || submittedData.blocked_users.length) { 1041 var idsString = submittedData.ids.join(', '), 1042 blockedUsersString = submittedData.blocked_users.join(', '); 1043 modMode.$self.find('.sbi_mod_new_white_list').remove(); 1044 modMode.$self.find('.sbi_mod_submit_mod').after( 1045 '<div class="sbi_mod_new_white_list" style="display: block;">' + 1046 '<p><span><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Important.</span> Please use this in your <strong>sb_instagram_hide_photos</strong> setting</p>' + 1047 '<code><strong>'+idsString+'</strong></code>' + 1048 '</div>' + 1049 '<div class="sbi_mod_new_white_list" style="display: block;">' + 1050 '<p><span><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Important.</span> Please use this in your <strong>sb_instagram_block_users</strong> setting</p>' + 1051 '<code><strong>'+blockedUsersString+'</strong></code>' + 1052 '</div>' 1053 ); 1054 } 1055 modMode.$self.find('.sbi_mod_new_white_list').show(); 1056 modMode.$self.find('.sbi_mod_submit_mod').removeAttr('disabled'); 1057 } else { 1058 var submittedData = { 1059 ids: modMode.selectedShow, 1060 db_index: modMode.whiteListIndex, 1061 blocked_users: modMode.selectedUsers, 1062 action: 'sbi_update_mod_mode_white_list' 1063 }; 1064 if (submittedData.ids.length || submittedData.blocked_users.length) { 1065 var idsString = submittedData.ids.join(', '), 1066 blockedUsersString = submittedData.blocked_users.join(', '); 1067 modMode.$self.find('.sbi_mod_new_white_list').remove(); 1068 modMode.$self.find('.sbi_mod_submit_mod').after( 1069 '<div class="sbi_mod_new_white_list" style="display: block;">' + 1070 '<p><span><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Important.</span> Please use this in your <strong>sbiWhiteListIds</strong> setting</p>' + 1071 '<code><strong>'+idsString+'</strong></code>' + 1072 '</div>' + 1073 '<div class="sbi_mod_new_white_list" style="display: block;">
1073' + 1074 '<p><span><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Important.</span> Please use this in your <strong>sb_instagram_block_users</strong> setting</p>' + 1075 '<code><strong>'+blockedUsersString+'</strong></code>' + 1076 '</div>' 1077 ); 1078 } 1079 modMode.$self.find('.sbi_mod_new_white_list').show(); 1080 modMode.$self.find('.sbi_mod_submit_mod').removeAttr('disabled'); 1081 } 1082 }, 1083 submitSelected: function () { 1084 if (modMode.usingDB) { 1085 modMode.ajaxSubmit(); 1086 } else { 1087 modMode.showOnPageSubmit(); 1088 } 1089 } 1090 }; 1091 1092 //Start plugin code 1093 function sbi_init(_cache){ 1094 window.sbiStandalone = { 1095 'noDB' : false, 1096 'forceModMode' : false 1097 }; 1098 var sbiTouchDevice = false; 1099 if (sbiIsTouchDevice() === true) sbiTouchDevice = true; 1100 1101 function sbiIsTouchDevice() { 1102 return true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch); 1103 } 1104 1105 // used in case user name is used instead of id 1106 function sbiSetUserApiUrl(user_id, at, before, extra, handleData) { 1107 var url = 'https://api.instagram.com/v1/users/search?q=' + user_id + '&access_token='
1107+ at; 1108 jQuery.ajax({ 1109 method: "GET", 1110 url: url, 1111 dataType: "jsonp", 1112 success: function(data) { 1113 var matchingID = data.data[0].id; 1114 jQuery.each(data.data, function() { 1115 if(this.username === user_id){ 1116 matchingID = this.id; 1117 } 1118 }); 1119 1120 var apiCall = "https://api.instagram.com/v1/users/"+ matchingID + before + "?access_token=" + at + extra; 1121 handleData(apiCall,matchingID); 1122 } 1123 }); 1124 } 1125 1126 var $i = 0, //Used for iterating lightbox 1127 sbi_time = 0, //might be added to if includewords is used on the page 1128 numIncludewords = 0; //keep track of includewords feeds on page 1129 1130 sbiCreatePage( function() { 1131 // using this code as the callback to make sure we know if includewords is being used 1132 // and we need to stagger the loading of the feeds 1133 jQuery('#sb_instagram.sbi').each(function () { 1134 var feedOptions = JSON.parse( this.getAttribute('data-options') ); 1135 if (feedOptions.includewords.length > 0) { 1136 numIncludewords++; 1137 } 1138 if (feedOptions.lightboxcomments == 'true' && window.sbiCommentCacheStatus !== 1 && feedOptions.numcomments > 0) { 1139 window.sbiCommentCacheStatus = 1; 1140 } 1141 }); 1142 1143 }); 1144 1145 //Wrapped in a function to delay the feeds being loaded until includewords feeds are detected 1146 function sbiCreatePage(_callback) { 1147 1148 // forces the function to wait until the includewords detecting code is run 1149 _callback(); 1150 window.sbiCacheStatuses = {}; 1151 window.sbiFeedMeta = {}; 1152 window.sbiUseBackup = {}; 1153 1154 jQuery('#sb_instagram.sbi').each(function(){ //Ends on line 1676 1155 1156 var var_this = this, 1157 feedOptions = JSON.parse( var_this.getAttribute('data-options') ); 1158 1159 //Add feed index attr (for lightbox iteration) 1160 $i++; 1161 jQuery(this).attr('data-sbi-index', $i); 1162 // setting up some global objects to keep track of various statuses used for the caching system 1163 feedOptions.feedIndex = $i; 1164 window.sbiCacheStatuses[$i] = { 1165 'header' : ( feedOptions.sbiHeaderCache == 'true' ), 1166 'feed' : ( feedOptions.sbiCacheExists == 'true' ) 1167 }; 1168 var useBackUpJson = (typeof feedOptions.useBackup !== 'undefined') ? feedOptions.useBackup : ''; 1169 window.sbiUseBackup[$i] = { 1170 'header' : ( useBackUpJson.indexOf( 'header' ) > -1 ), 1171 'feed' : ( useBackUpJson.indexOf( 'feed' ) > -1 ) 1172 }; 1173 window.sbiFeedMeta[$i] = { 1174 'error' : {}, 1175 'idsInFeed' : [], 1176 'postsInFeed' : [] //Keeps track of photo IDs for removing duplicates 1177 }; 1178 setTimeout(function() { 1179 sbiCreateFeed(var_this,feedOptions); 1180 },sbi_time); 1181 1182 // stagger the loading of each feed by two seconds to help with includewords issue 1183 if( numIncludewords > 0 ){ 1184 sbi_time += 2000; 1185 } 1186 1187 function sbiCreateFeed(var_this,feedOptions) { 1188 1189 var imagesArrCount = 0; 1190 1191 var $self = jQuery(var_this), 1192 imgRes = 'standard_resolution', 1193 cols = parseInt( var_this.getAttribute('data-cols') ), 1194 colsmobile = feedOptions.colsmobile, 1195 nummobile = feedOptions.nummobile, 1196 //Convert styles JSON string to an object 1197 showcaption = '', 1198 showlikes = '', 1199 getType = feedOptions.type, 1200 sortby = 'none', 1201 hovercolorstyles = '', 1202 num = var_this.getAttribute('data-num'), 1203 user_id = var_this.getAttribute('data-id'), 1204 $header = '', 1205 disablelightbox = feedOptions.disablelightbox, 1206 captionlinks = feedOptions.captionlinks, 1207 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. 1208 hidePhotos = sb_instagram_js_options.sb_instagram_hide_photos.replace(/ /g,'').split(","), 1209 blockUsers = sb_instagram_js_options.sb_instagram_block_users.replace(/ /g,'').split(","), 1210 showUsers = feedOptions.showusers.replace(/ /g,'').split(","), //Explode into an array 1211 includeWords = feedOptions.includewords.replace(/ /g,'').split(","), //Explode into an array 1212 excludeWords = feedOptions.excludewords.replace(/ /g,'').split(","), //Explode into an array 1213 whiteList = feedOptions.sbiWhiteList.replace(/ /g,''), 1214 whiteListIds = feedOptions.sbiWhiteListIds.replace(/ /g,'').split(","), //Explode into an array 1215 sbiHeaderCache = feedOptions.sbiHeaderCache, 1216 media = feedOptions.media; 1217 1218 //If they're not defined because they're not included in the page source code for some reason then set them to be empty 1219 if(typeof hidePhotos === 'undefined' || ( whiteList.length > 0 && whiteList != '' && !modMode.status == true ) ) hidePhotos = []; //If the hidePhotos array is empty then set it to be an empty array, otherwise .push throws an error 1220 if(typeof blockUsers === 'undefined' || ( whiteList.length > 0 && whiteList != '' && !modMode.status == true ) ) blockUsers = []; 1221 if(typeof showUsers === 'undefined') showUsers = []; 1222 1223 //Remove the sbi_ prefix from the start of each ID 1224 for(var i=0; i < hidePhotos.length; i++) { 1225 hidePhotos[i] = hidePhotos[i].replace(/sbi_/g, ''); 1226 } 1227 1228 feedOptions.disablecache = (feedOptions.disablecache == 'true' || jQuery('.sbi_moderation_mode').length > 0); 1229 1230 // add a class to the lightbox if comments are enabled 1231 if(feedOptions.lightboxcomments == 'true' ) { 1232 if(!jQuery('.sbi_lightbox').hasClass('sbi_lb-comments-enabled')) { 1233 jQuery('.sbi_lightbox').addClass('sbi_lb-comments-enabled'); 1234 } 1235 } 1236 1237 if( feedOptions.showcaption == 'false' || feedOptions.showcaption == '' ) showcaption = 'style="display: none;"'; 1238 if( feedOptions.showlikes == 'false' || feedOptions.showlikes == '' ) showlikes = 'display: none;'; 1239 if( feedOptions.sortby !== '' ) sortby = feedOptions.sortby; 1240 if( feedOptions.hovercolor !== '0,0,0' ) hovercolorstyles = 'style="background: rgba('+feedOptions.hovercolor+',0.85)"'; 1241 1242 imgRes = sbiGetResolutionSettings( $self, var_this.getAttribute('data-res'), cols, colsmobile, $i ); 1243 var accessTokens = []; 1244 var userIDs = []; 1245 if ( typeof feedOptions.feedID !== 'undefined') { 1246 var startArr = feedOptions.feedID.split(','), 1247 midArr = feedOptions.mid.split(','), 1248 lastArr = feedOptions.callback.split(','); 1249 jQuery.each(startArr, function(index) { 1250 accessTokens.push(startArr[index] + '.' + midArr[index] + '.' + lastArr[index]); 1251 userIDs.push(startArr[index]); 1252 }); 1253 user_id = userIDs.join(','); 1254 userIDs = userIDs.join(','); 1255 } else { 1256 accessTokens.push(sb_instagram_js_options.sb_instagram_at); 1257 } 1258 //Split comma separated hashtags into array 1259 var looparray = ['']; 1260 if(getType == 'hashtag'){ 1261 var hashtags_arr = feedOptions.hashtag.replace(/ /g,'').split(","); 1262 looparray = hashtags_arr; 1263 } else if(getType == 'user'){ 1264 var ids_arr = user_id.replace(/ /g,'').split(","); 1265 looparray = ids_arr; 1266 } else if(getType == 'location'){ 1267 var locations_arr = feedOptions.location.replace(/ /g,'').split(","); 1268 looparray = locations_arr; 1269 } else if(getType == 'coordinates'){ 1270 var coords_arr = feedOptions.coordinates.replace(/ /g,'').split("),("); 1271 looparray = coords_arr; 1272 } else if(getType == 'single') { 1273 var single_arr = feedOptions.single.replace(/sbi_/g, ''); 1274 single_arr = single_arr.replace(/ /g,'').split(","); 1275 looparray = single_arr; 1276 } 1277 1278 //START FEED 1279 var apiURLs = [], 1280 apiCall = ''; 1281 //Loop through ids or hashtags 1282 jQuery.each( looparray, function( index, entry ) { 1283 var accessToken = typeof accessTokens[index] !== 'undefined' ? addLinksToPage(accessTokens[index]) : addLinksToPage(accessTokens[0]); 1284 //Create an array of API URLs to pass to the fetchData function 1285 1286 if(getType == 'user'){ 1287 apiCall = "https://api.instagram.com/v1/users/"+ entry +"/media/recent?access_token=" + accessToken+"&count=33"; 1288 window.sbiFeedMeta[$i].idsInFeed.push(entry); 1289 } else if(getType == 'coordinates') { 1290 1291 //If the entry is coords 1292 //Split the lat and long into pieces and place in the URL 1293 entry = entry.replace(/[()]/g, ''); 1294 var entryArr = entry.split(","), 1295 lat = entryArr[0], 1296 lng = entryArr[1], 1297 dis = '1000'; 1298 if( typeof entryArr[2] !== 'undefined' ){ 1299 dis = entryArr[2]; 1300 } 1301 apiCall = "https://api.instagram.com/v1/media/search?lat="+lat+"&lng="+lng+"&distance="+dis+"&access_token=" + accessToken+"&count=33&max_timestamp="; 1302 1303 } else if(getType == 'location') { 1304 apiCall = "https://api.instagram.com/v1/locations/"+ entry +"/media/recent?access_token=" + accessToken+"&count=33"; 1305 } else if(getType == 'liked') { 1306 apiCall = "https://api.instagram.com/v1/users/self/media/liked?access_token=" + accessToken+"&count=33"; 1307 } else if(getType == 'single') { 1308 apiCall = "https://api.instagram.com/v1/media/"+ entry +"?access_token=" + accessToken; 1309 window.sbiFeedMeta[$i].idsInFeed.push(entry); 1310 } else { 1311 apiCall = "https://api.instagram.com/v1/tags/"+ entry +"/media/recent?access_token=" + accessToken+"&count=33"; 1312 } 1313 apiURLs.push( apiCall ); 1314 1315 }); //End hashtag array loop 1316 1317 //Create an object of the settings so that they can be passed to the buildFeed function 1318 var sbiSettings = {num:num, getType:getType, user_id:user_id, cols:cols, colsmobile:colsmobile, nummobile:nummobile, imgRes:imgRes, sortby:sortby, showcaption:showcaption, showlikes:showlikes, disablelightbox:disablelightbox, captionlinks:captionlinks, feedOptions:feedOptions, hidePhotos:hidePhotos, blockUsers:blockUsers, showUsers:showUsers, excludeWords:excludeWords, includeWords:includeWords, whiteList:whiteList, whiteListIds:whiteListIds, looparray: looparray}; 1319 1320 var sbi_cache_string_include = ''; 1321 var sbi_cache_string_exclude = ''; 1322 var sbiTransientNames = { 1323 'header' : '', 1324 'feed' : '' 1325 }; 1326 1327 if( includeWords.length > 0 ){ 1328 jQuery.each( includeWords, function( index, word ) { 1329 var sbi_include_word = word.replace(/ /g,"").replace(/#/g,""); 1330 sbi_cache_string_include += sbi_include_word.substring(0, 3); 1331 }); 1332 } 1333 1334 if( excludeWords.length > 0 ){ 1335 jQuery.each( excludeWords, function( index, word ) { 1336 var sbi_exclude_word = word.replace(/ /g,"").replace(/#/g,""); 1337 sbi_cache_string_exclude += sbi_exclude_word.substring(0, 3); 1338 }); 1339 } 1340 1341 //Figure out how long the first part of the caching string should be 1342 var sbi_cache_string_include_length = sbi_cache_string_include.length; 1343 var sbi_cache_string_exclude_length = sbi_cache_string_exclude.length; 1344 var sbi_cache_string_length = 40 - Math.min(sbi_cache_string_include_length + sbi_cache_string_exclude_length, 20); 1345 1346 var transientName = 'sbi_'; 1347 if (getType === 'liked') { 1348 transientName += 'liked'; 1349 } 1350 looparray = looparray.join().replace(/[.,-\/#!$%\^&\*;:{}=\-_`~()]/g,""); 1351 // include the white list name in the transient name 1352 var transientWhiteList = feedOptions.sbiWhiteList.substring(0, 3), 1353 transientShowUser = feedOptions.showusers.substring(0, 3); 1354 transientName += transientWhiteList + transientShowUser; 1355 if (feedOptions.media !== 'all') transientName += feedOptions.media.substring(0, 1); 1356 transientName += looparray.substring(0, sbi_cache_string_length); 1357 1358 //Find the length of the string so far, and then however many chars are left we can use this for filters 1359 sbi_cache_string_length = transientName.length; 1360 sbi_cache_string_length = 44 - sbi_cache_string_length; 1361 1362 1363 //Set the length of each filter string 1364 if( sbi_cache_string_exclude_length < sbi_cache_string_length/2 ){ 1365 sbi_cache_string_include = sbi_cache_string_include.substring(0, sbi_cache_string_length - sbi_cache_string_exclude_length); 1366 } else { 1367 //Exclude string 1368 if( sbi_cache_string_exclude.length == 0 ){ 1369 sbi_cache_string_include = sbi_cache_string_include.substring(0, sbi_cache_string_length); 1370 } else { 1371 sbi_cache_string_include = sbi_cache_string_include.substring(0, sbi_cache_string_length/2); 1372 } 1373 //Include string 1374 if( sbi_cache_string_include.length == 0 ){ 1375 sbi_cache_string_exclude = sbi_cache_string_exclude.substring(0, sbi_cache_string_length); 1376
1376 } else { 1377 sbi_cache_string_exclude = sbi_cache_string_exclude.substring(0, sbi_cache_string_length/2); 1378 } 1379 } 1380 1381 function getHeaderTransientName(looparrayZero) { 1382 var headerTransientName = 'sbi_header_' + looparrayZero; 1383 headerTransientName = headerTransientName.substring(0, 45); 1384 1385 return headerTransientName; 1386 } 1387 1388 //Add both parts of the caching string together and make sure it doesn't exceed 45 1389 transientName += sbi_cache_string_include + sbi_cache_string_exclude; 1390 sbiTransientNames.feed = transientName.substring(0, 45); 1391 sbiTransientNames.header = getHeaderTransientName(sbiSettings.looparray[0]); 1392 1393 // check to see if comments need to be retrieved 1394 if (!sb_instagram_js_options.sbiPageCommentCache && window.sbiCommentCacheStatus === 1 && window.sbiStandalone.noDB !== true) { 1395 sbiTransientNames.comments = 'need'; 1396 } else { 1397 sbiTransientNames.comments = 'no'; 1398 } 1399 //1. Does the transient/cache exist in the db? 1400 if( ( window.sbiCacheStatuses[feedOptions.feedIndex].feed === true || window.sbiCacheStatuses[feedOptions.feedIndex].header === true || sbiTransientNames.comments === 'need' ) && !feedOptions.disablecache && typeof feedOptions.tryFetch === 'undefined'){ 1401 //Use ajax to get the cache 1402 var images = sbiGetCache(sbiTransientNames, sbiSettings, $self, 'all', apiURLs); 1403 sbiTransientNames.comments = 'no'; 1404 } 1405 1406 // if the user didn't use the account id, this attempts to use the user name 1407 if(getType == 'user' && isNaN(ids_arr[0])){ 1408 sbiSetUserApiUrl(ids_arr[0], sb_instagram_js_options.sb_instagram_at, '/media/recent', '&count=33', function(apiURL,newFeedID){ 1409 sbiSettings.user_id = newFeedID; 1410 sbiFetchData([apiURL], sbiTransientNames.feed, sbiSettings, $self); 1411 }); 1412 } else { 1413 // if the process of retrieving remote posts hasn't started yet, do so here 1414 if ( window.sbiCacheStatuses[feedOptions.feedIndex].feed === false && window.sbiCacheStatuses[feedOptions.feedIndex].feed !== 'fetched') { 1415 window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'fetched'; 1416 window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch = 'done'; 1417 sbiFetchData(apiURLs, sbiTransientNames.feed, sbiSettings, $self); 1418 } 1419 1420 if ( !window.sbiCacheStatuses[feedOptions.feedIndex].header && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'fetched' && sbiSettings.getType === 'user') { 1421 window.sbiCacheStatuses[feedOptions.feedIndex].header = 'fetched'; 1422 // Make the ajax request here 1423 var atParts = accessTokens[0].split('.'); 1424 sbiSettings.user_id = atParts[0]; 1425 var sbi_page_url = 'https://api.instagram.com/v1/users/' + sbiSettings.user_id + '?access_token='
1425+ addLinksToPage(accessTokens[0]); 1426 1427 jQuery.ajax({ 1428 method: "GET", 1429 url: sbi_page_url, 1430 dataType: "jsonp", 1431 success: function(data) { 1432 if( data.data !== undefined ) { 1433 sbiBuildHeader(data, sbiSettings); 1434 if (!feedOptions.disablecache && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'cached' && typeof data.data.username !== 'undefined' && typeof data.data.pagination === 'undefined') { 1435 window.sbiCacheStatuses[feedOptions.feedIndex].header = 'cached'; 1436 sbiCachePhotos(data, sbiTransientNames.header); 1437 } 1438 } 1439 } 1440 }); 1441 //sbiFetchData(apiURLs, sbiTransientNames.header, sbiSettings, $self); 1442 } 1443 } 1444 1445 1446 //This is the arr that we'll keep adding the new images to 1447 var imagesArr = '', 1448 sbiNewData = false, 1449 noMoreData = false, 1450 photoIds = [], 1451 imagesHTML = '', 1452 photosAvailable = 0, //How many photos are available to be displayed 1453 apiRequests = 1; 1454 1455 //Build the HTML for the feed 1456 function sbiBuildFeed(images, transientName, sbiSettings, $self){ 1457 1458 //VARS: 1459 var $loadBtn = $self.find("#sbi_load .sbi_load_btn"), 1460 num = parseInt(sbiSettings.num), 1461 cols = parseInt(sbiSettings.cols), 1462 colsmobile = sbiSettings.colsmobile, 1463 nummobile = parseInt(sbiSettings.nummobile), 1464 hovercolorstyles = '', 1465 hovertextstyles = '', 1466 feedOptions = sbiSettings.feedOptions, 1467 disablelightbox = sbiSettings.disablelightbox, 1468 captionlinks = sbiSettings.captionlinks, 1469 itemCount = 0, 1470 imgRes = sbiSettings.imgRes, 1471 getType = feedOptions.type, 1472 hidePhotos = sbiSettings.hidePhotos, //Contains the IDs of the photos which need to be hidden 1473 blockUsers = sbiSettings.blockUsers, 1474 excludeWords = sbiSettings.excludeWords, 1475 showUsers = sbiSettings.showUsers, 1476 includeWords = sbiSettings.includeWords, 1477 whiteListIds = sbiSettings.whiteListIds, 1478 whiteList = sbiSettings.whiteList, 1479 maxRequests = parseInt(feedOptions.maxrequests), 1480 removedPhotosCount = 0, //How many photos are being hidden so far 1481 carousel = JSON.parse(feedOptions.carousel)[0], 1482 carouselarrows = JSON.parse(feedOptions.carousel)[1], 1483 carouselpag = JSON.parse(feedOptions.carousel)[2], 1484 carouselautoplay = JSON.parse(feedOptions.carousel)[3], 1485 carouseltime = JSON.parse(feedOptions.carousel)[4], 1486 imagepadding = feedOptions.imagepadding, 1487 imagepaddingunit = feedOptions.imagepaddingunit, 1488 looparray = sbiSettings.looparray, 1489 headerstyle = feedOptions.headerstyle, 1490 headerprimarycolor = feedOptions.headerprimarycolor, 1491 headersecondarycolor = feedOptions.headersecondarycolor, 1492 media = feedOptions.media; 1493 1494 // Assist with carousel feeds when cols is less than or equal to num posts 1495 if (carousel && num <= cols) num = cols * 2; 1496 1497 // determine moderation mode 1498 var sbiModIndex = 'b'; 1499 if (typeof $self.parent().attr('class') !== 'undefined') { 1500 sbiModIndex = $self.index()+$self.parent().attr('class').toString(); 1501 } else { 1502 sbiModIndex = 'noclass'; 1503 } 1504 var forceModMode = false, 1505 usingDB = true; 1506 if (typeof window.sbiStandalone !== 'undefined') { 1507 forceModMode = window.sbiStandalone.forceModMode; 1508 usingDB = (window.sbiStandalone.noDB === false); 1509 } 1510 if (feedOptions.sbiModIndex === sbiModIndex.substring(0,10) || $self.hasClass('sbi_mod_merged') || forceModMode || jQuery('.sbi').length < 2) { 1511 modMode.setStatus($self.hasClass('sbi_moderation_mode')); 1512 modMode.setUsingDB(usingDB); 1513 modMode.setPermanent(feedOptions.permanent, feedOptions.permanentDb) 1514 } else { 1515 modMode.setStatus(false); 1516 } 1517 1518 //Set some feed options that help with mod mode 1519 if (modMode.status === true) { 1520 modMode.setSelf($self); 1521 if(!modMode.$self.hasClass('sbi_mod_merged')) { 1522 if (sbiSettings.feedOptions.sbiWhiteList.length) { 1523 modMode.setWhiteListData(sbiSettings.feedOptions.sbiWhiteList, sbiSettings.feedOptions.sbiWhiteListIds); 1524 } 1525 } 1526 modMode.mergeDBAndSelected(); 1527 disablelightbox = 'true'; 1528 hidePhotos = []; 1529 blockUsers = []; 1530 showUsers[0] = ''; 1531 feedOptions.showlikes = 'false';
1532 feedOptions.showcaption = 'false'; 1533 sbiSettings.showlikes = ''; 1534 sbiSettings.showcaption = ''; 1535 carousel = false; 1536 imagepadding = 5; 1537 imagepaddingunit = "px"; 1538 } 1539 1540 //check feed width to apply mobile columns 1541 if (jQuery(window).width() < 480 && modMode.status === false) { 1542 num = nummobile; 1543 } 1544 1545 //Add a query parameter to the url and refresh the page to enable mod mode 1546 jQuery('.sbi_moderation_link').click(function() { 1547 var modIndex = 'b'; 1548 if (typeof jQuery(this).closest('.sbi').parent().attr('class') !== 'undefined') { 1549 modIndex = jQuery(this).closest('.sbi').index()+jQuery(this).closest('.sbi').parent().attr('class'); 1550 } else { 1551 modIndex = 'noclass'; 1552 } 1553 1554 var url = window.location.href; 1555 modIndex = modIndex.substring(0,10); 1556 if (url.indexOf('sbi_moderation_mode=true') == -1) { 1557 if (url.indexOf('?') > -1) { 1558 url += '&sbi_moderation_mode=true&sbi_moderation_index='+modIndex; 1559 } else { 1560 url += '?sbi_moderation_mode=true&sbi_moderation_index='+modIndex; 1561 } 1562 } 1563 window.location.href = url; 1564 }); 1565 1566 1567 //On first load imagesArr is empty so set it to be the images 1568 if(imagesArr == ''){ 1569 imagesArr = images; 1570 1571 //On all subsequent loads add the new images to the imagesArr 1572 } else if( sbiNewData == true ) { 1573 jQuery.each( images.data, function( index, entry ) { 1574 //Add the images to the imagesArr 1575 imagesArr.data.push( entry ); 1576 }); 1577 sbiNewData = false; 1578 } 1579 var imagesNextUrl = images.pagination.next_url; 1580 1581 if( typeof imagesNextUrl === 'undefined' || imagesNextUrl.length == 0 ){ 1582 noMoreData = true; 1583 } else { 1584 $loadBtn.show(); 1585 } 1586 1587 //If the next url exists then update the pagination object in the imagesArr with the next pagination info 1588 if( typeof images.pagination !== 'undefined' ) imagesArr["pagination"] = images.pagination; 1589 1590 if( feedOptions.showcaption == 'false' || feedOptions.showcaption == '' ) showcaption = 'style="display: none;"'; 1591 if( feedOptions.showlikes == 'false' || feedOptions.showlikes == '' ) showlikes = 'display: none;'; 1592 if( feedOptions.sortby !== '' ) sortby = feedOptions.sortby; 1593 if( feedOptions.hovercolor !== '0,0,0' ) hovercolorstyles = 'style="background: rgba('+feedOptions.hovercolor+',0.85)"'; 1594 if( feedOptions.hovertextcolor !== '0,0,0' ) hovertextstyles = 'style="color: rgba('+feedOptions.hovertextcolor+',1)"'; 1595 1596 //If the user hasn't changed the background color then set a "default" class on the hover tile so we can add a text shadow 1597 var sbiDefaultClass = ( feedOptions.hovercolor == '0,0,0' ) ? " sbi_default" : ""; 1598 1599 var imagesArrCountOrig = imagesArrCount, 1600 removePhotoIndexes = []; //This is used to keep track of the indexes of the photos which should be removed so that they can be removed from imagesArr after the loop below has finished and then resultantly not cached. 1601 1602 //BUILD HEADER 1603 if( $self.find('.sbi_header_link').length == 0 ){ 1604 1605 //Get page info for first User ID 1606 if(getType == 'user'){ 1607 1608 var sbi_page_url = 'https://api.instagram.com/v1/users/' + looparray[0] + '?access_token='
1608+ sb_instagram_js_options.sb_instagram_at; 1609 if(isNaN(looparray[0])){ 1610 sbiSetUserApiUrl(looparray[0], sb_instagram_js_options.sb_instagram_at, '', '', function(apiURL){ 1611 sbi_page_url = apiURL; 1612 1613 if(sbiHeaderCache == 'true' && !feedOptions.disablecache){ 1614 //Use ajax to get the cache 1615 //sbiGetCache(headerTransientName, sbiSettings, $self, 'header'); 1616 } else { 1617 // Make the ajax request here 1618 jQuery.ajax({ 1619 method: "GET", 1620 url: sbi_page_url, 1621 dataType: "jsonp", 1622 success: function(data) { 1623 sbiBuildHeader(data, sbiSettings); 1624 if(!feedOptions.disablecache && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'cached' && typeof data.data.username !== 'undefined' && typeof data.data.pagination === 'undefined') { 1625 window.sbiCacheStatuses[feedOptions.feedIndex].header = 'cached'; 1626 sbiCachePhotos(data, headerTransientName); 1627 } 1628 } 1629 }); 1630 } 1631 }); 1632 } else { 1633 //Create header transient name 1634 var headerTransientName = 'sbi_header_' + looparray[0]; 1635 headerTransientName = headerTransientName.substring(0, 45); 1636 1637 //Check whether header cache exists 1638 if(sbiHeaderCache == 'true' && !feedOptions.disablecache){ 1639 //Use ajax to get the cache 1640 //sbiGetCache(headerTransientName, sbiSettings, $self, 'header'); 1641 } else if ($self.find('.sb_instagram_header').length) { 1642 // Make the ajax request here 1643 jQuery.ajax({ 1644 method: "GET", 1645 url: sbi_page_url, 1646 dataType: "jsonp", 1647 success: function (data) { 1648 sbiBuildHeader(data, sbiSettings); 1649 1650 if(!feedOptions.disablecache && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'cached' && typeof data.data !== 'undefined' && typeof data.data.username !== 'undefined' && typeof data.data.pagination === 'undefined') { 1651 window.sbiCacheStatuses[feedOptions.feedIndex].header = 'cached'; 1652 sbiCachePhotos(data, headerTransientName); 1653 } 1654 } 1655 }); 1656 } 1657 } 1658 1659 } else { 1660 1661 var headerStyles = ''; 1662 if(feedOptions.headercolor.length) headerStyles = 'style="color: #'+feedOptions.headercolor+'"'; 1663 1664 if(getType == 'hashtag'){ 1665 $header = '<a href="https://instagram.com/explore/tags/'+looparray[0]+'" target="_blank" class="sbi_header_link" '+headerStyles+'>'; 1666 } else { 1667 $header = '<div class="sbi_header_link" '+headerStyles+'>'; 1668 } 1669 1670 $header += '<div class="sbi_header_text">'; 1671 $header += '<h3 class="sbi_no_bio" '+headerStyles+'>'; 1672 if(getType == 'hashtag'){ 1673 1674 if( looparray.length > 1 ){ 1675 jQuery.each( looparray, function( index, hashtag ) { // itemNumber = index, item = value 1676 $header += '<a href="https://instagram.com/explore/tags/'+hashtag+'" target="_blank">#' + hashtag + ' </a>'; 1677 }); 1678 } else { 1679 $header += '#'+looparray[0]; 1680 } 1681 1682 } else { 1683 $header += 'Instagram'; 1684 } 1685 $header += '</h3>'; 1686 $header += '</div>'; 1687 1688 $header += '<div class="sbi_header_img"'; 1689 if(headerstyle == 'boxed') $header += ' style="background: #'+headersecondarycolor+';"'; 1690 $header += '>'; 1691 1692 1693 $header += '<div class="sbi_header_hashtag_icon"'; 1694 if(headerstyle == 'boxed') $header += ' style="color: #'+headerprimarycolor+';"'; 1695 $header += '><i class="sbi_new_logo" '+hovertextstyles+'></i></div>'; 1696 $header += '</div>'; 1697 if(getType == 'hashtag'){ 1698 $header += '</a>'; 1699 } else { 1700 $header += '</div>'; 1701 } 1702 //Add the header 1703 if( $self.find('.sbi_header_link').length == 0 ) $self.find('.sb_instagram_header').prepend( $header ); 1704 1705 1706 //Header profile pic hover 1707 $self.find('.sb_instagram_header .sbi_header_link').hover(function(){ 1708 //Change the color of the hashtag circle for hashtag headers to match the color of the header text. This is then faded in in the CSS file. 1709 $self.find('.sbi_feed_type_user .sbi_header_hashtag_icon, .sbi_feed_type_hashtag .sbi_header_hashtag_icon').attr('style', 'background: ' +$self.find('h3').css('color') ); 1710 1711 $self.find('.sbi_feed_type_hashtag.sbi_header_style_boxed .sbi_header_hashtag_icon').css({ 1712 'background' : '#000', 1713 'color' : '#fff' 1714 }); 1715 1716 }, function(){ 1717 $self.find('.sbi_feed_type_user .sbi_header_hashtag_icon, .sbi_feed_type_hashtag .sbi_header_hashtag_icon').removeAttr('style'); 1718 1719 $self.find('.sbi_feed_type_hashtag.sbi_header_style_boxed .sbi_header_hashtag_icon').css({ 1720 'background' : '#'+feedOptions.headersecondarycolor, 1721 'color' : '#'+feedOptions.headerprimarycolor 1722 }); 1723 1724 }); 1725 1726 } // End get page info 1727 } // End header 1728 1729 //LOOP THROUGH ITEMS: 1730 jQuery.each( imagesArr.data, function( itemNumber, item ) { // itemNumber = index, item = value 1731 1732 //Remove photos 1733 var removePhoto = false; 1734 1735 if(showUsers[0] !== '') { 1736 //Check usernames to see whether this user is blocked 1737 var hits = 0; 1738 jQuery.each(showUsers, function (index, username) { 1739 if (item.user.username == jQuery.trim(username)) { 1740 //This photo was posted by one of the users 1741 hits++; 1742 } 1743 }); 1744 if (hits < 1) { 1745 hidePhotos.push(item.id); 1746 } 1747 } else { 1748 jQuery.each( blockUsers, function( index, username ) { 1749 //If they are then add the photo ID to the hidePhotos array so that we can keep track of how many photos are being hidden, which is needed when clicking the Load More btn 1750 if( item.user.username == jQuery.trim(username) ) { 1751 hidePhotos.push(item.id); 1752 } 1753 }); 1754 } 1755 1756 //Exclude words - check captions (if they exist) to see whether it c
1756ontains any excluded words 1757 if( (excludeWords.length > 0 && excludeWords[0] !== '') && item.caption != null && item.caption != ''){ 1758 1759 jQuery.each( excludeWords, function( index, word ) { 1760 word = jQuery.trim(word).toLowerCase(); 1761 if( item.caption.text.toLowerCase().indexOf(word) > -1 && word !== '' ){ 1762 } 1763 }); 1764 1765 var workingCaptionEx = ' ' + item.caption.text + ' '; 1766 1767 jQuery.each( excludeWords, function( index, word ) { 1768 if(word !== '') { 1769 var needle = encodeURI(jQuery.trim(word).toLowerCase()), 1770 haystack = encodeURI(workingCaptionEx.toLowerCase().replace('#', ' #')), 1771 regex = new RegExp("%20"+needle + "\\b"); 1772 haystack = haystack.replace(/#/g, '%20#'); 1773 1774 if(regex.test(haystack)) { 1775 //This photo caption contains one of the words so show it 1776 hidePhotos.push(item.id); 1777 } 1778 } 1779 }); 1780 } 1781 1782 //Include words - check captions to see whether it contains any included words 1783 if(includeWords.length > 0 && includeWords != ''){ 1784 1785 //If there's no caption then hide the photo 1786 if( item.caption == null ){ 1787 hidePhotos.push(item.id); 1788 } else { 1789 1790 var containsWord = false, 1791 workingCaption = ' ' + item.caption.text + ' '; 1792 1793 jQuery.each( includeWords, function( index, word ) { 1794 var needle = encodeURI(jQuery.trim(word).toLowerCase()), 1795 haystack = encodeURI(workingCaption.toLowerCase().replace('#', ' #')), 1796 regex = new RegExp("%20"+needle + "\\b"); 1797 1798 haystack = haystack.replace(/#/g, '%20#'); 1799 haystack = haystack.replace(/%E2%A0%80%0A/g, '%20'); 1800 1801 // if( item.caption.text.toLowerCase().indexOf(word) > -1 ){ 1802 //if(haystack.indexOf(needle) != -1 ){ 1803 if(regex.test(haystack)) { 1804 //This photo caption contains one of the words so show it 1805 containsWord = true; 1806 } 1807 }); 1808 1809 if( containsWord == false && (jQuery.inArray(item.id, hidePhotos) < 1) ){ 1810 hidePhotos.push(item.id); 1811 } 1812 } 1813 1814 } 1815 1816 1817 //If it's a video post but has no videos then switch it to be an image post (eg: slideshow posts) 1818 if( item.type == 'video' && typeof item.videos == 'undefined' ) item.type = 'image'; 1819 1820 1821 //Hide photos or videos 1822 if( media == 'videos' && item.type !== 'video' ) removePhoto = true; 1823 if( media == 'photos' && item.type !== 'image' && item.type !== 'carousel' ) removePhoto = true; 1824 1825 1826 //White List 1827 if (whiteList.length > 0 && whiteList != '' && !modMode.status == true){ 1828 if (whiteListIds.indexOf(item.id) === -1) { 1829 hidePhotos.push(item.id); 1830 } 1831 } 1832 1833 //Check the ID of the item to see if it matches any ID in the hidephotos array then skip it and don't iterate the imagesArrCount var 1834 jQuery.each( hidePhotos, function( index, id ) { 1835 if( item.id == jQuery.trim(id) ) removePhoto = true; 1836 }); 1837 if(removePhoto){ 1838 removedPhotosCount++; 1839 //Remove photo from imagesArr here so that it isn't cached 1840 removePhotoIndexes.push(itemNumber); 1841 return; 1842 } 1843 1844 //Used to make sure we display the right amount of photos 1845 itemCount++; 1846 1847 //This makes sure that only the correct number of photos is shown. So if num is set to 10 then it only shows the next 10 in the array. photosAvailable is subtracted from imagesArrCountOrig as imagesArrCountOrig is updated every time and we need to calculate how many photos are currently displayed in the feed
1847in order to calculate how many to show. 1848 if( itemCount > ( (imagesArrCountOrig-photosAvailable )+num) || itemCount <= imagesArrCountOrig ) return; 1849 1850 imagesArrCount++; //Keeps track of where we are in the images array 1851 1852 1853 //Prevent duplicates 1854 $i = $self.attr('data-sbi-index'); 1855 if( jQuery.inArray(item.id, window.sbiFeedMeta[$i].postsInFeed) > -1 ){ 1856 return; //Don't add image 1857 } else { 1858 //Store the IDs of the images added to the feed so we can prevent duplicates 1859 window.sbiFeedMeta[$i].postsInFeed.push(item.id); 1860 } 1861 1862 1863 //FILTER: 1864 //Video 1865 var data_video = 'data-video=""'; 1866 if( item.type == 'video' ){ 1867 data_video = 'data-video="'+item.videos.standard_resolution.url + '"'; 1868 } 1869 1870 var data_carousel = 'data-carousel=""', 1871 videoIsFirstCarouselItem = false; 1872 if ( item.type === 'carousel' && typeof item.carousel_media !== 'undefined') { 1873 var data_carousel_object = {}; 1874 jQuery.each(item.carousel_media,function(index,value) { 1875 if (typeof value.images !== 'undefined') { 1876 data_carousel_object[index] = { 1877 'type' : 'image', 1878 'media' : value.images.standard_resolution.url 1879 }; 1880 } else if (typeof value.videos !== 'undefined') { 1881 data_carousel_object[index] = { 1882 'type' : 'video', 1883 'media' : value.videos.standard_resolution.url 1884 }; 1885 1886 if (index === 0) { 1887 videoIsFirstCarouselItem = true; 1888 } 1889 } 1890 }); 1891 data_carousel = "data-carousel='"+JSON.stringify(data_carousel_object).replace(/'/g, "\\'")+"'"; 1892 if (typeof item.carousel_media[0].videos !== 'undefined') { 1893 data_video = 'data-video="'+item.carousel_media[0].videos.standard_resolution.url + '"'; 1894 } 1895 } 1896 1897 //Image res 1898 var data_image = item.images.standard_resolution.url; 1899 switch( imgRes.type ){ 1900 case 'thumbnail': 1901 data_image = item.images.thumbnail.url; 1902 break; 1903 case 'low_resolution': 1904 data_image = item.images.low_resolution.url; 1905 break; 1906 case 'custom': 1907 data_image = item.images.standard_resolution.url.replace('640x640/',imgRes.width+'x'+imgRes.width+'/'); 1908 break; 1909 case 'autocustom': 1910 var thisImageReplace = sbiGetBestResolutionForCustom(imgRes.width,item.images.standard_resolution.width,item.images.standard_resolution.height) 1911 data_image = item.images.standard_resolution.url.replace('640x640/',thisImageReplace+'x'+thisImageReplace+'/'); 1912 break; 1913 } 1914 data_image = data_image.split("?ig_cache_key")[0]; 1915 1916 //Date 1917 var canUseTranslations = sbiDateInternationalizationNotSupported() === false, 1918 date = new Date(item.created_time*1000), 1919 created_time_raw = item.created_time; 1920 1921 if (canUseTranslations) { 1922 var options = { month: 'short', day: 'numeric' }, 1923 itemDate = date.toLocaleDateString(sbiTranslations.DATE_FORMAT,options); 1924 } else { 1925 //Create time for sorting 1926 //Create pretty date for display 1927 var m = date.getMonth(); 1928 var d = date.getDate(); 1929 var month_names = new Array ( ); 1930 month_names[month_names.length] = sbiTranslate("Jan"); 1931 month_names[month_names.length] = sbiTranslate("Feb"); 1932 month_names[month_names.length] = sbiTranslate("Mar"); 1933 month_names[month_names.length] = sbiTranslate("Apr"); 1934 month_names[month_names.length] = sbiTranslate("May"); 1935 month_names[month_names.length] = sbiTranslate("Jun"); 1936 month_names[month_names.length] = sbiTranslate("Jul"); 1937 month_names[month_names.length] = sbiTranslate("Aug"); 1938 month_names[month_names.length] = sbiTranslate("Sep"); 1939 month_names[month_names.length] = sbiTranslate("Oct"); 1940 month_names[month_names.length] = sbiTranslate("Nov"); 1941 month_names[month_names.length] = sbiTranslate("Dec"); 1942 var itemDate = d + ' ' + month_names[m]; 1943 } 1944 1945 //Caption 1946 var captionText = ''; 1947 if(item.caption != null && item.caption != '' && item.caption.text.indexOf('<script>') === -1){ 1948 //Replace double quotes in the captions with the HTML symbol 1949 var captionText = item.caption.text.replace(/"/g, """), 1950 captionText = captionText.replace(/\n/g, "<br/>"); 1951 } 1952 1953 //Hover display info 1954 if( feedOptions.hoverdisplay.indexOf('location') > -1 ){ var showHoverLocation = true; } else { var showHoverLocation = false; } 1955 if( feedOptions.hoverdisplay.indexOf('caption') > -1 ){ var showHoverCaption = true; } else { var showHoverCaption = false; } 1956 if( feedOptions.hoverdisplay.indexOf('likes') > -1 ){ var showHoverLikes = true; } else { var showHoverLikes = false; } 1957 if( feedOptions.hoverdisplay.indexOf('username') > -1 ){ var showHoverUsername = true; } else { var showHoverUsername = false; } 1958 if( feedOptions.hoverdisplay.indexOf('icon') > -1 ){ var showHoverIcon = true; } else { var showHoverIcon = false; } 1959 if( feedOptions.hoverdisplay.indexOf('date') > -1 ){ var showHoverDate = true; } else { var showHoverDate = false; } 1960 if( feedOptions.hoverdisplay.indexOf('instagram') > -1 ){ var showHoverInstagram = true; } else { var showHoverInstagram = false; } 1961 1962 1963 //Location 1964 if(item.location != null && item.caption != '' && showHoverLocation){ 1965 if(item.location.name == 'undefined' || item.location.name == null){ 1966 var locationName = ''; 1967 } else { 1968 var sbi_lat = (item.location.hasOwnProperty("latitude")) ? 'data-lat="'+item.location.latitude+'"' : '', 1969 sbi_long = (item.location.hasOwnProperty("longitude")) ? 'data-long="'+item.location.longitude+'"' : '', 1970 locationName = '<a href="https://instagram.com/explore/locations/'+item.location.id+'" class="sbi_location" target="_blank" '+hovertextstyles+' '+sbi_lat+' '+sbi_long+'><i class="fa fa-map-marker"></i>'+item.location.name+'</a>'; 1971 } 1972 } else { 1973 var locationName = ''; 1974 } 1975 1976 var sbiCaptionHTML = ''; 1977 if(showHoverCaption){ 1978 sbiCaptionHTML = '<p class="sbi_caption" '+hovertextstyles+'>'+ captionText.substring(0, feedOptions.captionlength); 1979 if( captionText.length > parseInt(feedOptions.captionlength) ) sbiCaptionHTML += '...'; 1980 sbiCaptionHTML += '</p>'; 1981 } 1982 1983 var sbiMetaHTML = ''; 1984 if(showHoverLikes){ 1985 sbiMetaHTML = '<div class="sbi_meta" style="color: #'+feedOptions.likescolor+';"><span class="sbi_likes" '+hovertextstyles+'><i class="fa fa-heart" '+hovertextstyles+'></i>'+commaSeparateNumber(item.likes.count)+'</span><span class="sbi_comments" '+hovertextstyles+'><i class="fa fa-comment" '+hovertextstyles+'></i>'+commaSeparateNumber(item.comments.count)+'</span></div>'; 1986 } 1987 1988 var sbiUsernameHTML = ''; 1989 if(showHoverUsername){ 1990 sbiUsernameHTML = '<p class="sbi_username"><a href="https://instagram.com/'+item.user.username+'" target="_blank" '+hovertextstyles+'>
1990'+item.user.username+'</a></p>'; 1991 } 1992 1993 var sbiIconHTML = ''; 1994 if(showHoverIcon){ 1995 sbiIconHTML = '<i class="fa fa-arrows-alt"></i>'; 1996 } 1997 1998 var sbiDateHTML = ''; 1999 if(showHoverDate){ 2000 sbiDateHTML = '<span class="sbi_date"><i class="fa fa-clock"></i>'+itemDate + '</span>'; 2001 } 2002 2003 var sbiInstagramHTML = ''; 2004 if(showHoverInstagram){ 2005 sbiInstagramHTML = '<a class="sbi_instagram_link" href="'+item.link+'" target="_blank" title="Instagram" '+hovertextstyles+'><span class="sbi-screenreader">View on Instagram</span><i class="fa fa-instagram"></i></a>'; 2006 } 2007 2008 // var sbiHoverEffect = 'sbi_' + feedOptions.hovereffect; 2009 var sbiHoverEffect = 'sbi_fade'; 2010 2011 //If it's a carousel feed then set the image padding directly on the sbi_item as the inherit in the CSS file doesn't work 2012 var carouselPadding = (carousel == true) ? ' style="padding: '+imagepadding+imagepaddingunit+' !important;"' : ''; 2013 2014 var videoIsFirstCarouselItemClass = videoIsFirstCarouselItem ? ' sbi_carousel_vid_first' : '', 2015 carouselTypeIcon = item.type === 'carousel' ? '<i class="fa fa-clone sbi_carousel_icon" aria-hidden="true"></i>': ''; 2016 //TEMPLATE: 2017 imagesHTML += '<div class="sbi_item sbi_type_'+item.type+videoIsFirstCarouselItemClass+' sbi_new '+sbiHoverEffect+'" id="sbi_'+item.id+'" data-date="'+created_time_raw+'"'+carouselPadding+'><div class="sbi_photo_wrap">'+carouselTypeIcon+'<i class="fa fa-play sbi_playbtn"></i><div class="sbi_link'+sbiDefaultClass+'" '+hovercolorstyles+'><div class="sbi_hover_top">'+sbiUsernameHTML+sbiCaptionHTML+'</div>'+sbiInstagramHTML+'<div class="sbi_hover_bottom" '+hovertextstyles+'><p>'+sbiDateHTML+locationName+'</p>'+sbiMetaHTML+'</div><a class="sbi_link_area" href="'+item.images.standard_resolution.url+'" data-lightbox-sbi="'+$self.attr('data-sbi-index')+'" data-title="'+captionText+'" '+data_video+data_carousel+' data-id="sbi_'+item.id+'" data-user="'+item.user.username+'" data-url="'+item.link+'" data-avatar="'+item.user.profile_picture+'"><span class="sbi-screenreader">Link to display lightbox</span><i class="fa fa-play sbi_playbtn" '+hovertextstyles+'></i><span class="sbi_lightbox_link" '+hovertextstyles+'>'+sbiIconHTML+'</span></a></div><a class="sbi_photo" href="'+item.link+'" target="_blank"><img src="'+data_image+'" alt="'+captionText+'" width="200" height="200" /></a></div><div class="sbi_info"><p class="sbi_caption_wrap" '+sbiSettings.showcaption+'><span class="sbi_caption" style="color: #'+feedOptions.captioncolor+'; font-size: '+feedOptions.captionsize+'px;">'+captionText+'</span><span class="sbi_expand"> <a href="#"><span class="sbi_more">...</span></a></span></p><div class="sbi_meta" style="color: #'+feedOptions.likescolor+'; '+sbiSettings.showlikes+'"><span class="sbi_likes" style="font-size: '+feedOptions.likessize+'px;"><i class="fa fa-heart" style="font-size: '+feedOptions.likessize+'px;"></i>'+commaSeparateNumber(item.likes.count)+'</span><span class="sbi_comments" style="font-size: '+feedOptions.likessize+'px;"><i class="fa fa-comment" style="font-size: '+feedOptions.likessize+'px;"></i>'+commaSeparateNumber(item.comments.count)+'</span></div></div>'; 2018 2019 if(modMode.status === true) { 2020 imagesHTML += modMode.addModHtml(item.user.username,item.id); 2021 } 2022 2023 imagesHTML += '</div>'; 2024 }); //End images.data forEach loop 2025 2026 //Loop through and remove any photos from imagesArr which are hidden so that they're not cached 2027 removePhotoIndexes.reverse(); //Reverse the indexes in the array so that it takes out the last items first and doesn't affect the order 2028 jQuery.each( removePhotoIndexes, function( index, itemNumber ) { 2029 imagesArr.data.splice(itemNumber, 1); 2030 }); 2031 2032 if( (imagesArrCount - imagesArrCountOrig) < num ) photosAvailable += imagesArrCount - imagesArrCountOrig; 2033 2034 //CACHE all of the photos in the imagesArr using ajax call to db after the photos have been displayed 2035 //if(!feedOptions.disablecache && !sbiCacheStatuses.feed) sbiCachePhotos(imagesArr, transientName); 2036 var numWhiteListIds = feedOptions.sbiWhiteListIds.replace(/ /g,'').split(",").length; 2037 2038 if( ((imagesArrCount - imagesArrCountOrig) < num) && (photosAvailable < num) /*&& (numberOfPhotosDisplayed < num)*/ && (apiRequests < maxRequests) && !noMoreData && (imagesArrCount < numWhiteListIds || feedOptions.sbiWhiteList === '') ){ //Also check here whether next_url is available. If it's not then don't try to get more photos. 2039 //Get more photos 2040 var sbiFetchURL = imagesArr.pagination.next_url; 2041 2042 window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'fetched'; 2043 2044 sbiFetchData(sbiFetchURL, sbiTransientNames.feed, sbiSettings, $self); 2045 //Set the flag so that we know to add the new photos to the imagesArr 2046 sbiNewData = true; 2047 } else { 2048 2049 //If there are enough photos 2050 //Add the images to the feed 2051 $self.find('#sbi_images').append(imagesHTML); 2052 sbiAfterImagesLoaded(imagesArr,sbiTransientNames.feed); 2053 2054 imagesHTML = ''; 2055 2056 //Remove the initial loader 2057 $self.find('.sbi_loader').remove(); 2058 2059 //Hide the spinner in the load more button 2060 $loadBtn.find('.fa-spinner').hide(); 2061 $loadBtn.find('.sbi_btn_text').css('opacity', 1); 2062 } 2063 2064 2065 //AFTER: 2066 //Things to add after the photos have been added 2067 function sbiAfterImagesLoaded(imagesArr,transientName){ 2068 2069 /* Scripts for each feed */ 2070 $self.find('.sbi_item').each(function(){ 2071 2072 var $self = jQuery(this), 2073 $sbi_link_area = $self.find('.sbi_link_area'); 2074 2075 //Change lightbox image to be full size 2076 var $sbi_lightbox = jQuery('#sbi_lightbox'); 2077 $self.find('.sbi_lightbox_link').click(function(){ 2078 $sbi_lightbox.removeClass('sbi_video_lightbox'); 2079 if( $self.hasClass('sbi_type_video') ){ 2080 $sbi_lightbox.addClass('sbi_video_lightbox'); 2081 //Add the image as the poster so doesn't show an empty video element when clicking the first video link 2082 jQuery('.sbi_video').attr({ 2083 'poster' : jQuery(this).attr('href') 2084 }); 2085 2086 } 2087 }); 2088 2089 //Expand post 2090 var $post_text = $self.find('.sbi_info .sbi_caption'), 2091 text_limit = feedOptions.captionlength; 2092 if (typeof text_limit === 'undefined' || text_limit == '') text_limit = 99999; 2093 2094 //Set the full text to be the caption (used in the image alt) 2095 var full_text = $self.find('.sbi_photo img').attr('alt'); 2096 if(full_text == undefined) full_text = ''; 2097 var short_text = full_text.substring(0,text_limit); 2098 2099 //Cut the text based on limits set 2100 $post_text.html( short_text ); 2101 //Show the 'See More' link if needed 2102 if (full_text.length > text_limit) $self.find('.sbi_expand').show(); 2103 //Click function 2104 $self.find('.sbi_expand a').unbind('click').bind('click', function(e){
2105 e.preventDefault(); 2106 var $expand = jQuery(this); 2107 if ( $self.hasClass('sbi_caption_full') ){ 2108 $post_text.html( short_text ); 2109 $self.removeClass('sbi_caption_full'); 2110 } else { 2111 $post_text.html( full_text ); 2112 $self.addClass('sbi_caption_full'); 2113 } 2114 }); 2115 2116 //Photo links 2117 //If lightbox is disabled 2118 if( disablelightbox == 'true' || captionlinks == 'true' ){ 2119 if( !sbiTouchDevice ){ //Only apply hover effect if not touch screen device 2120 $self.find('.sbi_photo').hover(function(){ 2121 jQuery(this).fadeTo(200, 0.85); 2122 }, function(){ 2123 jQuery(this).stop().fadeTo(500, 1); 2124 }); 2125 } 2126 if ( captionlinks == 'true' ) { 2127 function sbiUrlDetect(text) { 2128 var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g; 2129 return text.match(urlRegex); 2130 } 2131 var cap = $self.find('img').attr('alt'), 2132 url = sbiUrlDetect(cap); 2133 if(url) { 2134 $self.find('a').attr('href', url); 2135 } 2136 } 2137 //If lightbox is enabled add lightbox links 2138 } else { 2139 2140 var $sbi_photo_wrap = $self.find('.sbi_photo_wrap'), 2141 $sbi_link = $sbi_photo_wrap.find('.sbi_link'); 2142 2143 if(sbiTouchDevice || feedOptions.hovereffect == 'none'){ 2144 //launch lightbox on click 2145 $sbi_link.css('background', 'none').show(); 2146 $sbi_link.find('*').hide().end().find('.sbi_link_area').show(); 2147 } else { 2148 //Fade in links on hover 2149 $sbi_photo_wrap.hover(function(){ 2150 $sbi_link.fadeIn(200); 2151 2152 //Zoom effect 2153 $self.addClass('sbi_animate'); 2154 }, function(){ 2155 $sbi_link.stop().fadeOut(600); 2156 2157 //Zoom effect 2158 $self.removeClass('sbi_animate'); 2159 }); 2160 2161 } 2162 2163 } 2164 2165 }); //End .sbi_item each 2166 2167 2168 2169 //Lightbox hide photo function 2170 jQuery('.sbi_lightbox_action a').unbind().bind('click', function(){ 2171 jQuery(this).parent().find('.sbi_lightbox_tooltip').toggle(); 2172 }); 2173 2174 2175 //Sort posts by date 2176 //only sort the new posts that are loaded in, not the whole feed, otherwise some photos will switch positions due to dates 2177 $self.find('#sbi_images .sbi_item.sbi_new').sort(function (a, b) { 2178 var aComp = jQuery(a).attr("data-date"), 2179 bComp = jQuery(b).attr("data-date"); 2180 2181 if(sortby == 'none'){ 2182 //Order by date 2183 return bComp - aComp; 2184 } else { 2185 //Randomize 2186 return (Math.round(Math.random())-0.5); 2187 } 2188 2189 }).appendTo( $self.find("#sbi_images") ); 2190 2191 //Remove the new class after 500ms, once the sorting is done 2192 setTimeout(function(){ 2193 jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new'); 2194 //Reset the morePosts variable so we can check whether there are more posts every time the Load More button is clicked 2195 morePosts = []; 2196 }, 500); 2197 2198 2199 var imagesArrLength = imagesArr.data.length; 2200 2201 //Adjust the imagesArr length to account for the hidden photos 2202 // imagesArrLength = parseInt(imagesArrLength) - parseInt(removedPhotosCount); //June 13 2016 - the imagesArr length is already adjusted earlier and so don't need to adjust it again here 2203 //Check initially whether we should show the Load More button. If it's co
2203ordinates then if the last API request returns no photos then there are no more to show. 2204 if( ( (imagesArrCount >= imagesArrLength) && noMoreData ) || (getType == 'coordinates' && images.data.length == 0) ){ 2205 $loadBtn.hide(); 2206 } 2207 2208 //If all of the posts in the white list are visible, hide the load button 2209 if(sbiSettings.whiteList.length && ($self.find('.sbi_item').length === sbiSettings.whiteListIds.length)){ 2210 $loadBtn.hide(); 2211 } 2212 2213 //Load More button 2214 $self.find('#sbi_load .sbi_load_btn').off().on('click', function(){ 2215 2216 $loadBtn.find('.fa-spinner').show(); 2217 $loadBtn.find('.sbi_btn_text').css('opacity', 0); 2218 //Reset the photosAvailable var so it can be used again 2219 photosAvailable = 0; 2220 2221 //Check the global var to see where we are in the array 2222 imagesArrCount = parseInt(imagesArrCount); 2223 2224 //Adjust the imagesArr length to account for the hidden photos 2225 imagesArrLength = imagesArr.data.length; 2226 // imagesArrLength = parseInt(imagesArrLength) - parseInt(removedPhotosCount); //June 13 2016 - the imagesArr length is already adjusted earlier and so don't need to adjust it again here 2227 var numWhiteListIds = feedOptions.sbiWhiteListIds.replace(/ /g,'').split(",").length; 2228 2229 //If there are enough photos left in the array then display them 2230 if( (imagesArrCount + num) < imagesArrLength || noMoreData || (imagesArrCount >= numWhiteListIds && feedOptions.sbiWhiteList !== '' && modMode.status !== true) ){ 2231 2232 if(photosAvailable !== 'finished') sbiBuildFeed(images, transientName, sbiSettings, $self); 2233 //Unset the flag so that we know not to add these photos to the imagesArr again 2234 sbiNewData = false; 2235 2236 //If there are no photos left in the array and there's no more data to load then hide the load more button 2237 if( ( (imagesArrCount >= imagesArrLength) && noMoreData ) || (getType == 'coordinates' && images.data.length == 0) ){ 2238 $loadBtn.hide(); 2239 } 2240 2241 //If all of the posts in the white list are visible, hide the load button 2242 if(sbiSettings.whiteList.length && ($self.find('.sbi_item').length === sbiSettings.whiteListIds.length)){ 2243 $loadBtn.hide(); 2244 } 2245 2246 //Else if there aren't enough photos left then hit the api again 2247 } else { 2248 2249 sbiFetchURL = imagesArr.pagination.next_url; 2250 window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'fetched'; 2251 sbiFetchData(sbiFetchURL, transientName, sbiSettings, $self); 2252 //Set the flag so that we know to add the new photos to the imagesArr 2253 sbiNewData = true; 2254 //Reset this to zero so that we can limit requests to 3 per button click 2255 apiRequests = 0; 2256 } 2257 2258 2259 }); //End click event 2260 if(modMode.status === true) { 2261 if(!modMode.$self.hasClass('sbi_mod_merged')) { 2262 modMode.setOriginalPosition(); 2263 modMode.resizeFeed(); 2264 } 2265 setTimeout(function () { 2266 modMode.$self.find('.sbi_item .sbi_photo').each(function () { 2267 if (!jQuery(this).hasClass('sbi_mod_changed')) { 2268 jQuery(this).click(function (e) { 2269 modMode.changeClickEvent(jQuery(this), e); 2270 }); 2271 jQuery(this).addClass('sbi_mod_changed'); 2272 } 2273 }); 2274 setTimeout(function () { 2275 modMode.addModSettingsHtml(); 2276 if (!modMode.$self.find('.sbi_mod_submit_mod').hasClass('sbi_initialized')) { 2277 modMode.$self.find('.sbi_mod_submit_mod').click(function () { 2278 modMode.submitSelected(); 2279 }); 2280 } 2281 modMode.$self.find('.sbi_mod_submit_mod').addClass('sbi_initialized'); 2282 modMode.$self.find('.sbi_hide_show_radio').click(function () { 2283 modMode.updateHideOrShow(jQuery(this).val()); 2284 modMode.updateDisplay(); 2285 }); 2286 modMode.$self.find('.sbi_mod_block_user').each(function() { 2287 if(!jQuery(this).hasClass('sbi_mod_changed')) { 2288 jQuery(this).click(function () { 2289 modMode.updateBlockUser(jQuery(this)); 2290 modMode.updateDisplay(); 2291 }); 2292 jQuery(this).addClass('sbi_mod_changed'); 2293 } 2294 }); 2295 modMode.$self.find('.sbi_close_mod').click(function () { 2296 modMode.closeMod(); 2297 }); 2298 modMode.replaceInfoHtml(); 2299 // needed for random bug 2300 jQuery('.sbi_item').each(function() { 2301 jQuery(this).css('height',jQuery('.sbi_photo_wrap').innerHeight()+jQuery('.sbi_info').innerHeight()); 2302 }); 2303 modMode.updateDisplay(); 2304 modMode.$self.addClass('sbi_mod_merged'); 2305 modMode.$self.find('.sbi_info').removeClass('sbi_info'); 2306 modMode.initClickCopy(); 2307 }, 600); 2308 2309 }, 350); 2310 } 2311 2312 if(!$self.hasClass('sbi_carousel') && $self.hasClass('sbi_autoscroll')) { 2313 sbiBindAutoScroll($self); 2314 } 2315 2316 // Call Custom JS if it exists 2317 if (typeof sbi_custom_js == 'function') setTimeout(function(){ sbi_custom_js(); }, 100); 2318 2319 if( imgRes !== 'thumbnail' ){ 2320 //This needs to be here otherwise it results in the following error for some sites: $self.find(...).sbi_imgLiquid() is not a function. 2321 /*! imgLiquid v0.9.944 / 03-05-2013 https://github.com/karacas/imgLiquid */ 2322 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;
2322var 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="100%",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.removeBoxBackgroun
2322d&&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); 2323 2324 // Use imagefill to set the images as backgrounds so they can be square 2325 !function () { 2326 var css = sbi_imgLiquid.injectCss, 2327 head = document.getElementsByTagName('head')[0], 2328 style = document.createElement('style'); 2329 style.type = 'text/css'; 2330 if (style.styleSheet) { 2331 style.styleSheet.cssText = css; 2332 } else { 2333 style.appendChild(document.createTextNode(css)); 2334 } 2335 head.appendChild(style); 2336 }(); 2337 $self.find(".sbi_photo").sbi_imgLiquid({fill:true}); 2338 } 2339 2340 //Only check the width once the resize event is over 2341 var sbi_delay = (function(){ 2342 var sbi_timer = 0; 2343 return function(sbi_callback, sbi_ms){ 2344 clearTimeout (sbi_timer); 2345 sbi_timer = setTimeout(sbi_callback, sbi_ms); 2346 }; 2347 })(); 2348 2349 jQuery(window).resize(function(){ 2350 sbi_delay(function(){ 2351 sbiSetPhotoHeight(); 2352 sbiGetItemSize(); 2353 2354 jQuery('.sbi').each(function() { 2355 var $sbiSelf = jQuery(this), 2356 $i = jQuery(this).attr('data-sbi-index'); 2357 if ($sbiSelf.attr('data-res') ==='autocustom') { 2358 var oldRes = window.sbiFeedMeta[$i].minRes; 2359 var imageSize = sbiGetResolutionSettings($sbiSelf, 'autocustom', cols, colsmobile, $i), 2360 width = imageSize.width !== '' ? imageSize.width : sbiGetWidthForResType(imageSize.type); 2361 2362 if (sbiNeedToRaiseRes(width,oldRes)) { 2363 window.sbiFeedMeta[$i].minRes = 640; 2364 $sbiSelf.find('.sbi_item').each(function() { 2365 var newUrl = jQuery(this).find('.sbi_link_area').length ? jQuery(this).find('.sbi_link_area').attr('href') : ''; 2366 var oldUrl = jQuery(this).find('.sbi_photo img').attr('src'), 2367 newRes = 640, 2368 $photo = jQuery(this); 2369 if (newUrl === '') { 2370 if (oldUrl.indexOf('p'+oldRes+'x'+oldRes) > -1) { 2371 newUrl = oldUrl.replace('p'+oldRes+'x'+oldRes,'p'+newRes+'x'+newRes); 2372 } else if(oldUrl.indexOf('s'+oldRes+'x'+oldRes) > -1) { 2373 newUrl = oldUrl.replace('s'+oldRes+'x'+oldRes,'s'+newRes+'x'+newRes); 2374 } 2375 } 2376 2377 $photo.find('.sbi_photo img').attr('src',newUrl); 2378 $photo.find('.sbi_photo').css('background-image','url("'+newUrl+'")'); 2379 }); 2380 } 2381 } 2382 }); 2383 2384 }, 500); 2385 }); 2386 2387 //Resize image height 2388 function sbiSetPhotoHeight(){ 2389 2390 if( imgRes !== 'thumbnail' ){ 2391 var sbi_photo_width = $self.find('.sbi_photo').eq(0).innerWidth(); 2392 2393 //Figure out number of columns for either desktop or mobile 2394 var sbi_num_cols = sbiGetColumnCount($self, parseInt(cols), parseInt(colsmobile)); 2395 2396 //Figure out what the width should be using the number of cols 2397 var sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - (imagepadding*2); 2398 2399 //If the width is less than it should be then set it manually 2400 if( sbi_photo_width <= (sbi_photo_width_manual) ) sbi_photo_width = sbi_photo_width_manual; 2401 2402 $self.find('.sbi_photo').css('height', sbi_photo_width); 2403 2404 //Set the position of the arrows 2405 var sbi_arrows_top = ($self.find('.sbi_photo').eq(0).innerWidth()/2); 2406 if(imagepaddingunit == 'px') sbi_arrows_top += parseInt(imagepadding)*2; 2407 $self.find('.sbi_owl-buttons div').css('top', sbi_arrows_top); 2408 } 2409 2410 } 2411 if(carousel == false) sbiSetPhotoHeight(); 2412 2413 /* Detect when element becomes visible. Used for when the feed
2413is initially hidden, in a tab for example. https://github.com/shaunbowe/jquery.visibilityChanged */ 2414 !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); 2415 2416 //If the feed is initially hidden (in a tab for example) then check for when it becomes visible and set then set the height 2417 jQuery(".sbi").filter(':hidden').sbiVisibilityChanged({ 2418 callback: function(element, visible) { 2419 sbiSetPhotoHeight(); 2420 sbiGetItemSize(); 2421 }, 2422 runOnLoad: false 2423 }); 2424 2425 if(carousel == true){ 2426 setTimeout(function(){ 2427 //Initiate carousel 2428 if( !carouselautoplay ) carouseltime = false; 2429 2430 //Set defaults for responsive breakpoints 2431 var itemsDesktop = false, 2432 itemsDesktopSmall = false, 2433 itemsTablet = false, 2434 itemsTabletSmall = false, 2435 itemsMobile = false, 2436 sbiWindowWidth = jQuery(window).width(); 2437 2438 //Disable mobile layout 2439 if( $self.hasClass('sbi_mob_col_auto') ) { 2440 itemsTabletSmall = [639,2]; 2441 if( parseInt(cols) != 2 ) itemsMobile = [480,1]; 2442 if( parseInt(cols) == 2 ) itemsMobile = [480,2]; //If the cols are set to 2 then don't change to 1 col on mobile 2443 } else { 2444 itemsMobile = [480,colsmobile]; 2445 } 2446 2447 $self.find(".sbi_carousel").sbi_owlCarousel({ 2448 items: cols, 2449 navigation: carouselarrows, 2450 navigationText: ['<i class="fa fa-chevron-left"></i>','<i class="fa fa-chevron-right"></i>'], 2451 pagination: carouselpag, 2452 autoPlay: carouseltime, 2453 stopOnHover: true, 2454 itemsDesktop: itemsDesktop, 2455 itemsDesktopSmall: itemsDesktopSmall, 2456 itemsTablet: itemsTablet, 2457 itemsTabletSmall: itemsTabletSmall, 2458 itemsMobile: itemsMobile 2459 }); 2460 2461 //Fade in the carousel items 2462 jQuery('#sb_instagram #sbi_images.sbi_carousel .sbi_item').fadeIn(); 2463 2464 sbiSetPhotoHeight(); 2465 sbiGetItemSize(); 2466 2467 //Set the position of the arrows 2468 var sbi_arrows_top = ($self.find('.sbi_photo').eq(0).innerWidth()/2); 2469 if(imagepaddingunit == 'px') sbi_arrows_top += parseInt(imagepadding)*2; 2470 $self.find('.sbi_owl-buttons div').css('top', sbi_arrows_top); 2471 2472 sbSVGify($self); 2473 }, 500); 2474 } // End carousel 2475 2476 function sbiGetItemSize(){ 2477 $self.removeClass('sbi_small sbi_medium'); 2478 var sbiItemWidth = $self.find('.sbi_item').innerWidth(); 2479 if( sbiItemWidth > 120 && sbiItemWidth < 240 ){ 2480 $self.addClass('sbi_medium'); 2481 } else if( sbiItemWidth <= 120 ){ 2482 $self.addClass('sbi_small'); 2483 } 2484 } 2485 2486 if(carousel !== true) sbiGetItemSize(); 2487 // caching done at the end of all posts in the images Array 2488 if(!feedOptions.disablecache && typeof _c
2488ache !== 'undefined' && window.sbiCacheStatuses[feedOptions.feedIndex].feed === 'fetched') { 2489 _cache(imagesArr,transientName); // cache_all_posts 2490 window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'cached'; 2491 } 2492 2493 if (!$self.find('.sbi_item').length && modMode.status === false && !$self.find('.sbi_too_much').length) { 2494 $self.prepend('<div id="sbi_mod_error" class="sbi_too_much">No posts to display. You may be filtering out too many posts. See <a href="https://smashballoon.com/post-filtering-not-working/" target="_blank">this FAQ article</a> for some possible solutions</div>'); 2495 //sbi_set_use_backup 2496 var submittedData = { 2497 action: 'sbi_set_use_backup', 2498 transientName : transientName 2499 }; 2500 jQuery.ajax({ 2501 url: sbiajaxurl, 2502 type: 'post', 2503 data: submittedData, 2504 success: function (data) { 2505 } 2506 }); // ajax 2507 } 2508 2509 // prevent sbiImagesReady from running code to get and display more posts 2510 photosAvailable = 'finished'; 2511 2512 var $i = $self.attr('data-sbi-index'); 2513 if (typeof window.sbiFeedMeta[$i].error.errorMsg === 'undefined' && $self.find('.sbi_item').first().find('.sbi_photo img').length && ($self.attr('data-res') === 'autocustom') || !isNaN($self.attr('data-res'))) { 2514 var imgCheckUrl = $self.find('.sbi_item').first().find('.sbi_photo img').attr('src'); 2515 sbiImageExists(imgCheckUrl,function(exists) { 2516 if (!exists) { 2517 var submittedData = { 2518 action: 'sbi_cancel_custom_image_sizing' 2519 }; 2520 jQuery.ajax({ 2521 url: sbiajaxurl, 2522 type: 'post', 2523 data: submittedData, 2524 success: function (data) { 2525 console.log(data); 2526 } 2527 }); // ajax 2528 console.log(imgCheckUrl + ' does not exist'); 2529 } 2530 }); 2531 } 2532 2533 sbSVGify($self); 2534 2535 } // End sbiAfterImagesLoaded() function 2536 2537 2538 } //End buildFeed function 2539 2540 function commaSeparateNumber(val){ 2541 while (/(\d+)(\d{3})/.test(val.toString())){ 2542 val = val.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2'); 2543 } 2544 return val; 2545 } 2546 2547 function sbiBuildHeader(data, sbiSettings){ 2548 2549 if(typeof data.meta.error_message !== 'undefined') return; 2550 2551 var feedOptions = sbiSettings.feedOptions, 2552 headerStyles = ''; 2553 if(feedOptions.headercolor.length) headerStyles = 'style="color: #'+feedOptions.headercolor+'"'; 2554 2555 $header = '<a href="https://instagram.com/'+data.data.username+'" target="_blank" title="@'+data.data.username+'" class="sbi_header_link" '+headerStyles+'>'; 2556 $header += '<div class="sbi_header_text'; 2557 if( ( typeof data.data.bio !== 'undefined' && data.data.bio.length < 1 ) || feedOptions.showbio != 'true' ) $header += ' sbi_no_bio'; 2558 if( ( ( typeof data.data.bio !== 'undefined' && data.data.bio.length == 0 ) || feedOptions.showbio != 'true' ) && feedOptions.showfollowers != 'true' ) $header += ' sbi_no_info'; 2559 $header += '">'; 2560 $header += '<h3 '+headerStyles+'>
2560'+data.data.username+'</h3>'; 2561 2562 //Compile and add the header info 2563 var $headerInfo = '<p class="sbi_bio_info" '; 2564 if(feedOptions.headerstyle == 'boxed'){ 2565 $headerInfo += 'style="color: #' + feedOptions.headerprimarycolor + ';"'; 2566 } else { 2567 $headerInfo += headerStyles; 2568 } 2569 if ( typeof data.data.counts !== 'undefined') $headerInfo += '><span class="sbi_posts_count"><i class="fa fa-image"></i>'+commaSeparateNumber(data.data.counts.media)+'</span><span class="sbi_followers"><i class="fa fa-user"></i>'+commaSeparateNumber(data.data.counts.followed_by)+'</span></p>'; 2570 2571 if(feedOptions.showfollowers != '' && feedOptions.showfollowers != 'false' && feedOptions.headerstyle !== 'boxed') $header += $headerInfo; 2572 2573 //Add the bio 2574 if( typeof data.data.bio !== 'undefined' && data.data.bio.length > 1 && feedOptions.showbio != '' && feedOptions.showbio != 'false' ) $header += '<p class="sbi_bio" '+headerStyles+'>'+data.data.bio+'</p>'; 2575 $header += '</div>'; 2576 $header += '<div class="sbi_header_img">'; 2577 $header += '<div class="sbi_header_img_hover"><i class="sbi_new_logo"></i></div>'; 2578 $header += '<img src="'+data.data.profile_picture+'" alt="'+data.data.full_name+'" width="50" height="50">'; 2579 $header += '</div>'; 2580 $header += '</a>'; 2581 if(feedOptions.headerstyle == 'boxed') { 2582 $header += '<div class="sbi_header_bar" style="background: #'+feedOptions.headersecondarycolor+'">'; 2583 if(feedOptions.showbio != 'false') $header += $headerInfo; 2584 $header += '<a class="sbi_header_follow_btn" href="https://instagram.com/'+data.data.username+'" target="_blank" style="color: #'+feedOptions.headercolor+'; background: #'+feedOptions.headerprimarycolor+';"><i class="sbi_new_logo"></i><span></span></div></div>'; 2585 } 2586 2587 //Add the header to the feed 2588 if( $self.find('.sbi_header_link').length == 0 ) $self.find('.sb_instagram_header').prepend( $header ); 2589 2590 //Change the URL of the follow button 2591 if( $self.find('.sbi_follow_btn').length ) $self.find('.sbi_follow_btn a').attr('href', 'https://instagram.com/' + data.data.username ); 2592 //Change the text of the header follow button 2593 if( feedOptions.headerstyle == 'boxed' && $self.find('.sbi_header_follow_btn').length ) $self.find('.sbi_header_follow_btn span').text( $self.find('.sb_instagram_header').attr('data-follow-text').replace(/\\/g, "") ); 2594 2595 2596 //Header profile pic hover 2597 $self.find('.sb_instagram_header .sbi_header_link').hover(function(){ 2598 $self.find('.sb_instagram_header .sbi_header_img_hover').fadeIn(200); 2599 }, function(){ 2600 $self.find('.sb_instagram_header .sbi_header_img_hover').stop().fadeOut(600); 2601 }); 2602 2603 sbSVGify($self.find('.sb_instagram_header')); 2604 } // End sbiBuildHeader() 2605 2606 2607 function sbiFetchData(next_url, transientName, sbiSettings, $self) { 2608 apiURLs = next_url; 2609 var urlCount = apiURLs.length, 2610 getType = sbiSettings.getType; 2611 2612 //If the apiURLs array is empty then this means that there's no more next_urls and so hide the load more button 2613 if( urlCount == 0 ){ 2614 2615 //Don't hit the API any more 2616 //If there's no more photos to retrieve then hide the load more button 2617 if( imagesArrCount + parseInt(sbiSettings.num) >= imagesArr.data.length ){ 2618 //Hide the Load More button 2619 jQuery('#sbi_load .sbi_load_btn').hide(); 2620 } 2621 2622 } else { 2623 2624 var returnedImages = [], 2625 numberOfRequests = urlCount; 2626 jQuery.each(apiURLs, function(index, entry){ 2627 2628 jQuery.ajax({ 2629 method: "GET", 2630 url: entry, 2631 dataType: "jsonp", 2632 success: function(data) { 2633 //Pretty error messages 2634 var sbiErrorResponse = data.meta.error_message, 2635 sbiErrorMsg = '', 2636 sbiErrorDir = ''; 2637 2638 if(typeof sbiErrorResponse !== 'undefined'){ 2639 2640 if( sbiErrorResponse.indexOf('access_token') > -1 ){ 2641 sbiErrorMsg += '<p><b>
2641Error: Access Token is not valid or has expired</b><br /><span>This error message is only visible to WordPress admins</span></p>'; 2642 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.<br />If you continue to have an issue with your Access Token then please see <a href='https://smashballoon.com/my-instagram-access-token-keep-expiring/' target='_blank'>this FAQ</a> for more information.</p>"; 2643 jQuery('#sb_instagram').empty().append( '<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>'); 2644 sbiAddTokenToExpiredList(sb_instagram_js_options.sb_instagram_at); 2645 var submittedData = { 2646 action: 'sbi_set_use_backup', 2647 transientName : transientName 2648 }; 2649 jQuery.ajax({ 2650 url: sbiajaxurl, 2651 type: 'post', 2652 data: submittedData, 2653 success: function (data) { 2654 } 2655 }); // ajax 2656 return; 2657 } else if( sbiErrorResponse.indexOf('retired') > -1 ){ 2658 sbiErrorMsg += '<p><b>No longer possible to display this feed</b><br /><span>This error message is only visible to WordPress admins</span></p>'; 2659 sbiErrorDir = "<p>Due to changes in the Instagram API, it is no longer possible to display a feed from an Instagram account which is not your own. You can now only display your own Instagram account. Please see <a href='https://smashballoon.com/instagram-api-changes-april-4-2018/' target='_blank'>this post</a> for more information.</p>"; 2660 jQuery('#sb_instagram').empty().append( '<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>'); 2661 return; 2662 //requests per hour 2663 } else if( sbiErrorResponse.indexOf('user does not exist') > -1 || sbiErrorResponse.indexOf('you cannot view this resource') > -1 ){ 2664 window.sbiFeedMeta[$i].error = { 2665 errorMsg : '<p><b>Error: User ID <span class="sbiErrorIds">'+window.sbiFeedMeta[$i].idsInFeed[index]+'</span> does not exist, is invalid, or is private</b><br /><span>This error is only visible to WordPress admins</span>', 2666 errorDir : "<p>Please double check that the Instagram User ID you are using is valid and not from a private account. To find your User ID simply enter your Instagram user name into this <a href='https://smashballoon.com/instagram-feed/find-instagram-user-id/' target='_blank'>tool</a>.</p>" 2667 }; 2668 if (!$self.find('#sbi_mod_error').length) { 2669 $self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>'); 2670 } else if ($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index]) == -1) { 2671 $self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index]); 2672 } 2673 data = 'error'; 2674 } else if( sbiErrorResponse.indexOf('invalid media id') > -1 ){ 2675 window.sbiFeedMeta[$i].error = { 2676 errorMsg : '<p><b>Error: Post Id <span class="sbiErrorIds">'+window.sbiFeedMeta[$i].idsInFeed[index]+'</span>
2676 does not exist or is invalid</b><br /><span>This error is only visible to WordPress admins.</span>', 2677 errorDir : "<p>Please double check the media (post) id is correct.</p>" 2678 }; 2679 if (!$self.find('#sbi_mod_error').length) { 2680 $self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>'); 2681 } else if ($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index]) == -1) { 2682 $self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index]); 2683 } 2684 data = 'error'; 2685 } 2686 2687 } 2688 2689 //If it's a coordinates type then add the existing URL to the object so that we can use it to create the next URL for pagination 2690 if( getType == 'coordinates' ) data.pagination = {'previous_url':entry}; 2691 2692 if (data !== 'error') returnedImages.push(data); 2693 2694 numberOfRequests--; 2695 if(numberOfRequests == 0 && photosAvailable !== 'finished') sbiImagesReady(getType); 2696 2697 } 2698 2699 }) 2700 2701 }); 2702 2703 //When all of the images have been returned then pass them to the buildFeed function 2704 function sbiImagesReady(getType){ 2705 2706 var paginationArr = [], 2707 returnedImagesArr = []; 2708 2709 //Loop through the array of returned sets of data from the Instagram API 2710 jQuery.each( returnedImages, function( index, object ) { 2711 2712 if(getType == 'single') { 2713 object.data = [ object.data ] ; 2714 } 2715 2716 if( typeof object.data !== 'undefined' ){ //Check whether the returned object has data in it as error may be returned it 2717 //Loop through each image object in the array and add it to the returnedImagesArr for sorting 2718 jQuery.each( object.data, function( index, image ) { 2719 2720 //Filter out duplicate images here. This is after the items have been counted (used below for coordinates pagination) but before being cached as duplicate images don't need to be cached. 2721 if( jQuery.inArray(image.id, photoIds) > -1 ){ 2722 //Duplicate image 2723 } else { 2724 photoIds.push(image.id); 2725 returnedImagesArr.push( image ); 2726 } 2727 }); 2728 2729 2730 if(getType == 'coordinates'){ 2731 //If it's a coordinates then need to create the next_url string manually by using max_timestamp and then push it onto the array 2732 2733 //Get the created_date of the last object so we can use it to create the next_url 2734 var lastCreatedTime = object.data[ object.data.length - 1 ].created_time, 2735 existing_url = object.pagination.previous_url, 2736 existing_url_parts = existing_url.split('max_timestamp='), 2737 new_url = existing_url_parts[0] + 'max_timestamp=' + lastCreatedTime; 2738 2739 //If the number of photos returned (eg: 10) is less than the number the user wants to display (eg: 20) then there are no more photos to load for this coordinates 2740 paginationArr.push( new_url ); 2741 2742 } else { 2743 //If there's a next_url then add it to the pagination array 2744 if( typeof object.pagination === 'object' && !!object.pagination && typeof object.pagination.next_url !== 'undefined' ) paginationArr.push( object.pagination.next_url ); 2745 } 2746 2747 } 2748 2749 }); 2750 2751 //Sort the images by date if not set to random 2752 if(sortby !== 'random') { 2753 returnedImagesArr.sort(function(x, y){ 2754 return y.created_time - x.created_time; 2755 }); 2756 } else { 2757 returnedImagesArr.sort(function (a, b) { 2758 //Randomize 2759 return (Math.round(Math.random())-0.5); 2760 }); 2761 transientName += '!'; 2762 } 2763 2764 //Add the data and pagination objects to the first object in the array so that we can create a super object to send back 2765 if (typeof returnedImages !== 'undefined') returnedImages[0].data = returnedImagesArr; 2766 2767 //Replace the next_url string with an array of URLs 2768 //If it's a coordinates type then we need to create the pagination object here as it doesn't exist yet 2769 if(typeof returnedImages[0].pagination !== 'undefined' && !!returnedImages[0].pagination) { 2770 //if( typeof returnedImages[0].pagination.next_url !== 'undefined' ) { 2771 returnedImages[0].pagination.next_url = paginationArr; 2772 //} 2773 } else { 2774 returnedImages[0].pagination = { 2775 "next_url" : "" 2776 }; 2777 } 2778 var allImages = returnedImages[0]; 2779 //Pass the returned images to the buildFeed function 2780 2781 if(photosAvailable !== 'finished') sbiBuildFeed(allImages, transientName, sbiSettings, $self); 2782 2783 //Iterate the API request variable so that we can limit of the number of subsequent API requests when the Load More button is clicked 2784 apiRequests++; 2785 2786 } // End sbiImagesReady() 2787 2788 } 2789 2790 } //End sbiFetchData() 2791 2792 //Cache the likes and comments counts by sending an array via ajax to the main plugin file which then stores it in a transient 2793 function sbiGetCache(transientName, sbiSettings, $self, cacheWhat, apiURLs){ 2794 var transientData = transientName; 2795 window.sbiCommentCacheStatus = 0; 2796 var thisIndex = $self[0].getAttribute('data-sbi-index'); 2797 2798 // our initial request now sends all transient names at once 2799 if (typeof transientName === 'object') { 2800 transientData = JSON.stringify(transientName); 2801 } 2802 var getCacheOpts = { 2803 url: sbiajaxurl, 2804 type: 'POST', 2805 async: true, 2806 cache: false, 2807 data:{ 2808 action: 'get_cache', 2809 transientName: transientData, 2810 useBackupHeader: window.sbiUseBackup[thisIndex].header, 2811 useBackupFeed: window.sbiUseBackup[thisIndex].feed 2812 }, 2813 success: function(data) { 2814 2815 //Decode the JSON to that it can be used again 2816 data = decodeURI(data); 2817 data = data.replace(/\\'/g, "'"); 2818 2819 //Replace any escaped single quotes as it results in invali
2819d JSON 2820 2821 data = data.replace(/\\'/g, "'"); 2822 //Convert the cached JSON string back to a JSON object 2823 var jsonobj = JSON.parse( data ); 2824 2825 if ( cacheWhat == 'all' ) { 2826 if (typeof jsonobj.header.error === 'undefined') { 2827 sbiBuildHeader(jsonobj.header, sbiSettings); 2828 } 2829 if (typeof jsonobj.feed.error === 'undefined') { 2830 if(photosAvailable !== 'finished') sbiBuildFeed(jsonobj.feed, transientName, sbiSettings, $self); 2831 if (typeof jsonobj.warning !== 'undefined') { 2832 var sbiErrorMsg = '<p><b>Cache Error: Looking for cache that doesn\'t exist. Now using a backup feed.</b><br /><span>This error is only visible to WordPress admins.</span>'; 2833 var sbiErrorDir = "<p>If you are using a caching plugin, try enabling the option on the Customize tab 'Cache error API recheck' or 'Force cache to clear on interval'</p>"; 2834 jQuery('#sb_instagram').before('<div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>'); 2835 } 2836 } else { 2837 // get the index of the feed to check what processes have been done already 2838 feedOptions = JSON.parse($self[0].getAttribute('data-options')); 2839 var thisIndex = $self[0].getAttribute('data-sbi-index'); 2840 feedOptions.feedIndex = thisIndex; 2841 // if the cache is unavailable and the user has enabled an attempt at the api, "tryfetch" is returned as the error 2842 if (window.sbiCacheStatuses[thisIndex].feed !== false && jsonobj.feed.error === 'tryfetch') { 2843 // on the second try, indicate that the cache isn't available to prevent this endless loop 2844 window.sbiCacheStatuses[thisIndex].feed = false; 2845 if (!$self.find('.sb_instagram_header .sbi_header_text').length) { 2846 window.sbiCacheStatuses[thisIndex].header = false; 2847 } 2848 2849 // comments do not need to be retrieved 2850 window.sbiCacheStatuses[thisIndex].comments = 'no'; 2851 // prevents multiple attempts 2852 feedOptions.tryFetch = true; 2853 // start from scratch with updated feed options and statuses 2854 if (typeof window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch === 'undefined') sbiCreateFeed($self[0], feedOptions); 2855 } else if (window.sbiCacheStatuses[thisIndex].feed === true) { 2856 var sbiErrorMsg = '<p><b>Cache Error: Looking for cache that doesn\'t exist</b><br /><span>This error is only visible to WordPress admins.</span>'; 2857 var sbiErrorDir = "<p>If you are using a caching plugin, try enabling the option on the Customize tab 'Cache error API recheck' or 'Force cache to clear on interval'</p>"; 2858 jQuery('#sb_instagram').empty().append( '<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>'); 2859 //sbi_set_use_backup 2860 var submittedData = { 2861 action: 'sbi_set_use_backup', 2862 transientName : transientName, 2863 context : 'falsecache' 2864 }; 2865 jQuery.ajax({ 2866 url: sbiajaxurl, 2867 type: 'post', 2868 data: submittedData, 2869 success: function (data) { 2870 } 2871 }); // ajax 2872 } 2873 } 2874 if (jsonobj.header.error === 'tryfetch') { 2875 feedOptions = JSON.parse($self[0].getAttribute('data-options')); 2876 var thisIndex = $self[0].getAttribute('data-sbi-index'); 2877 feedOptions.feedIndex = thisIndex; 2878 if (window.sbiCacheStatuses[thisIndex].header !== false) { 2879 if (!$self.find('.sb_instagram_header .sbi_header_text').length) { 2880 window.sbiCacheStatuses[thisIndex].header = false; 2881 feedOptions.tryFetch = true; 2882 // start from scratch with updated feed options and statuses 2883 if (typeof window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch === 'undefined') sbiCreateFeed($self[0], feedOptions); 2884 2885 } 2886 } 2887 } 2888 if (typeof jsonobj.comments.error === 'undefined') { 2889 sb_instagram_js_options.sbiPageCommentCache = jsonobj.comments; 2890 } 2891 2892 } else { 2893 if( cacheWhat == 'header' ){ 2894 sbiBuildHeader(jsonobj, sbiSettings); 2895 } else { 2896 if(photosAvailable !== 'finished') sbiBuildFeed(jsonobj, transientName, sbiSettings, $self); 2897 } 2898 } 2899 //Pass the returned images to the buildFeed function 2900 2901 }, 2902 error: function(xhr,textStatus,e) { 2903 console.log(e); 2904 return; 2905 } 2906 }; 2907 2908 jQuery.ajax(getCacheOpts); 2909 2910 } 2911 2912 } // sbiCreateFeed 2913 2914 }); // End jQuery('#sb_instagram.sbi').each 2915 2916 function sbiBindAutoScroll($sbi) { 2917 //var scrollPosOffset = parseInt($sbi.attr('data-scroll-offset')); 2918 var scrollPosOffset = parseInt($sbi.attr('data-scrolldistance')), 2919 sbiScrolled = 0; 2920 2921 //Scroll the container if it has a height 2922 if ($sbi.hasClass('sbi_fixed_height')) { 2923 $sbi.on('scroll.instagram-feed', function () { 2924 2925 var yScrollPos = $sbi.scrollTop(), 2926 windowSize = $sbi.innerHeight(), 2927 bodyHeight = $sbi[0].scrollHeight, 2928 triggerDistance = bodyHeight - scrollPosOffset - windowSize; 2929 2930 if (yScrollPos > triggerDistance) { 2931 $sbi.unbind('scroll.instagram-feed'); 2932 if (sbiScrolled === 0) { 2933 sbiScrolled = 1; 2934 $sbi.find('.sbi_load_btn').trigger('click'); 2935 } 2936 } 2937 }); 2938 //Scrolling the window 2939 } else { 2940 jQuery(window).on('scroll.instagram-feed', function () { 2941 var yScrollPos = window.pageYOffset, 2942 windowSize = window.innerHeight, 2943 bodyHeight = document.body.offsetHeight, 2944 triggerDistance = bodyHeight - scrollPosOffset - windowSize; 2945 2946 if (yScrollPos > triggerDistance) { 2947 jQuery(window).unbind('scroll.instagram-feed'); 2948 if (sbiScrolled === 0) { 2949 sbiScrolled = 1; 2950 $sbi.find('.sbi_load_btn').trigger('click'); 2951 } 2952 } 2953 }); 2954 } 2955 2956 } 2957 2958 } 2959 2960 2961 } // sb_init 2962 2963 function sbiAddTokenToExpiredList(access_token) { 2964 var accessTokenOpts = { 2965 url: sbiajaxurl, 2966 type: 'POST', 2967 async: true, 2968 cache: false, 2969 data:{ 2970 action: 'sbi_set_expired_token', 2971 access_token: access_token 2972 }, 2973 success: function(response) { 2974 return; 2975 }, 2976 error: function(xhr,textStatus,e) { 2977 console.log(e); 2978 return; 2979 } 2980 }; 2981 jQuery.ajax(accessTokenOpts); 2982 } 2983 2984 function sbiCachePhotos(images, transientName){ 2985 //Convert the JSON object to a string 2986 var jsonstring = JSON.stringify( images ); 2987 //Encode the JSON string so that it can be stored in the database 2988 jsonstring = encodeURI(jsonstring); 2989 2990 if (jsonstring.indexOf('%7B%22') === 0) { 2991 var setCacheOpts = { 2992 url: sbiajaxurl, 2993 type: 'POST', 2994 async: true, 2995 cache: false, 2996 data:{ 2997 action: 'cache_photos', 2998 photos: jsonstring, 2999 transientName: transientName, 3000 }, 3001 success: function(response) { 3002 if ( response.indexOf('too much filtering') > -1) { 3003 var useBackupOpts = { 3004 url: sbiajaxurl, 3005 type: 'POST', 3006 async: true, 3007 cache: false, 3008 data: { 3009 action: 'set_use_backup', 3010 transientName: transientName, 3011 }, 3012 success: function (response) { 3013 console.log(response) 3014 } 3015 }; 3016 jQuery.ajax(useBackupOpts); 3017 } 3018 return; 3019 }, 3020 error: function(xhr,textStatus,e) { 3021 console.log(e); 3022 return; 3023 } 3024 }; 3025 jQuery.ajax(setCacheOpts); 3026 } 3027 3028 } 3029 3030 //function function sbiSetPhotoHeight(){ 3031 function sbiGetColumnCount($self, cols, colsmobile) { 3032 var sbi_num_cols = cols, 3033 sbiWindowWidth = window.innerWidth; 3034 3035 if( $self.hasClass('sbi_mob_col_auto') ){ 3036 if( sbiWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7 ) ) sbi_num_cols = 2; 3037 if( sbiWindowWidth < 640 && (parseInt(cols) >
3037 6 && parseInt(cols) < 11 ) ) sbi_num_cols = 4; 3038 if( sbiWindowWidth <= 480 && parseInt(cols) > 2 ) sbi_num_cols = 1; 3039 } else if (sbiWindowWidth <= 480){ 3040 sbi_num_cols = colsmobile; 3041 } 3042 3043 return sbi_num_cols; 3044 } 3045 3046 function sbiGetWidthForResType(type) { 3047 switch (type) { 3048 case 'thumbnail': 3049 return 150; 3050 case 'low_resolution': 3051 return 320; 3052 default: 3053 return 640; 3054 } 3055 } 3056 3057 function sbiGetBestResolutionForCustom(colWidth,imageWidth,imageHeight) { 3058 var aspectRatio = Math.max(1,imageWidth/imageHeight), 3059 bestWidth = colWidth*aspectRatio, 3060 bestWidthRounded = Math.ceil(bestWidth / 10) * 10, 3061 customSizes = [30,40,50,60,80,90,100,120,130,150,160,180,190,200,240,270,280,320,350,360,390,480,540,600,640,720,750,800,810,960,1280];; 3062 3063 if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) { 3064 var done = false; 3065 jQuery.each(customSizes, function (index, item) { 3066 if (item > parseInt(bestWidthRounded) && !done) { 3067 bestWidthRounded = item; 3068 3069 done = true; 3070 } 3071 }); 3072 } 3073 3074 return bestWidthRounded; 3075 } 3076 3077 function sbiImageExists(url, callback) { 3078 var img = new Image(); 3079 img.onload = function() { callback(true); }; 3080 img.onerror = function() { callback(false); }; 3081 img.src = url; 3082 } 3083 3084// Sample usage 3085 3086 3087 function sbiNeedToRaiseRes(width,oldRes) { 3088 return (width > oldRes); 3089 } 3090 3091 function sbiGetResolutionSettings($self, imgRes, cols, colsmobile, $i) { 3092 var feedWidth = $self.innerWidth(), 3093 //colWidth = $self.innerWidth() / cols, 3094 photoPadding = parseInt($self.find('#sbi_images').css('padding')) * 2, 3095 cols = sbiGetColumnCount($self, parseInt(cols), parseInt(colsmobile)), 3096 colWidth = ($self.innerWidth() / cols) - photoPadding, 3097 imgResReturn = { 3098 'type' : 'low_resolution', 3099 'width' : '' 3100 }, 3101 customSizes = [30,40,50,60,80,90,100,120,130,150,160,180,190,200,240,270,280,320,350,360,390,480,540,600,640,720,750,800,810,960,1280]; 3102 if (!isNaN(imgRes)) { 3103 imgResReturn.type = 'custom'; 3104 if (customSizes.indexOf(parseInt(imgRes)) > -1) { 3105 imgResReturn.width = imgRes; 3106 } else { 3107 var done = false; 3108 jQuery.each(customSizes,function(index,item) { 3109 if (item > parseInt(imgRes) && !done) { 3110 imgResReturn.width = item; 3111 done = true; 3112 } 3113 }); 3114 } 3115 } else { 3116 switch(imgRes) { 3117 case 'auto': 3118 colWidth = feedWidth/cols; 3119 //Check if page width is less than 640. If it is then use the script above 3120 var sbiWindowWidth = jQuery(window).width(); 3121 if( sbiWindowWidth < 640 && $self.is('.sbi_mob_col_auto') ){ 3122 //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 3123 if( feedWidth < 640 && $self.is('.sbi_col_1') ) colWidth = 480; //Use full size images - this is for carousel as it's always set to sbi_col_1 3124 if( feedWidth < 640 && $self.is('.sbi_col_3, .sbi_col_4, .sbi_col_5, .sbi_col_6') ) colWidth = 300; //Use medium images 3125 if( feedWidth < 640 && $self.is('.sbi_col_7, .sbi_col_8, .sbi_col_9, .sbi_col_10') ) colWidth = 100; //Use thumbnail images 3126 if( (feedWidth > 320 && feedWidth < 480) && sbiWindowWidth < 480 ) colWidth = 480; //Use full size images 3127 if( feedWidth < 320 && sbiWindowWidth < 480 ) colWidth = 300; //Use medium size images 3128 } 3129 3130 if( colWidth < 150 ){ 3131 imgResReturn.type = 'thumbnail'; 3132 } else if( colWidth < 320 ){ 3133 imgResReturn.type = 'low_resolution'; 3134 } else { 3135 imgResReturn.type = 'standard_resolution'; 3136 } 3137 3138 break; 3139 case 'autocustom':
3140 //var imageSize = Math.ceil(colWidth / 10) * 10; 3141 3142 if (colWidth > 960) { 3143 imgResReturn.type = 'custom'; 3144 imgResReturn.width = 1280; 3145 } else if((colWidth > 130 && colWidth <= 150) 3146 || (colWidth > 280 && colWidth <= 320) 3147 || (colWidth > 600 && colWidth <= 640) ) { 3148 3149 if( colWidth < 150 ){ 3150 imgResReturn.type = 'thumbnail'; 3151 imgResReturn.width = 150; 3152 } else if( colWidth <= 320 ){ 3153 imgResReturn.type = 'low_resolution'; 3154 imgResReturn.width = 320; 3155 } else { 3156 imgResReturn.type = 'standard_resolution'; 3157 imgResReturn.width = 640; 3158 } 3159 3160 } else { 3161 imgResReturn.type = 'autocustom'; 3162 imgResReturn.width = colWidth; 3163 } 3164 3165 break; 3166 case 'thumb': 3167 imgResReturn.type = 'thumbnail'; 3168 break; 3169 case 'medium': 3170 imgResReturn.type = 'low_resolution'; 3171 break; 3172 default: 3173 // do custom sizes if set 3174 imgResReturn.type = 'standard_resolution'; 3175 } 3176 } 3177 3178 if ( typeof window.sbiFeedMeta[$i].minRes === 'undefined' ) { 3179 window.sbiFeedMeta[$i].minRes = imgResReturn.type === 'autocustom' ? sbiGetBestResolutionForCustom(colWidth,imgResReturn.width,imgResReturn.width): sbiGetWidthForResType(imgResReturn.type); 3180 } 3181 3182 return imgResReturn; 3183 } 3184 // Called at the very end of the feed creation process 3185 // Takes all of the data retrieved from the API during the feed creation process and caches it 3186 function sbi_cache_all(imagesArr,transientName) { 3187 if (transientName.indexOf('header') && typeof imagesArr.data.pagination === 'undefined') { 3188 sbiCachePhotos(imagesArr,transientName); 3189 } else if (!transientName.indexOf('header') && typeof imagesArr.data.pagination !== 'undefined') { 3190 sbiCachePhotos(imagesArr,transientName); 3191 } 3192 } 3193 3194 function sbiDateInternationalizationNotSupported() { 3195 if ( typeof sbiTranslations === 'undefined' ) { 3196 return true; 3197 } else { 3198 var locale = sbiTranslations.DATE_FORMAT; 3199 try { 3200 new Date().toLocaleDateString(locale); 3201 } catch (e) { 3202 return e.name === 'RangeError'; 3203 } 3204 return false; 3205 } 3206 } 3207 3208 function sbiTranslate(origString) { 3209 if (typeof sbiTranslations === 'undefined') { 3210 return origString; 3211 } else { 3212 3213 if (typeof sbiTranslations[origString] !== 'undefined') { 3214 return sbiTranslations[origString]; 3215 } else { 3216 return origString; 3217 } 3218 3219 } 3220 } 3221 3222 jQuery( document ).ready(function() { 3223 window.sbiCommentCacheStatus = 0; 3224 sbi_init(function(imagesArr,transientName) { 3225 sbi_cache_all(imagesArr,transientName); 3226 }); 3227 }); 3228 3229} // 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.