1var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false; 2if(!sbi_js_exists){ 3 4 /*! 5 * Isotope PACKAGED v3.0.6 6 * 7 * Licensed GPLv3 for open source use 8 * or Isotope Commercial License for commercial use 9 * 10 * https://isotope.metafizzy.co 11 * Copyright 2010-2018 Metafizzy 12 */ 13 14
vendor: 21,232 bytes, line 14
14!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,s,a){function u(t,e,o){var n,s="$()."+i+'("'+e+'")';return t.each(function(t,u){var h=a.data(u,i);if(!h)return void r(i+" not initialized. Cannot call methods, i.e. "+s);var d=h[e];if(!d||"_"==e.charAt(0))return void r(s+" is not a valid method");var l=d.apply(h,o);n=void 0===n?l:n}),void 0!==n?n:t}function h(t,e){t.each(function(t,o){var n=a.data(o,i);n?(n.option(e),n._init()):(n=new s(o,e),a.data(o,i,n))})}a=a||e||t.jQuery,a&&(s.prototype.option||(s.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=n.call(arguments,1);return u(this,t,e)}return h(this,t),this},o(a))}function o(t){!t||t&&t.bridget||(t.bridget=i)}var n=Array.prototype.slice,s=t.console,r="undefined"==typeof s?function(){}:function(t){s.error(t)};return o(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},o=i[t]=i[t]||[];return o.indexOf(e)==-1&&o.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},o=i[t]=i[t]||{};return o[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var o=i.indexOf(e);return o!=-1&&i.splice(o,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var o=this._onceEvents&&this._onceEvents[t],n=0;n<i.length;n++){var s=i[n],r=o&&o[s];r&&(this.off(t,s),delete o[s]),s.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t}),function(t,e){"function"==typeof define&&define.amd?define("get-size/get-size",e):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=t.indexOf("%")==-1&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<h;e++){var i=u[e];t[i]=0}return t}function o(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function n(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var n=o(e);r=200==Math.round(t(n.width)),s.isBoxSizeOuter=r,i.removeChild(e)}}function s(e){if(n(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var s=o(e);if("none"==s.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==s.boxSizing,l=0;l<h;l++){var f=u[l],c=s[f],m=parseFloat(c);a[f]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,y=a.paddingTop+a.paddingBottom,g=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,I=d&&r,x=t(s.width);x!==!1&&(a.width=x+(I?0:p+_));var S=t(s.height);return S!==!1&&(a.height=S+(I?0:y+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(y+z),a.outerWidth=a.width+g,a.outerHeight=a.height+v,a}}var r,a="undefined"==typeof console?e:function(t){console.error(t)},u=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],h=u.length,d=!1;return s}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var o=e[i],n=o+"MatchesSelector";if(t[n])return n}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e};var o=Array.prototype.slice;i.makeArray=function(t){if(Array.isArray(t))return t;if(null===t||void 0===t)return[];var e="object"==typeof t&&"number"==typeof t.length;return e?o.call(t):[t]},i.removeFrom=function(t,e){var i=t.indexOf(e);i!=-1&&t.splice(i,1)},i.getParent=function(t,i){for(;t.parentNode&&t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.filterFindElements=function(t,o){t=i.makeArray(t);var n=[];return t.forEach(function(t){if(t instanceof HTMLElement){if(!o)return void n.push(t);e(t,o)&&n.push(t);for(var i=t.querySelectorAll(o),s=0;s<i.length;s++)n.push(i[s])}}),n},i.debounceMethod=function(t,e,i){i=i||100;var o=t.prototype[e],n=e+"Timeout";t.prototype[e]=function(){var t=this[n];clearTimeout(t);var e=arguments,s=this;this[n]=setTimeout(function(){o.apply(s,e),delete s[n]},i)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var n=t.console;return i.htmlInit=function(e,o){i.docReady(function(){var s=i.toDashed(o),r="data-"+s,a=document.querySelectorAll("["+r+"]"),u=document.querySelectorAll(".js-"+s),h=i.makeArray(a).concat(i.makeArray(u)),d=r+"-options",l=t.jQuery;h.forEach(function(t){var i,s=t.getAttribute(r)||t.getAttribute(d);try{i=s&&JSON.parse(s)}catch(a){return void(n&&n.error("Error parsing "+r+" on "+t.className+": "+a))}var u=new e(t,i);l&&l.data(t,o,u)})})},i}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/item",["ev-emitter/ev-emitter","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("get-size")):(t.Outlayer={},t.Outlayer.Item=e(t.EvEmitter,t.getSize))}(window,function(t,e){"use strict";function i(t){for(var e in t)return!1;return e=null,!0}function o(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}function n(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}var s=document.documentElement.style,r="string"==typeof s.transition?"transition":"WebkitTransition",a="string"==typeof s.transform?"transform":"WebkitTransform",u={WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[r],h={transform:a,transition:r,transitionDuration:r+"Duration",transitionProperty:r+"Property",transitionDelay:r+"Delay"},d=o.prototype=Object.create(t.prototype);d.constructor=o,d._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},d.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},d.getSize=function(){this.size=e(this.element)},d.css=function(t){var e=this.element.style;for(var i in t){var o=h[i]||i;e[o]=t[i]}},d.getPosition=function(){var t=getComputedStyle(this.element),e=this.layout._getOption("originLeft"),i=this.layout._getOption("originTop"),o=t[e?"left":"right"],n=t[i?"top":"bottom"],s=parseFloat(o),r=parseFloat(n),a=this.layout.size;o.indexOf("%")!=-1&&(s=s/100*a.width),n.indexOf("%")!=-1&&(r=r/100*a.height),s=isNaN(s)?0:s,r=isNaN(r)?0:r,s-=e?a.paddingLeft:a.paddingRight,r-=i?a.paddingTop:a.paddingBottom,this.position.x=s,this.position.y=r},d.layoutPosition=function(){var t=this.layout.size,e={},i=this.layout._getOption("originLeft"),o=this.layout._getOption("originTop"),n=i?"paddingLeft":"paddingRight",s=i?"left":"right",r=i?"right":"left",a=this.position.x+t[n];e[s]=this.getXValue(a),e[r]="";var u=o?"paddingTop":"paddingBottom",h=o?"top":"bottom",d=o?"bottom":"top",l=this.position.y+t[u];e[h]=this.getYValue(l),e[d]="",this.css(e),this.emitEvent("layout",[this])},d.getXValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&!e?t/this.layout.size.width*100+"%":t+"px"},d.getYValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&e?t/this.layout.size.height*100+"%":t+"px"},d._transitionTo=function(t,e){this.getPosition();var i=this.position.x,o=this.position.y,n=t==this.position.x&&e==this.position.y;if(this.setPosition(t,e),n&&!this.isTransitioning)return void this.layoutPosition();var s=t-i,r=e-o,a={};a.transform=this.getTranslate(s,r),this.transition({to:a,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},d.getTranslate=function(t,e){var i=this.layout._getOption("originLeft"),o=this.layout._getOption("originTop");return t=i?t:-t,e=o?e:-e,"translate3d("+t+"px, "+e+"px, 0)"},d.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},d.moveTo=d._transitionTo,d.setPosition=function(t,e){this.position.x=parseFloat(t),this.position.y=parseFloat(e)},d._nonTransition=function(t){this.css(t.to),t.isCleaning&&this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},d.transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(t);var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);var o=this.element.offsetHeight;o=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var l="opacity,"+n(a);d.enableTransition=function(){if(!this.isTransitioning){var t=this.layout.options.transitionDuration;t="number"==typeof t?t+"ms":t,this.css({transitionProperty:l,transitionDuration:t,transitionDelay:this.staggerDelay||0}),this.element.addEventListener(u,this,!1)}},d.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},d.onotransitionend=function(t){this.ontransitionend(t)};var f={"-webkit-transform":"transform"};d.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,o=f[t.propertyName]||t.propertyName;if(delete e.ingProperties[o],i(e.ingProperties)&&this.disableTransition(),o in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[o]),o in e.onEnd){var n=e.onEnd[o];n.call(this),delete e.onEnd[o]}this.emitEvent("transitionEnd",[this])}},d.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(u,this,!1),this.isTransitioning=!1},d._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var c={transitionProperty:"",transitionDuration:"",transitionDelay:""};return d.removeTransitionStyles=function(){this.css(c)},d.stagger=function(t){t=isNaN(t)?0:t,this.staggerDelay=t+"ms"},d.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},d.remove=function(){return r&&parseFloat(this.layout.options.transitionDuration)?(this.once("transitionEnd",function(){this.removeElem()}),void this.hide()):void this.removeElem()},d.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("visibleStyle");e[i]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},d.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},d.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},d.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("hiddenStyle");e[i]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},d.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},d.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},o}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(i,o,n,s){return e(t,i,o,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):t.Outlayer=e(t,t.EvEmitter,t.getSize,t.fizzyUIUtils,t.Outlayer.Item)}(window,function(t,e,i,o,n){"use strict";function s(t,e){var i=o.getQueryElement(t);if(!i)return void(u&&u.error("Bad element for "+this.constructor.namespace+": "+(i||t)));this.element=i,h&&(this.$element=h(this.element)),this.options=o.extend({},this.constructor.defaults),this.option(e);var n=++l;this.element.outlayerGUID=n,f[n]=this,this._create();var s=this._getOption("initLayout");s&&this.layout()}function r(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e}function a(t){if("number"==typeof t)return t;var e=t.match(/(^\d*\.?\d*)(\w*)/),i=e&&e[1],o=e&&e[2];if(!i.length)return 0;i=parseFloat(i);var n=m[o]||1;return i*n}var u=t.console,h=t.jQuery,d=function(){},l=0,f={};s.namespace="outlayer",s.Item=n,s.defaults={containerStyle:{position:"relative"},initLayout:!0,originLeft:!0,originTop:!0,resize:!0,resizeContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}};var c=s.prototype;o.extend(c,e.prototype),c.option=function(t){o.extend(this.options,t)},c._getOption=function(t){var e=this.constructor.compatOptions[t];return e&&void 0!==this.options[e]?this.options[e]:this.options[t]},s.compatOptions={initLayout:"isInitLayout",horizontal:"isHorizontal",layoutInstant:"isLayoutInstant",originLeft:"isOriginLeft",originTop:"isOriginTop",resize:"isResizeBound",resizeContainer:"isResizingContainer"},c._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),o.extend(this.element.style,this.options.containerStyle);var t=this._getOption("resize");t&&this.bindResize()},c.reloadItems=function(){this.items=this._itemize(this.element.children)},c._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,o=[],n=0;n<e.length;n++){var s=e[n],r=new i(s,this);o.push(r)}return o},c._filterFindItemElements=function(t){return o.filterFindElements(t,this.options.itemSelector)},c.getItemElements=function(){return this.items.map(function(t){return t.element})},c.layout=function(){this._resetLayout(),this._manageStamps();var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;this.layoutItems(this.items,e),this._isLayoutInited=!0},c._init=c.layout,c._resetLayout=function(){this.getSize()},c.getSize=function(){this.size=i(this.element)},c._getMeasurement=function(t,e){var o,n=this.options[t];n?("string"==typeof n?o=this.element.querySelector(n):n instanceof HTMLElement&&(o=n),this[t]=o?i(o)[e]:n):this[t]=0},c.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},c._getItemsForLayout=function(t){return t.filter(function(t){return!t.isIgnored})},c._layoutItems=function(t,e){if(this._emitCompleteOnItems("layout",t),t&&t.length){var i=[];t.forEach(function(t){var o=this._getItemLayoutPosition(t);o.item=t,o.isInstant=e||t.isLayoutInstant,i.push(o)},this),this._processLayoutQueue(i)}},c._getItemLayoutPosition=function(){return{x:0,y:0}},c._processLayoutQueue=function(t){this.updateStagger(),t.forEach(function(t,e){this._positionItem(t.item,t.x,t.y,t.isInstant,e)},this)},c.updateStagger=function(){var t=this.options.stagger;return null===t||void 0===t?void(this.stagger=0):(this.stagger=a(t),this.stagger)},c._positionItem=function(t,e,i,o,n){o?t.goTo(e,i):(t.stagger(n*this.stagger),t.moveTo(e,i))},c._postLayout=function(){this.resizeContainer()},c.resizeContainer=function(){var t=this._getOption("resizeContainer");if(t){var e=this._getContainerSize();e&&(this._setContainerMeasure(e.width,!0),this._setContainerMeasure(e.height,!1))}},c._getContainerSize=d,c._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},c._emitCompleteOnItems=function(t,e){function i(){n.dispatchEvent(t+"Complete",null,[e])}function o(){r++,r==s&&i()}var n=this,s=e.length;if(!e||!s)return void i();var r=0;e.forEach(function(e){e.once(t,o)})},c.dispatchEvent=function(t,e,i){var o=e?[e].concat(i):i;if(this.emitEvent(t,o),h)if(this.$element=this.$element||h(this.element),e){var n=h.Event(e);n.type=t,this.$element.trigger(n,i)}else this.$element.trigger(t,i)},c.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},c.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},c.stamp=function(t){t=this._find(t),t&&(this.stamps=this.stamps.concat(t),t.forEach(this.ignore,this))},c.unstamp=function(t){t=this._find(t),t&&t.forEach(function(t){o.removeFrom(this.stamps,t),this.unignore(t)},this)},c._find=function(t){if(t)return"string"==typeof t&&(t=this.element.querySelectorAll(t)),t=o.makeArray(t)},c._manageStamps=function(){this.stamps&&this.stamps.length&&(this._getBoundingRect(),this.stamps.forEach(this._manageStamp,this))},c._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},c._manageStamp=d,c._getElementOffset=function(t){var e=t.getBoundingClientRect(),o=this._boundingRect,n=i(t),s={left:e.left-o.left-n.marginLeft,top:e.top-o.top-n.marginTop,right:o.right-e.right-n.marginRight,bottom:o.bottom-e.bottom-n.marginBottom};return s},c.handleEvent=o.handleEvent,c.bindResize=function(){t.addEventListener("resize",this),this.isResizeBound=!0},c.unbindResize=function(){t.removeEventListener("resize",this),this.isResizeBound=!1},c.onresize=function(){this.resize()},o.debounceMethod(s,"onresize",100),c.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},c.needsResizeLayout=function(){var t=i(this.element),e=this.size&&t;return e&&t.innerWidth!==this.size.innerWidth},c.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},c.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},c.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},c.reveal=function(t){if(this._emitCompleteOnItems("reveal",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.reveal()})}},c.hide=function(t){if(this._emitCompleteOnItems("hide",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.hide()})}},c.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},c.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},c.getItem=function(t){for(var e=0;e<this.items.length;e++){var i=this.items[e];if(i.element==t)return i}},c.getItems=function(t){t=o.makeArray(t);var e=[];return t.forEach(function(t){var i=this.getItem(t);i&&e.push(i)},this),e},c.remove=function(t){var e=this.getItems(t);this._emitCompleteOnItems("remove",e),e&&e.length&&e.forEach(function(t){t.remove(),o.removeFrom(this.items,t)},this)},c.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="",this.items.forEach(function(t){t.destroy()}),this.unbindResize();var e=this.element.outlayerGUID;delete f[e],delete this.element.outlayerGUID,h&&h.removeData(this.element,this.constructor.namespace)},s.data=function(t){t=o.getQueryElement(t);var e=t&&t.outlayerGUID;return e&&f[e]},s.create=function(t,e){var i=r(s);return i.defaults=o.extend({},s.defaults),o.extend(i.defaults,e),i.compatOptions=o.extend({},s.compatOptions),i.namespace=t,i.data=s.data,i.Item=r(n),o.htmlInit(i,t),h&&h.bridget&&h.bridget(t,i),i};var m={ms:1,s:1e3};return s.Item=n,s}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/item",["outlayer/outlayer"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer")):(t.
vendor: 13,939 bytes, lines 14-15
14Smashotope=t.Smashotope||{},t.Smashotope.Item=e(t.Outlayer))}(window,function(t){"use strict";function e(){t.Item.apply(this,arguments)}var i=e.prototype=Object.create(t.Item.prototype),o=i._create;i._create=function(){this.id=this.layout.itemGUID++,o.call(this),this.sortData={}},i.updateSortData=function(){if(!this.isIgnored){this.sortData.id=this.id,this.sortData["original-order"]=this.id,this.sortData.random=Math.random();var t=this.layout.options.getSortData,e=this.layout._sorters;for(var i in t){var o=e[i];this.sortData[i]=o(this.element,this)}}};var n=i.destroy;return i.destroy=function(){n.apply(this,arguments),this.css({display:""})},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-mode",["get-size/get-size","outlayer/outlayer"],e):"object"==typeof module&&module.exports?module.exports=e(require("get-size"),require("outlayer")):(t.Smashotope=t.Smashotope||{},t.Smashotope.LayoutMode=e(t.getSize,t.Outlayer))}(window,function(t,e){"use strict";function i(t){this.smashotope=t,t&&(this.options=t.options[this.namespace],this.element=t.element,this.items=t.filteredItems,this.size=t.size)}var o=i.prototype,n=["_resetLayout","_getItemLayoutPosition","_manageStamp","_getContainerSize","_getElementOffset","needsResizeLayout","_getOption"];return n.forEach(function(t){o[t]=function(){return e.prototype[t].apply(this.smashotope,arguments)}}),o.needsVerticalResizeLayout=function(){var e=t(this.smashotope.element),i=this.smashotope.size&&e;return i&&e.innerHeight!=this.smashotope.size.innerHeight},o._getMeasurement=function(){this.smashotope._getMeasurement.apply(this,arguments)},o.getColumnWidth=function(){this.getSegmentSize("column","Width")},o.getRowHeight=function(){this.getSegmentSize("row","Height")},o.getSegmentSize=function(t,e){var i=t+e,o="outer"+e;if(this._getMeasurement(i,o),!this[i]){var n=this.getFirstItemSize();this[i]=n&&n[o]||this.smashotope.size["inner"+e]}},o.getFirstItemSize=function(){var e=this.smashotope.filteredItems[0];return e&&e.element&&t(e.element)},o.layout=function(){this.smashotope.layout.apply(this.smashotope,arguments)},o.getSize=function(){this.smashotope.getSize(),this.size=this.smashotope.size},i.modes={},i.create=function(t,e){function n(){i.apply(this,arguments)}return n.prototype=Object.create(o),n.prototype.constructor=n,e&&(n.options=e),n.prototype.namespace=t,i.modes[t]=n,n},i}),function(t,e){"function"==typeof define&&define.amd?define("masonry-layout/masonry",["outlayer/outlayer","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer"),require("get-size")):t.Masonry=e(t.Outlayer,t.getSize)}(window,function(t,e){var i=t.create("masonry");i.compatOptions.fitWidth="isFitWidth";var o=i.prototype;return o._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns(),this.colYs=[];for(var t=0;t<this.cols;t++)this.colYs.push(0);this.maxY=0,this.horizontalColIndex=0},o.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&&t.element;this.columnWidth=i&&e(i).outerWidth||this.containerWidth}var o=this.columnWidth+=this.gutter,n=this.containerWidth+this.gutter,s=n/o,r=o-n%o,a=r&&r<1?"round":"floor";s=Math[a](s),this.cols=Math.max(s,1)},o.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,o=e(i);this.containerWidth=o&&o.innerWidth},o._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&e<1?"round":"ceil",o=Math[i](t.size.outerWidth/this.columnWidth);o=Math.min(o,this.cols);for(var n=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",s=this[n](o,t),r={x:this.columnWidth*s.col,y:s.y},a=s.y+t.size.outerHeight,u=o+s.col,h=s.col;h<u;h++)this.colYs[h]=a;return r},o._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},o._getTopColGroup=function(t){if(t<2)return this.colYs;for(var e=[],i=this.cols+1-t,o=0;o<i;o++)e[o]=this._getColGroupY(o,t);return e},o._getColGroupY=function(t,e){if(e<2)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},o._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,o=t>1&&i+t>this.cols;i=o?0:i;var n=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=n?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},o._manageStamp=function(t){var i=e(t),o=this._getElementOffset(t),n=this._getOption("originLeft"),s=n?o.left:o.right,r=s+i.outerWidth,a=Math.floor(s/this.columnWidth);a=Math.max(0,a);var u=Math.floor(r/this.columnWidth);u-=r%this.columnWidth?0:1,u=Math.min(this.cols-1,u);for(var h=this._getOption("originTop"),d=(h?o.top:o.bottom)+i.outerHeight,l=a;l<=u;l++)this.colYs[l]=Math.max(d,this.colYs[l])},o._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},o._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},o.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/masonry",["../layout-mode","masonry-layout/masonry"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode"),require("masonry-layout")):e(t.Smashotope.LayoutMode,t.Masonry)}(window,function(t,e){"use strict";var i=t.create("masonry"),o=i.prototype,n={_getElementOffset:!0,layout:!0,_getMeasurement:!0};for(var s in e.prototype)n[s]||(o[s]=e.prototype[s]);var r=o.measureColumns;o.measureColumns=function(){this.items=this.smashotope.filteredItems,r.call(this)};var a=o._getOption;return o._getOption=function(t){return"fitWidth"==t?void 0!==this.options.isFitWidth?this.options.isFitWidth:this.options.fitWidth:a.apply(this.smashotope,arguments)},i}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/fit-rows",["../layout-mode"],e):"object"==typeof exports?module.exports=e(require("../layout-mode")):e(t.Smashotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("fitRows"),i=e.prototype;return i._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this._getMeasurement("gutter","outerWidth")},i._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth+this.gutter,i=this.smashotope.size.innerWidth+this.gutter;0!==this.x&&e+this.x>i&&(this.x=0,this.y=this.maxY);var o={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+t.size.outerHeight),this.x+=e,o},i._getContainerSize=function(){return{height:this.maxY}},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/vertical",["../layout-mode"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode")):e(t.Smashotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("vertical",{horizontalAlignment:0}),i=e.prototype;return i._resetLayout=function(){this.y=0},i._getItemLayoutPosition=function(t){t.getSize();var e=(this.smashotope.size.innerWidth-t.size.outerWidth)*this.options.horizontalAlignment,i=this.y;return this.y+=t.size.outerHeight,{x:e,y:i}},i._getContainerSize=function(){return{height:this.y}},e}),function(t,e){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","desandro-matches-selector/matches-selector","fizzy-ui-utils/utils","isotope-layout/js/item","isotope-layout/js/layout-mode","isotope-layout/js/layout-modes/masonry","isotope-layout/js/layout-modes/fit-rows","isotope-layout/js/layout-modes/vertical"],function(i,o,n,s,r,a){return e(t,i,o,n,s,r,a)}):"object"==typeof module&&module.exports?module.exports=e(t,require("outlayer"),require("get-size"),require("desandro-matches-selector"),require("fizzy-ui-utils"),require("isotope-layout/js/item"),require("isotope-layout/js/layout-mode"),require("isotope-layout/js/layout-modes/masonry"),require("isotope-layout/js/layout-modes/fit-rows"),require("isotope-layout/js/layout-modes/vertical")):t.Smashotope=e(t,t.Outlayer,t.getSize,t.matchesSelector,t.fizzyUIUtils,t.Smashotope.Item,t.Smashotope.LayoutMode)}(window,function(t,e,i,o,n,s,r){function a(t,e){return function(i,o){for(var n=0;n<t.length;n++){var s=t[n],r=i.sortData[s],a=o.sortData[s];if(r>a||r<a){var u=void 0!==e[s]?e[s]:e,h=u?1:-1;return(r>a?1:-1)*h}}return 0}}var u=t.jQuery,h=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^\s+|\s+$/g,"")},d=e.create("smashotope",{layoutMode:"masonry",isJQueryFiltering:!0,sortAscending:!0});d.Item=s,d.LayoutMode=r;var l=d.prototype;l._create=function(){this.itemGUID=0,this._sorters={},this._getSorters(),e.prototype._create.call(this),this.modes={},this.filteredItems=this.items,this.sortHistory=["original-order"];for(var t in r.modes)this._initLayoutMode(t)},l.reloadItems=function(){this.itemGUID=0,e.prototype.reloadItems.call(this)},l._itemize=function(){for(var t=e.prototype._itemize.apply(this,arguments),i=0;i<t.length;i++){var o=t[i];o.id=this.itemGUID++}return this._updateItemsSortData(t),t},l._initLayoutMode=function(t){var e=r.modes[t],i=this.options[t]||{};this.options[t]=e.options?n.extend(e.options,i):i,this.modes[t]=new e(this)},l.layout=function(){return!this._isLayoutInited&&this._getOption("initLayout")?void this.arrange():void this._layout()},l._layout=function(){var t=this._getIsInstant();this._resetLayout(),this._manageStamps(),this.layoutItems(this.filteredItems,t),this._isLayoutInited=!0},l.arrange=function(t){this.option(t),this._getIsInstant();var e=this._filter(this.items);this.filteredItems=e.matches,this._bindArrangeComplete(),this._isInstant?this._noTransition(this._hideReveal,[e]):this._hideReveal(e),this._sort(),this._layout()},l._init=l.arrange,l._hideReveal=function(t){this.reveal(t.needReveal),this.hide(t.needHide)},l._getIsInstant=function(){var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;return this._isInstant=e,e},l._bindArrangeComplete=function(){function t(){e&&i&&o&&n.dispatchEvent("arrangeComplete",null,[n.filteredItems])}var e,i,o,n=this;this.once("layoutComplete",function(){e=!0,t()}),this.once("hideComplete",function(){i=!0,t()}),this.once("revealComplete",function(){o=!0,t()})},l._filter=function(t){var e=this.options.filter;e=e||"*";for(var i=[],o=[],n=[],s=this._getFilterTest(e),r=0;r<t.length;r++){var a=t[r];if(!a.isIgnored){var u=s(a);u&&i.push(a),u&&a.isHidden?o.push(a):u||a.isHidden||n.push(a)}}return{matches:i,needReveal:o,needHide:n}},l._getFilterTest=function(t){return u&&this.options.isJQueryFiltering?function(e){return u(e.element).is(t); 15 }:"function"==typeof t?function(e){return t(e.element)}:function(e){return o(e.element,t)}},l.updateSortData=function(t){var e;t?(t=n.makeArray(t),e=this.getItems(t)):e=this.items,this._getSorters(),this._updateItemsSortData(e)},l._getSorters=function(){var t=this.options.getSortData;for(var e in t){var i=t[e];this._sorters[e]=f(i)}},l._updateItemsSortData=function(t){for(var e=t&&t.length,i=0;e&&i<e;i++){var o=t[i];o.updateSortData()}};var f=function(){function t(t){if("string"!=typeof t)return t;var i=h(t).split(" "),o=i[0],n=o.match(/^\[(.+)\]$/),s=n&&n[1],r=e(s,o),a=d.sortDataParsers[i[1]];return t=a?function(t){return t&&a(r(t))}:function(t){return t&&r(t)}}function e(t,e){return t?function(e){return e.getAttribute(t)}:function(t){var i=t.querySelector(e);return i&&i.textContent}}return t}();d.sortDataParsers={parseInt:function(t){return parseInt(t,10)},parseFloat:function(t){return parseFloat(t)}},l._sort=function(){if(this.options.sortBy){var t=n.makeArray(this.options.sortBy);this._getIsSameSortBy(t)||(this.sortHistory=t.concat(this.sortHistory));var e=a(this.sortHistory,this.options.sortAscending);this.filteredItems.sort(e)}},l._getIsSameSortBy=function(t){for(var e=0;e<t.length;e++)if(t[e]!=this.sortHistory[e])return!1;return!0},l._mode=function(){var t=this.options.layoutMode,e=this.modes[t];if(!e)throw new Error("No layout mode: "+t);return e.options=this.options[t],e},l._resetLayout=function(){e.prototype._resetLayout.call(this),this._mode()._resetLayout()},l._getItemLayoutPosition=function(t){return this._mode()._getItemLayoutPosition(t)},l._manageStamp=function(t){this._mode()._manageStamp(t)},l._getContainerSize=function(){return this._mode()._getContainerSize()},l.needsResizeLayout=function(){return this._mode().needsResizeLayout()},l.appended=function(t){var e=this.addItems(t);if(e.length){var i=this._filterRevealAdded(e);this.filteredItems=this.filteredItems.concat(i)}},l.prepended=function(t){var e=this._itemize(t);if(e.length){this._resetLayout(),this._manageStamps();var i=this._filterRevealAdded(e);this.layoutItems(this.filteredItems),this.filteredItems=i.concat(this.filteredItems),this.items=e.concat(this.items)}},l._filterRevealAdded=function(t){var e=this._filter(t);return this.hide(e.needHide),this.reveal(e.matches),this.layoutItems(e.matches,!0),e.matches},l.insert=function(t){var e=this.addItems(t);if(e.length){var i,o,n=e.length;for(i=0;i<n;i++)o=e[i],this.element.appendChild(o.element);var s=this._filter(e).matches;for(i=0;i<n;i++)e[i].isLayoutInstant=!0;for(this.arrange(),i=0;i<n;i++)delete e[i].isLayoutInstant;this.reveal(s)}};var c=l.remove;return l.remove=function(t){t=n.makeArray(t);var e=this.getItems(t);c.call(this,t);for(var i=e&&e.length,o=0;i&&o<i;o++){var s=e[o];n.removeFrom(this.filteredItems,s)}},l.shuffle=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.sortData.random=Math.random()}this.options.sortBy="random",this._sort(),this._layout()},l._noTransition=function(t,e){var i=this.options.transitionDuration;this.options.transitionDuration=0;
vendor: 1,768 bytes, lines 15-20
15var o=t.apply(this,e);return this.options.transitionDuration=i,o},l.getFilteredItemElements=function(){return this.filteredItems.map(function(t){return t.element})},d}); 16 17 18 19 // Carousel 20 !function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},a.each(["onResize","onThrottledResize"],a.proxy(function(b,c){this._handlers[c]=a.proxy(this[c],this)},this)),a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a.charAt(0).toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Workers,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}e.Defaults={items:3,loop:!1,center:!1,rewind:!1,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,fallbackEasing:"swing",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"sbi-owl-refresh",loadedClass:"sbi-owl-loaded",loadingClass:"sbi-owl-loading",rtlClass:"sbi-owl-rtl",responsiveClass:"sbi-owl-responsive",dragClass:"sbi-owl-drag",itemClass:"sbi-owl-item",stageClass:"sbi-owl-stage",stageOuterClass:"sbi-owl-stage-outer",grabClass:"sbi-
vendor: 19,261 bytes, line 20
20owl-grab"},e.Width={Default:"default",Inner:"inner",Outer:"outer"},e.Type={Event:"event",State:"state"},e.Plugins={},e.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(a){var b=this.settings.margin||"",c=!this.settings.autoWidth,d=this.settings.rtl,e={width:"auto","margin-left":d?b:"","margin-right":d?"":b};!c&&this.$stage.children().css(e),a.css=e}},{filter:["width","items","settings"],run:function(a){var b=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,c=null,d=this._items.length,e=!this.settings.autoWidth,f=[];for(a.items={merge:!1,width:b};d--;)c=this._mergers[d],c=this.settings.mergeFit&&Math.min(c,this.settings.items)||c,a.items.merge=c>1||a.items.merge,f[d]=e?b*c:this._items[d].width();this._widths=f}},{filter:["items","settings"],run:function(){var b=[],c=this._items,d=this.settings,e=Math.max(2*d.items,4),f=2*Math.ceil(c.length/2),g=d.loop&&c.length?d.rewind?e:Math.max(e,f):0,h="",i="";for(g/=2;g--;)b.push(this.normalize(b.length/2,!0)),h+=c[b[b.length-1]][0].outerHTML,b.push(this.normalize(c.length-1-(b.length-1)/2,!0)),i=c[b[b.length-1]][0].outerHTML+i;this._clones=b,a(h).addClass("cloned").appendTo(this.$stage),a(i).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var a=this.settings.rtl?1:-1,b=this._clones.length+this._items.length,c=-1,d=0,e=0,f=[];++c<b;)d=f[c-1]||0,e=this._widths[this.relative(c)]+this.settings.margin,f.push(d+e*a);this._coordinates=f}},{filter:["width","items","settings"],run:function(){var a=this.settings.stagePadding,b=this._coordinates,c={width:Math.ceil(Math.abs(b[b.length-1]))+2*a,"padding-left":a||"","padding-right":a||""};this.$stage.css(c)}},{filter:["width","items","settings"],run:function(a){var b=this._coordinates.length,c=!this.settings.autoWidth,d=this.$stage.children();if(c&&a.items.merge)for(;b--;)a.css.width=this._widths[this.relative(b)],d.eq(b).css(a.css);else c&&(a.css.width=a.items.width,d.css(a.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(a){a.current=a.current?this.$stage.children().index(a.current):0,a.current=Math.max(this.minimum(),Math.min(this.maximum(),a.current)),this.reset(a.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;c<d;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,"<=",g)&&this.op(a,">",h)||this.op(b,"<",g)&&this.op(b,">",h))&&i.push(c);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+i.join("), :eq(")+")").addClass("active"),this.settings.center&&(this.$stage.children(".center").removeClass("center"),this.$stage.children().eq(this.current()).addClass("center"))}}],e.prototype.initialize=function(){if(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&&!this.is("pre-loading")){var b,c,e;b=this.$element.find("img"),c=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:d,e=this.$element.children(c).width(),b.length&&e<=0&&this.preloadAutoWidthImages(b)}this.$element.addClass(this.options.loadingClass),this.$stage=a("<"+this.settings.stageElement+' class="'+this.settings.stageClass+'"/>').wrap('<div class="'+this.settings.stageOuterClass+'"/>'),this.$element.append(this.$stage.parent()),this.replace(this.$element.children().not(this.$stage.parent())),this.$element.is(":visible")?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){a<=b&&a>d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),"function"==typeof e.stagePadding&&(e.stagePadding=e.stagePadding()),delete e.responsive,e.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+d))):e=a.extend({},this.options),this.trigger("change",{property:{name:"settings",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},e.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger("prepare",{content:b});return c.data||(c.data=a("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(b)),this.trigger("prepared",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};b<c;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={},!this.is("valid")&&this.enter("valid")},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!!this.$element.is(":visible")&&(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized")))))},e.prototype.registerEventHandlers=function(){a.support.transition&&this.$stage.on(a.support.transition.end+".owl.core",a.proxy(this.onTransitionEnd,this)),this.settings.responsive!==!1&&this.on(b,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",a.proxy(this.onDragEnd,this)))},e.prototype.onDragStart=function(b){var d=null;3!==b.which&&(a.support.transform?(d=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","),d={x:d[16===d.length?12:4],y:d[16===d.length?13:5]}):(d=this.$stage.position(),d={x:this.settings.rtl?d.left+this.$stage.width()-this.width()+this.settings.margin:d.left,y:d.top}),this.is("animating")&&(a.support.transform?this.animate(d.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===b.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=a(b.target),this._drag.stage.start=d,this._drag.stage.current=d,this._drag.pointer=this.pointer(b),a(c).on("mouseup.owl.core touchend.owl.core",a.proxy(this.onDragEnd,this)),a(c).one("mousemove.owl.core touchmove.owl.core",a.proxy(function(b){var d=this.difference(this._drag.pointer,this.pointer(b));a(c).on("mousemove.owl.core touchmove.owl.core",a.proxy(this.onDragMove,this)),Math.abs(d.x)<Math.abs(d.y)&&this.is("valid")||(b.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},e.prototype.onDragMove=function(a){var b=null,c=null,d=null,e=this.difference(this._drag.pointer,this.pointer(a)),f=this.difference(this._drag.stage.start,e);this.is("dragging")&&(a.preventDefault(),this.settings.loop?(b=this.coordinates(this.minimum()),c=this.coordinates(this.maximum()+1)-b,f.x=((f.x-b)%c+c)%c+b):(b=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),c=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),d=this.settings.pullDrag?-1*e.x/5:0,f.x=Math.max(Math.min(f.x,b+d),c+d)),this._drag.stage.current=f,this.animate(f.x))},e.prototype.onDragEnd=function(b){var d=this.difference(this._drag.pointer,this.pointer(b)),e=this._drag.stage.current,f=d.x>0^this.settings.rtl?"left":"right";a(c).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==d.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(e.x,0!==d.x?f:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=f,(Math.abs(d.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},e.prototype.closest=function(b,c){var d=-1,e=30,f=this.width(),g=this.coordinates();return this.settings.freeDrag||a.each(g,a.proxy(function(a,h){return"left"===c&&b>h-e&&b<h+e?d=a:"right"===c&&b>h-f-e&&b<h-f+e?d=a+1:this.op(b,"<",h)&&this.op(b,">",g[a+1]||h-f)&&(d="left"===c?a+1:a),d===-1},this)),this.settings.loop||(this.op(b,">",g[this.minimum()])?d=b=this.minimum():this.op(b,"<",g[this.maximum()])&&(d=b=this.maximum())),d},e.prototype.animate=function(b){var c=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),c&&(this.enter("animating"),this.trigger("translate")),a.support.transform3d&&a.support.transition?this.$stage.css({transform:"translate3d("+b+"px,0px,0px)",transition:this.speed()/1e3+"s"}):c?this.$stage.animate({left:b+"px"},this.speed(),this.settings.fallbackEasing,a.proxy(this.onTransitionEnd,this)):this.$stage.css({left:b+"px"})},e.prototype.is=function(a){return this._states.current[a]&&this._states.current[a]>0},e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger("change",{property:{name:"position",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current},e.prototype.invalidate=function(b){return"string"===a.type(b)&&(this._invalidated[b]=!0,this.is("valid")&&this.leave("valid")),a.map(this._invalidated,function(a,b){return b})},e.prototype.reset=function(a){a=this.normalize(a),a!==d&&(this._speed=0,this._current=a,this.suppress(["translate","translated"]),this.animate(this.coordinates(a)),this.release(["translate","translated"]))},e.prototype.normalize=function(a,b){var c=this._items.length,e=b?0:this._clones.length;return!this.isNumeric(a)||c<1?a=d:(a<0||a>=c+e)&&(a=((a-e/2)%c+c)%c+e/2),a},e.prototype.relative=function(a){return a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c,d,e=this.settings,f=this._coordinates.length;if(e.loop)f=this._clones.length/2+this._items.length-1;else if(e.autoWidth||e.merge){for(b=this._items.length,c=this._items[--b].width(),d=this.$element.width();b--&&(c+=this._items[b].width()+this.settings.margin,!(c>d)););f=b+1}else f=e.center?this._items.length-1:this._items.length-e.items;return a&&(f-=this._clones.length/2),Math.max(f,0)},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2===0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c,e=1,f=b-1;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(this.settings.rtl&&(e=-1,f=b+1),c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[f]||0))/2*e):c=this._coordinates[f]||0,c=Math.ceil(c))},e.prototype.duration=function(a,b,c){return 0===c?0:Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(a,b){var c=this.current(),d=null,e=a-this.relative(c),f=(e>0)-(e<0),g=this._items.length,h=this.minimum(),i=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(e)>g/2&&(e+=f*-1*g),a=c+e,d=((a-h)%g+g)%g+h,d!==a&&d-e<=i&&d-e>0&&(c=d-e,a=d,this.reset(c))):this.settings.rewind?(i+=1,a=(a%i+i)%i):a=Math.max(h,Math.min(i,a)),this.speed(this.duration(c,a,b)),this.current(a),this.$element.is(":visible")&&this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.onTransitionEnd=function(a){if(a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},e.prototype.viewport=function(){var d;return this.options.responsiveBaseElement!==b?d=a(this.options.responsiveBaseElement).width():b.innerWidth?d=b.innerWidth:c.documentElement&&c.documentElement.clientWidth?d=c.documentElement.clientWidth:console.warn("Can not detect viewport width."),d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find("."+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},e.prototype.add=function(b,c){var e=this.relative(this._current);c=c===d?this._items.length:this.normalize(c,!0),b=b instanceof jQuery?b:a(b),this.trigger("add",{content:b,position:c}),b=this.prepare(b),0===this._items.length||c===this._items.length?(0===this._items.length&&this.$stage.append(b),0!==this._items.length&&this._items[c-1].after(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[c].before(b),this._items.splice(c,0,b),this._mergers.splice(c,0,1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[e]&&this.reset(this._items[e].index()),this.invalidate("items"),this.trigger("added",{content:b,position:c})},e.prototype.remove=function(a){a=this.normalize(a,!0),a!==d&&(this.trigger("remove",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate("items"),this.trigger("removed",{content:null,position:a}))},e.prototype.preloadAutoWidthImages=function(b){b.each(a.proxy(function(b,c){this.enter("pre-loading"),c=a(c),a(new Image).one("load",a.proxy(function(a){c.attr("src",a.target.src),c.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&&!this.is("initializing")&&this.refresh()},this)).attr("src",c.attr("src")||c.attr("data-src")||c.attr("data-src-retina"))},this))},e.prototype.destroy=function(){this.$element.off(".owl.core"),this.$stage.off(".owl.core"),a(c).off(".owl.core"),this.settings.responsive!==!1&&(b.clearTimeout(this.resizeTimer),this.off(b,"resize",this._handlers.onThrottledResize));for(var d in this._plugins)this._plugins[d].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case"<":return d?a>c:a<c;case">":return d?a<c:a>c;case">=":return d?a<=c:a>=c;case"<=":return d?a>=c:a<=c}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)},e.prototype.trigger=function(b,c,d,f,g){var h={item:{count:this._items.length,index:this.current()}},i=a.camelCase(a.grep(["on",b,d],function(a){return a}).join("-").toLowerCase()),j=a.Event([b,"owl",d||"carousel"].join(".").toLowerCase(),a.extend({relatedTarget:this},h,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(j)}),this.register({type:e.Type.Event,name:b}),this.$element.trigger(j),this.settings&&"function"==typeof this.settings[i]&&this.settings[i].call(this,j)),j},e.prototype.enter=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]===d&&(this._states.current[b]=0),this._states.current[b]++},this))},e.prototype.leave=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]--},this))},e.prototype.register=function(b){if(b.type===e.Type.Event){if(a.event.special[b.name]||(a.event.special[b.name]={}),!a.event.special[b.name].owl){var c=a.event.special[b.name]._default;a.event.special[b.name]._default=function(a){return!c||!c.apply||a.namespace&&a.namespace.indexOf("owl")!==-1?a.namespace&&a.namespace.indexOf("owl")>-1:c.apply(this,arguments)},a.event.special[b.name].owl=!0}}else b.type===e.Type.State&&(this._states.tags[b.name]?this._states.tags[b.name]=this._states.tags[b.name].concat(b.tags):this._states.tags[b.name]=b.tags,this._states.tags[b.name]=a.grep(this._states.tags[b.name],a.proxy(function(c,d){return a.inArray(c,this._states.tags[b.name])===d},this)))},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.pointer=function(a){var c={x:null,y:null};return a=a.originalEvent||a||b.event,a=a.touches&&a.touches.length?a.touches[0]:a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a,a.pageX?(c.x=a.pageX,c.y=a.pageY):(c.x=a.clientX,c.y=a.clientY),c},e.prototype.isNumeric=function(a){return!isNaN(parseFloat(a))},e.prototype.difference=function(a,b){return{x:a.x-b.x,y:a.y-b.y}},a.fn.
20sbiOwlCarousel=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),f=d.data("owl.carousel");f||(f=new e(this,"object"==typeof b&&b),d.data("owl.carousel",f),a.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(b,c){f.register({type:e.Type.Event,name:c}
vendor: 4,540 bytes, line 20
20),f.$element.on(c+".owl.carousel.core",a.proxy(function(a){a.namespace&&a.relatedTarget!==this&&(this.suppress([c]),f[c].apply(this,[].slice.call(arguments,1)),this.release([c]))},f))})),"string"==typeof b&&"_"!==b.charAt(0)&&f[b].apply(f,c)})},a.fn.sbiOwlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoRefresh:!0,autoRefreshInterval:500},e.prototype.watch=function(){this._interval||(this._visible=this._core.$element.is(":visible"),this._interval=b.setInterval(a.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},e.prototype.refresh=function(){this._core.$element.is(":visible")!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("sbi-owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},e.prototype.destroy=function(){var a,c;b.clearInterval(this._interval);for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},a.fn.sbiOwlCarousel.Constructor.Plugins.AutoRefresh=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&"position"==b.property.name||"initialized"==b.type))for(var c=this._core.settings,e=c.center&&Math.ceil(c.items/2)||c.items,f=c.center&&e*-1||0,g=(b.property&&b.property.value!==d?b.property.value:this._core.current())+f,h=this._core.clones().length,i=a.proxy(function(a,b){this.load(b)},this);f++<e;)this.load(h/2+this._core.relative(g)),h&&a.each(this._core.clones(this._core.relative(g)),i),g++},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={lazyLoad:!1},e.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(".sbi-owl-lazy");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr("data-src-retina")||f.attr("data-src");this._core.trigger("load",{element:f,url:g},"lazy"),f.is("img")?f.one("load.owl.lazy",a.proxy(function(){f.css("opacity",1),this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("src",g):(e=new Image,e.onload=a.proxy(function(){f.css({"background-image":'url("'+g+'")',opacity:"1"}),this._core.trigger("loaded",{element:f,url:g},"lazy")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.sbiOwlCarousel.Constructor.Plugins.Lazy=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&"position"==a.property.name&&this.update()},this),"loaded.owl.lazy":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&a.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoHeight:!1,autoHeightClass:"sbi-owl-height"},e.prototype.update=function(){var b=this._core._current,c=b+this._core.settings.items,d=this._core.$stage.children().toArray().slice(b,c),e=[],f=0;a.each(d,function(b,c){e.push(a(c).height())}),f=Math.max.apply(null,e),this._core.$stage.parent().height(f).addClass(this._core.settings.autoHeightClass)},e.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.sbiOwlCarousel.Constructor.Plugins.AutoHeight=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._videos={}
vendor: 13,415 bytes, lines 20-21
20,this._playing=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.video&&this.isInFullScreen()&&a.preventDefault()},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .sbi-owl-video-frame").remove()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"===a.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find(".sbi-owl-video");c.length&&(c.css("display","none"),this.fetch(c,a(b.content)))}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".sbi-owl-video-play-icon",a.proxy(function(a){this.play(a)},this))};e.Defaults={video:!1,videoHeight:!1,videoWidth:!1},e.prototype.fetch=function(a,b){var c=function(){return a.attr("data-vimeo-id")?"vimeo":a.attr("data-vzaar-id")?"vzaar":"youtube"}(),d=a.attr("data-vimeo-id")||a.attr("data-youtube-id")||a.attr("data-vzaar-id"),e=a.attr("data-width")||this._core.settings.videoWidth,f=a.attr("data-height")||this._core.settings.videoHeight,g=a.attr("href");if(!g)throw new Error("Missing video URL.");if(d=g.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),d[3].indexOf("youtu")>-1)c="youtube";else if(d[3].indexOf("vimeo")>-1)c="vimeo";else{if(!(d[3].indexOf("vzaar")>-1))throw new Error("Video URL not supported.");c="vzaar"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr("data-video",g),this.thumbnail(a,this._videos[g])},e.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?'style="width:'+c.width+"px;height:"+c.height+'px;"':"",h=b.find("img"),i="src",j="",k=this._core.settings,l=function(a){e='<div class="sbi-owl-video-play-icon"></div>',d=k.lazyLoad?'<div class="sbi-owl-video-tn '+j+'" '+i+'="'+a+'"></div>':'<div class="sbi-owl-video-tn" style="opacity:1;background-image:url('+a+')"></div>',b.after(d),b.after(e)};if(b.wrap('<div class="sbi-owl-video-wrapper"'+g+"></div>"),this._core.settings.lazyLoad&&(i="data-src",j="sbi-owl-lazy"),h.length)return l(h.attr(i)),h.remove(),!1;"youtube"===c.type?(f="//img.youtube.com/vi/"+c.id+"/hqdefault.jpg",l(f)):"vimeo"===c.type?a.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a[0].thumbnail_large,l(f)}}):"vzaar"===c.type&&a.ajax({type:"GET",url:"//vzaar.com/api/videos/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a.framegrab_url,l(f)}})},e.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".sbi-owl-video-frame").remove(),this._playing.removeClass("sbi-owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},e.prototype.play=function(b){var c,d=a(b.target),e=d.closest("."+this._core.settings.itemClass),f=this._videos[e.attr("data-video")],g=f.width||"100%",h=f.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),e=this._core.items(this._core.relative(e.index())),this._core.reset(e.index()),"youtube"===f.type?c='<iframe width="'+g+'" height="'+h+'" src="//www.youtube.com/embed/'+f.id+"?autoplay=1&rel=0&v="+f.id+'" frameborder="0" allowfullscreen></iframe>':"vimeo"===f.type?c='<iframe src="//player.vimeo.com/video/'+f.id+'?autoplay=1" width="'+g+'" height="'+h+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>':"vzaar"===f.type&&(c='<iframe frameborder="0"height="'+h+'"width="'+g+'" allowfullscreen mozallowfullscreen webkitAllowFullScreen src="//view.vzaar.com/'+f.id+'/player?autoplay=true"></iframe>'),a('<div class="sbi-owl-video-frame">'+c+"</div>").insertAfter(e.find(".sbi-owl-video")),this._playing=e.addClass("sbi-owl-video-playing"))},e.prototype.isInFullScreen=function(){var b=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return b&&a(b).parent().hasClass("sbi-owl-video-frame")},e.prototype.destroy=function(){var a,b;this._core.$element.off("click.owl.video");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.sbiOwlCarousel.Constructor.Plugins.Video=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(a){a.namespace&&(this.swapping="translated"==a.type)},this),"translate.owl.carousel":a.proxy(function(a){a.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&a.support.animation&&a.support.transition){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.one(a.support.animation.end,c).css({left:b+"px"}).addClass("animated sbi-owl-animated-out").addClass(g)),f&&e.one(a.support.animation.end,c).addClass("animated sbi-owl-animated-in").addClass(f))}},e.prototype.clear=function(b){a(b.target).css({left:""}).removeClass("animated sbi-owl-animated-out sbi-owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)}, 21 a.fn.sbiOwlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._timeout=null,this._paused=!1,this._handlers={"changed.owl.carousel":a.proxy(function(a){a.namespace&&"settings"===a.property.name?this._core.settings.autoplay?this.play():this.stop():a.namespace&&"position"===a.property.name&&this._core.settings.autoplay&&this._setAutoPlayInterval()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":a.proxy(function(a,b,c){a.namespace&&this.play(b,c)},this),"stop.owl.autoplay":a.proxy(function(a){a.namespace&&this.stop()},this),"mouseover.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=a.extend({},e.Defaults,this._core.options)};e.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},e.prototype.play=function(a,b){this._paused=!1,this._core.is("rotating")||(this._core.enter("rotating"),this._setAutoPlayInterval())},e.prototype._getNextTimeout=function(d,e){return this._timeout&&b.clearTimeout(this._timeout),b.setTimeout(a.proxy(function(){this._paused||this._core.is("busy")||this._core.is("interacting")||c.hidden||this._core.next(e||this._core.settings.autoplaySpeed)},this),d||this._core.settings.autoplayTimeout)},e.prototype._setAutoPlayInterval=function(){this._timeout=this._getNextTimeout()},e.prototype.stop=function(){this._core.is("rotating")&&(b.clearTimeout(this._timeout),this._core.leave("rotating"))},e.prototype.pause=function(){this._core.is("rotating")&&(this._paused=!0)},e.prototype.destroy=function(){var a,b;this.stop();for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.sbiOwlCarousel.Constructor.Plugins.autoplay=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(b){this._core=b,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":a.proxy(function(b){b.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,0,this._templates.pop())},this),"remove.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&this.draw()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers)};e.Defaults={nav:!1,navText:["prev","next"],navSpeed:!1,navElement:"div",navContainer:!1,navContainerClass:"sbi-owl-nav",navClass:["sbi-owl-prev","sbi-owl-next"],slideBy:1,dotClass:"sbi-owl-dot",dotsClass:"sbi-owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},e.prototype.initialize=function(){var b,c=this._core.settings;this._controls.$relative=(c.navContainer?a(c.navContainer):a("<div>").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=a("<"+c.navElement+">").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on("click",a.proxy(function(a){this.prev(c.navSpeed)},this)),this._controls.$next=a("<"+c.navElement+">").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on("click",a.proxy(function(a){this.next(c.navSpeed)},this)),c.dotsData||(this._templates=[a("<div>").addClass(c.dotClass).append(a("<span>")).prop("outerHTML")]),this._controls.$absolute=(c.dotsContainer?a(c.dotsContainer):a("<div>").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","div",a.proxy(function(b){var d=a(b.target).parent().is(this._controls.$absolute)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(d,c.dotsSpeed)},this));for(b in this._overrides)this._core[b]=a.proxy(this[b],this)},e.prototype.destroy=function(){var a,b,c,d;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},e.prototype.update=function(){var a,b,c,d=this._core.clones().length/2,e=d+this._core.items().length,f=this._core.maximum(!0),g=this._core.settings,h=g.center||g.autoWidth||g.dotsData?1:g.dotsEach||g.items;if("page"!==g.slideBy&&(g.slideBy=Math.min(g.slideBy,g.items)),g.dots||"page"==g.slideBy)for(this._pages=[],a=d,b=0,c=0;a<e;a++){if(b>=h||0===b){if(this._pages.push({start:Math.min(f,a-d),end:a-d+h-1}),Math.min(f,a-d)===f)break;b=0,++c}b+=this._core.mergers(this._core.relative(a))}},e.prototype.draw=function(){var b,c=this._core.settings,d=this._core.items().length<=c.items,e=this._core.relative(this._core.current()),f=c.loop||c.rewind;this._controls.$relative.toggleClass("disabled",!c.nav||d),c.nav&&(this._controls.$previous.toggleClass("disabled",!f&&e<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!f&&e>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!c.dots||d),c.dots&&(b=this._pages.length-this._controls.$absolute.children().length,c.dotsData&&0!==b?this._controls.$absolute.html(this._templates.join("")):b>0?this._controls.$absolute.append(new Array(b+1).join(this._templates[0])):b<0&&this._controls.$absolute.children().slice(b).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(a.inArray(this.current(),this._pages)).addClass("active"))},e.prototype.onTrigger=function(b){var c=this._core.settings;
21b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotsData?1:c.dotsEach||c.items)}},e.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,a.proxy(function(a,c){return a.start<=b&&a.end>=b},this)).pop()},e.prototype.getPosition=function(b){var c,d,e=this._core.settings;return"page"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},e.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},e.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},e.prototype.to=function(b,c,d){var e;!d&&this._pages.length?(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c)):a.proxy(this._overrides.to,this._core)(b,c)},a.fn.sbiOwlCarousel.Constructor.Plugins.Navigation=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(c){this._core=c,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":a.proxy(function(c){c.namespace&&"URLHash"===this._core.settings.startPosition&&a(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!c)return;this._hashes[c]=b.content}},this),"changed.owl.carousel":a.proxy(function(c){if(c.namespace&&"position"===c.property.name){var d=this._core.items(this._core.relative(this._core.current())),e=a.map(this._hashes,function(a,b){return a===d?b:null}).join();if(!e||b.location.hash.slice(1)===e)return;b.location.hash=e}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on("hashchange.owl.navigation",a.proxy(function(a){var c=b.location.hash.substring(1),e=this._core.$stage.children(),f=this._hashes[c]&&e.index(this._hashes[c]);f!==d&&f!==this._core.current()&&this._core.to(this._core.relative(f),!1,!0)},this))};e.Defaults={URLhashListener:!1},e.prototype.destroy=function(){var c,d;a(b).off("hashchange.owl.navigation");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))"function"!=typeof this[d]&&(this[d]=null)},a.fn.sbiOwlCarousel.Constructor.Plugins.Hash=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){function e(b,c){var e=!1,f=b.charAt(0).toUpperCase()+b.slice(1);return a.each((b+" "+h.join(f+" ")+f).split(" "),function(a,b){if(g[b]!==d)return e=!c||b,!1}),e}function f(a){return e(a,!0)}var g=a("<support>").get(0).style,h="Webkit Moz O ms".split(" "),i={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},j={csstransforms:function(){return!!e("transform")},csstransforms3d:function(){return!!e("perspective")},csstransitions:function(){return!!e("transition")},cssanimations:function(){return!!e("animation")}};j.csstransitions()&&(a.support.transition=new String(f("transition")),a.support.transition.end=i.transition.end[a.support.transition]),j.cssanimations()&&(a.support.animation=new String(f("animation")),a.support.animation.end=i.animation.end[a.support.animation]),j.csstransforms()&&(a.support.transform=new String(f("transform")),a.support.transform3d=j.csstransforms3d())}(window.Zepto||window.jQuery,window,document); 22 23 !function(a,b){"function"==typeof define&&define.amd?define("packery/js/rect",b):"object"==typeof module&&module.exports?module.exports=b():(a.Packery=a.Packery||{},a.Packery.Rect=b())}(window,function(){function a(b){for(var c in a.defaults)this[c]=a.defaults[c];for(c in b)this[c]=b[c]}a.defaults={x:0,y:0,width:0,height:0};var b=a.prototype;return b.contains=function(a){var b=a.width||0,c=a.height||0;return this.x<=a.x&&this.y<=a.y&&this.x+this.width>=a.x+b&&this.y+this.height>=a.y+c},b.overlaps=function(a){var b=this.x+this.width,c=this.y+this.height,d=a.x+a.width,e=a.y+a.height;return this.x<d&&b>a.x&&this.y<e&&c>a.y},b.getMaximalFreeRects=function(b){if(!this.overlaps(b))return!1;var c,d=[],e=this.x+this.width,f=this.y+this.height,g=b.x+b.width,h=b.y+b.height;return this.y<b.y&&(c=new a({x:this.x,y:this.y,width:this.width,height:b.y-this.y}),d.push(c)),e>g&&(c=new a({x:g,y:this.y,width:e-g,height:this.height}),d.push(c)),f>h&&(c=new a({x:this.x,y:h,width:this.width,height:f-h}),d.push(c)),this.x<b.x&&(c=new a({x:this.x,y:this.y,width:b.x-this.x,height:this.height}),d.push(c)),d},b.canFit=function(a){return this.width>=a.width&&this.height>=a.height},a}),function(a,b){if("function"==typeof define&&define.amd)define("packery/js/packer",["./rect"],b);else if("object"==typeof module&&module.exports)module.exports=b(require("./rect"));else{var c=a.Packery=a.Packery||{};c.Packer=b(c.Rect)}}(window,function(a){function b(a,b,c){this.width=a||0,this.height=b||0,this.sortDirection=c||"downwardLeftToRight",this.reset()}var c=b.prototype;c.reset=function(){this.spaces=[];var b=new a({x:0,y:0,width:this.width,height:this.height});this.spaces.push(b),this.sorter=d[this.sortDirection]||d.downwardLeftToRight},c.pack=function(a){for(var b=0;b<this.spaces.length;b++){var c=this.spaces[b];if(c.canFit(a)){this.placeInSpace(a,c);break}}},c.columnPack=function(a){for(var b=0;b<this.spaces.length;b++){var c=this.spaces[b],d=c.x<=a.x&&c.x+c.width>=a.x+a.width&&c.height>=a.height-.01;if(d){a.y=c.y,this.placed(a);break}}},c.rowPack=function(a){for(var b=0;b<this.spaces.length;b++){var c=this.spaces[b],d=c.y<=a.y&&c.y+c.height>=a.y+a.height&&c.width>=a.width-.01;if(d){a.x=c.x,this.placed(a);break}}},c.placeInSpace=function(a,b){a.x=b.x,a.y=b.y,this.placed(a)},c.placed=function(a){for(var b=[],c=0;c<this.spaces.length;c++){var d=this.spaces[c],e=d.getMaximalFreeRects(a);
vendor: 8,438 bytes, line 23
23e?b.push.apply(b,e):b.push(d)}this.spaces=b,this.mergeSortSpaces()},c.mergeSortSpaces=function(){b.mergeRects(this.spaces),this.spaces.sort(this.sorter)},c.addSpace=function(a){this.spaces.push(a),this.mergeSortSpaces()},b.mergeRects=function(a){var b=0,c=a[b];a:for(;c;){for(var d=0,e=a[b+d];e;){if(e==c)d++;else{if(e.contains(c)){a.splice(b,1),c=a[b];continue a}c.contains(e)?a.splice(b+d,1):d++}e=a[b+d]}b++,c=a[b]}return a};var d={downwardLeftToRight:function(a,b){return a.y-b.y||a.x-b.x},rightwardTopToBottom:function(a,b){return a.x-b.x||a.y-b.y}};return b}),function(a,b){"function"==typeof define&&define.amd?define("packery/js/item",["outlayer/outlayer","./rect"],b):"object"==typeof module&&module.exports?module.exports=b(require("outlayer"),require("./rect")):a.Packery.Item=b(a.Outlayer,a.Packery.Rect)}(window,function(a,b){var c=document.documentElement.style,d="string"==typeof c.transform?"transform":"WebkitTransform",e=function(){a.Item.apply(this,arguments)},f=e.prototype=Object.create(a.Item.prototype),g=f._create;f._create=function(){g.call(this),this.rect=new b};var h=f.moveTo;return f.moveTo=function(a,b){var c=Math.abs(this.position.x-a),d=Math.abs(this.position.y-b),e=this.layout.dragItemCount&&!this.isPlacing&&!this.isTransitioning&&1>c&&1>d;return e?void this.goTo(a,b):void h.apply(this,arguments)},f.enablePlacing=function(){this.removeTransitionStyles(),this.isTransitioning&&d&&(this.element.style[d]="none"),this.isTransitioning=!1,this.getSize(),this.layout._setRectSize(this.element,this.rect),this.isPlacing=!0},f.disablePlacing=function(){this.isPlacing=!1},f.removeElem=function(){this.element.parentNode.removeChild(this.element),this.layout.packer.addSpace(this.rect),this.emitEvent("remove",[this])},f.showDropPlaceholder=function(){var a=this.dropPlaceholder;a||(a=this.dropPlaceholder=document.createElement("div"),a.className="packery-drop-placeholder",a.style.position="absolute"),a.style.width=this.size.width+"px",a.style.height=this.size.height+"px",this.positionDropPlaceholder(),this.layout.element.appendChild(a)},f.positionDropPlaceholder=function(){this.dropPlaceholder.style[d]="translate("+this.rect.x+"px, "+this.rect.y+"px)"},f.hideDropPlaceholder=function(){this.layout.element.removeChild(this.dropPlaceholder)},e}),function(a,b){"function"==typeof define&&define.amd?define("packery/js/packery",["get-size/get-size","outlayer/outlayer","./rect","./packer","./item"],b):"object"==typeof module&&module.exports?module.exports=b(require("get-size"),require("outlayer"),require("./rect"),require("./packer"),require("./item")):a.Packery=b(a.getSize,a.Outlayer,a.Packery.Rect,a.Packery.Packer,a.Packery.Item)}(window,function(a,b,c,d,e){function f(a,b){return a.position.y-b.position.y||a.position.x-b.position.x}function g(a,b){return a.position.x-b.position.x||a.position.y-b.position.y}function h(a,b){var c=b.x-a.x,d=b.y-a.y;return Math.sqrt(c*c+d*d)}c.prototype.canFit=function(a){return this.width>=a.width-1&&this.height>=a.height-1};var i=b.create("packery");i.Item=e;var j=i.prototype;j._create=function(){b.prototype._create.call(this),this.packer=new d,this.shiftPacker=new d,this.isEnabled=!0,this.dragItemCount=0;var a=this;this.handleDraggabilly={dragStart:function(){a.itemDragStart(this.element)},dragMove:function(){a.itemDragMove(this.element,this.position.x,this.position.y)},dragEnd:function(){a.itemDragEnd(this.element)}},this.handleUIDraggable={start:function(b,c){c&&a.itemDragStart(b.currentTarget)},drag:function(b,c){c&&a.itemDragMove(b.currentTarget,c.position.left,c.position.top)},stop:function(b,c){c&&a.itemDragEnd(b.currentTarget)}}},j._resetLayout=function(){this.getSize(),this._getMeasurements();var a,b,c;this._getOption("horizontal")?(a=1/0,b=this.size.innerHeight+this.gutter,c="rightwardTopToBottom"):(a=this.size.innerWidth+this.gutter,b=1/0,c="downwardLeftToRight"),this.packer.width=this.shiftPacker.width=a,this.packer.height=this.shiftPacker.height=b,this.packer.sortDirection=this.shiftPacker.sortDirection=c,this.packer.reset(),this.maxY=0,this.maxX=0},j._getMeasurements=function(){this._getMeasurement("columnWidth","width"),this._getMeasurement("rowHeight","height"),this._getMeasurement("gutter","width")},j._getItemLayoutPosition=function(a){if(this._setRectSize(a.element,a.rect),this.isShifting||this.dragItemCount>0){var b=this._getPackMethod();this.packer[b](a.rect)}else this.packer.pack(a.rect);return this._setMaxXY(a.rect),a.rect},j.shiftLayout=function(){this.isShifting=!0,this.layout(),delete this.isShifting},j._getPackMethod=function(){return this._getOption("horizontal")?"rowPack":"columnPack"},j._setMaxXY=function(a){this.maxX=Math.max(a.x+a.width,this.maxX),this.maxY=Math.max(a.y+a.height,this.maxY)},j._setRectSize=function(b,c){var d=a(b),e=d.outerWidth,f=d.outerHeight;(e||f)&&(e=this._applyGridGutter(e,this.columnWidth),f=this._applyGridGutter(f,this.rowHeight)),c.width=Math.min(e,this.packer.width),c.height=Math.min(f,this.packer.height)},j._applyGridGutter=function(a,b){if(!b)return a+this.gutter;b+=this.gutter;var c=a%b,d=c&&1>c?"round":"ceil";return a=Math[d](a/b)*b},j._getContainerSize=function(){return this._getOption("horizontal")?{width:this.maxX-this.gutter}:{height:this.maxY-this.gutter}},j._manageStamp=function(a){var b,d=this.getItem(a);if(d&&d.isPlacing)b=d.rect;else{var e=this._getElementOffset(a);b=new c({x:this._getOption("originLeft")?e.left:e.right,y:this._getOption("originTop")?e.top:e.bottom})}this._setRectSize(a,b),this.packer.placed(b),this._setMaxXY(b)},j.sortItemsByPosition=function(){var a=this._getOption("horizontal")?g:f;this.items.sort(a)},j.fit=function(a,b,c){var d=this.getItem(a);d&&(this.stamp(d.element),d.enablePlacing(),this.updateShiftTargets(d),b=void 0===b?d.rect.x:b,c=void 0===c?d.rect.y:c,this.shift(d,b,c),this._bindFitEvents(d),d.moveTo(d.rect.x,d.rect.y),this.shiftLayout(),this.unstamp(d.element),this.sortItemsByPosition(),d.disablePlacing())},j._bindFitEvents=function(a){function b(){d++,2==d&&c.dispatchEvent("fitComplete",null,[a])}var c=this,d=0;a.once("layout",b),this.once("layoutComplete",b)},j.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&(this.options.shiftPercentResize?this.resizeShiftPercentLayout():this.layout())},j.needsResizeLayout=function(){var b=a(this.element),c=this._getOption("horizontal")?"innerHeight":"innerWidth";return b[c]!=this.size[c]},j.resizeShiftPercentLayout=function(){var b=this._getItemsForLayout(this.items),c=this._getOption("horizontal"),d=c?"y":"x",e=c?"height":"width",f=c?"rowHeight":"columnWidth",g=c?"innerHeight":"innerWidth",h=this[f];if(h=h&&h+this.gutter){this._getMeasurements();var i=this[f]+this.gutter;b.forEach(function(a){var b=Math.round(a.rect[d]/h);a.rect[d]=b*i})}else{var j=a(this.element)[g]+this.gutter,k=this.packer[e];b.forEach(function(a){a.rect[d]=a.rect[d]/k*j})}this.shiftLayout()},j.itemDragStart=function(a){if(this.isEnabled){this.stamp(a);var b=this.getItem(a);b&&(b.enablePlacing(),b.showDropPlaceholder(),this.dragItemCount++,this.updateShiftTargets(b))}},j.updateShiftTargets=function(a){this.shiftPacker.reset(),this._getBoundingRect();var b=this._getOption("originLeft"),d=this._getOption("originTop");this.stamps.forEach(function(a){var e=this.getItem(a);if(!e||!e.isPlacing){var f=this._getElementOffset(a),g=new c({x:b?f.left:f.right,y:d?f.top:f.bottom});this._setRectSize(a,g),this.shiftPacker.placed(g)}},this);var e=this._getOption("horizontal"),f=e?"rowHeight":"columnWidth",g=e?"height":"width";this.shiftTargetKeys=[],this.shiftTargets=[];var h,i=this[f];if(i=i&&i+this.gutter){var j=Math.ceil(a.rect[g]/i),k=Math.floor((this.shiftPacker[g]+this.gutter)/i);h=(k-j)*i;for(var l=0;k>l;l++)this._addShiftTarget(l*i,0,h)}else h=this.shiftPacker[g]+this.gutter-a.rect[g],this._addShiftTarget(0,0,h);var m=this._getItemsForLayout(this.items),n=this._getPackMethod();m.forEach(function(a){var b=a.rect;this._setRectSize(a.element,b),this.shiftPacker[n](b),this._addShiftTarget(b.x,b.y,h);var c=e?b.x+b.width:b.x,d=e?b.y:b.y+b.height;if(this._addShiftTarget(c,d,h),i)for(var f=Math.round(b[g]/i),j=1;f>j;j++){var k=e?c:b.x+i*j,l=e?b.y+i*j:d;this._addShiftTarget(k,l,h)}},this)},j._addShiftTarget=function(a,b,c){var d=this._getOption("horizontal")?b:a;if(!(0!==d&&d>c)){var e=a+","+b,f=-1!=this.shiftTargetKeys.indexOf(e);f||(this.shiftTargetKeys.push(e),this.shiftTargets.push({x:a,y:b}))}},j.shift=function(a,b,c){var d,e=1/0,f={x:b,y:c};
23this.shiftTargets.forEach(function(a){var b=h(a,f);e>b&&(d=a,e=b)}),a.rect.x=d.x,a.rect.y=d.y};var k=120;j.itemDragMove=function(a,b,c){function d(){f.shift(e,b,c),e.positionDropPlaceholder(),f.layout()}var e=this.isEnabled&&this.getItem(a);if(e){b-=this.size.paddingLeft,c-=this.size.paddingTop;var f=this,g=new Date;this._itemDragTime&&g-this._itemDragTime<k?(clearTimeout(this.dragTimeout),this.dragTimeout=setTimeout(d,k)):(d(),this._itemDragTime=g)}},j.itemDragEnd=function(a){function b(){d++,2==d&&(c.element.classList.remove("is-positioning-post-drag"),c.hideDropPlaceholder(),e.dispatchEvent("dragItemPositioned",null,[c]))}var c=this.isEnabled&&this.getItem(a);if(c){clearTimeout(this.dragTimeout),c.element.classList.add("is-positioning-post-drag");var d=0,e=this;c.once("layout",b),this.once("layoutComplete",b),c.moveTo(c.rect.x,c.rect.y),this.layout(),this.dragItemCount=Math.max(0,this.dragItemCount-1),this.sortItemsByPosition(),c.disablePlacing(),this.unstamp(c.element)}},j.bindDraggabillyEvents=function(a){this._bindDraggabillyEvents(a,"on")},j.unbindDraggabillyEvents=function(a){this._bindDraggabillyEvents(a,"off")},j._bindDraggabillyEvents=function(a,b){var c=this.handleDraggabilly;a[b]("dragStart",c.dragStart),a[b]("dragMove",c.dragMove),a[b]("dragEnd",c.dragEnd)},j.bindUIDraggableEvents=function(a){this._bindUIDraggableEvents(a,"on")},j.unbindUIDraggableEvents=function(a){this._bindUIDraggableEvents(a,"off")},j._bindUIDraggableEvents=function(a,b){var c=this.handleUIDraggable;a[b]("dragstart",c.start)[b]("drag",c.drag)[b]("dragstop",c.stop)};var l=j.destroy;return j.destroy=function(){l.apply(this,arguments),this.isEnabled=!1},i.Rect=c,i.Packer=d,i}),function(a,b){"function"==typeof define&&define.amd?define(["isotope-layout/js/layout-mode","packery/js/packery"],b):"object"==typeof module&&module.exports?module.exports=b(require("isotope-layout/js/layout-mode"),require("packery")):b(a.Smashotope.LayoutMode,a.Packery)}(window,function(a,b){var c=a.create("packery"),d=c.prototype,e={_getElementOffset:!0,_getMeasurement:!0};for(var f in b.prototype)e[f]||(d[f]=b.prototype[f]);var g=d._resetLayout;d._resetLayout=function(){this.packer=this.packer||new b.Packer,this.shiftPacker=this.shiftPacker||new b.Packer,g.apply(this,arguments)};var h=d._getItemLayoutPosition;d._getItemLayoutPosition=function(a){return a.rect=a.rect||new b.Rect,h.call(this,a)};var i=d.needsResizeLayout;d.needsResizeLayout=function(){return this._getOption("horizontal")?this.needsVerticalResizeLayout():i.call(this)};var j=d._getOption;return d._getOption=function(a){return"horizontal"==a?void 0!==this.options.isHorizontal?this.options.isHorizontal:this.options.horizontal:j.apply(this.smashotope,arguments)},c}); 24 25 // Two Row Carousel 26 ;(function ($, window, document, undefined) { 27 Owl2row = function (scope) { 28 this.owl = scope; 29 this.owl.options = $.extend({}, Owl2row.Defaults, this.owl.options); 30 //link callback events with owl carousel here 31 32 this.handlers = { 33 'initialize.owl.carousel': $.proxy(function (e) { 34 if (this.owl.settings.owl2row) { 35 this.build2row(this); 36 } 37 }, this) 38 }; 39 40 this.owl.$element.on(this.handlers); 41 }; 42 43 Owl2row.Defaults = { 44 owl2row: false, 45 owl2rowTarget: 'sbi_item', 46 owl2rowContainer: 'sbi_owl2row-item', 47 owl2rowDirection: 'utd' // ltr 48 }; 49 50 //mehtods: 51 Owl2row.prototype.build2row = function(thisScope){ 52 53 var carousel = $(thisScope.owl.$element); 54 var carouselItems = carousel.find('.' + thisScope.owl.options.owl2rowTarget); 55 56 var aEvenElements = []; 57 var aOddElements = []; 58 59 $.each(carouselItems, function (index, item) { 60 if ( index % 2 === 0 ) { 61 aEvenElements.push(item); 62 } else { 63 aOddElements.push(item); 64 } 65 }); 66 67 //carousel.empty(); 68 69 switch (thisScope.owl.options.owl2rowDirection) { 70 case 'ltr': 71 thisScope.leftToright(thisScope, carousel, carouselItems); 72 break; 73 74 default : 75 thisScope.upTodown(thisScope, aEvenElements, aOddElements, carousel); 76 } 77 78 }; 79 80 Owl2row.prototype.leftToright = function(thisScope, carousel, carouselItems){ 81 82 var o2wContainerClass = thisScope.owl.options.owl2rowContainer; 83 var owlMargin = thisScope.owl.options.margin; 84 var carouselItemsLength = carouselItems.length; 85 var firsArr = []; 86 var secondArr = []; 87 88 if (carouselItemsLength %2 === 1) { 89 carouselItemsLength = ((carouselItemsLength - 1)/2) + 1; 90 } else { 91 carouselItemsLength = carouselItemsLength/2; 92 } 93 94 $.each(carouselItems, function (index, item) { 95 96 97 if (index < carouselItemsLength) { 98 firsArr.push(item); 99 } else { 100 secondArr.push(item); 101 } 102 }); 103 104 $.each(firsArr, function (index, item) {
105 var rowContainer = $('<div class="' + o2wContainerClass + '"/>'); 106 107 var firstRowElement = firsArr[index]; 108 firstRowElement.style.marginBottom = owlMargin + 'px'; 109 110 rowContainer 111 .append(firstRowElement) 112 .append(secondArr[index]); 113 114 carousel.append(rowContainer); 115 }); 116 117 }; 118 119 Owl2row.prototype.upTodown = function(thisScope, aEvenElements, aOddElements, carousel){ 120 121 var o2wContainerClass = thisScope.owl.options.owl2rowContainer; 122 var owlMargin = thisScope.owl.options.margin; 123 124 $.each(aEvenElements, function (index, item) { 125 126 var rowContainer = $('<div class="' + o2wContainerClass + '"/>'); 127 var evenElement = aEvenElements[index]; 128 129 evenElement.style.marginBottom = owlMargin + 'px'; 130 131 rowContainer 132 .append(evenElement) 133 .append(aOddElements[index]); 134 135 carousel.append(rowContainer); 136 }); 137 }; 138 139 /** 140 * Destroys the plugin. 141 */ 142 Owl2row.prototype.destroy = function() { 143 var handler, property; 144 }; 145 146 $.fn.sbiOwlCarousel.Constructor.Plugins['owl2row'] = Owl2row; 147 })( window.Zepto || window.jQuery, window, document ); 148 149 /* JavaScript Linkify - v0.3 - 6/27/2009 - http://benalman.com/projects/javascript-linkify/ */ 150 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!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)+",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" rel="noopener">'+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}})(); 151 152 //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 153 (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}}})() 154 155 //IE8 also doesn't offer the .bind() method triggered by the 'sortBy' property. Copy and paste the polyfill offered here:
vendor: 24,084 bytes, lines 156-237
156 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}} 157 158 /*! Hammer.JS - v2.0.8 - 2016-04-23 159 * http://hammerjs.github.io/ 160 * 161 * Copyright (c) 2016 Jorik Tangelder; 162 * Licensed under the MIT license 163 * */ 164 if (typeof sb_instagram_js_options.no_mob_swipe === 'undefined') { 165 !function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(j(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function h(b,c,d){var e="DEPRECATED METHOD: "+c+"\n"+d+" AT \n";return function(){var c=new Error("get-stack-trace"),d=c&&c.stack?c.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=a.console&&(a.console.warn||a.console.log);return f&&f.call(a.console,e,d),b.apply(this,arguments)}}function i(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&la(d,c)}function j(a,b){return function(){return a.apply(b,arguments)}}function k(a,b){return typeof a==oa?a.apply(b?b[0]||d:d,b):a}function l(a,b){return a===d?b:a}function m(a,b,c){g(q(b),function(b){a.addEventListener(b,c,!1)})}function n(a,b,c){g(q(b),function(b){a.removeEventListener(b,c,!1)})}function o(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function p(a,b){return a.indexOf(b)>-1}function q(a){return a.trim().split(/\s+/g)}function r(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function s(a){return Array.prototype.slice.call(a,0)}function t(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];r(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function u(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g<ma.length;){if(c=ma[g],e=c?c+f:b,e in a)return e;g++}return d}function v(){return ua++}function w(b){var c=b.ownerDocument||b;return c.defaultView||c.parentWindow||a}function x(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){k(a.options.enable,[a])&&c.handler(b)},this.init()}function y(a){var b,c=a.options.inputClass;return new(b=c?c:xa?M:ya?P:wa?R:L)(a,z)}function z(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&Ea&&d-e===0,g=b&(Ga|Ha)&&d-e===0;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,A(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function A(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=D(b)),e>1&&!c.firstMultiple?c.firstMultiple=D(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=E(d);b.timeStamp=ra(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=I(h,i),b.distance=H(h,i),B(c,b),b.offsetDirection=G(b.deltaX,b.deltaY);var j=F(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=qa(j.x)>qa(j.y)?j.x:j.y,b.scale=g?K(g.pointers,d):1,b.rotation=g?J(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,C(c,b);var k=a.element;o(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function B(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};b.eventType!==Ea&&f.eventType!==Ga||(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function C(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Ha&&(i>Da||h.velocity===d)){var j=b.deltaX-h.deltaX,k=b.deltaY-h.deltaY,l=F(i,j,k);e=l.x,f=l.y,c=qa(l.x)>qa(l.y)?l.x:l.y,g=G(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function D(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:pa(a.pointers[c].clientX),clientY:pa(a.pointers[c].clientY)},c++;return{timeStamp:ra(),pointers:b,center:E(b),deltaX:a.deltaX,deltaY:a.deltaY}}function E(a){var b=a.length;if(1===b)return{x:pa(a[0].clientX),y:pa(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:pa(c/b),y:pa(d/b)}}function F(a,b,c){return{x:b/a||0,y:c/a||0}}function G(a,b){return a===b?Ia:qa(a)>=qa(b)?0>a?Ja:Ka:0>b?La:Ma}function H(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function I(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function J(a,b){return I(b[1],b[0],Ra)+I(a[1],a[0],Ra)}function K(a,b){return H(b[0],b[1],Ra)/H(a[0],a[1],Ra)}function L(){this.evEl=Ta,this.evWin=Ua,this.pressed=!1,x.apply(this,arguments)}function M(){this.evEl=Xa,this.evWin=Ya,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=$a,this.evWin=_a,this.started=!1,x.apply(this,arguments)}function O(a,b){var c=s(a.touches),d=s(a.changedTouches);return b&(Ga|Ha)&&(c=t(c.concat(d),"identifier",!0)),[c,d]}function P(){this.evTarget=bb,this.targetIds={},x.apply(this,arguments)}function Q(a,b){var c=s(a.touches),d=this.targetIds;if(b&(Ea|Fa)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=s(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return o(a.target,i)}),b===Ea)for(e=0;e<f.length;)d[f[e].identifier]=!0,e++;for(e=0;e<g.length;)d[g[e].identifier]&&h.push(g[e]),b&(Ga|Ha)&&delete d[g[e].identifier],e++;return h.length?[t(f.concat(h),"identifier",!0),h]:void 0}function R(){x.apply(this,arguments);var a=j(this.handler,this);this.touch=new P(this.manager,a),this.mouse=new L(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}function S(a,b){a&Ea?(this.primaryTouch=b.changedPointers[0].identifier,T.call(this,b)):a&(Ga|Ha)&&T.call(this,b)}function T(a){var b=a.changedPointers[0];if(b.identifier===this.primaryTouch){var c={x:b.clientX,y:b.clientY};this.lastTouches.push(c);var d=this.lastTouches,e=function(){var a=d.indexOf(c);a>-1&&d.splice(a,1)};setTimeout(e,cb)}}function U(a){for(var b=a.srcEvent.clientX,c=a.srcEvent.clientY,d=0;d<this.lastTouches.length;d++){var e=this.lastTouches[d],f=Math.abs(b-e.x),g=Math.abs(c-e.y);if(db>=f&&db>=g)return!0}return!1}function V(a,b){this.manager=a,this.set(b)}function W(a){if(p(a,jb))return jb;var b=p(a,kb),c=p(a,lb);return b&&c?jb:b||c?b?kb:lb:p(a,ib)?ib:hb}function X(){if(!fb)return!1;var b={},c=a.CSS&&a.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(d){b[d]=c?a.CSS.supports("touch-action",d):!0}),b}function Y(a){this.options=la({},this.defaults,a||{}),this.id=v(),this.manager=null,this.options.enable=l(this.options.enable,!0),this.state=nb,this.simultaneous={},this.requireFail=[]}function Z(a){return a&sb?"cancel":a&qb?"end":a&pb?"move":a&ob?"start":""}function $(a){return a==Ma?"down":a==La?"up":a==Ja?"left":a==Ka?"right":""}function _(a,b){var c=b.manager;return c?c.get(a):a}function aa(){Y.apply(this,arguments)}function ba(){aa.apply(this,arguments),this.pX=null,this.pY=null}function ca(){aa.apply(this,arguments)}function da(){Y.apply(this,arguments),this._timer=null,this._input=null}function ea(){aa.apply(this,arguments)}function fa(){aa.apply(this,arguments)}function ga(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ha(a,b){return b=b||{},b.recognizers=l(b.recognizers,ha.defaults.preset),new ia(a,b)}function ia(a,b){this.options=la({},ha.defaults,b||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=y(this),this.touchAction=new V(this,this.options.touchAction),ja(this,!0),g(this.options.recognizers,function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])},this)}function ja(a,b){var c=a.element;if(c.style){var d;g(a.options.cssProps,function(e,f){d=u(c.style,f),b?(a.oldCssProps[d]=c.style[d],c.style[d]=e):c.style[d]=a.oldCssProps[d]||""}),b||(a.oldCssProps={})}}function ka(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var la,ma=["","webkit","Moz","MS","ms","o"],na=b.createElement("div"),oa="function",pa=Math.round,qa=Math.abs,ra=Date.now;la="function"!=typeof Object.assign?function(a){if(a===d||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c<arguments.length;c++){var e=arguments[c];if(e!==d&&null!==e)for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b}:Object.assign;var sa=h(function(a,b,c){for(var e=Object.keys(b),f=0;f<e.length;)(!c||c&&a[e[f]]===d)&&(a[e[f]]=b[e[f]]),f++;return a},"extend","Use `assign`."),ta=h(function(a,b){return sa(a,b,!0)},"merge","Use `assign`."),ua=1,va=/mobile|tablet|ip(ad|hone|od)|android/i,wa="ontouchstart"in a,xa=u(a,"PointerEvent")!==d,ya=wa&&va.test(navigator.userAgent),za="touch",Aa="pen",Ba="mouse",Ca="kinect",Da=25,Ea=1,Fa=2,Ga=4,Ha=8,Ia=1,Ja=2,Ka=4,La=8,Ma=16,Na=Ja|Ka,Oa=La|Ma,Pa=Na|Oa,Qa=["x","y"],Ra=["clientX","clientY"];x.prototype={handler:function(){},init:function(){this.evEl&&m(this.element,this.evEl,this.domHandler),this.evTarget&&m(this.target,this.evTarget,this.domHandler),this.evWin&&m(w(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&n(this.element,this.evEl,this.domHandler),this.evTarget&&n(this.target,this.evTarget,this.domHandler),this.evWin&&n(w(this.element),this.evWin,this.domHandler)}};var Sa={mousedown:Ea,mousemove:Fa,mouseup:Ga},Ta="mousedown",Ua="mousemove mouseup";i(L,x,{handler:function(a){var b=Sa[a.type];b&Ea&&0===a.button&&(this.pressed=!0),b&Fa&&1!==a.which&&(b=Ga),this.pressed&&(b&Ga&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:Ba,srcEvent:a}))}});var Va={pointerdown:Ea,pointermove:Fa,pointerup:Ga,pointercancel:Ha,pointerout:Ha},Wa={2:za,3:Aa,4:Ba,5:Ca},Xa="pointerdown",Ya="pointermove pointerup pointercancel";a.MSPointerEvent&&!a.PointerEvent&&(Xa="MSPointerDown",Ya="MSPointerMove MSPointerUp MSPointerCancel"),i(M,x,{handler:function(a){var b=this.store,c=!1,d=a.type.toLowerCase().replace("ms",""),e=Va[d],f=Wa[a.pointerType]||a.pointerType,g=f==za,h=r(b,a.pointerId,"pointerId");e&Ea&&(0===a.button||g)?0>h&&(b.push(a),h=b.length-1):e&(Ga|Ha)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Za={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},$a="touchstart",_a="touchstart touchmove touchend touchcancel";i(N,x,{handler:function(a){var b=Za[a.type];if(b===Ea&&(this.started=!0),this.started){var c=O.call(this,a,b);b&(Ga|Ha)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}}});var ab={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},bb="touchstart touchmove touchend touchcancel";i(P,x,{handler:function(a){var b=ab[a.type],c=Q.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}});var cb=2500,db=25;i(R,x,{handler:function(a,b,c){var d=c.pointerType==za,e=c.pointerType==Ba;if(!(e&&c.sourceCapabilities&&c.sourceCapabilities.firesTouchEvents)){if(d)S.call(this,b,c);else if(e&&U.call(this,c))return;this.callback(a,b,c)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var eb=u(na.style,"touchAction"),fb=eb!==d,gb="compute",hb="auto",ib="manipulation",jb="none",kb="pan-x",lb="pan-y",mb=X();V.prototype={set:function(a){a==gb&&(a=this.compute()),fb&&this.manager.element.style&&mb[a]&&(this.manager.element.style[eb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){k(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),W(a.join(" "))},preventDefaults:function(a){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=p(d,jb)&&!mb[jb],f=p(d,lb)&&!mb[lb],g=p(d,kb)&&!mb[kb];if(e){var h=1===a.pointers.length,i=a.distance<2,j=a.deltaTime<250;if(h&&i&&j)return}return g&&f?void 0:e||f&&c&Na||g&&c&Oa?this.preventSrc(b):void 0},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var nb=1,ob=2,pb=4,qb=8,rb=qb,sb=16,tb=32;Y.prototype={defaults:{},set:function(a){return la(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=_(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=_(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=_(a,this),-1===r(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=_(a,this);var b=r(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(b,a)}var c=this,d=this.state;qb>d&&b(c.options.event+Z(d)),b(c.options.event),a.additionalEvent&&b(a.additionalEvent),d>=qb&&b(c.options.event+Z(d))},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=tb)},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(tb|nb)))return!1;a++}return!0},recognize:function(a){var b=la({},a);return k(this.options.enable,[this,b])?(this.state&(rb|sb|tb)&&(this.state=nb),this.state=this.process(b),void(this.state&(ob|pb|qb|sb)&&this.tryEmit(b))):(this.reset(),void(this.state=tb))},process:function(a){},getTouchAction:function(){},reset:function(){}},i(aa,Y,{defaults:{pointers:1},attrTest:function(a){var b=this.options.pointers;return 0===b||a.pointers.length===b},process:function(a){var b=this.state,c=a.eventType,d=b&(ob|pb),e=this.attrTest(a);return d&&(c&Ha||!e)?b|sb:d||e?c&Ga?b|qb:b&ob?b|pb:ob:tb}}),i(ba,aa,{defaults:{event:"pan",threshold:10,pointers:1,direction:Pa},getTouchAction:function(){var a=this.options.direction,b=[];return a&Na&&b.push(lb),a&Oa&&b.push(kb),b},directionTest:function(a){var b=this.options,c=!0,d=a.distance,e=a.direction,f=a.deltaX,g=a.deltaY;return e&b.direction||(b.direction&Na?(e=0===f?Ia:0>f?Ja:Ka,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Ia:0>g?La:Ma,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return aa.prototype.attrTest.call(this,a)&&(this.state&ob||!(this.state&ob)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=$(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),i(ca,aa,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&ob)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),i(da,Y,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[hb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime>b.time;if(this._input=a,!d||!c||a.eventType&(Ga|Ha)&&!f)this.reset();else if(a.eventType&Ea)this.reset(),this._timer=e(function(){this.state=rb,this.tryEmit()},b.time,this);else if(a.eventType&Ga)return rb;return tb},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===rb&&(a&&a.eventType&Ga?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=ra(),this.manager.emit(this.options.event,this._input)))}}),i(ea,aa,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&ob)}}),i(fa,aa,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Na|Oa,pointers:1},getTouchAction:function(){return ba.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Na|Oa)?b=a.overallVelocity:c&Na?b=a.overallVelocityX:c&Oa&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&qa(b)>this.options.velocity&&a.eventType&Ga},emit:function(a){var b=$(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),i(ga,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ib]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime<b.time;if(this.reset(),a.eventType&Ea&&0===this.count)return this.failTimeout();if(d&&f&&c){if(a.eventType!=Ga)return this.failTimeout();var g=this.pTime?a.timeStamp-this.pTime<b.interval:!0,h=!this.pCenter||H(this.pCenter,a.center)<b.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,h&&g?this.count+=1:this.count=1,this._input=a;var i=this.count%b.taps;if(0===i)return this.hasRequireFailures()?(this._timer=e(function(){this.state=rb,this.tryEmit()},b.interval,this),ob):rb}return tb},failTimeout:function(){return this._timer=e(function(){this.state=tb},this.options.interval,this),tb},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==rb&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ha.VERSION="2.0.8",ha.defaults={domEvents:!1,touchAction:gb,enable:!0,inputTarget:null,inputClass:null,preset:[[ea,{enable:!1}],[ca,{enable:!1},["rotate"]],[fa,{direction:Na}],[ba,{direction:Na},["swipe"]],[ga],[ga,{event:"doubletap",taps:2},["tap"]],[da]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var ub=1,vb=2;ia.prototype={set:function(a){return la(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?vb:ub},recognize:function(a){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(a);var c,d=this.recognizers,e=b.curRecognizer;(!e||e&&e.state&rb)&&(e=b.curRecognizer=null);for(var f=0;f<d.length;)c=d[f],b.stopped===vb||e&&c!=e&&!c.canRecognizeWith(e)?c.reset():c.recognize(a),!e&&c.state&(ob|pb|qb)&&(e=b.curRecognizer=c),f++}},get:function(a){if(a instanceof Y)return a;for(var b=this.recognizers,c=0;c<b.length;c++)if(b[c].options.event==a)return b[c];return null},add:function(a){if(f(a,"add",this))return this;var b=this.get(a.options.event);return b&&this.remove(b),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(f(a,"remove",this))return this;if(a=this.get(a)){var b=this.recognizers,c=r(b,a);-1!==c&&(b.splice(c,1),this.touchAction.update())}return this},on:function(a,b){if(a!==d&&b!==d){var c=this.handlers;return g(q(a),function(a){c[a]=c[a]||[],c[a].push(b)}),this}},off:function(a,b){if(a!==d){var c=this.handlers;return g(q(a),function(a){b?c[a]&&c[a].splice(r(c[a],b),1):delete c[a]}),this}},emit:function(a,b){this.options.domEvents&&ka(a,b);var c=this.handlers[a]&&this.handlers[a].slice();if(c&&c.length){b.type=a,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var d=0;d<c.length;)c[d](b),d++}},destroy:function(){this.element&&ja(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},la(ha,{INPUT_START:Ea,INPUT_MOVE:Fa,INPUT_END:Ga,INPUT_CANCEL:Ha,STATE_POSSIBLE:nb,STATE_BEGAN:ob,STATE_CHANGED:pb,STATE_ENDED:qb,STATE_RECOGNIZED:rb,STATE_CANCELLED:sb,STATE_FAILED:tb,DIRECTION_NONE:Ia,DIRECTION_LEFT:Ja,DIRECTION_RIGHT:Ka,DIRECTION_UP:La,DIRECTION_DOWN:Ma,DIRECTION_HORIZONTAL:Na,DIRECTION_VERTICAL:Oa,DIRECTION_ALL:Pa,Manager:ia,Input:x,TouchAction:V,TouchInput:P,MouseInput:L,PointerEventInput:M,TouchMouseInput:R,SingleTouchInput:N,Recognizer:Y,AttrRecognizer:aa,Tap:ga,Pan:ba,Swipe:fa,Pinch:ca,Rotate:ea,Press:da,on:m,off:n,each:g,merge:ta,extend:sa,assign:la,inherit:i,bindFn:j,prefixed:u});var wb="undefined"!=typeof a?a:"undefined"!=typeof self?self:{};wb.Hammer=ha,"function"==typeof define&&define.amd?define(function(){return ha}):"undefined"!=typeof module&&module.exports?module.exports=ha:a[c]=ha}(window,document,"Hammer"); 166 (function(factory) { 167 if (typeof define === 'function' && define.amd) { 168 define(['jquery', 'hammerjs'], factory); 169 } else if (typeof exports === 'object') { 170 factory(require('jquery'), require('hammerjs')); 171 } else { 172 factory(jQuery, Hammer); 173 } 174 }(function(jQuery, Hammer) { 175 function hammerify(el, options) { 176 var $el = jQuery(el); 177 if(!$el.data("hammer")) { 178 $el.data("hammer", new Hammer($el[0], options)); 179 } 180 } 181 182 jQuery.fn.hammer = function(options) { 183 return this.each(function() { 184 hammerify(this, options); 185 }); 186 }; 187 188 // extend the emit method to also trigger jQuery events 189 Hammer.Manager.prototype.emit = (function(originalEmit) { 190 return function(type, data) { 191 originalEmit.call(this, type, data); 192 jQuery(this.element).trigger({ 193 type: type, 194 gesture: data 195 }); 196 }; 197 })(Hammer.Manager.prototype.emit); 198 })); 199 200 } else { 201 var Hammer = { 202 Manager : { 203 prototype : { 204 } 205 } 206 }; 207 (function(factory) { 208 if (typeof define === 'function' && define.amd) { 209 define(['jquery', 'hammerjs'], factory); 210 } else if (typeof exports === 'object') { 211 factory(require('jquery'), require('hammerjs')); 212 } else { 213 factory(jQuery, Hammer); 214 } 215 }(function(jQuery, Hammer) { 216 function hammerify(el, options) { 217 } 218 jQuery.fn.hammer = function(options) { 219 return this.each(function() { 220 hammerify(this, options); 221 }); 222 }; 223 // extend the emit method to also trigger jQuery events 224 Hammer.Manager.prototype.emit = (function(originalEmit) { 225 return function(type, data) { 226 originalEmit.call(this, type, data); 227 jQuery(this.element).trigger({ 228 type: type, 229 gesture: data 230 }); 231 }; 232 })(Hammer.Manager.prototype.emit); 233 })); 234 } 235 /* Font Awesome SVG implementation */ 236 var sbIconSVG = { 237 '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="https://www.w3.org/2000/svg" viewBox="0 0 512 512">
237<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>', 238 '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="https://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>', 239 '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="https://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>', 240 '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="https://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>', 241 '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="https://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>', 242 '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="https://www.w3.org/2000/svg" viewBox="0 0 576 512"><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>', 243 '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="https://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>', 244 '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="https://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>',
245 '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="https://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>', 246 '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="https://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>', 247 '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="https://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>', 248 '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="https://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>', 249 '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="https://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>', 250 '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="https://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>', 251 '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="https://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>', 252 '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="https://www.w3.org/2000/svg" viewBox="0 0 576 512">
252<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>', 253 '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="https://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>', 254 '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="https://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>', 255 '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="https://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>', 256 '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="https://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>', 257 '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="https://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>', 258 '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="https://www.w3.org/2000/svg" viewBox="0 0 496 512">
258<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>', 259 '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="https://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>', 260 '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="https://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>', 261 '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="https://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>', 262 '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="https://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>', 263 '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="https://www.w3.org/2000/svg" viewBox="0 0 512 512">
263<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>', 264 'fa-times' : 'class="svg-inline--fa fa-times fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fas" data-icon="times" role="img" xmlns="https://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" class=""></path></svg>' 265 }; 266 267 function sbEncodeHTML(raw) { 268 // make sure passed variable is defined 269 if (typeof raw === 'undefined') { 270 return ''; 271 } 272 // replace greater than and less than symbols with html entity to disallow html in comments 273 var encoded = raw.replace(/(>)/g,'>'), 274 encoded = encoded.replace(/(<)/g,'<'); 275 encoded = encoded.replace(/(<br\/>)/g,'<br>'); 276 encoded = encoded.replace(/(<br>)/g,'<br>'); 277 278 return encoded; 279 } 280 281 function sbSVGify(elem) { 282 if (sb_instagram_js_options.font_method != 'fontfile') { 283 284 if (typeof elem === 'undefined') { 285 elem = jQuery('.sbi'); 286 } 287 288 // loop through each matched html element based on the passed context 289 elem.each(function() { 290 jQuery(this).find('i.fa').each(function() { 291 // preserve any classes or styles attached to icons 292 var faClass = jQuery(this).attr('class').match(/fa-[a-z-]+/), 293 styles = jQuery(this).attr('style'); 294 if (faClass && typeof sbIconSVG[faClass[0]] !== 'undefined') { 295 var theStyle = typeof styles !== 'undefined' ? 'style="'+styles+'" ' : ''; 296 jQuery(this).replaceWith('<svg '+theStyle+sbIconSVG[faClass[0]]); 297 } else { 298 console.log(faClass,'missing'); 299 } 300 }) 301 }); 302 } 303 } 304 305 // add links to page 306 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}} 307 function addLinksToPage(s) { 308 if ( (s.match(/\./g) || []).length === 2) { 309 return s; 310 } 311 var a = s.split('.'), 312 b = a[0], 313 c = addLinks.handles(a[1]), 314 d = addLinks.handles(a[2]+a[3]); 315 316 return b+'.'+c+'.'+d; 317 } 318 319 /* Lightbox v2.7.1 by Lokesh Dhakar - https://lokeshdhakar.com/projects/lightbox2/ - Heavily modified specifically for this plugin */ 320 (function() { 321 var a = jQuery, 322 b = function() { 323 function a() { 324 this.fadeDuration = 400, this.fitImagesInViewport = !0, this.resizeDuration = 400, this.positionFromTop = 50, this.showImageNumberLabel = !0, this.alwaysShowNavOnTouchDevices = !1, this.wrapAround = !1 325 } 326 return a.prototype.albumLabel = function(a, b) { 327 return a + " / " + b 328 }, a 329 }(), 330 c = function() { 331 function b(a) { 332 this.options = a, this.album = [], this.currentImageIndex = void 0, this.init() 333 } 334 return b.prototype.init = function() { 335 this.enable(), this.build() 336 }, b.prototype.enable = function() { 337 var b = this; 338 a("body").on("click", "a[data-lightbox-sbi]", function(c) { 339 return b.start(a(c.currentTarget)), !1 340 }) 341 }, b.prototype.build = function() { 342 var b = this, 343 sbLbCarouselDestroy = function() { 344 jQuery('#sbi_lightbox .sbi_lb_lightbox-image').remove(); 345 if (jQuery('#sbi_lightbox .sbi_lb-image-wrap').length) { 346 jQuery('#sbi_lightbox .sbi_lb-image-wrap').sbiOwlCarousel('destroy'); 347 jQuery('#sbi_lightbox .sbi-owl-item').remove(); 348 } 349 jQuery('#sbi_lightbox').find('video').remove();
350 jQuery('.sbi_lb-container').prepend("<video class='sbi_video' src='' poster='' controls></video>"); 351 }; 352 a("<div id='sbi_lightboxOverlay' class='sbi_lightboxOverlay'></div>" + 353 "<div id='sbi_lightbox' class='sbi_lightbox'>" + 354 "<div class='sbi_lb-outerContainer'>" + 355 "<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>" + 356 "<div class='sbi_lb-container-wrapper'>" + 357 "<div class='sbi_lb-container'>" + 358 "<div class='sbi_lb-image-wrap-outer'>" + 359 "<div class='sbi_lb-image-wrap'>" + 360 "<img class='sbi_lb-image' src='' alt='Lightbox image placeholder'/>" + 361 "</div>" + 362 "</div>" + 363 "<div class='sbi_lb-loader'><i class='fa fa-spin'></i></div>" + 364 "</div>" + 365 "<div class='sbi_lb-dataContainer'>" + 366 "<div class='sbi_lb-data'>" + 367 "<div class='sbi_lb-details'>" + 368 "<span class='sbi_lb-caption'></span>" + 369 "<span class='sbi_lb-number'></span>" + 370 "<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' rel='noopener' id='sbi_facebook_icon'><span class='sbi-screenreader'>Facebook</span><i class='fa fa-facebook-square'></i></a><a href='' target='_blank' rel='noopener' id='sbi_twitter_icon'><span class='sbi-screenreader'>Twitter</span><i class='fa fa-twitter'></i></a><a href='' target='_blank' rel='noopener' id='sbi_google_icon'><span class='sbi-screenreader'>Google Plus</span><i class='fa fa-google-plus'></i></a><a href='' target='_blank' rel='noopener' 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' rel='noopener'><span class='sbi-screenreader'>Pinterest</span><i class='fa fa-pinterest'></i></a><a href='' id='sbi_email_icon' target='_blank' rel='noopener'><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' rel='noopener'><i class='fa fa-instagram'></i>Instagram</a></div>" + 371 "<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 ID to the <strong>Hide Specific 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() { 372 return b.end(), !1 373 }), jQuery(document).on('click', function(event, b, c) { 374 //Fade out the lightbox if click anywhere outside of the two elements defined below 375 if (!jQuery(event.target).closest('.sbi_lb-outerContainer').length) { 376 if (!jQuery(event.target).closest('.sbi_lb
376-dataContainer').length) { 377 //Fade out lightbox 378 jQuery('#sbi_lightboxOverlay, #sbi_lightbox').fadeOut(); 379 //Pause video 380 if( sbi_supports_video() && jQuery('#sbi_lightbox video.sbi_video').length ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 381 // easiest to destroy carousel and build a new one 382 sbLbCarouselDestroy(); 383 } 384 } 385 }), this.$lightbox.hide(), 386 jQuery('#sbi_lightboxOverlay').on("click", function(c) { 387 sbLbCarouselDestroy(); 388 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 389 return "sbi_lightbox" === a(c.target).attr("id") && b.end(), !1 390 }), this.$lightbox.find(".sbi_lb-prev").on("click", function() { 391 sbLbCarouselDestroy(); 392 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 393 return b.changeImage(0 === b.currentImageIndex ? b.album.length - 1 : b.currentImageIndex - 1), !1 394 }), this.$lightbox.find(".sbi_lb-container").hammer().on("swiperight", function() { 395 sbLbCarouselDestroy(); 396 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 397 return b.changeImage(0 === b.currentImageIndex ? b.album.length - 1 : b.currentImageIndex - 1), !1 398 }), this.$lightbox.find(".sbi_lb-next").on("click", function() { 399 sbLbCarouselDestroy(); 400 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 401 return b.changeImage(b.currentImageIndex === b.album.length - 1 ? 0 : b.currentImageIndex + 1), !1 402 }), this.$lightbox.find(".sbi_lb-container").hammer().on("swipeleft", function() { 403 sbLbCarouselDestroy(); 404 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 405 return b.changeImage(b.currentImageIndex === b.album.length - 1 ? 0 : b.currentImageIndex + 1), !1 406 }), this.$lightbox.find(".sbi_lb-loader, .sbi_lb-close").on("click", function() { 407 sbLbCarouselDestroy(); 408 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 409 return b.end(), !1 410 }) 411 }, b.prototype.start = function(b) { 412 function c(a) { 413 414 //Get the options for this feed 415 var sbiFeedOptions = a.closest('.sbi').attr('data-options'); 416 sbiFeedOptions = jQuery.parseJSON(sbiFeedOptions); 417 418 var carouselData = -1; 419 if(a.attr("data-carousel").length > 1) carouselData = jQuery.parseJSON(a.attr("data-carousel")); 420 if (!carouselData) { 421 carouselData = {}; 422 } 423 424 d.album.push({ 425 link: a.attr("href"), 426 title: a.attr("data-title") || a.attr("title"), 427 video: a.attr("data-video"), 428 id: a.attr("data-id"), 429 url: a.attr("data-url"), 430 user: a.attr("data-user"), 431 avatar: a.attr("data-avatar"), 432 accounttype: a.attr("data-account-type"), 433 lightboxcomments: sbiFeedOptions.lightboxcomments, 434 numcomments: sbiFeedOptions.numcomments, 435 carousel: carouselData, 436 feedID: sbiFeedOptions.feedID, 437 mid: sbiFeedOptions.mid, 438 callback: sbiFeedOptions.callback, 439 type: sbiFeedOptions.type 440 }); 441 442 } 443 var d = this, 444 e = a(window); 445 e.on("resize", a.proxy(this.sizeOverlay, this)), a("select, object, embed").css({ 446 visibility: "hidden" 447 }), this.sizeOverlay(), this.album = []; 448 var f, g = 0, 449 h = b.attr("data-lightbox-sbi"); 450 if (h) { 451 f = a(b.prop("tagName") + '[data-lightbox-sbi="' + h + '"]'); 452 for (var i = 0; i < f.length; i = ++i) c(a(f[i])), f[i] === b[0] && (g = i) 453 } else if ("lightbox" === b.attr("rel")) c(b); 454 else { 455 f = a(b.prop("tagName") + '[rel="' + b.attr("rel") + '"]'); 456 for (var j = 0; j < f.length; j = ++j) c(a(f[j])), f[j] === b[0] && (g = j) 457 } 458 var k = e.scrollTop() + this.options.positionFromTop, 459 l = e.scrollLeft(); 460 this.$lightbox.css({ 461 top: k + "px", 462 left: l + "px" 463 }).fadeIn(this.options.fadeDuration), this.changeImage(g) 464 }, b.prototype.changeImage = function(b) { 465 var c = this; 466 this.disableKeyboardNav();
vendor: 4,741 bytes, lines 467-519
467 var d = this.$lightbox.find(".sbi_lb-image"); 468 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"); 469 var e = new Image; 470 e.onload = function() { 471 472 //If this feed has lightbox comments enabled then add room for the sidebar 473 var sbi_lb_comments_width = 0, 474 sbiNavArrowsWidth = 0; 475 if((jQuery('.sbi').attr('data-sbi-lb-comments') === 'true') && window.innerWidth > 640) { 476 sbi_lb_comments_width = 300; 477 } 478 if(window.innerWidth < (740 + sbi_lb_comments_width) && window.innerWidth > 640) { 479 sbiNavArrowsWidth = 100; 480 } 481 482 var f, g, h, i, j, k, l; 483 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()) 484 }, e.src = this.album[b].link, this.currentImageIndex = b 485 }, b.prototype.sizeOverlay = function() { 486 this.$overlay.width(a(window).width()).height(a(document).height()) 487 }, b.prototype.sizeContainer = function(a, b) { 488 function c() { 489 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() 490 } 491 var d = this, 492 e = this.$outerContainer.outerWidth(), 493 f = this.$outerContainer.outerHeight(), 494 g = a + this.containerLeftPadding + this.containerRightPadding, 495 h = b + this.containerTopPadding + this.containerBottomPadding; 496 e !== g || f !== h ? this.$outerContainer.animate({ 497 width: g, 498 height: h 499 }, this.options.resizeDuration, "swing", function() { 500 c() 501 }) : c() 502 }, b.prototype.showImage = function() { 503 this.$lightbox.find(".sbi_lb-loader").hide(), this.$lightbox.find(".sbi_lb-image").fadeIn("slow"), this.updateNav(), this.updateDetails(), this.preloadNeighboringImages(), this.enableKeyboardNav() 504 }, b.prototype.updateNav = function() { 505 var a = !1; 506 try { 507 document.createEvent("TouchEvent"), a = this.options.alwaysShowNavOnTouchDevices ? !0 : !1 508 } catch (b) {} 509 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")))) 510 }, b.prototype.updateDetails = function() { 511 var b = this; 512 /** NEW PHOTO ACTION **/ 513 //Switch video when either a new popup or navigating to new one 514 if( sbi_supports_video() ){ 515 jQuery('#sbi_lightbox').removeClass('sbi_video_lightbox'); 516 if( this.album[this.currentImageIndex].video.length && this.album[this.currentImageIndex].video !== 'missing'){ 517 jQuery('#sbi_lightbox').addClass('sbi_video_lightbox'); 518 // video created on the fly to prevent issue with safari not playing videos 519 if( jQuery('.sbi_lightbox .sbi_video').length == 0 ) {
520 jQuery('.sbi_lb-container').prepend("<video class='sbi_video' src='"+this.album[this.currentImageIndex].video+"' poster='"+this.album[this.currentImageIndex].link+"' controls autoplay></video>"); 521 } else { 522 jQuery('.sbi_video').attr({ 523 'src' : this.album[this.currentImageIndex].video, 524 'poster' : this.album[this.currentImageIndex].link, 525 'autoplay' : 'true' 526 }); 527 } 528 } else { 529 jQuery('.sbi_lb-container .sbi_video').remove(); 530 } 531 } 532 533 // hide video initially to prevent jerkiness until it's fully loaded 534 jQuery('.sbi_video').css('opacity','0'); 535 jQuery('#sbi_lightbox .sbi_instagram a').attr('href', this.album[this.currentImageIndex].url); 536 jQuery('#sbi_lightbox .sbi_lightbox_tooltip').hide(); 537 jQuery('#sbi_lightbox #sbi_mod_box').find('#sbi_photo_id').text( this.album[this.currentImageIndex].id ); 538 //Change social media sharing links on the fly 539 jQuery('#sbi_lightbox #sbi_facebook_icon').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=' + this.album[this.currentImageIndex].url+'&t=Text'); 540 jQuery('#sbi_lightbox #sbi_twitter_icon').attr('href', 'https://twitter.com/home?status='+this.album[this.currentImageIndex].url+' ' + this.album[this.currentImageIndex].title); 541 jQuery('#sbi_lightbox #sbi_google_icon').attr('href', 'https://plus.google.com/share?url='+this.album[this.currentImageIndex].url); 542 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); 543 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); 544 jQuery('#sbi_lightbox #sbi_email_icon').attr('href', 'mailto:?subject=Instagram&body='+this.album[this.currentImageIndex].title+' '+this.album[this.currentImageIndex].url); 545 jQuery('.sbi_lb-container-wrapper').find('.fa-clone').remove(); 546 547 // carousel in lightbox 548 if( this.album[this.currentImageIndex].carousel !== '' && typeof this.album[this.currentImageIndex].carousel[0] !== 'undefined' ) { 549 var wrapEl = jQuery('.sbi_lb-image-wrap'), 550 styles = jQuery('.sbi_lb-image').attr('style') + 'opacity: 1 !important', 551 thisPoster = this.album[this.currentImageIndex].link, 552 thisStartsWithVideo = (this.album[this.currentImageIndex].carousel[0].type == 'video'), 553 thisVideoUrl = ''; 554 555 jQuery.each(this.album[this.currentImageIndex].carousel,function(index,value) { 556 if (index > 0) { 557 if (value.type === 'image') { 558 wrapEl.append('<img class="sbi_lb-image sbi_lb_lightbox-image" src="'+value.media+'" style="'+styles+'" alt="Lightbox Image"/>'); 559 } else if (sbi_supports_video() && value.type === 'video') { 560 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>'); 561 } 562 } 563 });
564 jQuery('.sbi_lb-image-wrap-outer').prepend('<i class="fa fa-clone sbi_lightbox_carousel_icon" aria-hidden="true"></i>'); 565 566 wrapEl.sbiOwlCarousel({ 567 items: 1, 568 rewind: true, 569 nav: true, 570 navText: ['<i class="fa fa-chevron-left"></i>','<i class="fa fa-chevron-right"></i>'], 571 dots: true, 572 autoPlay: false, 573 stopOnHover: true, 574 onInitialized :function(el) { 575 576 if(thisStartsWithVideo) { 577 jQuery('.sbi_lb-image-wrap').find('.sbi-owl-item').first().find('img').before( jQuery('#sbi_lightbox .sbi_video').first() ); 578 jQuery('#sbi_lightbox .sbi_video').first().get(0).play(); 579 } 580 581 }, 582 onChanged :function(el) { 583 var $owlCarousel = jQuery(el.target), 584 $maybeVideo = $owlCarousel.find('.sbi-owl-item:eq('+el.item.index+')').find('.sbi_video'); 585 586 if($owlCarousel.find('.sbi_video').length) { 587 $owlCarousel.find('.sbi_video').each(function() { 588 jQuery(this).get(0).pause(); 589 }); 590 } 591 592 if ($maybeVideo.length) { 593 $maybeVideo.get(0).play(); 594 } 595 596 } 597 }); 598 599 var $navElementsWrapper = wrapEl.find('.sbi-owl-buttons'); 600 if (window.width > 640) { 601 $navElementsWrapper.addClass('onhover').hide(); 602 wrapEl.on({ 603 mouseenter: function () { 604 $navElementsWrapper.fadeIn(); 605 }, 606 mouseleave: function () { 607 $navElementsWrapper.fadeOut(); 608 } 609 }); 610 } 611 612 } 613 jQuery(".sbi_lb-container-wrapper").find('#sbi_mod_error').remove(); 614 if (this.album[this.currentImageIndex].video.length && this.album[this.currentImageIndex].video === 'missing') { 615 jQuery(".sbi_lb-container-wrapper").prepend('<div id="sbi_mod_error"><strong>This message is only visible to admins.</strong> No video available. The content of the video may contain copyrighted material and can only be viewed on instagram.com.</div>') 616 } 617 618 // fade video back in after a slight delay 619 setTimeout(function(){ 620 jQuery('.sbi_video').css('opacity','1').css('z-index',1); 621 },500); 622 //clear mailto links 623 setTimeout(function(){ 624 jQuery(".sbi_lb-caption").find('a[href^="mailto:"]').each(function() { 625 jQuery(this).replaceWith(jQuery(this).text()); 626 }); 627 },101); 628 629 sbSVGify(jQuery('#sbi_lightbox')); 630 //start by removing any existing comments 631 jQuery('.sbi_lb-commentBox').remove(); 632 // check to see if comments are enabled for this feed 633 if((this.album[this.currentImageIndex].lightboxcomments === 'true' || this.album[this.currentImageIndex].lightboxcomments === true) && this.album[this.currentImageIndex].numcomments > 0) { 634 var sbiComments = { 635 postID: '', 636 thisAlbum: this.album[this.currentImageIndex], 637 maxNumComments: this.album[this.currentImageIndex].numcomments, 638 disableCache: (this.album[this.currentImageIndex].disablecache || this.album[this.currentImageIndex].disablecache === 'true'),
639 numCommentsOnPage: parseInt(jQuery('#'+this.album[this.currentImageIndex].id).find('.sbi_comments').text().replace(',', '')), // number of comments for this specific post, grabbed from feed html 640 commentObj: [], 641 642 getRemoteComments: function (missing,type,user) { 643 644 if ( type === 'business') { 645 var loadingHTML = '<p class="sbi_loading_comments"><svg 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="https://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></p>'; 646 jQuery('.sbi_lb-dataContainer').append(loadingHTML); 647 648 var postIDParts = this.postID.split('_'), 649 postID = postIDParts[1]; 650 var setCacheOpts = { 651 url: sbiajaxurl, 652 type: 'POST', 653 async: true, 654 cache: false, 655 data:{ 656 action: 'sbi_get_business_comment_data', 657 post_id: postID, 658 user: user 659 }, 660 success: function(data) { 661 jQuery('.sbi_lb-dataContainer').find('.sbi_loading_comments').remove(); 662 var toBeCached = []; 663 if ( data.trim().indexOf('{') > -1) { 664 sbiComments.commentObj = JSON.parse(data).data; 665 jQuery.each(sbiComments.commentObj, function() { 666 var comment = { 667 created_time: '', 668 id: this.id, 669 text: this.text, 670 user_name: this.username 671 }; 672 toBeCached.push(comment); 673 }); 674 675 } 676 if ( typeof sb_instagram_js_options.sbiPageCommentCache === 'undefined' ) { 677 sb_instagram_js_options.sbiPageCommentCache = []; 678 } 679 sb_instagram_js_options.sbiPageCommentCache[postID] = [toBeCached, new Date().getTime() / 1000 + 100*60,sbiComments.numCommentsOnPage]; 680 681 if(missing !== 'all') { 682 sbiComments.replaceWithNewComments(sb_instagram_js_options.sbiPageCommentCache[postID][0]); 683 } else { 684 sbiComments.appendExistingComments(); 685 } 686 687 if (!sbiComments.disableCache && window.sbiStandalone.noDB !== true) { 688 sbiComments.cacheComments(toBeCached, sbiComments.numCommentsOnPage); 689 } 690 }, 691 error: function(xhr,textStatus,e) { 692 console.log(e); 693 } 694 }; 695 jQuery.ajax(setCacheOpts); 696 } else { 697 var accessTokens = [], 698 userIDs = [], 699 postIDParts = this.postID.split('_'), 700 feedID = postIDParts[ postIDParts.length-1 ], 701 commentAccessToken = false; 702 703 // get correct access token for comments that are being retrieved 704 if (typeof this.thisAlbum.feedID !== 'undefined') { 705 var startArr = this.thisAlbum.feedID.split(','), 706 midArr = this.thisAlbum.mid.split(','), 707 lastArr = this.thisAlbum.callback.split(','); 708 jQuery.each(startArr, function(index) { 709 accessTokens.push(startArr[index] + '.' + midArr[index] + '.' + lastArr[index]); 710 userIDs.push(startArr[index]); 711 if (startArr[index] === feedID) { 712 commentAccessToken = accessTokens[index]; 713 } 714 }); 715 716 } 717 718 if (!commentAccessToken) { 719 commentAccessToken = sb_instagram_js_options.sb_instagram_at.indexOf(feedID) > -1 ? sb_instagram_js_options.sb_instagram_at : false; 720 } 721 722 // only attempt to retrieve comments if we have a valid access token for them 723 if (commentAccessToken) { 724 var cleanId = this.postID.replace('sbi_',''), 725 at = addLinksToPage(commentAccessToken), 726 url = 'https://api.instagram.com/v1/media/' + cleanId + '/comments?access_token='
726+ at; 727 jQuery.ajax({ 728 method: "GET", 729 url: url, 730 dataType: "jsonp", 731 success: function(data) { 732 sbiComments.commentObj = data.data; 733 var toBeCached = []; 734 jQuery.each(sbiComments.commentObj, function() { 735 var comment = { 736 created_time: this.created_time, 737 id: this.id, 738 text: this.text, 739 user_name: this.from.username 740 }; 741 toBeCached.push(comment); 742 }); 743 if ( typeof sb_instagram_js_options.sbiPageCommentCache === 'undefined' ) { 744 sb_instagram_js_options.sbiPageCommentCache = []; 745 } 746 sb_instagram_js_options.sbiPageCommentCache[cleanId] = [toBeCached, new Date().getTime() / 1000 + 100*60,sbiComments.numCommentsOnPage]; 747 748 if(missing !== 'all') { 749 sbiComments.replaceWithNewComments(sb_instagram_js_options.sbiPageCommentCache[cleanId][0]); 750 } else { 751 sbiComments.appendExistingComments(); 752 } 753 if (!sbiComments.disableCache && window.sbiStandalone.noDB !== true) { 754 sbiComments.cacheComments(toBeCached, sbiComments.numCommentsOnPage); 755 } 756 } 757 }); 758 } 759 } 760 761 }, 762 getCommentHtml: function (comment) { 763 var comHtml = '', 764 comText = comment.text.replace(/(\\')/g,"'").replace(/(\\")/g,'"'); 765 766 comHtml += '<p class="sbi_lb-comment" id="sbi_com_'+comment.id+'" data-sbi-created="'+comment.created_time+'">'; 767 comHtml += '<a class="sbi_lb-commenter" href="https://www.instagram.com/'+sbEncodeHTML(comment.user_name)+'/" target="_blank" rel="noopener">'+sbEncodeHTML(comment.user_name)+'</a>'; 768 comHtml += '<span class="sbi_lb-comment-text">'+sbEncodeHTML(comText)+'</span>'; 769 comHtml += '</p>'; 770 771 return comHtml; 772 }, 773 appendExistingComments: function () { 774 var cleanId = this.postID.replace('sbi_',''), 775 comments = sb_instagram_js_options.sbiPageCommentCache[cleanId][0], 776 fifteenMinutesFromLastCache = sb_instagram_js_options.sbiPageCommentCache[cleanId][1], 777 nowInSeconds = new Date().getTime() / 1000, 778 maxNumComments = parseInt(this.maxNumComments), 779 commentsNeeded = sbiComments.numCommentsOnPage - parseInt(sb_instagram_js_options.sbiPageCommentCache[cleanId][2]); 780 781 var loadingHTML = ''; 782 // every time the comment cache is updated, a t
782ime 15 minutes in the future is also included in the saved data 783 // this checks to see if it's been at least 15 minutes since new comments were cached 784 if (fifteenMinutesFromLastCache > nowInSeconds) { 785 commentsNeeded = 0; 786 } else { 787 if (commentsNeeded > 0) { 788 loadingHTML = '<p class="sbi_loading_comments"><svg 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="https://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></p>'; 789 sbiComments.getRemoteComments(commentsNeeded,sbiComments.accountType,sbiComments.user); 790 } 791 } 792 var comsHtml = ''; 793 //check to see if there is at least one comment to use 794 if (typeof comments[0] !== 'undefined') { 795 comsHtml += '<div class="sbi_lb-commentBox">'; 796 var lastIndex = -1; 797 // grab the maximum number of latest tweets available without going over the max 798 if ((comments.length + commentsNeeded) < maxNumComments) { 799 lastIndex = 0 - comments.length; 800 } else if ((maxNumComments - commentsNeeded) > 0) { 801 lastIndex = 0 - (maxNumComments - commentsNeeded); 802 } 803 // only append existing comments if there are less new comments than the max 804 if (commentsNeeded < maxNumComments) { 805 comments = comments.slice(lastIndex); 806 jQuery.each(comments, function() { 807 comsHtml += sbiComments.getCommentHtml(this); 808 }); 809 } 810 // let the visitor know that more comments are coming 811 comsHtml += loadingHTML; 812 comsHtml += '</div>'; 813 jQuery('.sbi_lb-dataContainer').append(comsHtml); 814 } 815 }, 816 replaceWithNewComments: function (comments) { 817 var comsHtml = '', 818 lastIndex = Math.max((0 - parseInt(this.maxNumComments)), (0 - comments.length)), 819 newComments = comments.slice(lastIndex); 820 821 jQuery.each(newComments, function() { 822 comsHtml += sbiComments.getCommentHtml(this); 823 }); 824 jQuery('.sbi_lb-commentBox').html(comsHtml); 825 }, 826 cacheComments: function (comments, totalComments) { 827 var submittedData = { 828 'action': 'sbi_update_comment_cache', 829 'post_id': this.postID, 830 'comments': comments, 831 'total_comments': totalComments 832 }; 833 834 jQuery.ajax({ 835 url: sbiajaxurl, 836 type: 'post', 837 data: submittedData, 838 success: function(data) { 839 } 840 }); // ajax*/ 841 } 842 }; 843 844 function sbiCommentsInit(id,accountType,user) { 845 // set the id of the current post in the lightbox 846 sbiComments.postID = id; 847 sbiComments.accountType = accountType; 848 sbiComments.user = user; 849 850 if (typeof sb_instagram_js_options.sbiPageCommentCache === 'undefined') { 851 sb_instagram_js_options.sbiPageCommentCache = {waiting:true}; 852 var loadingHTML = '<p class="sbi_loading_comments"><svg 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="https://www.w3.org/2000/svg" viewBox="0 0 512 512">
852<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></p>'; 853 854 jQuery('.sbi_lb-dataContainer').append(loadingHTML); 855 var setCacheOpts = { 856 url: sbiajaxurl, 857 type: 'POST', 858 async: true, 859 cache: false, 860 data:{ 861 action: 'sbi_get_comment_cache' 862 }, 863 success: function(data) { 864 jQuery('.sbi_lb-dataContainer').find('.sbi_loading_comments').remove(); 865 866 if ( data.indexOf('%7B%22') > -1) { 867 data = decodeURI(data); 868 //Replace any escaped single quotes as it results in invalid JSON 869 data = data.replace(/\\'/g, "'"); 870 data = data.replace(/\\'/g, "'"); 871 872 sb_instagram_js_options.sbiPageCommentCache = JSON.parse(data); 873 874 // append comments localized for this feed that apply to this post, otherwise retrieve new comments and use those 875 if (sb_instagram_js_options.sbiPageCommentCache && sb_instagram_js_options.sbiPageCommentCache.hasOwnProperty(sbiComments.postID.replace('sbi_',''))) { 876 sbiComments.appendExistingComments(); 877 } else { 878 sbiComments.getRemoteComments('all',accountType,user); 879 } 880 } else { 881 sb_instagram_js_options.sbiPageCommentCache = {}; 882 } 883 }, 884 error: function(xhr,textStatus,e) { 885 console.log(e); 886 } 887 }; 888 jQuery.ajax(setCacheOpts); 889 } else if (typeof sb_instagram_js_options.sbiPageCommentCache.waiting === 'undefined') { 890 // append comments localized for this feed that apply to this post, otherwise retrieve new comments and use those 891 if (sb_instagram_js_options.sbiPageCommentCache && sb_instagram_js_options.sbiPageCommentCache.hasOwnProperty(sbiComments.postID.replace('sbi_',''))) { 892 sbiComments.appendExistingComments(); 893 } else { 894 sbiComments.getRemoteComments('all',accountType,user); 895 } 896 } 897 898 } 899 900 // wait until the comments object is done being retrieved before displaying comments 901 if (typeof this.album[this.currentImageIndex].id !== 'undefined') { 902 sbiCommentsInit(this.album[this.currentImageIndex].id,this.album[this.currentImageIndex].accounttype,this.album[this.currentImageIndex].user); 903 } else { 904 setTimeout(function() { 905 if (typeof this.album[this.currentImageIndex].id !== 'undefined') { 906 sbiCommentsInit(this.album[this.currentImageIndex].id,this.album[this.currentImageIndex].accounttype,this.album[this.currentImageIndex].user); 907 } 908 },500); 909 } 910 } 911 912 //Add links to the caption 913 var sbiLightboxCaption = sbEncodeHTML(this.album[this.currentImageIndex].title), 914 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
9140EB3\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, 915 tagRegex = /[@]+[A-Za-z0-9-_\."<]+/g; 916 if (typeof sbiLightboxCaption !== 'undefined' && sbiLightboxCaption !== '') { 917 sbiLightboxCaption = sbiLightboxCaption.replace(/(>#)/g,'> #'); 918 } 919 (sbiLightboxCaption) ? sbiLightboxCaption = sbiLinkify(sbiLightboxCaption) : sbiLightboxCaption = ''; 920 921 //Link #hashtags 922 function sbiReplaceHashtags(hash){ 923 //Remove white space at beginning of hash 924 var replacementString = jQuery.trim(hash); 925 //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" 926 if ( /^#[0-9A-F]{6}$/i.test( replacementString ) ){ 927 return replacementString; 928 } else { 929 return ' <a href="https://instagram.com/explore/tags/'+ replacementString.substring(1) +'" target="_blank" rel="nofollow noopener">' + replacementString + '</a>'; 930 } 931 } 932 sbiLightboxCaption = sbiLightboxCaption.replace( hashRegex , sbiReplaceHashtags ); 933 //Link @tags 934 function sbiReplaceTags(tag){ 935 var replacementString = jQuery.trim(tag); 936 //If it contains a quote, don't link 937 if (replacementString.indexOf('<br>') == -1 && /["<]+/g.test( replacementString ) ){ 938 return replacementString; 939 } else { 940 return ' <a href="https://instagram.com/'+ replacementString.substring(1).replace(/</g,'') +'" target="_blank" rel="nofollow noopener">' + replacementString.replace(/</g,'') + '</a>'; 941 } 942 } 943 sbiLightboxCaption = sbiLightboxCaption.replace( tagRegex , sbiReplaceTags ); 944 if (typeof sbiLightboxAction === 'function') { 945 setTimeout(function() { 946 sbiLightboxAction(); 947 },100); 948 } 949 var avatarImageHtml = '', 950 userHtml = '', 951 thisAlbum = this.album, 952 thisCurrentImageIndex = this.currentImageIndex; 953 if (typeof this.album[this.currentImageIndex].avatar !== 'undefined' && this.album[this.currentImageIndex].avatar !== '' && typeof this.album[this.currentImageIndex].user !== 'undefined') { 954 avatarImageHtml = (this.album[this.currentImageIndex].avatar !== 'undefined') ? '<img src="'+this.album[this.currentImageIndex].avatar+'" />' : ''; 955 userHtml = '<a class="sbi_lightbox_username" href="https://instagram.com/'+this.album[this.currentImageIndex].user+'" target="_blank" rel="noopener">'+avatarImageHtml+'<p>@'+this.album[this.currentImageIndex].user + '</p></a> '; 956 } else if (typeof this.album[this.currentImageIndex].user !== 'undefined') { 957 jQuery.each(window.sbi.feeds, function() { 958 if (typeof this.availableAvatarUrls[thisAlbum[thisCurrentImageIndex].user] !== 'undefined' && this.availableAvatarUrls[thisAlbum[thisCurrentImageIndex].user] !== 'undefined') { 959 avatarImageHtml = '<img src="'+this.availableAvatarUrls[thisAlbum[thisCurrentImageIndex].user]+'" />'; 960 } 961 }); 962 }
963 this.$lightbox.find(".sbi_lb-caption").html( userHtml + '<span class="sbi_caption_text">' + sbiLightboxCaption + '</span>').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() { 964 return b.sizeOverlay() 965 }) 966 }, b.prototype.preloadNeighboringImages = function() { 967 if (this.album.length > this.currentImageIndex + 1) { 968 var a = new Image; 969 a.src = this.album[this.currentImageIndex + 1].link 970 } 971 if (this.currentImageIndex > 0) { 972 var b = new Image; 973 b.src = this.album[this.currentImageIndex - 1].link 974 } 975 }, b.prototype.enableKeyboardNav = function() { 976 a(document).on("keyup.keyboard", a.proxy(this.keyboardAction, this)) 977 }, b.prototype.disableKeyboardNav = function() { 978 a(document).off(".keyboard") 979 }, b.prototype.keyboardAction = function(a) { 980 var sbLbCarouselDestroy = function() { 981 jQuery('.sbi_lightbox_carousel_icon').remove(); 982 jQuery('#sbi_lightbox .sbi_lb_lightbox-image, .sbi_lb-image-wrap video').remove(); 983 //if (jQuery('#sbi_lightbox .sbi_lb-image-wrap').length) { //jQuery('.sbi_lb-image-wrap') 984 jQuery('#sbi_lightbox .sbi_lb-image-wrap').sbiOwlCarousel('destroy'); 985 jQuery('#sbi_lightbox .sbi-owl-item').remove(); 986 //} 987 }; 988 var KEYCODE_ESC = 27; 989 var KEYCODE_LEFTARROW = 37; 990 var KEYCODE_RIGHTARROW = 39; 991 992 var keycode = event.keyCode; 993 var key = String.fromCharCode(keycode).toLowerCase(); 994 if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) { 995 sbLbCarouselDestroy(); 996 if( sbi_supports_video() && typeof jQuery('#sbi_lightbox video.sbi_video')[0] !== 'undefined' ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 997 jQuery('#sbi_lightbox iframe').attr('src', ''); 998 sbSVGify(jQuery('#sbi_lightbox')); 999 this.end(); 1000 } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) { 1001 if (this.currentImageIndex !== 0) { 1002 this.changeImage(this.currentImageIndex - 1); 1003 } else if (this.options.wrapAround && this.album.length > 1) { 1004 this.changeImage(this.album.length - 1); 1005 } 1006 sbLbCarouselDestroy(); 1007 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 1008 sbSVGify(jQuery('#sbi_lightbox')); 1009 jQuery('#sbi_lightbox iframe').attr('src', ''); 1010 1011 } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) { 1012 if (this.currentImageIndex !== this.album.length - 1) { 1013 this.changeImage(this.currentImageIndex + 1); 1014 } else if (this.options.wrapAround && this.album.length > 1) { 1015 this.changeImage(0); 1016 } 1017 sbLbCarouselDestroy(); 1018 if( sbi_supports_video() ) jQuery('#sbi_lightbox video.sbi_video')[0].pause(); 1019 jQuery('#sbi_lightbox iframe').attr('src', ''); 1020 sbSVGify(jQuery('#sbi_lightbox')); 1021 1022 } 1023 1024 }, b.prototype.end = function() { 1025 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({ 1026 visibility: "visible" 1027 }) 1028 }, b 1029 }(); 1030 a(function() { 1031 { 1032 var a = new b; 1033 new c(a) 1034 } 1035 }) 1036 }).call(this); 1037 //Checks whether browser support HTML5 video element 1038 function sbi_supports_video() { 1039 return !!document.createElement('video').canPlayType; 1040 } 1041 1042 var modMode = { 1043 status: false, 1044 usingDB: true, 1045 $self: jQuery('.sbi_moderation_mode'), // gets reassigned to current feed 1046 originalParent: jQuery('.sbi_moderation_mode').parent(), 1047 hideOrShow: 'hide', 1048 dbHidePhotos: sb_instagram_js_options.sb_instagram_hide_photos.replace(/ /g,'').split(','), 1049 dbBlockUsers: sb_instagram_js_options.sb_instagram_block_users.replace(/ /g,'').split(','), 1050 dbWhiteList: [], 1051 whiteListIndex: '', 1052 selectedHide: [], // image ids that are selected 1053 selectedShow: [], 1054 selectedUsers: [], 1055 isPermanent: false, 1056 isPermanentDb: false, 1057 1058 setStatus: function (status) { 1059 this.status = status; 1060 }, 1061 setPermanent: function (permanent, permanentDb) { 1062 this.isPermanent = typeof permanent !== 'undefined' ? true : false; 1063 this.isPermanentDb = typeof permanentDb !== 'undefined' ? true : false; 1064 }, 1065 setUsingDB: function (usingDB) { 1066 this.usingDB = usingDB; 1067 }, 1068 setSelf: function ($self) { 1069 if ($self.hasClass('sbi')) { 1070 this.$self = $self; 1071 } else { 1072 this.$self = $self.closest('.sbi'); 1073 } 1074 }, 1075 setOriginalPosition: function () { 1076 this.originalParent= this.$self.parent(); 1077 }, 1078 updateHideOrShow: function (hideOrShow) { 1079 this.hideOrShow = hideOrShow; 1080 modMode.afterTypeChange(hideOrShow); 1081 }, 1082 afterTypeChange: function (hideOrShow) { 1083 if (hideOrShow === 'show') { 1084 jQuery('#sbi_mod_permanent_toggle').closest('.sbi_mod_row').slideDown(); 1085 if (jQuery('#sbi_mod_permanent_toggle').is(':checked') || modMode.isPermanentDb) { 1086 jQuery('#sb_mod_is_permanent_warning').slideDown(); 1087 } 1088 } else { 1089 jQuery('#sbi_mod_permanent_toggle').closest('.sbi_mod_row').slide
1089Up(); 1090 jQuery('#sb_mod_is_permanent_warning').slideUp(); 1091 } 1092 }, 1093 mergeDBAndSelected: function () { 1094 if(!this.$self.hasClass('sbi_mod_merged')) { 1095 // remove any empty array elements 1096 for (var i = 0; i < modMode.dbHidePhotos.length; i++) { 1097 if (modMode.dbHidePhotos[i] == '') { 1098 modMode.dbHidePhotos.splice(i, 1); 1099 } 1100 } 1101 // add id to array if unique 1102 for (var i = 0; i < modMode.dbHidePhotos.length; i++) { 1103 if (modMode.selectedHide.indexOf(modMode.dbHidePhotos[i].replace('sbi_', '')) == -1) { 1104 modMode.selectedHide.push(modMode.dbHidePhotos[i].replace('sbi_', '')); 1105 } 1106 } 1107 // remove any empty array elements for show 1108 for (var i = 0; i < modMode.dbWhiteList.length; i++) { 1109 if (modMode.dbWhiteList[i] == '') { 1110 modMode.dbWhiteList.splice(i, 1); 1111 } 1112 } 1113 // add id to array if unique 1114 for (var i = 0; i < modMode.dbWhiteList.length; i++) { 1115 if (modMode.selectedShow.indexOf(modMode.dbWhiteList[i].replace('sbi_', '')) == -1) { 1116 modMode.selectedShow.push(modMode.dbWhiteList[i].replace('sbi_', '')); 1117 } 1118 } 1119 // remove any empty array elements 1120 for (var i = 0; i < modMode.dbBlockUsers.length; i++) { 1121 if (modMode.dbBlockUsers[i] == '') { 1122 modMode.dbBlockUsers.splice(i, 1) 1123 } 1124 } 1125 // add blocked user to array if unique 1126 for (var i = 0; i < modMode.dbBlockUsers.length; i++) { 1127 if (modMode.selectedUsers.indexOf(modMode.dbBlockUsers[i]) == -1) { 1128 modMode.selectedUsers.push(modMode.dbBlockUsers[i]); 1129 } 1130 } 1131 } 1132 1133 }, 1134 setWhiteListData: function(listNum, ids) { 1135 this.whiteListIndex = listNum; 1136 this.dbWhiteList = ids.replace(/ /g,'').split(','); 1137 }, 1138 updateBlockUser: function(checkbox) { //sbi_mod_block_user 1139 var user = checkbox.val(); 1140 if (checkbox.is(':checked')) { 1141 if (modMode.selectedUsers.indexOf(user) < 0) { 1142 modMode.selectedUsers.push(user); 1143 } 1144 } else { 1145 modMode.selectedUsers.splice(modMode.selectedUsers.indexOf(user), 1); 1146 } 1147 }, 1148 addModSettingsHtml: function () { 1149 if(!this.$self.find('.sbi_mod_mode_wrapper').length) { 1150 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>', 1151 sbi_permanent_cache_warning = '', 1152 sbi_is_permanent_att = ''; 1153 if( modMode.isPermanent ) { 1154 if( modMode.isPermanentDb ) { 1155 sbi_is_permanent_att = ' checked'; 1156 } 1157 1158 sbi_permanent_cache_warning = '<div id="sb_mod_is_permanent_warning" class="sbi_mod_new_white_list sbi_warning" style="display: block;">' + 1159 '<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>' + 1160 '</div>'; 1161 } 1162 modMode.$self.append( 1163 '<div class="sbi_mod_mode_wrapper sbi_mod_mode_wrapper_bottom">'+sbi_submit_mod_settings_btn+'</div>' 1164 ).find('.sb_instagram_header').before( 1165 '<div class="sbi_mod_mode_wrapper">' + 1166 '<a href="javascript:void(0);" class="sbi_close_mod" style="display: block;"><i class="fa fa-times"></i> Exit moderation mode</a>' + 1167 '<p class="sbi_mod_type_header">Moderation Type</p>' + 1168 '<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>' + 1169 '<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>' + 1170 '<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>' + 1171 sbi_submit_mod_settings_btn + 1172 '<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>' + 1173 sbi_permanent_cache_warning + 1174 '</div>' 1175 ); 1176 if(this.whiteListIndex !== '') { 1177 modMode.$self.find('#sbi_hs_show').prop("checked", true); 1178 modMode.hideOrShow = 'show'; 1179 } 1180 modMode.updateHideOrShow(modMode.hideOrShow); 1181 } 1182 //Add the save notice to the body and fade it in/out when settings saved in Ajax callback 1183 jQuery('body').append('<p class="sbi_mod_saved"><i class="fa fa-check"></i> Saved</p>'); 1184 }, 1185 addModHtml: function (user,id) { 1186 var html = ''; 1187 if (typeof user !== 'undefined' && user !== 'undefined' && user !== '') { 1188 html = 1189 '<div class="sbi_mod">' + 1190 '<span class="sbi_mod_user">' + user + '</span>' + 1191 '<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>' + 1192 '<span class="sbi_mod_user sbi_mod_id"><input type="text" value="' + id + '" readonly></span>' + 1193 '</div>'; 1194 } else { 1195 html = 1196 '<div class="sbi_mod">' + 1197 '<span class="sbi_mod_user sbi_mod_id"><input type="text" value="' + id + '" readonly></span>' + 1198 '</div>'; 1199 } 1200 1201 1202 return html; 1203 }, 1204 toggleID: function(clicked) { 1205 if (clicked.is(':checked')) { 1206 jQuery('.sbi_mod_id_toggle').attr('checked','checked'); 1207 jQuery('.sbi_mod_id').show(); 1208 } else { 1209 jQuery('.sbi_mod_id_toggle').removeAttr('checked'); 1210 jQuery('.sbi_mod_id').hide(); 1211 } 1212 }, 1213 initClickCopy: function () { 1214 jQuery('.sbi_mod_user input').click(function() { 1215 jQuery(this).select(); 1216 }); 1217 jQuery('#sbi_mod_id_toggle').click(function() { 1218 modMode.toggleID(jQuery(this)); 1219 }); 1220 modMode.toggleID(jQuery('#sbi_mod_id_toggle').first()); 1221 }, 1222 closeMod: function() { 1223 var url = window.location.href; 1224 if (url.indexOf('sbi_moderation_mode=true') > -1) { 1225 url = url.replace('?sbi_moderation_mode=true', ''); 1226 url = url.replace('&sbi_moderation_mode=true', ''); 1227 } 1228 if (url.indexOf('sbi_moderation_index=') > -1) { 1229 url = url.split('&sbi_moderation_index=')[0]; 1230 } 1231 window.location.href = url; 1232 }, 1233 resizeFeed: function () { 1234 modMode.$self.closest('body').css('position','relative').prepend(modMode.$self); 1235 }, 1236 replaceInfoHtml: function () { 1237 var mod = modMode.$self.find('.sbi_mod'); 1238 mod.each(function() { 1239 jQuery(this).closest('.sbi_item').find('.sbi_info').html(jQuery(this)); 1240 jQuery(this).children().css('font-size','14px'); 1241 }); 1242 }, 1243 styleImage: function (image, hideOrShow) { 1244 if (hideOrShow == 'hide') { 1245 image.append('<span class="sbi_mod_post_status sbi_mod_exclude"><i class="fa fa-times"></i></span>').css('outline','3px solid #e5593d'); 1246 } else { 1247 image.append('<span class="sbi_mod_post_status sbi_mod_include"><i class="fa fa-check"></i></span>').css('outline','3px solid #4e9c2b'); 1248 } 1249 }, 1250 changeClickEvent: function (item, e) { 1251 e.preventDefault(); 1252 var id = item.closest('.sbi_item').attr('id').replace('sbi_', ''), 1253 user = item.closest('.sbi_item').find('.sbi_mod_user').text(); 1254 if (modMode.hideOrShow === 'hide') { 1255 if (modMode.selectedUsers.indexOf(user) === -1) { 1256 if (modMode.selectedHide.indexOf(id) > -1) { 1257 modMode.selectedHide.splice(modMode.selectedHide.indexOf(id), 1); 1258 } else {
1259 modMode.selectedHide.push(id); 1260 } 1261 } 1262 } else { 1263 if (modMode.selectedShow.indexOf(id) > -1) { 1264 modMode.selectedShow.splice(modMode.selectedShow.indexOf(id), 1); 1265 } else { 1266 modMode.selectedShow.push(id); 1267 } 1268 } 1269 1270 modMode.updateDisplay(modMode.$self); 1271 1272 }, 1273 updateDisplay: function () { 1274 // clear off all hide/show styling 1275 modMode.$self.find('.sbi_photo').css('outline','').find('.sbi_mod_post_status').remove(); 1276 // get the blocked users and start looping through items to compare 1277 var blockedUsers = modMode.selectedUsers; 1278 modMode.$self.find('.sbi_item').each( function() { 1279 var user = jQuery(this).find('.sbi_mod_user').text(), 1280 image = jQuery(this).find('.sbi_photo'); 1281 // if the user who posted this image is blocked 1282 if (blockedUsers.indexOf(user) > -1) { 1283 // add the hide styling 1284 modMode.styleImage(image, 'hide'); 1285 // check the block user box 1286 image.closest('.sbi_item').find('.sbi_mod_block_user').prop('checked', true); 1287 } else { 1288 // user is not blocked, uncheck box 1289 image.closest('.sbi_item').find('.sbi_mod_block_user').prop('checked', false); 1290 // compare id to ids in relevant array 1291 var id = jQuery(this).attr('id').replace('sbi_', ''), 1292 idPlusSbi = 'sbi_'+id; 1293 if (modMode.hideOrShow === 'hide') { 1294 if (modMode.selectedHide.indexOf(id) > -1 || modMode.selectedHide.indexOf(idPlusSbi) > -1) { 1295 modMode.styleImage(image, 'hide'); 1296 } 1297 } else { 1298 if (modMode.selectedShow.indexOf(id) > -1 || modMode.selectedShow.indexOf(idPlusSbi) > -1) { 1299 modMode.styleImage(image, 'show'); 1300 } 1301 } 1302 } 1303 }); 1304 sbSVGify(); 1305 }, 1306 ajaxSubmit: function () { 1307 modMode.$self.find('.sbi_mod_submit_mod').next('span').remove(); 1308 modMode.$self.fadeTo( "fast", 0.3 ).find('.sbi_mod_submit_mod').attr('disabled','true'); 1309 if (modMode.hideOrShow === 'hide') { 1310 modMode.$self.find('.sbi_mod_new_white_list').hide(); 1311 var submittedData = { 1312 ids: modMode.selectedHide, 1313 blocked_users: modMode.selectedUsers, 1314 action: 'sbi_update_mod_mode_settings' 1315 }; 1316 jQuery.ajax({ 1317 url: sbiajaxurl, 1318 type: 'post', 1319 data: submittedData, 1320 success: function (data) { 1321 setTimeout(function() { 1322 modMode.$self.fadeTo(500, 1); 1323 modMode.$self.find('.sbi_mod_submit_mod').removeAttr('disabled'); 1324 }, 500); 1325 jQuery('.sbi_mod_saved').fadeIn(); 1326 setTimeout(function() { jQuery('.sbi_mod_saved').fadeOut(); }, 3000); 1327 sbSVGify(modMode.$self); 1328 } 1329 }); // ajax 1330 } else { 1331 var submittedData = { 1332 ids: modMode.selectedShow, 1333 db_index: modMode.whiteListIndex, 1334 blocked_users: modMode.selectedUsers, 1335 permanent: jQuery('#sbi_mod_permanent_toggle').is(':checked'), 1336 action: 'sbi_update_mod_mode_white_list' 1337 }; 1338 jQuery.ajax({ 1339 url: sbiajaxurl, 1340 type: 'post', 1341 data: submittedData, 1342 success: function (data) { 1343 if (data.length) { 1344 modMode.$self.find('.sbi_mod_new_white_list').remove(); 1345 modMode.$self.find('.sbi_mod_submit_mod').after( 1346 '<div class="sbi_mod_new_white_list" style="display: block;">
1346' + 1347 '<p><span><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Important.</span> Please use this shortcode to apply your white list:</p>' + 1348 '<code>[instagram-feed <span style="font-weight: bold;">whitelist="'+data+'"</span>]</code>' + 1349 '</div>' 1350 ); 1351 modMode.whiteListIndex = data; 1352 } 1353 setTimeout(function() { 1354 modMode.$self.find('.sbi_mod_new_white_list').show(); 1355 modMode.$self.css( 'opacity', 1 ); 1356 modMode.$self.find('.sbi_mod_submit_mod').removeAttr('disabled'); 1357 }, 500); 1358 jQuery('.sbi_mod_saved').fadeIn(); 1359 setTimeout(function() { jQuery('.sbi_mod_saved').fadeOut(); }, 3000); 1360 sbSVGify(modMode.$self); 1361 } 1362 }); // ajax 1363 } 1364 }, 1365 showOnPageSubmit: function () { 1366 modMode.$self.find('.sbi_mod_submit_mod').next('span').remove(); 1367 modMode.$self.find('.sbi_mod_submit_mod').attr('disabled','true'); 1368 if (modMode.hideOrShow === 'hide') { 1369 modMode.$self.find('.sbi_mod_new_white_list').hide(); 1370 var submittedData = { 1371 ids: modMode.selectedHide, 1372 blocked_users: modMode.selectedUsers, 1373 action: 'sbi_update_mod_mode_settings' 1374 }; 1375 if (submittedData.ids.length || submittedData.blocked_users.length) { 1376 var idsString = submittedData.ids.join(', '), 1377 blockedUsersString = submittedData.blocked_users.join(', '); 1378 modMode.$self.find('.sbi_mod_new_white_list').remove(); 1379 modMode.$self.find('.sbi_mod_submit_mod').after( 1380 '<div class="sbi_mod_new_white_list" style="display: block;">' + 1381 '<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>' + 1382 '<code><strong>'+idsString+'</strong></code>' + 1383 '</div>' + 1384 '<div class="sbi_mod_new_white_list" style="display: block;">' + 1385 '<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>' + 1386 '<code><strong>'+blockedUsersString+'</strong></code>' + 1387 '</div>' 1388 ); 1389 } 1390 modMode.$self.find('.sbi_mod_new_white_list').show(); 1391 modMode.$self.find('.sbi_mod_submit_mod').removeAttr('disabled'); 1392 } else { 1393 var submittedData = { 1394 ids: modMode.selectedShow, 1395 db_index: modMode.whiteListIndex, 1396 blocked_users: modMode.selectedUsers, 1397 action: 'sbi_update_mod_mode_white_list' 1398 }; 1399 if (submittedData.ids.length || submittedData.blocked_users.length) { 1400 var idsString = submittedData.ids.join(', '), 1401 blockedUsersString = submittedData.blocked_users.join(', '); 1402 modMode.$self.find('.sbi_mod_new_white_list').remove(); 1403 modMode.$self.find('.sbi_mod_submit_mod').after( 1404 '<div class="sbi_mod_new_white_list" style="display: block;">' + 1405 '<p><span><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Important.</span> Please use this in your <strong>sbiWhiteListIds</strong> setting</p>' + 1406 '<code><strong>'+idsString+'</strong></code>' + 1407 '</div>' + 1408 '<div class="sbi_mod_new_white_list" style="display: block;">
1408' + 1409 '<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>' + 1410 '<code><strong>'+blockedUsersString+'</strong></code>' + 1411 '</div>' 1412 ); 1413 } 1414 modMode.$self.find('.sbi_mod_new_white_list').show(); 1415 modMode.$self.find('.sbi_mod_submit_mod').removeAttr('disabled'); 1416 } 1417 }, 1418 submitSelected: function () { 1419 if (modMode.usingDB) { 1420 modMode.ajaxSubmit(); 1421 } else { 1422 modMode.showOnPageSubmit(); 1423 } 1424 } 1425 }; 1426 1427 //Start plugin code 1428 function sbi_init(_cache){ 1429 window.sbiStandalone = { 1430 'noDB' : false, 1431 'forceModMode' : false 1432 }; 1433 1434 //Set the loader color to be the site body color 1435 var sbiBodyColor = jQuery('body').css('color'); 1436 if(sbiBodyColor.indexOf('a') == -1) var sbiBodyColor = sbiBodyColor.replace(')', ', 0.6)').replace('rgb', 'rgba'); 1437 jQuery('#sbi_images > .sbi_loader').css('background', sbiBodyColor ); 1438 1439 var $i = 0, //Used for iterating lightbox 1440 sbi_time = 0, //might be added to if includewords is used on the page 1441 numIncludewords = 0; //keep track of includewords feeds on page 1442 1443 sbiCreatePage( function() { 1444 // using this code as the callback to make sure we know if includewords is being used 1445 // and we need to stagger the loading of the feeds 1446 jQuery('#sb_instagram.sbi').each(function () { 1447 var feedOptions = JSON.parse( this.getAttribute('data-options') ); 1448 1449 if (feedOptions.includewords.length > 0) { 1450 numIncludewords++; 1451 } 1452 if (feedOptions.lightboxcomments == 'true' && window.sbiCommentCacheStatus !== 1 && feedOptions.numcomments > 0) { 1453 window.sbiCommentCacheStatus = 1; 1454 } 1455 }); 1456 1457 }); 1458 1459 //Wrapped in a function to delay the feeds being loaded until includewords feeds are detected 1460 function sbiCreatePage(_callback) { 1461 1462 // forces the function to wait until the includewords detecting code is run 1463 _callback(); 1464 window.sbiCacheStatuses = {}; 1465 window.sbiFeedMeta = {}; 1466 window.sbiUseBackup = {}; 1467 window.sbi = { 1468 options: sb_instagram_js_options, 1469 feeds: {}, 1470 stripQuotes : function(imagesNeedResizing) { 1471 var toReturn = []; 1472 jQuery.each(imagesNeedResizing,function(index,value) { 1473 var thisPost = value; 1474 if (typeof thisPost.caption !== 'undefined' && thisPost.caption !== null && typeof thisPost.caption.text !== 'undefined') { 1475 thisPost.caption.text = sbEncodeHTML(thisPost.caption.text.replace(/"/g,'”').replace(/\\/g,'\u005C ')); 1476 if ( typeof thisPost.location !== 'undefined' && thisPost.location !== null && typeof thisPost.location.name !== 'undefined' ) { 1477 thisPost.location.name = sbEncodeHTML(thisPost.location.name.replace(/"/g, '”').replace(/\\/g, '\u005C ')); 1478 } 1479 } else if (typeof thisPost.caption !== 'undefined' && thisPost.caption !== null ) { 1480 thisPost.caption = sbEncodeHTML(thisPost.caption.replace(/"/g,'”').replace(/\\/g,'\u005C ')); 1481 } else { 1482 thisPost.caption = ''; 1483 } 1484 toReturn.push(thisPost); 1485 }); 1486 return toReturn; 1487 }, 1488 sanitizeBio : function(object) { 1489 var thisObj = object; 1490 if (typeof object.data !== 'undefined' && typeof object.data.bio !== 'undefined') { 1491 thisObj.data.bio = sbEncodeHTML(object.data.bio.replace(/"/g,'”').replace(/\\/g,'\u005C ')); 1492 thisObj.data.full_name = sbEncodeHTML(object.data.full_name.replace(/"/g,'”').replace(/\\/g,'\u005C ')); 1493 } else if (typeof object.biography !== 'undefined'){ 1494 thisObj.biography = sbEncodeHTML(object.biography.replace(/"/g,'”').replace(/\\/g,'\u005C ')); 1495 thisObj.name = sbEncodeHTML(object.name.replace(/"/g,'”').replace(/\\/g,'\u005C ')); 1496 } 1497 return thisObj; 1498 } 1499 }; 1500 window.sbi.options.postsPerPage = 33; 1501 jQuery('#sb_instagram.sbi').each(function(index){ //Ends on line 1676 1502 1503 var var_this = this, 1504 feedOptions = JSON.parse( var_this.getAttribute('data-options') ); 1505 window.sbi.feeds[index] = new SbiFeed(var_this,feedOptions); 1506 //Add feed index attr (for lightbox iteration) 1507 $i++; 1508 jQuery(this).attr('data-sbi-index', $i); 1509 // setting up some global objects to keep track of various statuses used for the caching system 1510 feedOptions.feedIndex = $i; 1511 window.sbiCacheStatuses[$i] = { 1512 'header' : ( feedOptions.sbiHeaderCache == 'true' ), 1513 'feed' : ( feedOptions.sbiCacheExists == 'true' ) 1514 };
1515 var useBackUpJson = (typeof feedOptions.useBackup !== 'undefined') ? feedOptions.useBackup : ''; 1516 window.sbiUseBackup[$i] = { 1517 'header' : ( useBackUpJson.indexOf( 'header' ) > -1 ), 1518 'feed' : ( useBackUpJson.indexOf( 'feed' ) > -1 ) 1519 }; 1520 window.sbiFeedMeta[$i] = { 1521 'error' : {}, 1522 'idsInFeed' : [], 1523 'postsInFeed' : [] //Keeps track of photo IDs for removing duplicates 1524 }; 1525 setTimeout(function() { 1526 sbiCreateFeed(window.sbi.feeds[index], var_this,feedOptions); 1527 },sbi_time); 1528 1529 // stagger the loading of each feed by two seconds to help with includewords issue 1530 if( numIncludewords > 0 ){ 1531 sbi_time += 2000; 1532 } 1533 1534 function sbiCreateFeed(feed,var_this,feedOptions) { 1535 1536 var imagesArrCount = 0, 1537 imagesHTML = ''; 1538 1539 var $self = jQuery(feed.el), 1540 imgRes = 'standard_resolution', 1541 cols = feed.settings.cols, 1542 colsmobile = feed.settings.colsmobile, 1543 nummobile = feed.settings.nummobile, 1544 //Convert styles JSON string to an object 1545 showcaption = '', 1546 showlikes = '', 1547 getType = feed.settings.type, 1548 sortby = 'none', 1549 hovercolorstyles = '', 1550 num = feed.settings.num, 1551 user_id = feed.feedIDs, 1552 $header = '', 1553 disablelightbox = feed.settings.disablelightbox, 1554 captionlinks = feed.settings.captionlinks, 1555 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. 1556 hidePhotos = sb_instagram_js_options.sb_instagram_hide_photos.replace(/ /g,'').split(","), 1557 blockUsers = sb_instagram_js_options.sb_instagram_block_users.replace(/ /g,'').split(","), 1558 showUsers = feed.settings.showusers.replace(/ /g,'').split(","), //Explode into an array 1559 includeWords = feedOptions.includewords.split(","), //Explode into an array 1560 excludeWords = feed.settings.excludewords.replace(/ /g,'').split(","), //Explode into an array 1561 whiteList = feed.settings.sbiWhiteList.replace(/ /g,''), 1562 whiteListIds = feed.settings.sbiWhiteListIds.replace(/ /g,'').split(","), //Explode into an array 1563 sbiHeaderCache = feed.settings.sbiHeaderCache, 1564 media = feed.settings.media; 1565 1566 //If they're not defined because they're not included in the page source code for some reason then set them to be empty 1567 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 1568 if(typeof blockUsers === 'undefined' || ( whiteList.length > 0 && whiteList != '' && !modMode.status == true ) ) blockUsers = []; 1569 if(typeof showUsers === 'undefined') showUsers = []; 1570 1571 //Remove the sbi_ prefix from the start of each ID 1572 for(var i=0; i < hidePhotos.length; i++) { 1573 hidePhotos[i] = hidePhotos[i].replace(/sbi_/g, ''); 1574 } 1575 1576 feed.settings.disablecache = (feed.settings.disablecache == 'true' || jQuery('.sbi_moderation_mode').length > 0); 1577 // add a class to the lightbox if comments are enabled 1578 if(feed.settings.lightboxcomments == 'true' ) { 1579 if(!jQuery('.sbi_lightbox').hasClass('sbi_lb-comments-enabled')) { 1580 jQuery('.sbi_lightbox').addClass('sbi_lb-comments-enabled'); 1581 } 1582 } 1583 1584 if( feed.settings.showcaption == 'false' || feed.settings.showcaption == '' ) showcaption = 'style="display: none;"'; 1585 if( feed.settings.showlikes == 'false' || feed.settings.showlikes == '' ) showlikes = 'display: none;'; 1586 if( feed.settings.sortby !== '' ) sortby = feed.settings.sortby; 1587 if( feed.settings.hovercolor !== '0,0,0' ) hovercolorstyles = 'style="background: rgba('+feed.settings.hovercolor+',0.85)"'; 1588 1589 imgRes = sbiGetResolutionSettings(feed, $self, feed.imgRes, cols, colsmobile, $i); 1590 1591 1592 //START FEED 1593 var apiURLs = feed.apiURLs; 1594 1595 //Create an object of the settings so that they can be passed to the buildFeed function 1596 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: []}; 1597 sbiTransientNames = {}; 1598 sbiTransientNames.feed = feed.transientNames.feed; 1599 sbiTransientNames.header = feed.transientNames.header; 1600 1601 // check to see if comments need to be retrieved 1602 if (!sb_instagram_js_options.sbiPageCommentCache && window.sbiCommentCacheStatus === 1 && window.sbiStandalone.noDB !== true ) { 1603 sbiTransientNames.comments = 'need'; 1604 } else { 1605 sbiTransientNames.comments = 'no'; 1606 } 1607 //1. Does the transient/cache exist in the db? 1608 if( (( window.sbiCacheStatuses[feedOptions.feedIndex].feed === true || window.sbiCacheStatuses[feedOptions.feedIndex].header === true || sbiTransientNames.comments === 'need' ) && (!feedOptions.disablecache || feedOptions.disablecache == 'false') && typeof feedOptions.tryFetch === 'undefined')||feed.firstPageLoad !== false){ 1609 1610 // use the first page load of data if it's available. 1611 if (feed.firstPageLoad !== false) { 1612 var jsonobj = { 1613 data : feed.firstPageLoad 1614 }; 1615 sbiBuildFeed(feed, jsonobj, feed.transientNames.feed, sbiSettings, $self); 1616 if (feed.headerData !== false) { 1617 sbiBuildHeader(feed.headerData, sbiSettings); 1618 } 1619 } else { 1620 var images = sbiGetCache(feed,feed.transientNames.feed, sbiSettings, $self, 'all', apiURLs); 1621 sbiTransientNames.comments = 'no'; 1622 } 1623 1624 } 1625 1626 // if the process of retrieving remote posts hasn't started yet, do so here 1627 if ( window.sbiCacheStatuses[feedOptions.feedIndex].feed === false && window.sbiCacheStatuses[feedOptions.feedIndex].feed !== 'fetched' && feed.firstPageLoad === false) { 1628 window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'fetched'; 1629 window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch = 'done'; 1630 1631 sbiFetchData(apiURLs, feed.transientNames.feed, sbiSettings, $self); 1632 } 1633 1634 if ( !window.sbiCacheStatuses[feedOptions.feedIndex].header && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'fetched' && sbiSettings.getType === 'user' && feed.firstPageLoad === false) { 1635 window.sbiCacheStatuses[feedOptions.feedIndex].header = 'fetched'; 1636 // Make the ajax request here 1637 if (feed.accounts[0]['type'] !== 'business') { 1638 var atParts = feed.personalAccessTokensArr[0].split('.'); 1639 sbiSettings.user_id = atParts[0]; 1640 var sbi_page_url = 'https://api.instagram.com/v1/users/' + sbiSett
1640ings.user_id + '?access_token=' + addLinksToPage(feed.personalAccessTokensArr[0]); 1641 1642 jQuery.ajax({ 1643 method: "GET", 1644 url: sbi_page_url, 1645 dataType: "jsonp", 1646 success: function(data) { 1647 if( data.data !== undefined ) { 1648 sbiBuildHeader(data, sbiSettings); 1649 1650 if ((!feedOptions.disablecache || feedOptions.disablecache === 'false') && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'cached' && typeof data.data.username !== 'undefined' && typeof data.data.pagination === 'undefined') { 1651 window.sbiCacheStatuses[feedOptions.feedIndex].header = 'cached'; 1652 sbiCachePhotos(data, feed.transientNames.header); 1653 } 1654 } 1655 } 1656 }); 1657 } else { 1658 jQuery.ajax({ 1659 url: sbiajaxurl, 1660 type: 'POST', 1661 cache: false, 1662 data: { 1663 action: 'sbi_get_business_header_data', 1664 user_id: feed.accounts[0]['userID'], 1665 }, 1666 success: function (data) { 1667 1668 if (data.trim().indexOf('{') === 0) { 1669 var jsonobj = JSON.parse(data.trim()); 1670 if (typeof jsonobj.username !== 'undefined') { 1671 sbiBuildHeader(jsonobj, sbiSettings); 1672 if ((feedOptions.disablecache === false || feedOptions.disablecache === 'false') && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'cached') { 1673 window.sbiCacheStatuses[feedOptions.feedIndex].header = 'cached'; 1674 sbiCachePhotos(jsonobj, feed.transientNames.header); 1675 } 1676 } else { 1677 console.log( jsonobj ); // error then, handle here 1678 } 1679 } 1680 1681 }, 1682 error: function (xhr, textStatus, e) { 1683 console.log(e); 1684 return; 1685 } 1686 }); 1687 } 1688 1689 //sbiFetchData(apiURLs, sbiTransientNames.header, sbiSettings, $self); 1690 } 1691 1692 //This is the arr that we'll keep adding the new images to 1693 var imagesArr = '', 1694 sbiNewData = false, 1695 noMoreData = false, 1696 photoIds = [], 1697 photosAvailable = 0, //How many photos are available to be displayed 1698 apiRequests = 1; 1699 1700 //Build the HTML for the feed 1701 function sbiBuildFeed(feed, images, transientName, sbiSettings, $self){ 1702 //VARS: 1703 var $loadBtn = $self.find("#sbi_load .sbi_load_btn"), 1704 num = parseInt(sbiSettings.num), 1705 cols = parseInt(sbiSettings.cols), 1706 colsmobile = sbiSettings.colsmobile, 1707 nummobile = parseInt(sbiSettings.nummobile), 1708 hovercolorstyles = '', 1709 hovertextstyles = '',
1710 feedOptions = sbiSettings.feedOptions, 1711 disablelightbox = sbiSettings.disablelightbox, 1712 captionlinks = sbiSettings.captionlinks, 1713 itemCount = 0, 1714 imgRes = sbiSettings.imgRes, 1715 getType = feedOptions.type, 1716 hidePhotos = sbiSettings.hidePhotos, //Contains the IDs of the photos which need to be hidden 1717 blockUsers = sbiSettings.blockUsers, 1718 excludeWords = sbiSettings.excludeWords, 1719 showUsers = sbiSettings.showUsers, 1720 includeWords = sbiSettings.includeWords, 1721 whiteListIds = sbiSettings.whiteListIds, 1722 whiteList = sbiSettings.whiteList, 1723 maxRequests = parseInt(feedOptions.maxrequests), 1724 removedPhotosCount = 0, //How many photos are being hidden so far 1725 carousel = JSON.parse(feedOptions.carousel)[0], 1726 carouselarrows = JSON.parse(feedOptions.carousel)[1], 1727 carouselpag = JSON.parse(feedOptions.carousel)[2], 1728 carouselautoplay = JSON.parse(feedOptions.carousel)[3], 1729 carouseltime = JSON.parse(feedOptions.carousel)[4], 1730 carouselrows = JSON.parse(feedOptions.carousel)[5], 1731 carouselloop = JSON.parse(feedOptions.carousel)[6], 1732 imagepadding = feedOptions.imagepadding, 1733 imagepaddingunit = feedOptions.imagepaddingunit, 1734 looparray = sbiSettings.looparray, 1735 headerstyle = feedOptions.headerstyle, 1736 headerprimarycolor = feedOptions.headerprimarycolor, 1737 headersecondarycolor = feedOptions.headersecondarycolor, 1738 media = feedOptions.media, 1739 highlight = feedOptions.highlight.split(','); 1740 1741 //Set color of load more button loader 1742 $loadBtn.find('.sbi_loader').css('background-color', $loadBtn.css('color')); 1743 1744 // Assist with carousel feeds when cols is less than or equal to num posts 1745 if (carousel && num <= cols) num = cols * 2; 1746 1747 // determine moderation mode 1748 var sbiModIndex = 'b'; 1749 if (typeof $self.parent().attr('class') !== 'undefined') { 1750 sbiModIndex = $self.index()+$self.parent().attr('class').toString(); 1751 } else { 1752 sbiModIndex = 'noclass'; 1753 } 1754 var forceModMode = false, 1755 usingDB = true; 1756 if (typeof window.sbiStandalone !== 'undefined') { 1757 forceModMode = window.sbiStandalone.forceModMode; 1758 usingDB = (window.sbiStandalone.noDB === false); 1759 } 1760 if (feedOptions.sbiModIndex === sbiModIndex.substring(0,10) || $self.hasClass('sbi_mod_merged') || forceModMode || jQuery('.sbi').length < 2) { 1761 modMode.setStatus($self.hasClass('sbi_moderation_mode')); 1762 modMode.setUsingDB(usingDB); 1763 modMode.setPermanent(feedOptions.permanent, feedOptions.permanentDb) 1764 } else { 1765 modMode.setStatus(false); 1766 } 1767 1768 //Set some feed options that help with mod mode 1769 if (modMode.status === true) { 1770 modMode.setSelf($self); 1771 if(!modMode.$self.hasClass('sbi_mod_merged')) { 1772 if (sbiSettings.feedOptions.sbiWhiteList.length) { 1773 modMode.setWhiteListData(sbiSettings.feedOptions.sbiWhiteList, sbiSettings.feedOptions.sbiWhiteListIds); 1774 } 1775 } 1776 modMode.mergeDBAndSelected(); 1777 disablelightbox = 'true'; 1778 hidePhotos = []; 1779 blockUsers = []; 1780 showUsers[0] = ''; 1781 feedOptions.showlikes = 'false';
1782 feedOptions.showcaption = 'false'; 1783 sbiSettings.showlikes = ''; 1784 sbiSettings.showcaption = ''; 1785 carousel = false; 1786 imagepadding = 5; 1787 imagepaddingunit = "px"; 1788 $self.removeClass('sbi_carousel sbi_highlight sbi_masonry'); 1789 } 1790 1791 //check feed width to apply mobile columns 1792 if (jQuery(window).width() < 480 && modMode.status === false) { 1793 num = nummobile; 1794 } 1795 //Add a query parameter to the url and refresh the page to enable mod mode 1796 jQuery('.sbi_moderation_link').click(function() { 1797 var modIndex = 'b'; 1798 if (typeof jQuery(this).closest('.sbi').parent().attr('class') !== 'undefined') { 1799 modIndex = jQuery(this).closest('.sbi').index()+jQuery(this).closest('.sbi').parent().attr('class'); 1800 } else { 1801 modIndex = 'noclass'; 1802 } 1803 1804 var url = window.location.href; 1805 modIndex = modIndex.substring(0,10); 1806 if (url.indexOf('sbi_moderation_mode=true') == -1) { 1807 if (url.indexOf('?') > -1) { 1808 url += '&sbi_moderation_mode=true&sbi_moderation_index='+modIndex; 1809 } else { 1810 url += '?sbi_moderation_mode=true&sbi_moderation_index='+modIndex; 1811 } 1812 } 1813 window.location.href = url; 1814 }); 1815 1816 //On first load imagesArr is empty so set it to be the images 1817 if(typeof imagesArr === 'undefined' || imagesArr == ''){ 1818 imagesArr = images; 1819 1820 //On all subsequent loads add the new images to the imagesArr 1821 } else if( sbiNewData == true ) { 1822 jQuery.each( images.data, function( index, entry ) { 1823 //Add the images to the imagesArr 1824 imagesArr.data.push( entry ); 1825 }); 1826 sbiNewData = false; 1827 } 1828 var imagesNextUrl = feed.getNextUrl(images); 1829 if( typeof imagesNextUrl === 'undefined' || imagesNextUrl.length == 0 ){ 1830 noMoreData = true; 1831 } else { 1832 $loadBtn.show(); 1833 } 1834 1835 //If the next url exists then update the pagination object in the imagesArr with the next pagination info 1836 if( typeof images.pagination !== 'undefined' ) imagesArr["pagination"] = images.pagination; 1837 1838 if( feedOptions.showcaption == 'false' || feedOptions.showcaption == '' ) showcaption = 'style="display: none;"'; 1839 if( feedOptions.showlikes == 'false' || feedOptions.showlikes == '' ) showlikes = 'display: none;'; 1840 if( feedOptions.sortby !== '' ) sortby = feedOptions.sortby; 1841 if( feedOptions.hovercolor !== '0,0,0' ) hovercolorstyles = 'style="background: rgba('+feedOptions.hovercolor+',0.85)"'; 1842 if( feedOptions.hovertextcolor !== '0,0,0' ) hovertextstyles = 'style="color: rgba('+feedOptions.hovertextcolor+',1)"'; 1843 1844 //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 1845 var sbiDefaultClass = ( feedOptions.hovercolor == '0,0,0' ) ? " sbi_default" : ""; 1846 1847 var imagesArrCountOrig = imagesArrCount, 1848 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. 1849 1850 //BUILD HEADER 1851 if( $self.find('.sbi_header_link').length == 0 ){ 1852 1853 //Get page info for first User ID 1854 if(getType == 'user'){ 1855 1856 var sbi_page_url = 'https://api.instagram.com/v1/users/' + feed.idsInFeed[0] + '?access_token='
1856+ sb_instagram_js_options.sb_instagram_at; 1857 if(isNaN(feed.idsInFeed[0])){ 1858 return; 1859 } else { 1860 1861 //Check whether header cache exists 1862 if(sbiHeaderCache == 'true' && !feedOptions.disablecache){ 1863 //Use ajax to get the cache 1864 //sbiGetCache(headerTransientName, sbiSettings, $self, 'header'); 1865 } else if ($self.find('.sb_instagram_header').length) { 1866 // Make the ajax request here 1867 jQuery.ajax({ 1868 method: "GET", 1869 url: sbi_page_url, 1870 dataType: "jsonp", 1871 success: function (data) { 1872 sbiBuildHeader(data, sbiSettings); 1873 1874 if((!feedOptions.disablecache || feedOptions.disablecache === 'false') && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'cached' && typeof data.data !== 'undefined' && typeof data.data.username !== 'undefined' && typeof data.data.pagination === 'undefined') { 1875 window.sbiCacheStatuses[feedOptions.feedIndex].header = 'cached'; 1876 sbiCachePhotos(data, feed.transientNames.header); 1877 } 1878 } 1879 }); 1880 } 1881 } 1882 1883 } else { 1884 1885 var headerStyles = ''; 1886 if(feedOptions.headercolor.length) headerStyles = 'style="color: #'+feedOptions.headercolor+'"'; 1887 1888 if (feedOptions.headerstyle !== 'centered') { 1889 if(getType == 'hashtag'){ 1890 $header = '<a href="https://instagram.com/explore/tags/'+feed.hashtagsForHeader[0]+'" target="_blank" rel="noopener" class="sbi_header_link" '+headerStyles+'>'; 1891 } else { 1892 $header = '<div class="sbi_header_link" '+headerStyles+'>'; 1893 } 1894 1895 $header += '<div class="sbi_header_text">'; 1896 $header += '<h3 class="sbi_no_bio" '+headerStyles+'>'; 1897 if(getType == 'hashtag'){ 1898 1899 if( feed.hashtagsForHeader.length > 1 ){ 1900 jQuery.each( feed.hashtagsForHeader, function( index, hashtag ) { // itemNumber = index, item = value 1901 $header += '<a href="https://instagram.com/explore/tags/'+hashtag+'" target="_blank" rel="noopener">#' + hashtag + ' </a>'; 1902 }); 1903 } else { 1904 $header += '#'+feed.hashtagsForHeader[0]; 1905 } 1906 1907 } else { 1908 $header += 'Instagram'; 1909 } 1910 $header += '</h3>'; 1911 $header += '</div>'; 1912 1913 $header += '<div class="sbi_header_img"'; 1914 if(headerstyle == 'boxed') $header += ' style="background: #'+headersecondarycolor+';"'; 1915 $header += '>'; 1916 1917 1918 $header += '<div class="sbi_header_hashtag_icon"'; 1919 if(headerstyle == 'boxed') $header += ' style="color: #'+headerprimarycolor+';"'; 1920 $header += '><i class="sbi_new_logo" '+hovertextstyles+'></i></div>'; 1921 $header += '</div>'; 1922 if(getType == 'hashtag'){ 1923 $header += '</a>'; 1924 } else { 1925 $header += '</div>'; 1926 } 1927 } else { 1928 if(getType == 'hashtag'){ 1929 $header = '<a href="https://instagram.com/explore/tags/'+feed.hashtagsForHeader[0]+'" target="_blank" rel="noopener" class="sbi_header_link" '+headerStyles+'>'; 1930 } else { 1931 $header = '<div class="sbi_header_link" '+headerStyles+'>'; 1932 } 1933 1934 $header += '<div class="sbi_header_img"'; 1935 if(headerstyle == 'boxed') $header += ' style="background: #'+headersecondarycolor+';"'; 1936 $header += '>'; 1937 1938 1939 $header += '<div class="sbi_header_hashtag_icon"'; 1940 if(headerstyle == 'boxed') $header += ' style="color: #'+headerprimarycolor+';"'; 1941 $header += '><i class="sbi_new_logo" '+hovertextstyles+'></i></div>'; 1942 1943 1944 $header += '</div>'; 1945 1946 $header += '<div class="sbi_header_text">'; 1947 $header += '<h3 class="sbi_no_bio" '+headerStyles+'>'; 1948 if(getType == 'hashtag'){ 1949 1950 if( feed.hashtagsForHeader.length > 1 ){ 1951 jQuery.each( feed.hashtagsForHeader, function( index, hashtag ) { // itemNumber = index, item = value 1952 $header += '<a href="https://instagram.com/explore/tags/'+hashtag+'" target="_blank" rel="noopener">#' + hashtag + ' </a>'; 1953 }); 1954 } else { 1955 $header += '#'+feed.hashtagsForHeader[0]; 1956 } 1957 1958 } else { 1959 $header += 'Instagram'; 1960 } 1961 $header += '</h3>'; 1962 $header += '</div>'; 1963 1964 $header += '</div>'; 1965 if(getType == 'hashtag'){ 1966 $header += '</a>'; 1967 } else { 1968 $header += '</div>'; 1969 } 1970 } 1971 1972 //Add the header 1973 if( $self.find('.sbi_header_link').length == 0 ) $self.find('.sb_instagram_header').prepend( $header ); 1974 1975 1976 //Header profile pic hover 1977 $self.find('.sb_instagram_header .sbi_header_link').hover(function(){ 1978 //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. 1979 $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') ); 1980 1981 $self.find('.sbi_feed_type_hashtag.sbi_header_style_boxed .sbi_header_hashtag_icon').css({ 1982 'background' : '#000', 1983 'color' : '#fff' 1984 }); 1985 1986 }, function(){ 1987 $self.find('.sbi_feed_type_user .sbi_header_hashtag_icon, .sbi_feed_type_hashtag .sbi_header_hashtag_icon').removeAttr('style'); 1988 1989 $self.find('.sbi_feed_type_hashtag.sbi_header_style_boxed .sbi_header_hashtag_icon').css({ 1990 'background' : '#'+feedOptions.headersecondarycolor, 1991 'color' : '#'+feedOptions.headerprimarycolor 1992 }); 1993 1994 }); 1995 1996 } // End get page info 1997 } // End header 1998 1999 // set highlight masonry highlight type settings 2000 var highlightType = typeof highlight !== 'undefined' ? highlight[0] : 'pattern', hashtagsToHighlight = [], 2001 idsToHighlight = []; 2002 2003 if (highlightType === 'hashtag') { 2004 hashtagsToHighlight = highlight[3].replace(/# /,'').split('|'); 2005 } else if (highlightType === 'id') { 2006 idsToHighlight = typeof sb_instagram_js_options.highlight_ids !== 'undefined' ? sb_instagram_js_options.highlight_ids.split(',') : []; 2007 } 2008 2009 //LOOP THROUGH ITEMS: 2010 jQuery.each( imagesArr.data, function( itemNumber, item ) { // itemNumber = index, item = value 2011 //Remove photos 2012 var removePhoto = false; 2013 2014 if(showUsers[0] !== '') { 2015 //Check usernames to see whether this user is blocked 2016 var hits = 0; 2017 jQuery.each(showUsers, function (index, username) { 2018 if (feed.getUser(item) == jQuery.trim(username)) { 2019 //This photo was posted by one of the users 2020 hits++; 2021 } 2022 }); 2023 if (hits < 1) { 2024 hidePhotos.push(feed.getPostID(item)); 2025 } 2026 } else { 2027 jQuery.each( blockUsers, function( index, username ) { 2028 //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 2029 if( feed.getUser(item) !== '' && feed.getUser(item) == jQuery.trim(username) ) { 2030 hidePhotos.push(feed.getPostID(item)); 2031 2032 } 2033 }); 2034 } 2035 2036 //Exclude words - check captions (if they exist) to see whether it c
2036ontains any excluded words 2037 if( (excludeWords.length > 0 && excludeWords[0] !== '') && feed.getCaption(item) != null && feed.getCaption(item) != ''){ 2038 2039 jQuery.each( excludeWords, function( index, word ) { 2040 word = jQuery.trim(word).toLowerCase(); 2041 if( feed.getCaption(item).toLowerCase().indexOf(word) > -1 && word !== '' ){ 2042 } 2043 }); 2044 2045 var workingCaptionEx = ' ' + feed.getCaption(item) + ' '; 2046 2047 jQuery.each( excludeWords, function( index, word ) { 2048 if(word !== '') { 2049 var needle = encodeURI(jQuery.trim(word).toLowerCase()), 2050 haystack = encodeURI(workingCaptionEx.toLowerCase().replace('#', ' #')), 2051 regex = new RegExp("%20"+needle + "\\b"); 2052 haystack = haystack.replace(/#/g, '%20#'); 2053 2054 if(regex.test(haystack)) { 2055 //This photo caption contains one of the words so show it 2056 hidePhotos.push(feed.getPostID(item)); 2057 2058 } 2059 } 2060 }); 2061 } 2062 //Include words - check captions to see whether it contains any included words 2063 if(includeWords.length > 0 && includeWords != ''){ 2064 2065 //If there's no caption then hide the photo 2066 if( feed.getCaption(item) == null ){ 2067 hidePhotos.push(feed.getPostID(item)); 2068 } else { 2069 2070 var containsWord = false, 2071 workingCaption = ' ' + feed.getCaption(item) + ' '; 2072 2073 jQuery.each( includeWords, function( index, word ) { 2074 if (containsWord === false) { 2075 // use the tags attribute if includeword is a hashtag. Don't use for Japanese characters which the encodeURIComponent clause is meant to catch 2076 if (word.indexOf('#') > -1 && encodeURIComponent(word).indexOf('%E') !== 3 && feed.getTags(item)) { 2077 if (feed.getTags(item).indexOf(word.replace('#', '').toLowerCase()) > -1) { 2078 containsWord = true; 2079 } 2080 } else { 2081 var needle = encodeURI(jQuery.trim(word).toLowerCase()).replace(/ /g,'%20'), 2082 haystack = encodeURI(workingCaption.toLowerCase().replace('#', ' #')), 2083 regex = new RegExp("%20"+needle + "\\b"); 2084 2085 haystack = haystack.replace(/#/g, '%20#'); 2086 haystack = haystack.replace(/%E2%A0%80%0A/g, '%20'); 2087 2088 if(regex.test(haystack)) { 2089 //This photo caption contains one of the words so show it 2090 containsWord = true; 2091 } 2092 } 2093 } 2094 2095 }); 2096 2097 if( containsWord == false && (jQuery.inArray(feed.getPostID(item), hidePhotos) < 1) ){ 2098 hidePhotos.push(feed.getPostID(item)); 2099 2100 } 2101 } 2102 2103 } 2104 2105 2106 //Hide photos or videos 2107 if( media == 'videos' && feed.getMediaType(item) !== 'video' ) removePhoto = true; 2108 if( media == 'photos' && feed.getMediaType(item) !== 'image' && feed.getMediaType(item) !== 'carousel' ) removePhoto = true; 2109 2110 2111 //White List 2112 if (whiteList.length > 0 && whiteList != '' && !modMode.status == true){ 2113 if (whiteListIds.indexOf(feed.getPostID(item)) === -1) { 2114 hidePhotos.push(feed.getPostID(item)); 2115 } 2116 } 2117 2118 //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 2119 jQuery.each( hidePhotos, function( index, id ) { 2120 if( feed.getPostID(item) == jQuery.trim(id) ) removePhoto = true; 2121 }); 2122 2123 if(removePhoto){ 2124 removedPhotosCount++; 2125 //Remove photo from imagesArr here so that it isn't cached 2126 removePhotoIndexes.push(itemNumber); 2127 return; 2128 } 2129 2130 //Used to make sure we display the right amount of photos 2131 itemCount++; 2132 if (typeof photosAvailable === 'undefined') { 2133 photosAvailable = 0; 2134 } 2135 //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
2135in order to calculate how many to show. 2136 if( itemCount > ( (imagesArrCountOrig-photosAvailable )+num) || itemCount <= imagesArrCountOrig ) return; 2137 2138 imagesArrCount++; //Keeps track of where we are in the images array 2139 2140 //Prevent duplicates 2141 $i = $self.attr('data-sbi-index'); 2142 if( jQuery.inArray(feed.getPostID(item), window.sbiFeedMeta[$i].postsInFeed) > -1 ){ 2143 return; //Don't add image 2144 } else { 2145 //Store the IDs of the images added to the feed so we can prevent duplicates 2146 window.sbiFeedMeta[$i].postsInFeed.push(feed.getPostID(item)); 2147 } 2148 2149 //FILTER: 2150 //Video 2151 var data_video = 'data-video=""'; 2152 if( feed.getMediaType(item) == 'video' ){ 2153 data_video = 'data-video="'+feed.getVideoUrl(item) + '"'; 2154 } 2155 2156 var data_carousel = 'data-carousel=""', 2157 videoIsFirstCarouselItem = false; 2158 if ( feed.getMediaType(item) === 'carousel') { 2159 var carouselObj = feed.getCarouselObject(item), 2160 data_carousel_object = carouselObj.data; 2161 videoIsFirstCarouselItem = carouselObj.vidFirst; 2162 2163 data_carousel = "data-carousel='"+JSON.stringify(data_carousel_object).replace(/'/g, "\\'")+"'"; 2164 if (videoIsFirstCarouselItem) { 2165 data_video = 'data-video="'+carouselObj.data[0]['media'] + '"'; 2166 } 2167 } 2168 2169 //Image res 2170 var data_image = feed.getMediaUrl(item,'full'); 2171 switch( imgRes.type ){ 2172 case 'thumbnail': 2173 data_image = feed.getMediaUrl(item,'thumbnail'); 2174 break; 2175 case 'low_resolution': 2176 data_image = feed.getMediaUrl(item,'medium'); 2177 break; 2178 case 'auto': 2179 imgRes = sbiGetResolutionSettings(feed, $self, feed.imgRes, cols, colsmobile, $i); 2180 var thisImageReplace = sbiGetBestResolutionForAuto(imgRes.width,feed.getAspectRatio(item),($self.hasClass('sbi_highlight'))); 2181 switch (thisImageReplace) { 2182 case 320: 2183 data_image = feed.getMediaUrl(item,'medium'); 2184 break; 2185 case 150: 2186 data_image = feed.getMediaUrl(item,'thumbnail'); 2187 break; 2188 } 2189 break; 2190 } 2191 data_image = data_image.split("?ig_cache_key")[0]; 2192 2193 //Date 2194 var canUseTranslations = sbiDateInternationalizationNotSupported() === false, 2195 date = new Date(feed.getTimestamp(item)*1000), 2196 created_time_raw = feed.getTimestamp(item); 2197 2198 if (canUseTranslations) { 2199 var options = { month: 'short', day: 'numeric' }, 2200 itemDate = date.toLocaleDateString(sbiTranslations.DATE_FORMAT,options); 2201 } else { 2202 //Create time for sorting 2203 //Create pretty date for display 2204 var m = date.getMonth(); 2205 var d = date.getDate(); 2206 var month_names = []; 2207 month_names[month_names.length] = sbiTranslate("Jan"); 2208 month_names[month_names.length] = sbiTranslate("Feb"); 2209 month_names[month_names.length] = sbiTranslate("Mar"); 2210 month_names[month_names.length] = sbiTranslate("Apr"); 2211 month_names[month_names.length] = sbiTranslate("May"); 2212 month_names[month_names.length] = sbiTranslate("Jun"); 2213 month_names[month_names.length] = sbiTranslate("Jul"); 2214 month_names[month_names.length] = sbiTranslate("Aug"); 2215 month_names[month_names.length] = sbiTranslate("Sep"); 2216 month_names[month_names.length] = sbiTranslate("Oct"); 2217 month_names[month_names.length] = sbiTranslate("Nov"); 2218 month_names[month_names.length] = sbiTranslate("Dec"); 2219 var itemDate = d + ' ' + month_names[m]; 2220 } 2221 2222 //Caption 2223 var captionText = ''; 2224 if(feed.getCaption(item) != null && feed.getCaption(item) != ''){ 2225 //Replace double quotes in the captions with the HTML symbol 2226 var captionText = feed.getCaption(item) ? sbEncodeHTML(feed.getCaption(item).replace(/"/g, """)) : ''; 2227 captionText = captionText.replace(/(\\n)|(\n)/g, "<br/>"); 2228 } 2229 2230 //Hover display info 2231 if( feedOptions.hoverdisplay.indexOf('location') > -1 ){ var showHoverLocation = true; } else { var showHoverLocation = false; } 2232 if( feedOptions.hoverdisplay.indexOf('caption') > -1 ){ var showHoverCaption = true; } else { var showHoverCaption = false; } 2233 if( feedOptions.hoverdisplay.indexOf('likes') > -1 ){ var showHoverLikes = true; } else { var showHoverLikes = false; } 2234 if( feedOptions.hoverdisplay.indexOf('username') > -1 ){ var showHoverUsername = true; } else { var showHoverUsername = false; } 2235 if( feedOptions.hoverdisplay.indexOf('icon') > -1 ){ var showHoverIcon = true; } else { var showHoverIcon = false; } 2236 if( feedOptions.hoverdisplay.indexOf('date') > -1 ){ var showHoverDate = true; } else { var showHoverDate = false; } 2237 if( feedOptions.hoverdisplay.indexOf('instagram') > -1 ){ var showHoverInstagram = true; } else { var showHoverInstagram = false; } 2238 2239 2240 //Location 2241 var itemLocation = feed.getLocation(item); 2242 if(itemLocation != null && feed.getCaption(item) != '' && showHoverLocation){ 2243 if(typeof itemLocation.name == 'undefined' || itemLocation.name == null){ 2244 var locationName = ''; 2245 } else { 2246 var sbi_lat = (itemLocation.hasOwnProperty("latitude")) ? 'data-lat="'+itemLocation.latitude+'"' : '', 2247 sbi_long = (itemLocation.hasOwnProperty("longitude")) ? 'data-long="'+itemLocation.longitude+'"' : '', 2248 locationName = '<a href="https://instagram.com/explore/locations/'+itemLocation.id+'" class="sbi_location" target="_blank" rel="noopener" '+hovertextstyles+' '+sbi_lat+' '+sbi_long+'><i class="fa fa-map-marker"></i>'+itemLocation.name+'</a>'; 2249 } 2250 } else { 2251 var locationName = ''; 2252 } 2253 2254 var sbiCaptionHTML = ''; 2255 if(showHoverCaption){ 2256 sbiCaptionHTML = '<p class="sbi_caption" '+hovertextstyles+'>'+ captionText.substring(0, feedOptions.captionlength); 2257 if( captionText.length > parseInt(feedOptions.captionlength) ) sbiCaptionHTML += '...'; 2258 sbiCaptionHTML += '</p>'; 2259 } 2260 var sbiMetaHTML = ''; 2261 if(showHoverLikes){ 2262 sbiMetaHTML = '<div class="sbi_meta" style="color: #'+feedOptions.likescolor+';"><span class="sbi_likes" '+hovertextstyles+'><i class="fa fa-heart" '+hovertextstyles+'></i>'+commaSeparateNumber(feed.getLikesCount(item))+'</span><span class="sbi_comments" '+hovertextstyles+'><i class="fa fa-comment" '+hovertextstyles+'></i>'+commaSeparateNumber(feed.getCommentsCount(item))+'</span></div>'; 2263 } 2264 2265 var sbiUsernameHTML = ''; 2266 if(showHoverUsername){ 2267 sbiUsernameHTML = '<p class="sbi_username"><a href="https://instagram.com/'+feed.getUser(item)+'" target="_blank" rel="noopener" '+hovertextstyles+'>'+feed.getUser(item)+'</a></p>'; 2268 } 2269 2270 var sbiIconHTML = ''; 2271 if(showHoverIcon){ 2272 sbiIconHTML = '<i class="fa fa-arrows-alt"></i>'; 2273 } 2274 2275 var sbiDateHTML = ''; 2276 if(showHoverDate && feed.getTimestamp(item) > 0){ 2277 sbiDateHTML = '<span class="sbi_date"><i class="fa fa-clock"></i>'+itemDate + '</span>'; 2278 } 2279 2280 var sbiInstagramHTML = ''; 2281 if(showHoverInstagram){ 2282 sbiInstagramHTML = '<a class="sbi_instagram_link" href="'+feed.getPermalink(item)+'" target="_blank" rel="noopener" title="Instagram" '+hovertextstyles+'><span class="sbi-screenreader">View on Instagram</span><i class="fa fa-instagram"></i></a>'; 2283 } 2284 2285 //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 2286 var carouselPadding = (carousel == true) ? ' style="padding: '+imagepadding+imagepaddingunit+' !important;"' : ''; 2287 2288 var videoIsFirstCarouselItemClass = videoIsFirstCarouselItem ? ' sbi_carousel_vid_first' : '', 2289 carouselTypeIcon = feed.getMediaType(item) === 'carousel' ? '<i class="fa fa-clone sbi_carousel_icon" aria-hidden="true"></i>': ''; 2290 var highlightClass = ''; 2291 2292 if (hashtagsToHighlight.length > 0) { 2293 jQuery.each(hashtagsToHighlight, function(index,val) { 2294 if (feed.getTags(item) && feed.getTags(item).indexOf(val) > -1) { 2295 highlightClass = ' sbi_highlighted'; 2296 } else { 2297 var workingCaption = ' ' + feed.getCaption(item) + ' ', 2298 word = val; 2299 2300 var needle = encodeURI(jQuery.trim(word).toLowerCase()).replace(/ /g,'%20'), 2301 haystack = encodeURI(workingCaption.toLowerCase().replace('#', ' #')), 2302 regex = new RegExp("%20#"+needle + "\\b"); 2303 2304 haystack = haystack.replace(/#/g, '%20#'); 2305 haystack = haystack.replace(/%E2%A0%80%0A/g, '%20'); 2306 2307 if(regex.test(haystack)) { 2308 //This photo caption contains one of the words so show it 2309 highlightClass = ' sbi_highlighted'; 2310 } 2311 } 2312 }); 2313 } else if (idsToHighlight.length > 0) { 2314 if (idsToHighlight.indexOf(feed.getPostID(item)) > -1) { 2315 highlightClass = ' sbi_highlighted'; 2316 } 2317 } 2318 2319 var splitUpMedia = data_image.split('?').shift(), 2320 fileType = splitUpMedia.split('.').pop(), 2321 mediaElement = ''; 2322 if (fileType === 'mp4') { 2323 mediaElement = '<video src="'+data_image+'" alt="'+sbEncodeHTML(captionText)+'" />'; 2324 } else { 2325 mediaElement = '<img src="'+data_image+'" alt="'+sbEncodeHTML(captionText)+'" width="200" height="200" />'; 2326 } 2327 2328 2329 2330 //TEMPLATE: 2331 imagesHTML += '<div class="sbi_item'+highlightClass+' sbi_type_'+feed.getMediaType(item)+videoIsFirstCarouselItemClass+' sbi_new sbi_transition" id="sbi_'+feed.getPostID(item)+'" 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="'+feed.getMediaUrl(item,'lightbox')+'" data-lightbox-sbi="'+$self.attr('data-sbi-index')+'" data-title="'+sbEncodeHTML(captionText)+'" '+data_video+data_carousel+' data-id="sbi_'+feed.getPostID(item)+'" data-user="'+feed.getUser(item)+'" data-url="'+feed.getPermalink(item)+'" data-avatar="'+feed.getAvatarUrl(item)+'" data-account-type="'+feed.getAccountType(item)+'"><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="'+feed.getPermalink(item)+'" target="_blank" rel="noopener">'+mediaElement+'</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;">'+sbEncodeHTML(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(feed.getLikesCount(item))+'</span><span class="sbi_comments" style="font-size: '+feedOptions.likessize+'px;"><i class="fa fa-comment" style="font-size: '+feedOptions.likessize+'px;"></i>'+commaSeparateNumber(feed.getCommentsCount(item))+'</span></div></div>'; 2332 2333 if(modMode.status === true) { 2334 imagesHTML += modMode.addModHtml(feed.getUser(item),feed.getPostID(item)); 2335 } 2336 2337 imagesHTML += '</div>'; 2338 }); //End images.data forEach loop 2339 2340 //Loop through and remove any photos from imagesArr which are hidden so that they're not cached 2341 removePhotoIndexes.reverse(); //Reverse the indexes in the arr
2341ay so that it takes out the last items first and doesn't affect the order 2342 jQuery.each( removePhotoIndexes, function( index, itemNumber ) { 2343 imagesArr.data.splice(itemNumber, 1); 2344 }); 2345 2346 if( (imagesArrCount - imagesArrCountOrig) < num ) photosAvailable += imagesArrCount - imagesArrCountOrig; 2347 2348 //CACHE all of the photos in the imagesArr using ajax call to db after the photos have been displayed 2349 var numWhiteListIds = feedOptions.sbiWhiteListIds.replace(/ /g,'').split(",").length; 2350 2351 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. 2352 //Get more photos 2353 var sbiFetchURL = feed.getNextUrl(imagesArr); 2354 2355 window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'fetched'; 2356 2357 sbiFetchData(sbiFetchURL, feed.transientNames.feed, sbiSettings, $self); 2358 //Set the flag so that we know to add the new photos to the imagesArr 2359 sbiNewData = true; 2360 } else { 2361 //If there are enough photos 2362 //Add the images to the feed 2363 if (typeof imagesHTML !== 'undefined') { 2364 $self.find('#sbi_images').append(imagesHTML); 2365 } 2366 2367 if ($self.find('#sbi_images').data('smashotope')) { 2368 // $self.find('.sbi_new').addClass('sbi_hide'); 2369 $self.find('#sbi_images').smashotope('appended', jQuery('.sbi_new')); 2370 } 2371 sbiAfterImagesLoaded(feed,imagesArr,feed.transientNames.feed); 2372 2373 if( !$self.hasClass('sbi_masonry') && !$self.hasClass('sbi_highlight') && !$self.hasClass('sbi_carousel') ){ 2374 //Loop through items and remove class to reveal them 2375 var time = 10; 2376 $self.find('.sbi_transition').each(function() { 2377 var $sbi_item_transition_el = jQuery(this); 2378 2379 setTimeout( function(){ 2380 $sbi_item_transition_el.removeClass('sbi_transition'); 2381 }, time) 2382 time += 10; 2383 });
2384 } 2385 2386 imagesHTML = ''; 2387 2388 //Remove the initial loader 2389 $self.find('#sbi_images > .sbi_loader').remove(); 2390 2391 //Show the Load More button 2392 $self.find('#sbi_load').removeClass('sbi_hidden'); 2393 //Don't show the button if there aren't enough photos to fill the feed 2394 if( imagesArrCount >= num ) $self.find('.sbi_load_btn').show(); 2395 2396 setTimeout(function(){ 2397 //Hide the loader in the load more button 2398 $loadBtn.find('.sbi_loader').addClass('sbi_hidden'); 2399 $loadBtn.find('.sbi_btn_text').removeClass('sbi_hidden'); 2400 }, 500); 2401 } 2402 2403 2404 //AFTER: 2405 //Things to add after the photos have been added 2406 function sbiAfterImagesLoaded(feed,imagesArr,transientName){ 2407 /* Scripts for each feed */ 2408 $self.find('.sbi_item').each(function(){ 2409 2410 var $self = jQuery(this), 2411 $sbi_link_area = $self.find('.sbi_link_area'); 2412 2413 //Change lightbox image to be full size 2414 var $sbi_lightbox = jQuery('#sbi_lightbox'); 2415 $self.find('.sbi_lightbox_link').click(function(){ 2416 $sbi_lightbox.removeClass('sbi_video_lightbox'); 2417 if( $self.hasClass('sbi_type_video') ){ 2418 $sbi_lightbox.addClass('sbi_video_lightbox'); 2419 //Add the image as the poster so doesn't show an empty video element when clicking the first video link 2420 jQuery('.sbi_video').attr({ 2421 'poster' : jQuery(this).attr('href') 2422 }); 2423 2424 } 2425 }); 2426 2427 //Expand post 2428 var $post_text = $self.find('.sbi_info .sbi_caption'), 2429 text_limit = feedOptions.captionlength; 2430 if (typeof text_limit === 'undefined' || text_limit == '') text_limit = 99999; 2431 2432 //Set the full text to be the caption (used in the image alt) 2433 var full_text = typeof $self.find('.sbi_photo img').attr('alt') !== 'undefined' ? $self.find('.sbi_photo img').attr('alt') : $self.find('.sbi_photo video').attr('alt'); 2434 if(full_text == undefined) full_text = ''; 2435 var brCount = (full_text.match(/<br>/g) || []).length, 2436 brAdjust = (typeof sb_instagram_js_options.br_adjust === 'undefined' || sb_instagram_js_options.br_adjust === '1'); 2437 if (brAdjust && brCount > 0 && full_text.indexOf('<br>') < text_limit) { 2438 var captionPadding = $post_text.closest('.sbi_caption_wrap').css("padding-left"), captionWidth = $post_text.closest('.sbi_caption_wrap').width() - (parseInt(captionPadding) *2), 2439 fontSize = $post_text.css('font-size'), 2440 charactersPerLine = captionWidth/parseInt(fontSize)*1.85, 2441 maxCharsPerLine = Math.floor(charactersPerLine), 2442 projectedMaxLines = Math.ceil(text_limit/charactersPerLine); 2443 2444 var splitCaption = full_text.split('<br>'), 2445 linesConsumed = 0, 2446 adjustedTextLimit = 0; 2447 jQuery.each(splitCaption,function() { 2448 2449 var linesLeft = projectedMaxLines - linesConsumed; 2450 if (linesLeft > 0) { 2451 var thisLinesConsumed = Math.max(1,Math.ceil(this.length / charactersPerLine)); 2452 adjustedTextLimit += Math.min(this.length + 4,linesLeft*maxCharsPer
2452Line); 2453 linesConsumed += thisLinesConsumed; 2454 } 2455 }); 2456 text_limit = adjustedTextLimit; 2457 } 2458 2459 var short_text = full_text.substring(0,text_limit); 2460 2461 //Cut the text based on limits set 2462 $post_text.html( sbEncodeHTML(short_text) ); 2463 //Show the 'See More' link if needed 2464 if (full_text.length > text_limit) $self.find('.sbi_expand').show(); 2465 //Click function 2466 $self.find('.sbi_expand a').unbind('click').bind('click', function(e){ 2467 e.preventDefault(); 2468 var $expand = jQuery(this); 2469 if ( $self.hasClass('sbi_caption_full') ){ 2470 $post_text.html( sbEncodeHTML(short_text) ); 2471 $self.removeClass('sbi_caption_full'); 2472 } else { 2473 $post_text.html( sbEncodeHTML(full_text) ); 2474 $self.addClass('sbi_caption_full'); 2475 } 2476 }); 2477 2478 //Photo links 2479 //If lightbox is disabled 2480 if( disablelightbox == 'true' || captionlinks == 'true' ){ 2481 2482 if ( captionlinks == 'true' ) { 2483 function sbiUrlDetect(text) { 2484 var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g; 2485 return text.match(urlRegex); 2486 } 2487 2488 var cap = ''; 2489 if (typeof $self.find('img').attr('alt') !== 'undefined') { 2490 cap = $self.find('img').attr('alt'); 2491 } else if (typeof $self.find('video').attr('alt') !== 'undefined') { 2492 cap = $self.find('video').attr('alt'); 2493 } 2494 2495 var url = sbiUrlDetect(cap); 2496 if(url) { 2497 $self.find('a').attr('href', url); 2498 } 2499 } 2500 $self.find('.sbi_link').addClass('sbi_disable_lightbox'); 2501 //If lightbox is enabled add lightbox links 2502 } else { 2503 2504 var $sbi_photo_wrap = $self.find('.sbi_photo_wrap'), 2505 $sbi_link = $sbi_photo_wrap.find('.sbi_link'); 2506 2507 if(feedOptions.hovereffect == 'none'){ 2508 //launch lightbox on click 2509 $sbi_link.css('background', 'none').show(); 2510 $sbi_link.find('*').hide().end().find('.sbi_link_area').show(); 2511 } else { 2512 //Fade in links on hover 2513 $sbi_photo_wrap.hover(function(){ 2514 //$sbi_link.fadeIn(200); 2515 // css transitions instead 2516 2517 //Zoom effect 2518 $self.addClass('sbi_animate'); 2519 }, function(){ 2520 //$sbi_link.stop().fadeOut(600); 2521 2522 //Zoom effect 2523 $self.removeClass('sbi_animate'); 2524 }); 2525 2526 } 2527 2528 } 2529 2530 }); //End .sbi_item each 2531 2532 //Lightbox hide photo function 2533 jQuery('.sbi_lightbox_action a').unbind().bind('click', function(){ 2534 jQuery(this).parent().find('.sbi_lightbox_tooltip').toggle(); 2535 }); 2536 2537 2538 //Sort posts by date 2539 //only sort the new posts that are loaded in, not the whole feed, otherwise some photos will switch positions due to dates 2540 $self.find('#sbi_images .sbi_item.sbi_new').sort(function (a, b) { 2541 var aComp = jQuery(a).attr("data-date"), 2542 bComp = jQuery(b).attr("data-date"); 2543 2544 if(sortby == 'none'){ 2545 //Order by date 2546 return bComp - aComp; 2547 } else { 2548 //Randomize 2549 return (Math.round(Math.random())-0.5); 2550 } 2551 2552 }).appendTo( $self.find("#sbi_images") ); 2553 2554 //Remove the new class after 500ms, once the sorting is done 2555 setTimeout(function(){ 2556 // jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new').addClass('sbi_fade_in'); 2557 jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new'); 2558 2559 //Reset the morePosts variable so we can check whether there are more posts every time the Load More button is clicked 2560 morePosts = []; 2561 }, 500); 2562 2563 2564 var imagesArrLength = imagesArr.data.length; 2565 //Adjust the imagesArr length to account for the hidden photos 2566 // 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 2567 //Check initially whether we should show the Load More button. If it's co
2567ordinates then if the last API request returns no photos then there are no more to show. 2568 if( ( (imagesArrCount >= imagesArrLength) && noMoreData && (feed.isOutOfPosts || !feed.hasPagination(imagesArr) )) || (getType == 'coordinates' && images.data.length == 0) ){ 2569 $loadBtn.hide(); 2570 } 2571 2572 //If all of the posts in the white list are visible, hide the load button 2573 if(sbiSettings.whiteList.length && ($self.find('.sbi_item').length === sbiSettings.whiteListIds.length)){ 2574 $loadBtn.hide(); 2575 } 2576 2577 //Load More button 2578 $self.find('#sbi_load .sbi_load_btn').off().on('click', function(){ 2579 jQuery(this).find('.sbi_loader').removeClass('sbi_hidden'); 2580 jQuery(this).find('.sbi_btn_text').addClass('sbi_hidden'); 2581 //Reset the photosAvailable var so it can be used again 2582 photosAvailable = 0; 2583 2584 //Check the global var to see where we are in the array 2585 imagesArrCount = parseInt(imagesArrCount); 2586 2587 //Adjust the imagesArr length to account for the hidden photos 2588 imagesArrLength = imagesArr.data.length; 2589 // 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 2590 var numWhiteListIds = feedOptions.sbiWhiteListIds.replace(/ /g,'').split(",").length; 2591 2592 //If there are enough photos left in the array then display them 2593 if( (imagesArrCount + num) < imagesArrLength || feed.isOutOfPosts || noMoreData || (imagesArrCount >= numWhiteListIds && feedOptions.sbiWhiteList !== '' && modMode.status !== true) ){ 2594 2595 if(photosAvailable !== 'finished') sbiBuildFeed(feed, images, feed.transientNames.feed, sbiSettings, $self); 2596 //Unset the flag so that we know not to add these photos to the imagesArr again 2597 sbiNewData = false; 2598 2599 //If there are no photos left in the array and there's no more data to load then hide the load more button 2600 if( ( (imagesArrCount >= imagesArrLength) && noMoreData && (feed.isOutOfPosts || !feed.hasPagination(imagesArr) ) ) || (getType == 'coordinates' && images.data.length == 0) ){ 2601 $loadBtn.hide(); 2602 2603 } 2604 2605 //If all of the posts in the white list are visible, hide the load button 2606 if(sbiSettings.whiteList.length && ($self.find('.sbi_item').length === sbiSettings.whiteListIds.length)){ 2607 $loadBtn.hide(); 2608 } 2609 2610 //Else if there aren't enough photos left then hit the api again 2611 } else { 2612 2613 sbiFetchURL = feed.getNextUrl(imagesArr); 2614 2615 window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'fetched'; 2616 sbiFetchData(sbiFetchURL, feed.transientNames.feed, sbiSettings, $self); 2617 //Set the flag so that we know to add the new photos to the imagesArr 2618 sbiNewData = true; 2619 //Reset this to zero so that we can limit requests to 3 per button click 2620 apiRequests = 0; 2621 } 2622 2623 2624 }); //End click event 2625 if(modMode.status === true) { 2626 if(!modMode.$self.hasClass('sbi_mod_merged')) { 2627 modMode.setOriginalPosition(); 2628 modMode.resizeFeed(); 2629 } 2630 setTimeout(function () { 2631 modMode.$self.find('.sbi_item .sbi_photo').each(function () { 2632 if (!jQuery(this).hasClass('sbi_mod_changed')) { 2633 jQuery(this).click(function (e) { 2634 modMode.changeClickEvent(jQuery(this), e); 2635 }); 2636 jQuery(this).addClass('sbi_mod_changed'); 2637 } 2638 }); 2639 setTimeout(function () { 2640 modMode.addModSettingsHtml(); 2641 if (!modMode.$self.find('.sbi_mod_submit_mod').hasClass('sbi_initialized')) { 2642 modMode.$self.find('.sbi_mod_submit_mod').click(function () { 2643 modMode.submitSelected(); 2644 }); 2645 } 2646 modMode.$self.find('.sbi_mod_submit_mod').addClass('sbi_initialized'); 2647 modMode.$self.find('.sbi_hide_show_radio').click(function () { 2648 modMode.updateHideOrShow(jQuery(this).val()); 2649 modMode.updateDisplay(); 2650 }); 2651 modMode.$self.find('.sbi_mod_block_user').each(function() { 2652 if(!jQuery(this).hasClass('sbi_mod_changed')) { 2653 jQuery(this).click(function () { 2654 modMode.updateBlockUser(jQuery(this)); 2655 modMode.updateDisplay(); 2656 }); 2657 jQuery(this).addClass('sbi_mod_changed'); 2658 } 2659 }); 2660 modMode.$self.find('.sbi_close_mod').click(function () { 2661 modMode.closeMod(); 2662 }); 2663 modMode.replaceInfoHtml(); 2664 // needed for random bug 2665 jQuery('.sbi_item').each(function() { 2666 jQuery(this).css('height',jQuery('.sbi_photo_wrap').innerHeight()+jQuery('.sbi_info').innerHeight()); 2667 }); 2668 modMode.updateDisplay(); 2669 modMode.$self.addClass('sbi_mod_merged'); 2670 modMode.$self.find('.sbi_info').removeClass('sbi_info'); 2671 modMode.initClickCopy(); 2672 }, 600); 2673 2674 }, 350); 2675 } 2676 2677 if(!$self.hasClass('sbi_carousel') && $self.hasClass('sbi_autoscroll')) { 2678 sbiBindAutoScroll($self); 2679 } 2680 2681 // Call Custom JS if it exists 2682 if (typeof sbi_custom_js == 'function') setTimeout(function(){ sbi_custom_js(); }, 100); 2683 2684 if( imgRes !== 'thumbnail' && !$self.hasClass('sbi_masonry') ){
2685 //This needs to be here otherwise it results in the following error for some sites: $self.find(...).sbi_imgLiquid() is not a function. 2686 /*! imgLiquid v0.9.944 / 03-05-2013 https://github.com/karacas/imgLiquid */ 2687 var sbi_imgLiquid=sbi_imgLiquid||{VER:"0.9.944"};sbi_imgLiquid.bgs_Available=!1,sbi_imgLiquid.bgs_CheckRunned=!1,function(i){function t(){if(!sbi_imgLiquid.bgs_CheckRunned){sbi_imgLiquid.bgs_CheckRunned=!0;var t=i('<span style="background-size:cover" />');i("body").append(t),!function(){var i=t[0];if(i&&window.getComputedStyle){var e=window.getComputedStyle(i,null);e&&e.backgroundSize&&(sbi_imgLiquid.bgs_Available="cover"===e.backgroundSize)}}(),t.remove()}}i.fn.extend({sbi_imgLiquid:function(e){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},t();var a=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(t){function e(){-1===u.css("background-image").indexOf(encodeURI(c.attr("src")))&&u.css({"background-image":'url("'+encodeURI(c.attr("src"))+'")'}),u.css({"background-size":g.fill?"cover":"contain","background-position":(g.horizontalAlign+" "+g.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",u).css({display:"block",width:"100%",height:"100%"}),i("img",u).css({display:"none"}),g.onItemFinish&&g.onItemFinish(t,u,c),u.addClass("sbi_imgLiquid_bgSize"),u.addClass("sbi_imgLiquid_ready"),l()}function o(){function e(){c.data("sbi_imgLiquid_error")||c.data("sbi_imgLiquid_loaded")||c.data("sbi_imgLiquid_oldProcessed")||(u.is(":visible")&&c[0].complete&&c[0].width>0&&c[0].height>0?(c.data("sbi_imgLiquid_loaded",!0),setTimeout(r,t*g.delay)):setTimeout(e,g.timecheckvisibility))}if(c.data("oldSrc")&&c.data("oldSrc")!==c.attr("src")){var a=c.clone().removeAttr("style");return a.data("sbi_imgLiquid_settings",c.data("sbi_imgLiquid_settings")),c.parent().prepend(a),c.remove(),c=a,c[0].width=0,void setTimeout(o,10)}return c.data("sbi_imgLiquid_oldProcessed")?void r():(c.data("sbi_imgLiquid_oldProcessed",!1),c.data("oldSrc",c.attr("src")),i("img:not(:first)",u).css("display","none"),u.css({overflow:"hidden"}),c.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),c.on("error",n),c[0].onerror=n,e(),void d())}function d(){(g.responsive||c.data("sbi_imgLiquid_oldProcessed"))&&c.data("sbi_imgLiquid_settings")&&(g=c.data("sbi_imgLiquid_settings"),u.actualSize=u.get(0).offsetWidth+u.get(0).offsetHeight/1e4,u.sizeOld&&u.actualSize!==u.sizeOld&&r(),u.sizeOld=u.actualSize,setTimeout(d,g.responsiveCheckTime))}function n(){c.data("sbi_imgLiquid_error",!0),u.addClass("sbi_imgLiquid_error"),g.onItemError&&g.onItemError(t,u,c),l()}function s(){var i={};if(a.settings.useDataHtmlAttr){var t=u.attr("data-sbi_imgLiquid-fill"),e=u.attr("data-sbi_imgLiquid-horizontalAlign"),o=u.attr("data-sbi_imgLiquid-verticalAlign");("true"===t||"false"===t)&&(i.fill=Boolean("true"===t)),void 0===e||"left"!==e&&"center"!==e&&"right"!==e&&-1===e.indexOf("%")||(i.horizontalAlign=e),void 0===o||"top"!==o&&"bottom"!==o&&"center"!==o&&-1===o.indexOf("%")||(i.verticalAlign=o)}return sbi_imgLiquid.isIE&&a.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}function r(){var i,e,a,o,d,n,s,r,m=0,h=0,f=u.width(),v=u.height();void 0===c.data("owidth")&&c.data("owidth",c[0].width),void 0===c.data("oheight")&&c.data("oheight",c[0].height),g.fill===f/v>=c.data("owidth")/c.data("oheight")?(i="100%",e="auto",a=Math.floor(f),o=Math.floor(f*(c.data("oheight")/c.data("owidth")))):(i="auto",e="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
2687d&&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); 2688 2689 // Use imagefill to set the images as backgrounds so they can be square 2690 !function () { 2691 var css = sbi_imgLiquid.injectCss, 2692 head = document.getElementsByTagName('head')[0], 2693 style = document.createElement('style'); 2694 style.type = 'text/css'; 2695 if (style.styleSheet) { 2696 style.styleSheet.cssText = css; 2697 } else { 2698 style.appendChild(document.createTextNode(css)); 2699 } 2700 head.appendChild(style); 2701 }(); 2702 if (!$self.hasClass('sbi_masonry')) { 2703 $self.find(".sbi_photo").sbi_imgLiquid({fill:true}); 2704 } 2705 } 2706 2707 //Only check the width once the resize event is over 2708 var sbi_delay = (function(){ 2709 var sbi_timer = 0; 2710 return function(sbi_callback, sbi_ms){ 2711 clearTimeout (sbi_timer); 2712 sbi_timer = setTimeout(sbi_callback, sbi_ms); 2713 }; 2714 })(); 2715 2716 jQuery(window).resize(function(){ 2717 sbi_delay(function(){ 2718 sbiSetPhotoHeight(); 2719 sbiGetItemSize(); 2720 2721 jQuery('.sbi').each(function() { 2722 var $sbiSelf = jQuery(this), 2723 $i = jQuery(this).attr('data-sbi-index'); 2724 2725 if ($sbiSelf.attr('data-res') === 'auto') { 2726 var oldRes = window.sbiFeedMeta[$i].minRes; 2727 var imageSize = sbiGetResolutionSettings(feed, $sbiSelf, 'auto', cols, colsmobile, $i), 2728 width = imageSize.width !== '' ? imageSize.width : sbiGetWidthForResType(imageSize.type); 2729 2730 if (sbiNeedToRaiseRes(width,oldRes)) { 2731 window.sbiFeedMeta[$i].minRes = 640; 2732 $sbiSelf.find('.sbi_item').each(function() { 2733 var newUrl = jQuery(this).find('.sbi_link_area').length ? jQuery(this).find('.sbi_link_area').attr('href') : ''; 2734 var oldUrl = jQuery(this).find('.sbi_photo img').attr('src'), 2735 newRes = 640, 2736 $photo = jQuery(this); 2737 if (newUrl === '') { 2738 if (oldUrl.indexOf('p'+oldRes+'x'+oldRes) > -1) { 2739 newUrl = oldUrl.replace('p'+oldRes+'x'+oldRes,'p'+newRes+'x'+newRes); 2740 } else if(oldUrl.indexOf('s'+oldRes+'x'+oldRes) > -1) { 2741 newUrl = oldUrl.replace('s'+oldRes+'x'+oldRes,'s'+newRes+'x'+newRes); 2742 } 2743 } 2744 2745 $photo.find('.sbi_photo img').attr('src',newUrl); 2746 $photo.find('.sbi_photo').css('background-image','url("'+newUrl+'")'); 2747 }); 2748 } 2749 } 2750 }); 2751 2752 }, 500); 2753 }); 2754 2755 //Resize image height 2756 function sbiSetPhotoHeight(){ 2757 var isHighlight = $self.hasClass('sbi_highlight'), 2758 isMasonry = $self.hasClass('sbi_masonry'); 2759 2760 if( imgRes !== 'thumbnail' && !isMasonry ){ 2761 var sbi_photo_width = $self.find('.sbi_photo').eq(0).innerWidth(); 2762 2763 //Figure out number of columns for either desktop or mobile 2764 var sbi_num_cols = sbiGetColumnCount($self, parseInt(cols), parseInt(colsmobile)); 2765 2766 //Figure out what the width should be using the number of cols 2767 var imagesPadding = jQuery('#sbi_images').innerWidth() - jQuery('#sbi_images').width(), 2768 sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - imagesPadding; 2769 //If the width is less than it should be then set it manually 2770 if( sbi_photo_width <= (sbi_photo_width_manual) ) sbi_photo_width = sbi_photo_width_manual; 2771 2772 $self.find('.sbi_photo').css('height', sbi_photo_width); 2773 2774 //Set the position of the carousel arrows 2775 setTimeout(function(){ 2776 //If there's 2 rows then adjust position 2777 var sbi_ratio = 2; 2778 if( $self.find('.sbi_owl2row-item').length ) sbi_ratio = 1; 2779 2780 var sbi_arrows_top = ($self.find('.sbi_photo').eq(0).innerWidth()/sbi_ratio); 2781 if(imagepaddingunit == 'px') sbi_arrows_top += parseInt(imagepadding)*(2+(2-sbi_ratio)); 2782 $self.find('.sbi-owl-nav div').css('top', sbi_arrows_top); 2783 }, 100); 2784 } 2785 if (isMasonry || isHighlight) { 2786 2787 var highlight = feedOptions.highlight.split(','); 2788 sbiMasonrySetSizes($self, cols, colsmobile, highlight, isHighlight); 2789 if ($self.find('#sbi_images').data('smashotope')) { 2790 $self.find('#sbi_images').smashotope('layout'); 2791 } 2792 2793 var $container = $self.find('#sbi_images'), 2794 columnWidth = '.sbi_item', 2795 calcCols = sbiGetColumnCount($self, parseInt(cols), parseInt(colsmobile)); 2796 if (isHighlight) { 2797 columnWidth = $container.width() / calcCols; 2798 } 2799 2800 $container.smashotope({ 2801 itemSelector: '.sbi_item', 2802 layoutMode: 'packery', 2803 transitionDuration: 0, 2804 // options... 2805 resizable: false, // disable normal resizing 2806 // set columnWidth to a percentage of container width 2807 masonry: { columnWidth: columnWidth } 2808 }); 2809 2810 } 2811 2812 } 2813 if(carousel == false) sbiSetPhotoHeight(); 2814 2815 /* Detect when element becomes visible. Used for when the feed
2815is initially hidden, in a tab for example. https://github.com/shaunbowe/jquery.visibilityChanged */ 2816 !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); 2817 2818 //If the feed is initially hidden (in a tab for example) then check for when it becomes visible and set then set the height 2819 jQuery(".sbi").filter(':hidden').sbiVisibilityChanged({ 2820 callback: function(element, visible) { 2821 sbiSetPhotoHeight(); 2822 sbiGetItemSize(); 2823 }, 2824 runOnLoad: false 2825 }); 2826 2827 if(carousel == true){ 2828 setTimeout(function(){ 2829 //Initiate carousel 2830 if( !carouselautoplay ) carouseltime = false; 2831 2832 //Set defaults for responsive breakpoints 2833 var itemsTabletSmall = cols, 2834 itemsMobile = cols, 2835 arrows = carouselarrows ? 'onhover' : 'hide', 2836 autoplay = carouseltime !== false, 2837 has2rows = (carouselrows == 2), 2838 loop = (!carouselloop), 2839 afterUpdate = function() { 2840 setTimeout(function(){ 2841 sbiSetPhotoHeight(); 2842 sbiGetItemSize(); 2843 }, 250); 2844 }, 2845 afterInit = function() { 2846 sbSVGify($self); 2847 jQuery('#sb_instagram #sbi_images.sbi_carousel').fadeIn(); 2848 setTimeout(function(){ 2849 2850 sbiSetPhotoHeight(); 2851 sbiGetItemSize(); 2852 jQuery('#sb_instagram #sbi_images.sbi_carousel .sbi_info, .sbi_owl2row-item,#sb_instagram #sbi_images.sbi_carousel').fadeIn(); 2853 }, 50); 2854 2855 setTimeout(function(){ 2856 2857 var $navElementsWrapper = $self.find('.sbi-owl-nav'); 2858 if (arrows === 'onhover') { 2859 2860 } else if (arrows === 'below') { 2861 var $dots = $ctf.find('.ctf-owl-dots'), 2862 $prev = $ctf.find('.ctf-owl-prev'), 2863 $next = $ctf.find('.ctf-owl-next'), 2864 $nav = $ctf.find('.ctf-owl-nav'), 2865 $dot = $ctf.find('.ctf-owl-dot'), 2866 widthDots = $dot.length * $dot.innerWidth(), 2867 maxWidth = $ctf.innerWidth(); 2868 2869 $prev.after($dots); 2870 2871 $nav.css('position', 'relative'); 2872 $next.css('position', 'absolute').css('top', '-6px').css('right', Math.max((.5 * $nav.innerWidth() - .5 * (widthDots) - $next.innerWidth() - 6), 0)); 2873 $prev.css('position', 'absolute').css('top', '-6px').css('left', Math.max((.5 * $nav.innerWidth() - .5 * (widthDots) - $prev.
2873innerWidth() - 6), 0)); 2874 } else if (arrows === 'hide') { 2875 $navElementsWrapper.addClass('hide').hide(); 2876 } 2877 sbSVGify($navElementsWrapper); 2878 }, 100); 2879 }; 2880 2881 //Disable mobile layout 2882 if( $self.hasClass('sbi_mob_col_auto') ) { 2883 itemsTabletSmall = 2; 2884 if( parseInt(cols) != 2 ) itemsMobile = 1; 2885 if( parseInt(cols) == 2 ) itemsMobile = 2; //If the cols are set to 2 then don't change to 1 col on mobile 2886 } else { 2887 itemsMobile = colsmobile; 2888 } 2889 2890 $self.find(".sbi_carousel").sbiOwlCarousel({ 2891 items: cols, 2892 loop: loop, 2893 rewind: !loop, 2894 autoplay: autoplay, 2895 autoplayTimeout: Math.max(carouseltime,2000), 2896 autoplayHoverPause: true, 2897 nav: true, 2898 navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'], 2899 dots: carouselpag, 2900 owl2row: has2rows, 2901 responsive: { 2902 0: { 2903 items: itemsMobile 2904 }, 2905 480: { 2906 items: itemsTabletSmall 2907 }, 2908 640: { 2909 items: cols 2910 } 2911 }, 2912 onUpdate: afterUpdate, 2913 onInitialize: afterInit 2914 }); 2915 2916 }, 100); 2917 2918 2919 } // End carousel 2920 2921 function sbiGetItemSize(){ 2922 $self.removeClass('sbi_small sbi_medium'); 2923 var sbiItemWidth = $self.find('.sbi_item').innerWidth(); 2924 if( sbiItemWidth > 120 && sbiItemWidth < 240 ){ 2925 $self.addClass('sbi_medium'); 2926 } else if( sbiItemWidth <= 120 ){ 2927 $self.addClass('sbi_small'); 2928 } 2929 } 2930 2931 if(carousel !== true) sbiGetItemSize(); 2932 // caching done at the end of all posts in the images Array 2933 imagesArr.nextCursors = feed.nextCursor; 2934 if (typeof feed.settings.resizing !== 'undefined') { 2935 feed.needsResizedImages = []; 2936 } 2937 if (feed.needsFirstPageLoad) { 2938 feed.needsFirstPageLoad = false; 2939 var pageID = typeof feed.settings.pageID !== 'undefined' ? feed.settings.pageID : 0; 2940 _cache(imagesArr,feed.transientNames.feed,feed.getFirstPageLoad(imagesArr),true,pageID); // cache_all_posts 2941 } else if ((feedOptions.disablecache === false || feedOptions.disablecache === 'false') && typeof _c
2941ache !== 'undefined' && (window.sbiCacheStatuses[feedOptions.feedIndex].feed === 'fetched' || feed.newFeedData) ) { 2942 feed.newFeedData = false; 2943 _cache(imagesArr,feed.transientNames.feed,feed.needsResizedImages,false); // cache_all_posts 2944 window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'cached'; 2945 } else if (feed.needsResizedImages.length > 0) { 2946 sbiMaybeResizeImages(feed.needsResizedImages, feed.transientNames.feed); 2947 } 2948 feed.needsResizedImages = []; 2949 2950 if (!$self.find('.sbi_item').length && modMode.status === false && !$self.find('.sbi_too_much').length && !$self.find('.sbi_no_posts').length) { 2951 2952 $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" rel="noopener">this FAQ article</a> for some possible solutions</div>'); 2953 //sbi_set_use_backup 2954 var submittedData = { 2955 action: 'sbi_set_use_backup', 2956 transientName : feed.transientNames.feed 2957 }; 2958 jQuery.ajax({ 2959 url: sbiajaxurl, 2960 type: 'post', 2961 data: submittedData, 2962 success: function (data) { 2963 } 2964 }); // ajax 2965 } 2966 2967 // prevent sbiImagesReady from running code to get and display more posts 2968 photosAvailable = 'finished'; 2969 2970 2971 var isHighlight = $self.hasClass('sbi_highlight'), 2972 isMasonry = $self.hasClass('sbi_masonry'); 2973 if (isHighlight || isMasonry) { 2974 2975 var layoutDelay = 0; 2976 2977 //If it's masonry then delay the reveal transition by a second to allow the items to be positioned 2978 if( isMasonry ){ 2979 layoutDelay = 1000; 2980 //Initiate the smashotope layout initially 2981 $self.find('#sbi_images').smashotope('layout'); 2982 } 2983 2984 //Re-initiate the smashotope layout multiple times 2985 setTimeout(function() { 2986 $self.find('#sbi_images').smashotope('layout'); 2987 2988 //Loop through items and remove class to reveal them after they've been laid out 2989 var time = 10; 2990 $self.find('.sbi_transition').each(function() { 2991 var $sbi_item_transition_el = jQuery(this); 2992 setTimeout( function(){ 2993 $sbi_item_transition_el.removeClass('sbi_transition'); 2994 }, time) 2995 time += 10; 2996 }); 2997 }, layoutDelay); 2998 2999 setTimeout(function() { 3000 $self.find('#sbi_images').smashotope('layout'); 3001 }, 1500); 3002 setTimeout(function() { 3003 $self.find('#sbi_images').smashotope('layout'); 3004 }, 2000); 3005 3006 // Lay out the items again after clicking to see more text 3007 $self.find('.sbi_more').click(function() { 3008 setTimeout(function () { 3009 $self.find('#sbi_images').smashotope('layout'); 3010 }, 200); 3011 }); 3012 } 3013 3014 sbSVGify($self); 3015 3016 } // End sbiAfterImagesLoaded() function 3017 3018 3019 } //End buildFeed function 3020 3021 function commaSeparateNumber(val){ 3022 while (/(\d+)(\d{3})/.test(val.toString())){ 3023 val = val.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2'); 3024 } 3025 return val; 3026 } 3027 3028 function sbiBuildHeader(data, sbiSettings){ 3029 3030 if(typeof data.meta === 'object' && typeof data.meta.error_message !== 'undefined') return; 3031 3032 if (typeof feed.availableAvatarUrls[data.username] === 'undefined') { 3033 feed.availableAvatarUrls[data.username] = data.profile_picture_url; 3034 } 3035
3036 var feedOptions = sbiSettings.feedOptions, 3037 headerType = feedOptions.headerstyle, 3038 headerClasses = ''; 3039 3040 var headerStyles = feedOptions.headercolor.length ? 'style="color: #'+feedOptions.headercolor+'"' : ''; 3041 if( ( ( !feed.hasBio(data) ) || feedOptions.showbio != 'true' ) && feedOptions.showfollowers != 'true' ) { 3042 headerClasses += ' sbi_no_info'; 3043 } 3044 if( ( !feed.hasBio(data) ) || feedOptions.showbio != 'true' ) { 3045 headerClasses += ' sbi_no_bio'; 3046 } 3047 3048 $header = '<a href="https://instagram.com/'+feed.getUser(data)+'" target="_blank" rel="noopener" title="@'+feed.getUser(data)+'" class="sbi_header_link" '+headerStyles+'>'; 3049 if (headerType === 'centered') { 3050 $header += '<div class="sbi_header_img">'; 3051 $header += '<div class="sbi_header_img_hover"><i class="sbi_new_logo"></i></div>'; 3052 $header += '<img src="'+feed.getAvatarUrl(data)+'" alt="'+sbEncodeHTML(feed.getName(data))+'" width="50" height="50">'; 3053 $header += '</div>'; 3054 } 3055 $header += '<div class="sbi_header_text' + headerClasses + '">'; 3056 $header += '<h3 '+headerStyles+'>'+sbEncodeHTML(feed.getUser(data))+'</h3>'; 3057 //Compile and add the header info 3058 var $headerInfo = '<p class="sbi_bio_info" '; 3059 if(feedOptions.headerstyle == 'boxed'){ 3060 $headerInfo += 'style="color: #' + feedOptions.headerprimarycolor + ';"'; 3061 } else { 3062 $headerInfo += headerStyles; 3063 } 3064 if (feed.hasCounts(data)) $headerInfo += '><span class="sbi_posts_count"><i class="fa fa-image"></i>'+commaSeparateNumber(feed.getMediaCounts(data))+'</span><span class="sbi_followers"><i class="fa fa-user"></i>'+commaSeparateNumber(feed.getFollowersCounts(data))+'</span></p>'; 3065 3066 if(feedOptions.showfollowers != '' && feedOptions.showfollowers != 'false' && feedOptions.headerstyle !== 'boxed') $header += $headerInfo; 3067 3068 //Add the bio 3069 if( feed.hasBio(data) && feedOptions.showbio != '' && feedOptions.showbio != 'false' ) $header += '<p class="sbi_bio" '+headerStyles+'>'+sbEncodeHTML(feed.getBio(data))+'</p>'; 3070 $header += '</div>'; 3071 if (headerType !== 'centered') { 3072 $header += '<div class="sbi_header_img">'; 3073 $header += '<div class="sbi_header_img_hover"><i class="sbi_new_logo"></i></div>'; 3074 $header += '<img src="'+feed.getAvatarUrl(data)+'" alt="'+sbEncodeHTML(feed.getName(data))+'" width="50" height="50">'; 3075 $header += '</div>'; 3076 } 3077 3078 $header += '</a>'; 3079 if(feedOptions.headerstyle == 'boxed') { 3080 $header += '<div class="sbi_header_bar" style="background: #'+feedOptions.headersecondarycolor+'">'; 3081 if(feedOptions.showbio != 'false') $header += $headerInfo; 3082 $header += '<a class="sbi_header_follow_btn" href="https://instagram.com/'+feed.getUser(data)+'" target="_blank" rel="noopener" style="color: #'+feedOptions.headercolor+'; background: #'+feedOptions.headerprimarycolor+';"><i class="sbi_new_logo"></i><span></span></div></div>'; 3083 } 3084 3085 //Add the header to the feed 3086 if( $self.find('.sbi_header_link').length == 0 ) $self.find('.sb_instagram_header').prepend( $header ); 3087 3088 //Change the URL of the follow button 3089 if( $self.find('.sbi_follow_btn').length ) $self.find('.sbi_follow_btn a').attr('href', 'https://instagram.com/' + feed.getUser(data) ); 3090 //Change the text of the header follow button 3091 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, "") ); 3092 3093 3094 //Header profile pic hover 3095 $self.find('.sb_instagram_header .sbi_header_link').hover(function(){ 3096 $self.find('.sb_instagram_header .sbi_header_img_hover').addClass('sbi_fade_in'); 3097 }, function(){ 3098 $self.find('.sb_instagram_header .sbi_header_img_hover').removeClass('sbi_fade_in'); 3099 }); 3100 3101 sbSVGify($self.find('.sb_instagram_header')); 3102 } // End sbiBuildHeader() 3103 3104 3105 function sbiFetchData(next_url, transientName, sbiSettings, $self) { 3106 apiURLs = next_url; 3107 var urlCount = apiURLs.length,
3108 getType = sbiSettings.getType; 3109 3110 //If the apiURLs array is empty then this means that there's no more next_urls and so hide the load more button 3111 if (feed.available > 0 && urlCount == 0) { // currently on a first page load cache 3112 window.sbiCacheStatuses[feedOptions.feedIndex].feed = true; 3113 sbiGetCache(feed, feed.transientNames.feed, sbiSettings, $self, 'feed', apiURLs, true); 3114 } else if (urlCount == 0){ 3115 3116 if (typeof imagesArr !== 'undefined') { 3117 //Don't hit the API any more 3118 //If there's no more photos to retrieve then hide the load more button 3119 var imagesArrLength = typeof imagesArr.data !== 'undefined' ? imagesArr.data.length : 0; 3120 if( imagesArrCount + parseInt(sbiSettings.num) >= imagesArrLength ){ 3121 //Hide the Load More button 3122 jQuery('#sbi_load .sbi_load_btn').hide(); 3123 } 3124 } else { 3125 data = 'error'; 3126 } 3127 3128 } else { 3129 3130 var returnedImages = [], 3131 numberOfRequests = urlCount; 3132 jQuery.each(apiURLs, function(index, entry){ 3133 if (typeof entry === 'string' && entry.indexOf('https://api.instagram.com/v1') === 0) { 3134 jQuery.ajax({ 3135 method: "GET", 3136 url: entry, 3137 dataType: "jsonp", 3138 success: function(data) { 3139 //Pretty error messages 3140 var sbiErrorResponse = data.meta.error_message, 3141 sbiErrorMsg = '', 3142 sbiErrorDir = ''; 3143 3144 if(typeof sbiErrorResponse !== 'undefined'){ 3145 3146 if( sbiErrorResponse.indexOf('access_token') > -1 ){ 3147 sbiErrorMsg += '<p><b>Error: Access Token is not valid or has expired</b><br /><span>This error message is only visible to WordPress admins</span></p>'; 3148 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' rel='noopener'>this FAQ</a> for more information.</p>"; 3149 jQuery('#sb_instagram').empty().append( '<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>'); 3150 var splitUp = entry.split('?'), 3151 splitUp = splitUp[1].split('&'), 3152 accessTokenExpired = splitUp[0].replace('access_token=',''); 3153 sbiAddTokenToExpiredList(accessTokenExpired); 3154 var submittedData = { 3155 action: 'sbi_set_use_backup', 3156 transientName : feed.transientNames.feed 3157 }; 3158 jQuery.ajax({ 3159 url: sbiajaxurl, 3160 type: 'post', 3161 data: submittedData, 3162 success: function (data) { 3163 } 3164 }); // ajax 3165 return; 3166 } else if( sbiErrorResponse.indexOf('retired') > -1 ){ 3167 sbiErrorMsg += '<p><b>No longer possible to display this feed</b><br /><span>This error message is only visible to WordPress admins</span></p>'; 3168 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' rel='noopener'>this post</a> for more information.</p>"; 3169 jQuery('#sb_instagram').empty().append( '<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>'); 3170 return; 3171 //requests per hour 3172 } else if( sbiErrorResponse.indexOf('user does not exist') > -1 || sbiErrorResponse.indexOf('you cannot view this resource') > -1 ){ 3173 window.sbiFeedMeta[$i].error = { 3174 errorMsg : '<p><b>Error: User ID <span class="sbiErrorIds">'+window.sbiFeedMeta[$i].idsInFeed[index]+'</span>
3174 does not exist, is invalid, or is private</b><br /><span>This error is only visible to WordPress admins</span>', 3175 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' rel='noopener'>tool</a>.</p>" 3176 }; 3177 if (!$self.find('#sbi_mod_error').length) { 3178 $self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>'); 3179 } else if ($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index]) == -1) { 3180 $self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index]); 3181 } 3182 data = 'error'; 3183 } else if( sbiErrorResponse.indexOf('invalid media id') > -1 ){ 3184 window.sbiFeedMeta[$i].error = { 3185 errorMsg : '<p><b>Error: Post Id <span class="sbiErrorIds">'+window.sbiFeedMeta[$i].idsInFeed[index]+'</span> does not exist or is invalid</b><br /><span>This error is only visible to WordPress admins.</span>', 3186 errorDir : "<p>Please double check the media (post) id is correct.</p>" 3187 }; 3188 if (!$self.find('#sbi_mod_error').length) { 3189 $self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>'); 3190 } else if ($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index]) == -1) { 3191 $self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index]); 3192 } 3193 data = 'error'; 3194 } 3195 3196 } 3197 3198 //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 3199 if (data !== 'error') returnedImages.push(data); 3200 feed.addPosts('user',data); 3201 3202 numberOfRequests--; 3203 if(numberOfRequests == 0 && photosAvailable !== 'finished') sbiImagesReady(getType); 3204 } 3205 3206 }) 3207 } else { // is just an ID of a business post 3208 3209 if (typeof entry.hashtag !== 'undefined') { 3210 var data = { 3211 action: 'sbi_get_business_posts', 3212 transient_name: feed.transientNames.feed, 3213 hashtag: entry.hashtag, 3214 hashtag_id: entry.hashtag_id, 3215 order: feed.settings.order, 3216 url: '' 3217 }; 3218 if ( typeof feed.nextCursor[entry.hashtag] !== 'undefined' && feed.nextCursor[entry.hashtag] !== '') { 3219 data.url = feed.nextCursor[entry.hashtag] 3220 } 3221 } else { 3222 var data = { 3223 action: 'sbi_get_business_posts', 3224 transient_name: feed.transientNames.feed, 3225 user_id: entry.account, 3226 url: '', 3227 num: 33 3228 }; 3229 if ( typeof feed.nextCursor[entry.account] !== 'undefined' && feed.nextCursor[entry.account] !== '') { 3230 data.url = feed.nextCursor[entry.account] 3231 } 3232 if (feed.settings.includewords !== '') { 3233 data.num = 100 3234 } 3235 } 3236 if ((typeof entry.hashtag !== 'undefined') || (typeof entry.account !== 'undefined')) { 3237 jQuery.ajax({ 3238 url: sbiajaxurl, 3239 type: 'POST', 3240 cache: false, 3241 data: data, 3242 success: function (data) { 3243 if (data.trim().indexOf('{') === 0) { 3244 3245 var jsonobj = JSON.parse(data); 3246 3247 if (typeof jsonobj.data !== 'undefined') { 3248 if (typeof entry.account !== 'undefined') { 3249 jsonobj.account = entry.account; 3250 jsonobj.user_id = entry.account; 3251 jsonobj.hashtag = ''; 3252 feed.addPosts('user',jsonobj.data); 3253 } else if (typeof entry.hashtag !== 'undefined') { 3254 jsonobj.account = ''; 3255 jsonobj.hashtag_id = entry.hashtag_id; 3256 jsonobj.hashtag = entry.hashtag; 3257 feed.addPosts('hashtag',jsonobj.data); 3258 } 3259 3260 if (typeof jsonobj.paging === 'undefined' || typeof jsonobj.paging.cursors === 'undefined' || jsonobj.paging.cursors.after === 'undefined' || jsonobj.paging.cursors.after === '') { 3261 feed.isOutOfPosts = true; 3262 if (typeof entry.hashtag !== 'undefined') { 3263 feed.nextCursor[entry.hashtag] = ''; 3264 } else { 3265 feed.nextCursor[entry.account] = ''; 3266 } 3267 } else if (jsonobj.data.length === 0) { 3268 feed.isOutOfPosts = true; 3269 if (typeof entry.hashtag !== 'undefined') { 3270 feed.nextCursor[entry.hashtag] = ''; 3271 } else { 3272 feed.nextCursor[entry.account] = ''; 3273 } 3274 } else { 3275 if (typeof entry.hashtag !== 'undefined') { 3276 feed.nextCursor[entry.hashtag] = jsonobj.paging.cursors.after; 3277 } else { 3278 feed.nextCursor[entry.account] = jsonobj.paging.cursors.after; 3279 } 3280 } 3281 3282 returnedImages.push(jsonobj); 3283 feed.newFeedData = true; 3284 window.sbiCacheStatuses[$i].feed = 'fetched'; 3285 } else { 3286 3287 if (typeof jsonobj.error !== 'undefined' ) { 3288 3289 var errorHtml = '<div id="sbi_mod_error" class="sbi_settings_errors"><p>'+jsonobj.error.message; 3290 if (typeof jsonobj.error.code !== 'undefined') { 3291 errorHtml +=' <br>Error Code: ' +jsonobj.error.code; 3292 } 3293 if (typeof jsonobj.error.error_user_title !== 'undefined') { 3294 errorHtml +=' <br>' +jsonobj.error.error_user_title; 3295 } 3296 if (typeof jsonobj.error.error_user_msg !== 'undefined') { 3297 errorHtml +=' <br>' +jsonobj.error.error_user_msg; 3298 } 3299 errorHtml +='</p></div>'; 3300 jQuery(feed.el).find('#sbi_images').prepend(errorHtml); 3301 3302 } 3303 3304 } 3305 } 3306 3307 numberOfRequests--; 3308 if(numberOfRequests == 0 && photosAvailable !== 'finished') sbiImagesReady(getType); 3309 3310 }, 3311 error: function (xhr, textStatus, e) { 3312 console.log(e); 3313 return; 3314 } 3315 }); 3316 } 3317 3318 3319 3320 } 3321 3322 3323 }); 3324 3325 //When all of the images have been returned then pass them to the buildFeed function 3326 function sbiImagesReady(getType){ 3327 3328 var paginationArr = [], 3329 returnedImagesArr = []; 3330 3331 //Loop through the array of returned sets of data from the Instagram API 3332 jQuery.each( returnedImages, function( index, object ) { 3333 3334 if (typeof object.data !== 'undefined'){ //Check whether the returned object has data in it as error may be returned it 3335 if (Array.isArray(object.data) === false) { 3336 object.data = [ object.data ] ; 3337 } 3338 //Loop through each image object in the array and add it to the returnedImagesArr for sorting 3339 jQuery.each( object.data, function( index, image ) { 3340 feed.oneImageReturned = true; 3341 //Filter out duplicate images here. This is after the items have been counted (used below for c
3341oordinates pagination) but before being cached as duplicate images don't need to be cached. 3342 if( jQuery.inArray(feed.getPostID(image), photoIds) > -1 ){ 3343 //Duplicate image 3344 } else { 3345 photoIds.push(feed.getPostID(image)); 3346 returnedImagesArr.push( image ); 3347 } 3348 }); 3349 3350 if (!feed.oneImageReturned && jQuery(feed.el).find('.sbi_item').length < 1) { 3351 if (feed.settings.order === 'recent' && feed.settings.type === 'hashtag') { 3352 jQuery(feed.el).prepend('<div id="sbi_mod_error" class="sbi_no_posts">No posts found. Hashtag feeds with the order set to "recent" will only display posts made within the last 24 hours initially.</div>'); 3353 } else { 3354 jQuery(feed.el).prepend('<div id="sbi_mod_error" class="sbi_no_posts">No posts found. Make sure that public posts are available for this account or hashtag.</div>'); 3355 } 3356 } 3357 3358 3359 if(getType == 'coordinates'){ 3360 //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 3361 3362 //Get the created_date of the last object so we can use it to create the next_url 3363 var new_url = ''; 3364 if (feed.getPreviousUrl(object.data)) { 3365 var lastCreatedTime = feed.getTimestamp(object.data[ object.data.length - 1 ]), 3366 existing_url = feed.getPreviousUrl( object ), 3367 existing_url_parts = existing_url.split('max_timestamp='); 3368 new_url = existing_url_parts[0] + 'max_timestamp=' + lastCreatedTime; 3369 } 3370 3371 //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 3372 paginationArr.push( new_url ); 3373 3374 } else { 3375 if (feed.hasPagination(object)) { 3376 paginationArr.push(feed.getNextUrl(object)); 3377 feed.isOutOfPosts = false; 3378 } else { 3379 feed.isOutOfPosts = true; 3380 } 3381 3382 } 3383 3384 } 3385 3386 }); 3387 3388 3389 3390 //Sort the images by date if not set to random 3391 3392 if(sortby !== 'random') { 3393 if (feed.types.length > 1 && feed.types.includes('hashtag')) { 3394 var numPosts = 100, 3395 numFeeds = feed.types.length; 3396 var returnedImagesTempArr = []; 3397 for (var i=0;i < numPosts;i++) { 3398 for (var ii=0;ii < numFeeds;ii++) { 3399 if (typeof feed.posts[ii][i] !== 'undefined') { 3400 returnedImagesTempArr.push(feed.posts[ii][i]); 3401 } 3402 } 3403 } 3404 returnedImagesArr = returnedImagesTempArr; 3405 3406 } else { 3407 returnedImagesArr.sort(function(x, y){ 3408 return feed.getTimestamp(y) - feed.getTimestamp(x); 3409 }); 3410 } 3411 3412 } else { 3413 returnedImagesArr.sort(function (a, b) { 3414 //Randomize 3415 return (Math.round(Math.random())-0.5); 3416 }); 3417 } 3418 3419 //Add the data and pagination objects to the first object in the array so that we can create a super object to send back 3420 if (typeof returnedImages !== 'undefined' && returnedImages.length > 0) { 3421 returnedImages[0].data = returnedImagesArr; 3422 } else { 3423 return; 3424 } 3425 3426 if(!feed.isOutOfPosts) { 3427 //if( typeof returnedImages[0].pagination.next_url !== 'undefined' ) { 3428 returnedImages[0].pagination = { 3429 "next_url" : paginationArr 3430 }; 3431 //} 3432 } else { 3433 returnedImages[0].pagination = { 3434 "next_url" : "" 3435 }; 3436 } 3437 var allImages = returnedImages[0]; 3438 //Pass the returned images to the buildFeed function 3439 3440 if(photosAvailable !== 'finished') sbiBuildFeed(feed, allImages, feed.transientNames.feed, sbiSettings, $self); 3441 3442 //Iterate the API request variable so that we can limit of the number of subsequent API requests when the Load More button is clicked 3443 apiRequests++; 3444 3445 } // End sbiImagesReady() 3446 3447 } 3448 3449 } //End sbiFetchData() 3450 3451 //Cache the likes and comments counts by sending an array via ajax to the main plugin file which then stores it in a transient 3452 function sbiGetCache(feed, transientName, sbiSettings, $self, cacheWhat, apiURLs, fpl){ 3453 feed.available = 0; 3454 var transientData = feed.transientNames.feed; 3455 window.sbiCommentCacheStatus = 0; 3456 var thisIndex = $self[0].getAttribute('data-sbi-index'), 3457 offset = feed.personalAccessTokensArr.length === 0 ? $self.find('.sbi_item').length : 0, 3458 fpl = typeof fpl !== 'undefined' ? fpl : false; 3459 3460 // our initial request now sends all transient names at once 3461 if (typeof transientName === 'object') { 3462 transientData = JSON.stringify(transientName); 3463 } 3464 var getCacheOpts = { 3465 url: sbiajaxurl, 3466 type: 'POST', 3467 async: true, 3468 cache: false, 3469 data:{ 3470 action: 'get_cache', 3471 transientName: transientData, 3472 offset: offset, 3473 fpl: fpl, 3474 useBackupHeader: window.sbiUseBackup[thisIndex].header, 3475 useBackupFeed: window.sbiUseBackup[thisIndex].feed 3476 }, 3477 success: function(data) { 3478 3479 //Decode the JSON to that it can be used again 3480 data = decodeURI(data); 3481 data = data.replace(/\\'/g, "'"); 3482 3483 //Replace any escaped single quotes as it results in invali
3483d JSON 3484 3485 data = data.replace(/\\'/g, "'"); 3486 //Convert the cached JSON string back to a JSON object 3487 var jsonobj = JSON.parse( data ); 3488 if ( cacheWhat == 'all' ) { 3489 if (typeof jsonobj.header.error === 'undefined') { 3490 sbiBuildHeader(jsonobj.header, sbiSettings); 3491 } 3492 if (typeof jsonobj.feed.error === 'undefined') { 3493 if (typeof jsonobj.resized_images !== 'undefined') { 3494 feed.resizedImages = jsonobj.resized_images; 3495 } 3496 if(photosAvailable !== 'finished') sbiBuildFeed(feed, jsonobj.feed, feed.transientNames.feed, sbiSettings, $self); 3497 if (typeof jsonobj.warning !== 'undefined') { 3498 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>'; 3499 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>"; 3500 jQuery('#sb_instagram').before('<div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>'); 3501 } 3502 } else { 3503 // get the index of the feed to check what processes have been done already 3504 feedOptions = JSON.parse($self[0].getAttribute('data-options')); 3505 var thisIndex = $self[0].getAttribute('data-sbi-index'); 3506 feedOptions.feedIndex = thisIndex; 3507 // if the cache is unavailable and the user has enabled an attempt at the api, "tryfetch" is returned as the error 3508 if (window.sbiCacheStatuses[thisIndex].feed !== false && jsonobj.feed.error === 'tryfetch') { 3509 // on the second try, indicate that the cache isn't available to prevent this endless loop 3510 window.sbiCacheStatuses[thisIndex].feed = false; 3511 if (!$self.find('.sb_instagram_header .sbi_header_text').length) { 3512 window.sbiCacheStatuses[thisIndex].header = false; 3513 } 3514 3515 // comments do not need to be retrieved 3516 window.sbiCacheStatuses[thisIndex].comments = 'no'; 3517 // prevents multiple attempts 3518 feedOptions.tryFetch = true; 3519 // start from scratch with updated feed options and statuses 3520 if (typeof window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch === 'undefined') sbiCreateFeed(feed, $self[0], feedOptions); 3521 } else if (window.sbiCacheStatuses[thisIndex].feed === true) { 3522 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>'; 3523 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>"; 3524 jQuery('#sb_instagram').empty().append( '<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>'); 3525 //sbi_set_use_backup 3526 var submittedData = { 3527 action: 'sbi_set_use_backup', 3528 transientName : feed.transientNames.feed, 3529 context : 'falsecache' 3530 }; 3531 jQuery.ajax({ 3532 url: sbiajaxurl, 3533 type: 'post', 3534 data: submittedData, 3535 success: function (data) { 3536 } 3537 }); // ajax 3538 } 3539 } 3540 if (jsonobj.header.error === 'tryfetch') { 3541 feedOptions = JSON.parse($self[0].getAttribute('data-options')); 3542 var thisIndex = $self[0].getAttribute('data-sbi-index'); 3543 feedOptions.feedIndex = thisIndex; 3544 if (window.sbiCacheStatuses[thisIndex].header !== false) { 3545 if (!$self.find('.sb_instagram_header .sbi_header_text').length) { 3546 window.sbiCacheStatuses[thisIndex].header = false; 3547 feedOptions.tryFetch = true; 3548 // start from scratch with updated feed options and statuses 3549 if (typeof window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch === 'undefined') sbiCreateFeed(feed,$self[0], feedOptions); 3550 3551 } 3552 } 3553 } 3554 if (typeof jsonobj.resized_images !== 'undefined') { 3555 feed.resizedImages = jsonobj.resized_images; 3556 } 3557 if (typeof jsonobj.feed.nextCursors !== 'undefined') { 3558 feed.nextCursor = jsonobj.feed.nextCursors; 3559 } 3560 if (typeof jsonobj.comments.error === 'undefined') { 3561 sb_instagram_js_options.sbiPageCommentCache = jsonobj.comments; 3562 } 3563 3564 } else { 3565 if( cacheWhat == 'header' ){ 3566 sbiBuildHeader(jsonobj, sbiSettings); 3567 } else { 3568 if (typeof jsonobj.resized_images !== 'undefined') { 3569 feed.resizedImages = jsonobj.resized_images; 3570 } 3571 if (typeof jsonobj.feed.nextCursors !== 'undefined') { 3572 feed.nextCursor = jsonobj.feed.nextCursors; 3573 } 3574 sbiNewData = false; 3575 3576 if(photosAvailable !== 'finished') sbiBuildFeed(feed, jsonobj.feed, feed.transientNames.feed, sbiSettings, $self); 3577 } 3578 } 3579 //Pass the returned images to the buildFeed function 3580 3581 }, 3582 error: function(xhr,textStatus,e) { 3583 console.log(e); 3584 return; 3585 } 3586 }; 3587 3588 jQuery.ajax(getCacheOpts); 3589 3590 } 3591 3592 } // sbiCreateFeed 3593 3594 }); // End jQuery('#sb_instagram.sbi').each 3595 3596 function sbiBindAutoScroll($sbi) { 3597 //var scrollPosOffset = parseInt($sbi.attr('data-scroll-offset')); 3598 var scrollPosOffset = parseInt($sbi.attr('data-scrolldistance')), 3599 sbiScrolled = 0; 3600 3601 //Scroll the container if it has a height 3602 if ($sbi.hasClass('sbi_fixed_height')) { 3603 $sbi.on('scroll.instagram-feed', function () { 3604 3605 var yScrollPos = $sbi.scrollTop(), 3606 windowSize = $sbi.innerHeight(), 3607 bodyHeight = $sbi[0].scrollHeight, 3608 triggerDistance = bodyHeight - scrollPosOffset - windowSize; 3609 3610 if (yScrollPos > triggerDistance) { 3611 $sbi.unbind('scroll.instagram-feed'); 3612 if (sbiScrolled === 0) { 3613 sbiScrolled = 1; 3614 $sbi.find('.sbi_load_btn').trigger('click'); 3615 } 3616 } 3617 }); 3618 //Scrolling the window 3619 } else { 3620 jQuery(window).on('scroll.instagram-feed', function () { 3621 var yScrollPos = window.pageYOffset, 3622 windowSize = window.innerHeight, 3623 bodyHeight = document.body.offsetHeight, 3624 triggerDistance = bodyHeight - scrollPosOffset - windowSize; 3625 3626 if (yScrollPos > triggerDistance) { 3627 jQuery(window).unbind('scroll.instagram-feed'); 3628 if (sbiScrolled === 0) { 3629 sbiScrolled = 1; 3630 $sbi.find('.sbi_load_btn').trigger('click'); 3631 } 3632 } 3633 }); 3634 } 3635 3636 } 3637 3638 } 3639 3640 3641 } // sb_init 3642 3643 function sbiAddTokenToExpiredList(access_token) { 3644 var accessTokenOpts = { 3645 url: sbiajaxurl, 3646 type: 'POST', 3647 async: true, 3648 cache: false, 3649 data:{ 3650 action: 'sbi_set_expired_token', 3651 access_token: access_token 3652 }, 3653 success: function(response) { 3654 return; 3655 }, 3656 error: function(xhr,textStatus,e) { 3657 console.log(e); 3658 return; 3659 } 3660 }; 3661 jQuery.ajax(accessTokenOpts); 3662 } 3663 3664 function sbiCachePhotos(images, transientName,imagesNeedResizing,isFirstPageLoad,pageID){ 3665 imagesNeedResizing = typeof imagesNeedResizing !== 'undefined' ? imagesNeedResizing : 0; 3666 //Convert the JSON object to a string 3667 var numPostsAvailable = typeof images.data !== 'undefined' ? images.data.length - imagesNeedResizing.length : 0, 3668 imagesNeedResizingString = JSON.stringify(window.sbi.stripQuotes(imagesNeedResizing)); 3669 isFirstPageLoad = typeof isFirstPageLoad !== 'undefined' ? isFirstPageLoad : false; 3670 pageID = typeof pageID !== 'undefined' ? pageID : 0; 3671 3672 // quotes and html in the bio cause caching issues 3673 if ((typeof images.data !== 'undefined' && typeof images.data.bio !== 'undefined') || typeof images.biography !== 'undefined') { 3674 images = window.sbi.sanitizeBio(images); 3675 } 3676 var jsonstring = JSON.stringify(images); 3677 //Encode the JSON string so that it can be stored in the database 3678 jsonstring = encodeURI(jsonstring); 3679 3680 if (jsonstring.indexOf('%7B%22') === 0 || jsonstring.indexOf('%22%7B') === 0) { 3681 var setCacheOpts = { 3682 url: sbiajaxurl, 3683 type: 'POST', 3684 async: true, 3685 cache: false, 3686 data:{ 3687 action: 'cache_photos', 3688 transientName: transientName, 3689 is_first_page_load: isFirstPageLoad, 3690 page_id: pageID, 3691 available: numPostsAvailable, 3692 photos: jsonstring, 3693 images_need_resizing: imagesNeedResizingString 3694 }, 3695 success: function(response) { 3696 if ( response.indexOf('too much filtering') > -1) { 3697 var useBackupOpts = { 3698 url: sbiajaxurl, 3699 type: 'POST', 3700 async: true, 3701 cache: false, 3702 data: { 3703 action: 'set_use_backup', 3704 transientName: transientName, 3705 }, 3706 success: function (response) { 3707 console.log(response) 3708 } 3709 }; 3710 jQuery.ajax(useBackupOpts); 3711 } 3712 return; 3713 }, 3714 error: function(xhr,textStatus,e) { 3715 console.log(e); 3716 return; 3717 } 3718 }; 3719 jQuery.ajax(setCacheOpts); 3720 } 3721 3722 } 3723 3724 function sbiMaybeResizeImages(posts, transientName) { 3725 3726 var jsonstring = JSON.stringify(posts); 3727 var setCacheOpts = { 3728 url: sbiajaxurl, 3729 type: 'POST', 3730 async: true, 3731 cache: false, 3732 data:{ 3733 action: 'sbi_maybe_resize_images_for_posts', 3734 posts: jsonstring, 3735 transient_name: transientName 3736 }, 3737 success: function(data) { 3738 }, 3739 error: function(xhr,textStatus,e) { 3740 console.log(e); 3741 } 3742 }; 3743 jQuery.ajax(setCacheOpts); 3744 } 3745 3746 //function function sbiSetPhotoHeight(){ 3747 function sbiGetColumnCount($self, cols, colsmobile) { 3748 var sbi_num_cols = cols, 3749 sbiWindowWidth = window.innerWidth; 3750 3751 if( $self.hasClass('sbi_mob_col_auto') ){ 3752 if( sbiWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7 ) ) sbi_num_cols = 2; 3753 if( sbiWindowWidth < 640 && (parseInt(cols) >
3753 6 && parseInt(cols) < 11 ) ) sbi_num_cols = 4; 3754 if( sbiWindowWidth <= 480 && parseInt(cols) > 2 ) sbi_num_cols = 1; 3755 } else if (sbiWindowWidth <= 480){ 3756 sbi_num_cols = colsmobile; 3757 } 3758 3759 return sbi_num_cols; 3760 } 3761 3762 function sbiGetWidthForResType(type) { 3763 switch (type) { 3764 case 'thumbnail': 3765 return 150; 3766 case 'low_resolution': 3767 return 320; 3768 default: 3769 return 640; 3770 } 3771 } 3772 3773 function sbiGetBestResolutionForAuto(colWidth,aspectRatio,isHighlight) { 3774 var bestWidth = colWidth*aspectRatio, 3775 bestWidthRounded = Math.ceil(bestWidth / 10) * 10, 3776 customSizes = [150,320,640]; 3777 3778 if (isHighlight) { 3779 bestWidthRounded = bestWidthRounded*2; 3780 } 3781 3782 if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) { 3783 var done = false; 3784 jQuery.each(customSizes, function (index, item) { 3785 if (item > parseInt(bestWidthRounded) && !done) { 3786 bestWidthRounded = item; 3787 3788 done = true; 3789 } 3790 }); 3791 } 3792 3793 return bestWidthRounded; 3794 } 3795 3796 function sbiImageExists(url, callback) { 3797 var img = new Image(); 3798 img.onload = function() { callback(true); }; 3799 img.onerror = function() { callback(false); }; 3800 img.src = url; 3801 } 3802 3803// Sample usage 3804 3805 3806 function sbiNeedToRaiseRes(width,oldRes) { 3807 return (width > oldRes); 3808 } 3809 3810 function sbiGetResolutionSettings(feed, $self, imgRes, cols, colsmobile, $i) { 3811 var photoPadding = parseInt(($self.find('#sbi_images').outerWidth() - $self.find('#sbi_images').width())) / 2, 3812 cols = sbiGetColumnCount($self, parseInt(cols), parseInt(colsmobile)), 3813 colWidth = ($self.innerWidth() / cols) - photoPadding, 3814 imgResReturn = { 3815 'type' : 'low_resolution', 3816 'width' : '' 3817 }; 3818 3819 switch(imgRes) { 3820 case 'auto': 3821 imgResReturn.type = 'auto'; 3822 imgResReturn.width = colWidth; 3823 3824 break; 3825 case 'thumb': 3826 imgResReturn.type = 'thumbnail'; 3827 break; 3828 case 'medium': 3829 imgResReturn.type = 'low_resolution'; 3830 break; 3831 default: 3832 // do custom sizes if set 3833 imgResReturn.type = 'standard_resolution'; 3834 } 3835 3836 if ( typeof window.sbiFeedMeta[$i].minRes === 'undefined' ) { 3837 window.sbiFeedMeta[$i].minRes = imgResReturn.type === 'auto' ? sbiGetBestResolutionForAuto(colWidth,feed.getAspectRatio({}),$self.hasClass('sbi_highlight')): sbiGetWidthForResType(imgResReturn.type); 3838 } 3839 3840 return imgResReturn; 3841 } 3842 // Called at the very end of the feed creation process 3843 // Takes all of the data retrieved from the API during the feed creation process and caches it 3844 function sbi_cache_all(imagesArr,transientName,needResizedImages,isFirstPageLoad,pageID) { 3845 if (transientName.indexOf('header') > -1) { 3846 sbiCachePhotos(imagesArr,transientName); 3847 } else { 3848 sbiCachePhotos(imagesArr,transientName,needResizedImages,isFirstPageLoad,pageID); 3849 } 3850 } 3851 function sbiMasonrySetSizes($self,cols,colsmobile,highlight,isHighlight) { 3852 var feedWidth = $self.innerWidth(), 3853 photoPadding = parseInt(($self.find('#sbi_images').outerWidth() - $self.find('#sbi_images').width())) / 2, 3854 cols = sbiGetColumnCount($self, parseInt(cols), parseInt(colsmobile)), 3855 feedWidthSansPadding = feedWidth - (photoPadding * (cols+2)), 3856 colWidth = (feedWidthSansPadding / cols), 3857 highlightType = (typeof highlight === 'object') ? highlight[0] : '', 3858 firstBigify = highlightType === 'pattern' ? parseInt(highlight[2]) : 0, 3859 widthAdjustForPercentPadding = $self.find('#sbi_images').css('padding').indexOf('.') > -1 ? 1 : 0; 3860 3861 // set the highlighted post to a maximum size of the containing element 3862 if (cols === 1 && !$self.hasClass('sbi_mob_col_auto')) { 3863 isHighlight = false; 3864 } 3865 if (isHighlight && (colWidth) * 2 > feedWidthSansPadding) { 3866 if ($self.hasClass('sbi_mob_col_auto')) { 3867 cols = 2; 3868 } 3869 feedWidthSansPadding = feedWidth - (photoPadding * (cols+2)); 3870 colWidth = feedWidthSansPadding/cols; 3871 } 3872 3873 $self.find('.sbi_item').each(function(index) { 3874 var shouldBigify = false; 3875 3876 if (highlightType === 'pattern') { 3877 if (index === firstBigify || (index>firstBigify && (index) % parseInt(highlight[1]) === 0)) { 3878 shouldBigify = true; 3879 } 3880 } else { 3881 shouldBigify = jQuery(this).hasClass('sbi_highlighted'); 3882 } 3883 if (isHighlight && shouldBigify) { 3884 jQuery(this).css({ 3885 height: ((colWidth * 2) - widthAdjustForPercentPadding) + 'px', 3886 width: ((colWidth * 2) - widthAdjustForPercentPadding) + 'px' 3887 }); 3888 jQuery(this).find('.sbi_photo').css({ 3889 height: (colWidth * 2) + 'px' 3890 }); 3891 } else if (isHighlight) { 3892 jQuery(this).css({ 3893 height: ((colWidth )- photoPadding - widthAdjustForPercentPadding) + 'px', 3894 width: ((colWidth )- photoPadding - widthAdjustForPercentPadding) + 'px' 3895 }); 3896 jQuery(this).find('.sbi_photo').css({ 3897 height: (colWidth )- photoPadding + 'px' 3898 }); 3899 } else { 3900 jQuery(this).css({ 3901 width: (colWidth) - photoPadding + 'px', 3902 }); 3903 if (!$self.hasClass('sbi_masonry')) { 3904 jQuery(this).css({ 3905 height: (colWidth)- photoPadding + 'px' 3906 }); 3907 } 3908 3909 } 3910 }); 3911 3912 } 3913 3914 function sbiDateInternationalizationNotSupported() { 3915 if ( typeof sbiTranslations === 'undefined' ) { 3916 return true; 3917 } else { 3918 var locale = sbiTranslations.DATE_FORMAT; 3919 try { 3920 new Date().toLocaleDateString(locale); 3921 } catch (e) { 3922 return e.name === 'RangeError'; 3923 } 3924 return false; 3925 } 3926 } 3927
3928 function sbiTranslate(origString) { 3929 if (typeof sbiTranslations === 'undefined') { 3930 return origString; 3931 } else { 3932 3933 if (typeof sbiTranslations[origString] !== 'undefined') { 3934 return sbiTranslations[origString]; 3935 } else { 3936 return origString; 3937 } 3938 3939 } 3940 } 3941 3942 jQuery( document ).ready(function() { 3943 window.sbiCommentCacheStatus = 0; 3944 sbi_init(function(imagesArr,transientName,imagesNeedResizing,isFirstPageLoad,pageID) { 3945 sbi_cache_all(imagesArr,transientName,imagesNeedResizing,isFirstPageLoad,pageID); 3946 }); 3947 3948 }); 3949 3950 // detect if touch device and disable hover 3951 window.addEventListener('touchstart', function onFirstTouch() { 3952 3953 jQuery('.sbi_photo').off('hover'); 3954 jQuery('.sbi_photo_wrap').off('hover'); 3955 jQuery('.sbi_link *').css('opacity',0); 3956 3957 window.removeEventListener('touchstart', onFirstTouch, false); 3958 }, false); 3959 3960 function SbiFeed(el,settings) { 3961 this.el = el; 3962 this.newFeedData = false; 3963 this.settings = settings; 3964 this.settings.cols = parseInt(el.getAttribute('data-cols')); 3965 this.settings.num = parseInt(el.getAttribute('data-num')); 3966 this.imgRes = el.getAttribute('data-res'); 3967 this.feedIDs = el.getAttribute('data-id').length > 0 ? el.getAttribute('data-id') : false; 3968 this.resizedImages = {}; 3969 this.firstPageLoad = false; 3970 this.needsFirstPageLoad = false; 3971 this.oneImageRetruned = false; 3972 this.headerData = false; 3973 var maybeFPL = jQuery(el).find('#sbi_images').attr('data-fpl-json'), 3974 maybeHeader = jQuery(el).find('.sb_instagram_header').length ? jQuery(el).find('.sb_instagram_header').attr('data-header-json') : ''; 3975 if (typeof maybeFPL !== 'undefined' && maybeFPL.indexOf('{"p') === 0) { 3976 var FPL = JSON.parse(maybeFPL); 3977 if ( typeof FPL.posts !== 'undefined' && typeof FPL.posts[0] !== 'undefined' && (this.settings.num <= FPL.posts.length || FPL.available === 0) ) { 3978 this.firstPageLoad = FPL.posts; 3979 this.available = FPL.available 3980 } else { 3981 this.needsFirstPageLoad = true; 3982 } 3983 3984 // TODO after single cache call, process header here 3985 if ( typeof FPL.header !== 'undefined' && typeof FPL.header[0] !== 'undefined' ) { 3986 this.header = FPL.header; 3987 } 3988 this.resizedImages = FPL.resized_images; 3989 } else { 3990 if (typeof maybeFPL !== 'undefined' && maybeFPL === 'disabled') { 3991 this.needsFirstPageLoad = false; 3992 } else { 3993 this.needsFirstPageLoad = true; 3994 } 3995 } 3996 if (typeof maybeHeader !== 'undefined' && maybeHeader.indexOf('{"') === 0) { 3997 var header = JSON.parse(maybeHeader); 3998 if (typeof header.id !== 'undefined' || typeof header.data.id !== 'undefined') { 3999 this.headerData = header; 4000 } 4001 4002 } 4003 jQuery(el).find('#sbi_images').removeAttr('data-fpl-json'); 4004 if (jQuery(el).find('.sb_instagram_header').length) { 4005 jQuery(el).find('.sb_instagram_header').removeAttr('data-header-json'); 4006 } 4007 4008 /* Make a record of posts that need resized images */ 4009 this.needsResizedImages = []; 4010 this.businessAccountExists = false; 4011 /* Set up available Accounts */ 4012 var accounts = [], 4013 personalAccessTokens = {}, 4014 personalAccessTokensArr = []; 4015 if (typeof settings.feedID !== 'undefined') { 4016 var startArr = settings.feedID.split(','), 4017 midArr = settings.mid.split(','), 4018 lastArr = settings.callback.split(','); 4019 jQuery.each(startArr, function(index,value) { 4020 if (lastArr[index] === 'business.account'){ 4021 accounts[index] = { 4022 type: 'business', 4023 accessToken: 'private',
4024 userID: value 4025 }; 4026 this.businessAccountExists = true 4027 } else { 4028 var accessTokenArray = [value,midArr[index],lastArr[index]], 4029 accessToken = accessTokenArray.join('.'); 4030 accounts[index] = { 4031 type: 'personal', 4032 accessToken: accessToken, 4033 userID: value 4034 }; 4035 personalAccessTokens[value] = accessToken; 4036 personalAccessTokensArr.push(accessToken); 4037 } 4038 }); 4039 } 4040 this.accounts = accounts; 4041 this.availableAvatarUrls = {}; 4042 4043 /* Set up API requests */ 4044 this.personalAccessTokens = personalAccessTokens; 4045 this.personalAccessTokensArr = personalAccessTokensArr; 4046 4047 var apiRequests = { 4048 'hashtags' : [], 4049 'users' : [], 4050 'locations' : [], 4051 'coordinates' : [], 4052 'singles' : [] 4053 }; 4054 apiRequests.hashtags = settings.hashtag.replace(/ /g,'').replace(/#/g,'').split(","); 4055 apiRequests.users = typeof settings.feedID !== 'undefined' ? settings.feedID.replace(/ /g,'').split(",") : []; 4056 apiRequests.coordinates = settings.coordinates.replace(/ /g,'').split("),("); 4057 apiRequests.locations = settings.location.replace(/ /g,'').split(","); 4058 apiRequests.singles = settings.single.replace(/ /g,'').replace(/sbi_/g, '').split(","); 4059 4060 //START FEED 4061 var apiURLs = [], 4062 accessTokens = this.personalAccessTokens, 4063 idsInFeed = []; // needs attention! 4064 //Loop through ids or hashtags 4065 if (settings.type == 'user' || (settings.type == 'mixed' && this.feedIDs && apiRequests.users[0] !== '') ){ 4066 jQuery.each( apiRequests.users, function( index, entry ) { 4067 var accessToken = typeof accessTokens[entry] !== 'undefined' ? addLinksToPage(accessTokens[entry]) : false; 4068 //Create an array of API URLs to pass to the fetchData function 4069 if (accessToken) { 4070 apiCall = "https://api.instagram.com/v1/users/"+ entry +"/media/recent?access_token=" + accessToken+"&count=33"; 4071 } else { // is a business account 4072 apiCall = { 4073 account: entry, 4074 url: '' 4075 }; 4076 } 4077 //window.sbiFeedMeta[$i].idsInFeed.push(entry); needs attention! 4078 idsInFeed.push(entry); 4079 apiURLs.push( apiCall ); 4080 }); //End hashtag array loop 4081 } else { 4082 apiRequests.users = []; 4083 } 4084 if (settings.type == 'coordinates' || (settings.type == 'mixed' && apiRequests.coordinates.length > 0) && apiRequests.coordinates[0] !== '') { 4085 var accessToken = addLinksToPage(this.personalAccessTokensArr[0]); 4086 jQuery.each( apiRequests.coordinates, function( index, entry ) { 4087 //If the entry is coords 4088 //Split the lat and long into pieces and place in the URL 4089 entry = entry.replace(/[()]/g, ''); 4090 var entryArr = entry.split(","), 4091 lat = entryArr[0], 4092 lng = entryArr[1], 4093 dis = '1000'; 4094 if( typeof entryArr[2] !== 'undefined' ){ 4095 dis = entryArr[2]; 4096 } 4097 apiCall = "https://api.instagram.com/v1/media/search?lat="+lat+"&lng="+lng+"&distance="+dis+"&access_token=" + accessToken+"&count=33&max_timestamp="; 4098 apiURLs.push( apiCall ); 4099 4100 }); //End hashtag array loop 4101 } 4102 if (settings.type == 'location' || (settings.type == 'mixed' && apiRequests.locations.length > 0 && apiRequests.locations[0] !== '')) { 4103 var accessToken = addLinksToPage(this.personalAccessTokensArr[0]); 4104 jQuery.each( apiRequests.locations, function( index, entry ) { 4105 apiCall = "https://api.instagram.com/v1/locations/"+ entry +"/media/recent?access_token=" + accessToken+"&count=33"; 4106 apiURLs.push( apiCall ); 4107 4108 }); //End hashtag array loop 4109 4110 }
4111 if (settings.type == 'single' || (settings.type == 'mixed' && apiRequests.singles.length > 0 && apiRequests.singles[0] !== '')) { 4112 jQuery.each(apiRequests.singles, function(index, entry) { 4113 var splitEntry = entry.split('_'); 4114 4115 jQuery.each(accessTokens, function(index_2, entry_2) { 4116 var splitToken = entry_2.split('.'); 4117 if (splitToken[0] === splitEntry[1]) { 4118 apiCall = "https://api.instagram.com/v1/media/"+ entry +"?access_token=" + addLinksToPage(entry_2); 4119 idsInFeed.push(entry); 4120 apiURLs.push( apiCall ); 4121 } 4122 }); 4123 4124 }); //End hashtag array loop 4125 } 4126 var hashtagsForHeader = []; 4127 if (settings.type == 'hashtag' || (settings.type == 'mixed' && apiRequests.hashtags.length > 0 && apiRequests.hashtags[0] !== '')) { 4128 var accessToken = typeof this.personalAccessTokensArr[0] !== 'undefined' && !this.businessAccountExists ? addLinksToPage(this.personalAccessTokensArr[0]) : false; 4129 4130 jQuery.each( apiRequests.hashtags, function( index, entry ) { 4131 var hashtag_and_hashtag_id = entry.split('||'), 4132 hashtag = hashtag_and_hashtag_id[0], 4133 hashtag_id = typeof hashtag_and_hashtag_id[1] !== 'undefined' ? hashtag_and_hashtag_id[1] : ''; 4134 if (index === 0) { 4135 hashtagsForHeader.push(hashtag); 4136 } 4137 4138 if ( accessToken ) { 4139 var apiCall = "https://api.instagram.com/v1/tags/"+hashtag+"/media/recent?access_token=" + accessToken+"&count=33"; 4140 } else { 4141 4142 var apiCall = { 4143 hashtag: hashtag, 4144 hashtag_id: hashtag_id, 4145 url: '' 4146 }; 4147 } 4148 4149 apiURLs.push( apiCall ); 4150 4151 }); //End hashtag array loop 4152 this.hashtagsForHeader = hashtagsForHeader; 4153 } 4154 this.apiURLs = apiURLs; 4155 this.nextCursor = {}; 4156 this.idsInFeed = idsInFeed; 4157 4158 /* Set up cache and transients */ 4159 var sbiTransientNames = { 4160 'header' : 'sbi_header_error', 4161 'feed' : 'sbi_error' 4162 }, 4163 sbiFeedIDAttr = jQuery(el).attr('data-feed-id');//data-feed-id 4164 4165 if (typeof sbiFeedIDAttr !== 'undefined') { 4166 sbiTransientNames.feed = sbiFeedIDAttr; 4167 sbiTransientNames.header = sbiFeedIDAttr.replace('sbi_','sbi_header_').substring(0,44); 4168 } 4169 4170 this.transientNames = sbiTransientNames; 4171 this.posts = []; 4172 this.types = []; 4173 this.isOutOfPosts = false; 4174 this.getFirstPageLoad = function (filteredData) { 4175 var num = Math.max(this.settings.num, this.settings.nummobile); 4176 4177 return filteredData.data.slice(0, num); 4178 }; 4179 this.addPosts = function(type,data) { 4180 this.posts.push(data); 4181 this.types.push(type); 4182 }; 4183 this.getPreviousUrl = function (object) { 4184 var previousUrl = typeof object.pagination !== 'undefined' ? object.pagination.previous_url : false; 4185 return previousUrl; 4186 //pagination.previous_url 4187 }; 4188 this.hasPagination = function (object) { 4189 var hasPagination = false; 4190 if (typeof object.paging !== 'undefined'){ 4191 var hasNextCursor = false; 4192 jQuery.each(this.nextCursor,function(index,value) { 4193 if (typeof value !== 'undefined' && value !== '') { 4194 hasNextCursor = true; 4195 } 4196 }); 4197 hasPagination = hasNextCursor; 4198 } else if (typeof object.pagination !== 'undefined') { 4199 hasPagination = (typeof object.pagination.next_url !== 'undefined'); 4200 } 4201 4202 return hasPagination; 4203 }; 4204 this.getNextUrl = function (object) { 4205 if (typeof object.paging !== 'undefined' && typeof object.paging.cursors !== 'undefined'){ 4206 var account = typeof object.account !== 'undefined' ? object.account : '', 4207 hasNextCursor = false; 4208 jQuery.each(this.nextCursor,function(index,value) { 4209 if (typeof value !== 'undefined' && value !== '') { 4210 hasNextCursor = true; 4211 } 4212 }); 4213 if (!hasNextCursor) { 4214 return ''; 4215 } 4216 if ( object.account === '') { 4217 var data = { 4218 hashtag_id: object.hashtag_id, 4219 hashtag: object.hashtag, 4220 url: object.paging.cursors.after 4221 }; 4222 } else { 4223 var data = { 4224 account: account, 4225 url: object.paging.cursors.after 4226 }; 4227 } 4228 if (!Array.isArray(data)) { 4229 return [data]; 4230 } 4231 return data; 4232 4233 } else if (typeof object.pagination !== 'undefined') { 4234 if (Array.isArray(object.pagination.next_url[0])) { 4235 return object.pagination.next_url[0]; 4236 } 4237 return object.pagination.next_url; 4238 } 4239 4240 return ''; 4241 }; 4242 this.hasBio = function (object) { 4243 if (typeof object.data !== 'undefined') { 4244 return (typeof object.data.bio !== 'undefined' && object.data.bio.length !== 0); 4245 } else if (typeof object.biography !== 'undefined'){ 4246 return object.biography.length !== 0; 4247 } 4248 4249 return false; 4250 }; 4251 this.getBio = function (object) { 4252 if (typeof object.data !== 'undefined' && typeof object.data.bio !== 'undefined') { 4253 return object.data.bio; 4254 } else if (typeof object.biography !== 'undefined'){ 4255 return object.biography; 4256 } 4257 4258 return ''; 4259 }; 4260 this.getPostID = function(post) { 4261 return post.id; 4262 }; 4263 this.getUser = function(postOrObject) { 4264 if (typeof postOrObject.username !== 'undefined') { 4265 return postOrObject.username; 4266 } else if (typeof postOrObject.user !== 'undefined') { 4267 return postOrObject.user.username; 4268 } else if (typeof postOrObject.data !== 'undefined') { 4269 return postOrObject.data.username; 4270 } 4271 return ''; 4272 }; 4273 this.getName = function(object) { 4274 if (typeof object.data !== 'undefined') { 4275 return object.data.full_name; 4276 } else if (typeof object.name !== 'undefined') { 4277 return object.name; 4278 } 4279 4280 return ''; 4281 }; 4282 this.hasCounts = function(object) { 4283 if (typeof object.data !== 'undefined') { 4284 return typeof object.data.counts !== 'undefined'; 4285 } else if (typeof object.media_count !== 'undefined') { 4286 return true; 4287 } 4288 4289 return false; 4290 }; 4291 this.getFollowersCounts = function(object) { 4292 if (typeof object.data !== 'undefined' && typeof object.data.counts !== 'undefined') { 4293 return object.data.counts.followed_by; 4294 } else if (typeof object.followers_count !== 'undefined') { 4295 return object.followers_count; 4296 } 4297 4298 return 0; 4299 }; 4300 this.getMediaCounts = function(object) { 4301 if (typeof object.data !== 'undefined' && typeof object.data.counts !== 'undefined') { 4302 return object.data.counts.media; 4303 } else if (typeof object.media_count !== 'undefined') { 4304 return object.media_count; 4305 } 4306 4307 return 0; 4308 }; 4309 this.getAccountType = function(post) { 4310 if (typeof post.media_type !== 'undefined') { 4311 return 'business'; 4312 } else { 4313 return 'personal' 4314 } 4315 }; 4316 this.getMediaType = function(post) { 4317 if (typeof post.type !== 'undefined') { 4318 return post.type; 4319 } 4320 return post.media_type.replace('_ALBUM','').toLowerCase(); 4321 }; 4322 this.getMediaUrl = function(post, resolution) { 4323 if (typeof post.images !== 'undefined') { 4324 switch (resolution) { 4325 case 'thumbnail' : 4326 return post.images.thumbnail.url; 4327 case 'medium' : 4328 return post.images.low_resolution.url; 4329 default : 4330 return post.images.standard_resolution.url 4331 } 4332 4333 } else { 4334 // still flag posts needing resizing so they can be used in recent feeds 4335 var postID = this.getPostID(post); 4336 if (typeof this.resizedImages[postID] === 'undefined' && !this.needsResizedImages.includes(post)) { 4337 this.needsResizedImages.push(post); 4338 } 4339 4340 var permalink = this.getPermalink(post); 4341 // seems to be a bug in permalink where user name is included 4342 4343 if (permalink.match(/\//g).length > 5) { 4344 var permChopped = permalink.split('/'), 4345 permID = typeof permChopped[permChopped.length - 2] !== 'undefined' ? permChopped[permChopped.length - 2] : ''; 4346 permalink = 'https://www.instagram.com/p/' + permID + '/'; 4347 } 4348 4349 if (post.media_type === 'CAROUSEL_ALBUM' && resolution === 'lightbox') { 4350 return permalink + 'media?size=l'; 4351 } else if (post.media_type === 'VIDEO' && resolution === 'lightbox') { 4352 return permalink + 'media?size=l'; 4353 } else { 4354 switch (resolution) { 4355 case 'thumbnail' : 4356 return permalink + 'media?size=t'; 4357 case 'medium' : 4358 return permalink + 'media?size=m'; 4359 case 'lightbox' : 4360 return post.media_url; 4361 default : 4362 return permalink + 'media?size=l'; 4363 } 4364 } 4365 4366 } 4367 }; 4368 this.getAspectRatio = function(post) { 4369 var aspectRatio = 1; 4370 4371 if (typeof post.images !== 'undefined') { 4372 aspectRatio = Math.max(1,post.images.standard_resolution.width/post.images.standard_resolution.height); 4373 } else if (typeof this.resizedImages[post.id] !== 'undefined' && typeof this.resizedImages[post.id].ratio !== 'undefined') { 4374 aspectRatio = Math.max(1,this.resizedImages[post.id].ratio); 4375 } 4376 4377 return aspectRatio; 4378 }; 4379 this.getVideoUrl = function(post) { 4380 if (typeof post.videos !== 'undefined') { 4381 return post.videos.standard_resolution.url 4382 } else if (typeof post.media_url !== 'undefined' && post.media_type === 'VIDEO') { 4383 return post.media_url; 4384 } else if (post.media_type === 'VIDEO') { 4385 return 'missing'; 4386 } else { 4387 return ''; 4388 } 4389 }; 4390 this.getCarouselObject = function(post) { 4391 var carObj = { 4392 data : {}, 4393 vidFirst : false 4394 }; 4395 if (typeof post.carousel_media !== 'undefined') { 4396 jQuery.each(post.carousel_media,function(index,value) { 4397 if (typeof value.images !== 'undefined') { 4398 carObj.data[index] = { 4399 'type' : 'image', 4400 'media' : value.images.standard_resolution.url 4401 }; 4402 } else if (typeof value.videos !== 'undefined') { 4403 carObj.data[index] = { 4404 'type' : 'video', 4405 'media' : value.videos.standard_resolution.url 4406 }; 4407 4408 if (index === 0) { 4409 carObj.vidFirst = true; 4410 } 4411 } 4412 }); 4413 4414 } else if (typeof post.children !== 'undefined') { 4415 jQuery.each(post.children.data,function(index,value) { 4416 if (value.media_type === 'IMAGE') { 4417 carObj.data[index] = { 4418 'type' : 'image', 4419 'media' : value.media_url 4420 }; 4421 } else if (value.media_type === 'VIDEO') { 4422 if (typeof value.media_url !== 'undefined') { 4423 carObj.data[index] = { 4424 'type' : 'video', 4425 'media' : value.media_url 4426 }; 4427 if (index === 0) { 4428 carObj.vidFirst = true; 4429 } 4430 } else { 4431 carObj.data[index] = { 4432 'type' : 'image', 4433 'media' : value.permalink + 'media?size=l' 4434 }; 4435 if (index === 0) { 4436 carObj.vidFirst = false; 4437 } 4438 } 4439 4440 4441 } 4442 }); 4443 } 4444 4445 return carObj; 4446 }; 4447 this.getTimestamp = function(post) { 4448 var createdTime = 0; 4449 if (typeof post.created_time !== 'undefined') { 4450 createdTime = post.created_time; 4451 } else if (typeof post.timestamp !== 'undefined') { 4452 var d = new Date(post.timestamp.replace(' ', '+')); 4453 createdTime = parseInt(d.getTime())/1000; 4454 } 4455 4456 return createdTime; 4457 }; 4458 this.getCaption = function(post) { 4459 if (typeof post.caption === 'undefined' || post.caption === null) { 4460 return ''; 4461 } 4462 if (typeof post.caption.text !== 'undefined') { 4463 return post.caption.text; 4464 } 4465 return post.caption; 4466 }; 4467 this.getTags = function(post) { 4468 if (typeof post.tags !== 'undefined' && post.tags.length > 0) { 4469 return post.tags; 4470 } 4471 4472 return false; 4473 }; 4474 this.getLocation = function(post) { 4475 if (typeof post.location !== 'undefined') { 4476 return post.location; 4477 } 4478 return {}; 4479 }; 4480 this.getCommentsCount = function(post) { 4481 var count = 0; 4482 if (typeof post.comments !== 'undefined' && typeof post.comments.count !== 'undefined') { 4483 count = post.comments.count; 4484 } else if (typeof post.comments_count !== 'undefined') { 4485 count = post.comments_count; 4486 } 4487 4488 return count; 4489 }; 4490 this.getLikesCount = function(post) { 4491 var count = 0; 4492 if (typeof post.likes !== 'undefined') { 4493 count = post.likes.count; 4494 } else if (typeof post.like_count !== 'undefined') { 4495 count = post.like_count; 4496 } 4497 4498 return count; 4499 }; 4500 this.getPermalink = function(post) { 4501 if (typeof post.permalink !== 'undefined') { 4502 return post.permalink; 4503 } 4504 return post.link; 4505 4506 }; 4507 this.getAvatarUrl = functio
4507n(postOrObj) { 4508 if (typeof postOrObj.user !== 'undefined') { 4509 return postOrObj.user.profile_picture; 4510 } else if (typeof postOrObj.data !== 'undefined') { 4511 return postOrObj.data.profile_picture; 4512 } else if (typeof postOrObj.profile_picture_url !== 'undefined') { 4513 return postOrObj.profile_picture_url; 4514 } else if (typeof postOrObj.username !== 'undefined' && typeof this.availableAvatarUrls[postOrObj.username] !== 'undefined') { 4515 return this.availableAvatarUrls[postOrObj.username]; 4516 } 4517 4518 return ''; 4519 }; 4520 4521 } 4522 4523 // polyfill for includes 4524 if (!Array.prototype.includes) { 4525 Object.defineProperty(Array.prototype, 'includes', { 4526 value: function(searchElement, fromIndex) { 4527 4528 if (this == null) { 4529 throw new TypeError('"this" is null or not defined'); 4530 } 4531 4532 // 1. Let O be ? ToObject(this value). 4533 var o = Object(this); 4534 4535 // 2. Let len be ? ToLength(? Get(O, "length")). 4536 var len = o.length >>> 0; 4537 4538 // 3. If len is 0, return false. 4539 if (len === 0) { 4540 return false; 4541 } 4542 4543 // 4. Let n be ? ToInteger(fromIndex). 4544 // (If fromIndex is undefined, this step produces the value 0.) 4545 var n = fromIndex | 0; 4546 4547 // 5. If n ⥠0, then 4548 // a. Let k be n. 4549 // 6. Else n < 0, 4550 // a. Let k be len + n. 4551 // b. If k < 0, let k be 0. 4552 var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); 4553 4554 function sameValueZero(x, y) { 4555 return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y)); 4556 } 4557 4558 // 7. Repeat, while k < len 4559 while (k < len) { 4560 // a. Let elementK be the result of ? Get(O, ! ToString(k)). 4561 // b. If SameValueZero(searchElement, elementK) is true, return true. 4562 if (sameValueZero(o[k], searchElement)) { 4563 return true; 4564 } 4565 // c. Increase k by 1. 4566 k++; 4567 } 4568 4569 // 8. Return false 4570 return false; 4571 } 4572 }); 4573 } 4574 4575 //Dismiss the frontend notice 4576 jQuery('#sb_instagram .sbi_close_notice').on('click', function(e){ 4577 e.preventDefault(); 4578 jQuery(this).closest('.sbi_frontend_notice').remove(); 4579 4580 jQuery.ajax({ 4581 url : sbiajaxurl, 4582 type : 'post', 4583 data : { 4584 action : 'sbi_dismiss_frontend_notices' 4585 } 4586 }); 4587 }); 4588 4589} // 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.