1/*! 2 * Bootstrap v4.0.0 (https://getbootstrap.com) 3 * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 */ 6!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e(t.bootstrap={},t.jQuery,t.Popper)}(this,function(t,e,n){"use strict";function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}e=e&&e.hasOwnProperty("default")?e.default:e,n=n&&n.hasOwnProperty("default")?n.default:n;var o,a,l,h,c,u,f,d,_,g,p,m,v,E,T,y,C,I,A,b,D,S,w,N,O,k,P=function(t){var e=!1;function n(e){var n=this,s=!1;return t(this).one(i.TRANSITION_END,function(){s=!0}),setTimeout(function(){s||i.triggerTransitionEnd(n)},e),this}var i={TRANSITION_END:"bsTransitionEnd",getUID:function(t){do{t+=~~(1e6*Math.random())}while(document.getElementById(t));return t},getSelectorFromElement:function(e){var n,i=e.getAttribute("data-target");i&&"#"!==i||(i=e.getAttribute("href")||""),"#"===i.charAt(0)&&(n=i,i=n="function"==typeof t.escapeSelector?t.escapeSelector(n).substr(1):n.replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1"));try{return t(document).find(i).length>0?i:null}catch(t){return null}},reflow:function(t){return t.offsetHeight},triggerTransitionEnd:function(n){t(n).trigger(e.end)},supportsTransitionEnd:function(){return Boolean(e)},isElement:function(t){return(t[0]||t).nodeType},typeCheckConfig:function(t,e,n){for(var s in n)if(Object.prototype.hasOwnProperty.call(n,s)){var r=n[s],o=e[s],a=o&&i.isElement(o)?"element":(l=o,{}.toString.call(l).match(/\s([a-zA-Z]+)/)[1].toLowerCase());if(!new RegExp(r).test(a))throw new Error(t.toUpperCase()+': Option "'+s+'" provided type "'+a+'" but expected type "'+r+'".')}var l}};return e=("undefined"==typeof window||!window.QUnit)&&{end:"transitionend"},t.fn.emulateTransitionEnd=n,i.supportsTransitionEnd()&&(t.event.special[i.TRANSITION_END]={bindType:e.end,delegateType:e.end,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}}),i}(e),L=(a="alert",h="."+(l="bs.alert"),c=(o=e).fn[a],u={CLOSE:"close"+h,CLOSED:"closed"+h,CLICK_DATA_API:"click"+h+".data-api"},f="alert",d="fade",_="show",g=function(){function t(t){this._element=t}var e=t.prototype;return e.close=function(t){t=t||this._element;var e=this._getRootElement(t);this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},e.dispose=function(){o.removeData(this._element,l),this._element=null},e._getRootElement=function(t){var e=P.getSelectorFromElement(t),n=!1;return e&&(n=o(e)[0]),n||(n=o(t).closest("."+f)[0]),n},e._triggerCloseEvent=function(t){var e=o.Event(u.CLOSE);return o(t).trigger(e),e},e._removeElement=function(t){var e=this;o(t).removeClass(_),P.supportsTransitionEnd()&&o(t).hasClass(d)?o(t).one(P.TRANSITION_END,function(n){return e._destroyElement(t,n)}).emulateTransitionEnd(150):this._destroyElement(t)},e._destroyElement=function(t){o(t).detach().trigger(u.CLOSED).remove()},t._jQueryInterface=function(e){return this.each(function(){var n=o(this),i=n.data(l);i||(i=new t(this),n.data(l,i)),"close"===e&&i[e](this)})},t._handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},s(t,null,[{key:"VERSION",get:function(){return"4.0.0"}}]),t}(),o(document).on(u.CLICK_DATA_API,'[data-dismiss="alert"]',g._handleDismiss(new g)),o.fn[a]=g._jQueryInterface,o.fn[a].Constructor=g,o.fn[a].noConflict=function(){return o.fn[a]=c,g._jQueryInterface},g),R=(m="button",E="."+(v="bs.button"),T=".data-api",y=(p=e).fn[m],C="active",I="btn",A="focus",b='[data-toggle^="button"]',D='[data-toggle="buttons"]',S="input",w=".active",N=".btn",O={CLICK_DATA_API:"click"+E+T,FOCUS_BLUR_DATA_API:"focus"+E+T+" blur"+E+T},k=function(){function t(t){this._element=t}var e=t.prototype;return e.toggle=function(){var t=!0,e=!0,n=p(this._element).closest(D)[0];if(n){var i=p(this._element).find(S)[0];if(i){if("radio"===i.type)if(i.checked&&p(this._element).hasClass(C))t=!1;else{var s=p(n).find(w)[0];s&&p(s).removeClass(C)}if(t){if(i.hasAttribute("disabled")||n.hasAttribute("disabled")||i.classList.contains("disabled")||n.classList.contains("disabled"))return;i.checked=!p(this._element).hasClass(C),p(i).trigger("change")}i.focus(),e=!1}}e&&this._element.setAttribute("aria-pressed",!p(this._element).hasClass(C)),t&&p(this._element).toggleClass(C)},e.dispose=function(){p.removeData(this._element,v),this._element=null},t._jQueryInterface=function(e){return this.each(function(){var n=p(this).data(v);n||(n=new t(this),p(this).data(v,n)),"toggle"===e&&n[e]()})},s(t,null,[{key:"VERSION",get:function(){return"4.0.0"}}]),t}(),p(document).on(O.CLICK_DATA_API,b,function(t){t.preventDefault();var e=t.target;p(e).hasClass(I)||(e=p(e).closest(N)),k._jQueryInterface.call(p(e),"toggle")}).on(O.FOCUS_BLUR_DATA_API,b,function(t){var e=p(t.target).closest(N)[0];p(e).toggleClass(A,/^focus(in)?$/.test(t.type))}),p.fn[m]=k._jQueryInterface,p.fn[m].Constructor=k,p.fn[m].noConflict=function(){return p.fn[m]=y,k._jQueryInterface},k),j=function(t){var e="carousel",n="bs.carousel",i="."+n,o=t.fn[e],a={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0},l={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean"},h="next",c="prev",u="left",f="right",d={SLIDE:"slide"+i,SLID:"slid"+i,KEYDOWN:"keydown"+i,MOUSEENTER:"mouseenter"+i,MOUSELEAVE:"mouseleave"+i,TOUCHEND:"touchend"+i,LOAD_DATA_API:"load"+i+".data-api",CLICK_DATA_API:"click"+i+".data-api"},_="carousel",g="active",p="slide",m="carousel-item-right",v="carousel-item-left",E="carousel-item-next",T="carousel-item-prev",y={ACTIVE:".active",ACTIVE_ITEM:".active.carousel-item",ITEM:".carousel-item",NEXT_PREV:".carousel-item-next, .carousel-item-prev",INDICATORS:".carousel-indicators",DATA_SLIDE:"[data-sli
6de], [data-slide-to]",DATA_RIDE:'[data-ride="carousel"]'},C=function(){function o(e,n){this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this._config=this._getConfig(n),this._element=t(e)[0],this._indicatorsElement=t(this._element).find(y.INDICATORS)[0],this._addEventListeners()}var C=o.prototype;return C.next=function(){this._isSliding||this._slide(h)},C.nextWhenVisible=function(){!document.hidden&&t(this._element).is(":visible")&&"hidden"!==t(this._element).css("visibility")&&this.next()},C.prev=function(){this._isSliding||this._slide(c)},C.pause=function(e){e||(this._isPaused=!0),t(this._element).find(y.NEXT_PREV)[0]&&P.supportsTransitionEnd()&&(P.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},C.cycle=function(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},C.to=function(e){var n=this;this._activeElement=t(this._element).find(y.ACTIVE_ITEM)[0];var i=this._getItemIndex(this._activeElement);if(!(e>this._items.length-1||e<0))if(this._isSliding)t(this._element).one(d.SLID,function(){return n.to(e)});else{if(i===e)return this.pause(),void this.cycle();var s=e>i?h:c;this._slide(s,this._items[e])}},C.dispose=function(){t(this._element).off(i),t.removeData(this._element,n),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},C._getConfig=function(t){return t=r({},a,t),P.typeCheckConfig(e,t,l),t},C._addEventListeners=function(){var e=this;this._config.keyboard&&t(this._element).on(d.KEYDOWN,function(t){return e._keydown(t)}),"hover"===this._config.pause&&(t(this._element).on(d.MOUSEENTER,function(t){return e.pause(t)}).on(d.MOUSELEAVE,function(t){return e.cycle(t)}),"ontouchstart"in document.documentElement&&t(this._element).on(d.TOUCHEND,function(){e.pause(),e.touchTimeout&&clearTimeout(e.touchTimeout),e.touchTimeout=setTimeout(function(t){return e.cycle(t)},500+e._config.interval)}))},C._keydown=function(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.which){case 37:t.preventDefault(),this.prev();break;case 39:t.preventDefault(),this.next()}},C._getItemIndex=function(e){return this._items=t.makeArray(t(e).parent().find(y.ITEM)),this._items.indexOf(e)},C._getItemByDirection=function(t,e){var n=t===h,i=t===c,s=this._getItemIndex(e),r=this._items.length-1;if((i&&0===s||n&&s===r)&&!this._config.wrap)return e;var o=(s+(t===c?-1:1))%this._items.length;return-1===o?this._items[this._items.length-1]:this._items[o]},C._triggerSlideEvent=function(e,n){var i=this._getItemIndex(e),s=this._getItemIndex(t(this._element).find(y.ACTIVE_ITEM)[0]),r=t.Event(d.SLIDE,{relatedTarget:e,direction:n,from:s,to:i});return t(this._element).trigger(r),r},C._setActiveIndicatorElement=function(e){if(this._indicatorsElement){t(this._indicatorsElement).find(y.ACTIVE).removeClass(g);var n=this._indicatorsElement.children[this._getItemIndex(e)];n&&t(n).addClass(g)}},C._slide=function(e,n){var i,s,r,o=this,a=t(this._element).find(y.ACTIVE_ITEM)[0],l=this._getItemIndex(a),c=n||a&&this._getItemByDirection(e,a),_=this._getItemIndex(c),C=Boolean(this._interval);if(e===h?(i=v,s=E,r=u):(i=m,s=T,r=f),c&&t(c).hasClass(g))this._isSliding=!1;else if(!this._triggerSlideEvent(c,r).isDefaultPrevented()&&a&&c){this._isSliding=!0,C&&this.pause(),this._setActiveIndicatorElement(c);var I=t.Event(d.SLID,{relatedTarget:c,direction:r,from:l,to:_});P.supportsTransitionEnd()&&t(this._element).hasClass(p)?(t(c).addClass(s),P.reflow(c),t(a).addClass(i),t(c).addClass(i),t(a).one(P.TRANSITION_END,function(){t(c).removeClass(i+" "+s).addClass(g),t(a).removeClass(g+" "+s+" "+i),o._isSliding=!1,setTimeout(function(){return t(o._element).trigger(I)},0)}).emulateTransitionEnd(600)):(t(a).removeClass(g),t(c).addClass(g),this._isSliding=!1,t(this._element).trigger(I)),C&&this.cycle()}},o._jQueryInterface=function(e){return this.each(function(){var i=t(this).data(n),s=r({},a,t(this).data());"object"==typeof e&&(s=r({},s,e));var l="string"==typeof e?e:s.slide;if(i||(i=new o(this,s),t(this).data(n,i)),"number"==typeof e)i.to(e);else if("string"==typeof l){if("undefined"==typeof i[l])throw new TypeError('No method n
6amed "'+l+'"');i[l]()}else s.interval&&(i.pause(),i.cycle())})},o._dataApiClickHandler=function(e){var i=P.getSelectorFromElement(this);if(i){var s=t(i)[0];if(s&&t(s).hasClass(_)){var a=r({},t(s).data(),t(this).data()),l=this.getAttribute("data-slide-to");l&&(a.interval=!1),o._jQueryInterface.call(t(s),a),l&&t(s).data(n).to(l),e.preventDefault()}}},s(o,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return a}}]),o}();return t(document).on(d.CLICK_DATA_API,y.DATA_SLIDE,C._dataApiClickHandler),t(window).on(d.LOAD_DATA_API,function(){t(y.DATA_RIDE).each(function(){var e=t(this);C._jQueryInterface.call(e,e.data())})}),t.fn[e]=C._jQueryInterface,t.fn[e].Constructor=C,t.fn[e].noConflict=function(){return t.fn[e]=o,C._jQueryInterface},C}(e),H=function(t){var e="collapse",n="bs.collapse",i="."+n,o=t.fn[e],a={toggle:!0,parent:""},l={toggle:"boolean",parent:"(string|element)"},h={SHOW:"show"+i,SHOWN:"shown"+i,HIDE:"hide"+i,HIDDEN:"hidden"+i,CLICK_DATA_API:"click"+i+".data-api"},c="show",u="collapse",f="collapsing",d="collapsed",_="width",g="height",p={ACTIVES:".show, .collapsing",DATA_TOGGLE:'[data-toggle="collapse"]'},m=function(){function i(e,n){this._isTransitioning=!1,this._element=e,this._config=this._getConfig(n),this._triggerArray=t.makeArray(t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'));for(var i=t(p.DATA_TOGGLE),s=0;s<i.length;s++){var r=i[s],o=P.getSelectorFromElement(r);null!==o&&t(o).filter(e).length>0&&(this._selector=o,this._triggerArray.push(r))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var o=i.prototype;return o.toggle=function(){t(this._element).hasClass(c)?this.hide():this.show()},o.show=function(){var e,s,r=this;if(!this._isTransitioning&&!t(this._element).hasClass(c)&&(this._parent&&0===(e=t.makeArray(t(this._parent).find(p.ACTIVES).filter('[data-parent="'+this._config.parent+'"]'))).length&&(e=null),!(e&&(s=t(e).not(this._selector).data(n))&&s._isTransitioning))){var o=t.Event(h.SHOW);if(t(this._element).trigger(o),!o.isDefaultPrevented()){e&&(i._jQueryInterface.call(t(e).not(this._selector),"hide"),s||t(e).data(n,null));var a=this._getDimension();t(this._element).removeClass(u).addClass(f),this._element.style[a]=0,this._triggerArray.length>0&&t(this._triggerArray).removeClass(d).attr("aria-expanded",!0),this.setTransitioning(!0);var l=function(){t(r._element).removeClass(f).addClass(u).addClass(c),r._element.style[a]="",r.setTransitioning(!1),t(r._element).trigger(h.SHOWN)};if(P.supportsTransitionEnd()){var _="scroll"+(a[0].toUpperCase()+a.slice(1));t(this._element).one(P.TRANSITION_END,l).emulateTransitionEnd(600),this._element.style[a]=this._element[_]+"px"}else l()}}},o.hide=function(){var e=this;if(!this._isTransitioning&&t(this._element).hasClass(c)){var n=t.Event(h.HIDE);if(t(this._element).trigger(n),!n.isDefaultPrevented()){var i=this._getDimension();if(this._element.style[i]=this._element.getBoundingClientRect()[i]+"px",P.reflow(this._element),t(this._element).addClass(f).removeClass(u).removeClass(c),this._triggerArray.length>0)for(var s=0;s<this._triggerArray.length;s++){var r=this._triggerArray[s],o=P.getSelectorFromElement(r);if(null!==o)t(o).hasClass(c)||t(r).addClass(d).attr("aria-expanded",!1)}this.setTransitioning(!0);var a=function(){e.setTransitioning(!1),t(e._element).removeClass(f).addClass(u).trigger(h.HIDDEN)};this._element.style[i]="",P.supportsTransitionEnd()?t(this._element).one(P.TRANSITION_END,a).emulateTransitionEnd(600):a()}}},o.setTransitioning=function(t){this._isTransitioning=t},o.dispose=function(){t.removeData(this._element,n),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},o._getConfig=function(t){return(t=r({},a,t)).toggle=Boolean(t.toggle),P.typeCheckConfig(e,t,l),t},o._getDimension=function(){return t(this._element).hasClass(_)?_:g},o._getParent=function(){var e=this,n=null;P.isElement(this._config.parent)?(n=this._config.parent,"undefined"!=typeof this._config.parent.jquery&&(n=this._config.parent[0])):n=t(this._config.parent)[0];var s='[data-toggle="collapse"][data-parent="'+this._config.parent+'"]';return t(n).find(s).each(function(t,n){e._addAriaAndCollapsedClass(i._getTargetFromElement(n),[n])}),n},o._addAriaAndCollapsedClass=function(e,n){if(e){var i=t(e).hasClass(c);n.length>0&&t(n).toggleClass(d,!i).attr("aria-expanded",i)}},i._getTargetFromElement=function(e){var n=P.getSelectorFromElement(e);return n?t(n)[0]:null},i._jQueryInterface=function(e){return this.each(function(){var s=t(this),o=s.data(n),l=r({},a,s.data(),"object"==typeof e&&e);if(!o&&l.toggle&&/show|hide/.test(e)&&(l.toggle=!1),o||(o=new i(this,l),s.data(n,o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method n
6amed "'+e+'"');o[e]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return a}}]),i}();return t(document).on(h.CLICK_DATA_API,p.DATA_TOGGLE,function(e){"A"===e.currentTarget.tagName&&e.preventDefault();var i=t(this),s=P.getSelectorFromElement(this);t(s).each(function(){var e=t(this),s=e.data(n)?"toggle":i.data();m._jQueryInterface.call(e,s)})}),t.fn[e]=m._jQueryInterface,t.fn[e].Constructor=m,t.fn[e].noConflict=function(){return t.fn[e]=o,m._jQueryInterface},m}(e),W=function(t){var e="dropdown",i="bs.dropdown",o="."+i,a=".data-api",l=t.fn[e],h=new RegExp("38|40|27"),c={HIDE:"hide"+o,HIDDEN:"hidden"+o,SHOW:"show"+o,SHOWN:"shown"+o,CLICK:"click"+o,CLICK_DATA_API:"click"+o+a,KEYDOWN_DATA_API:"keydown"+o+a,KEYUP_DATA_API:"keyup"+o+a},u="disabled",f="show",d="dropup",_="dropright",g="dropleft",p="dropdown-menu-right",m="dropdown-menu-left",v="position-static",E='[data-toggle="dropdown"]',T=".dropdown form",y=".dropdown-menu",C=".navbar-nav",I=".dropdown-menu .dropdown-item:not(.disabled)",A="top-start",b="top-end",D="bottom-start",S="bottom-end",w="right-start",N="left-start",O={offset:0,flip:!0,boundary:"scrollParent"},k={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)"},L=function(){function a(t,e){this._element=t,this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var l=a.prototype;return l.toggle=function(){if(!this._element.disabled&&!t(this._element).hasClass(u)){var e=a._getParentFromElement(this._element),i=t(this._menu).hasClass(f);if(a._clearMenus(),!i){var s={relatedTarget:this._element},r=t.Event(c.SHOW,s);if(t(e).trigger(r),!r.isDefaultPrevented()){if(!this._inNavbar){if("undefined"==typeof n)throw new TypeError("Bootstrap dropdown require Popper.js (https://popper.js.org)");var o=this._element;t(e).hasClass(d)&&(t(this._menu).hasClass(m)||t(this._menu).hasClass(p))&&(o=e),"scrollParent"!==this._config.boundary&&t(e).addClass(v),this._popper=new n(o,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===t(e).closest(C).length&&t("body").children().on("mouseover",null,t.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),t(this._menu).toggleClass(f),t(e).toggleClass(f).trigger(t.Event(c.SHOWN,s))}}}},l.dispose=function(){t.removeData(this._element,i),t(this._element).off(o),this._element=null,this._menu=null,null!==this._popper&&(this._popper.destroy(),this._popper=null)},l.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},l._addEventListeners=function(){var e=this;t(this._element).on(c.CLICK,function(t){t.preventDefault(),t.stopPropagation(),e.toggle()})},l._getConfig=function(n){return n=r({},this.constructor.Default,t(this._element).data(),n),P.typeCheckConfig(e,n,this.constructor.DefaultType),n},l._getMenuElement=function(){if(!this._menu){var e=a._getParentFromElement(this._element);this._menu=t(e).find(y)[0]}return this._menu},l._getPlacement=function(){var e=t(this._element).parent(),n=D;return e.hasClass(d)?(n=A,t(this._menu).hasClass(p)&&(n=b)):e.hasClass(_)?n=w:e.hasClass(g)?n=N:t(this._menu).hasClass(p)&&(n=S),n},l._detectNavbar=function(){return t(this._element).closest(".navbar").length>0},l._getPopperConfig=function(){var t=this,e={};return"function"==typeof this._config.offset?e.fn=function(e){return e.offsets=r({},e.offsets,t._config.offset(e.offsets)||{}),e}:e.offset=this._config.offset,{placement:this._getPlacement(),modifiers:{offset:e,flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}}},a._jQueryInterface=function(e){return this.each(function(){var n=t(this).data(i);if(n||(n=new a(this,"object"==typeof e?e:null),t(this).data(i,n)),"string"==typeof e){if("undefined"==typeof n[e])throw new TypeError('No method named "'+e+'"');n[e]()}})},a._clearMenus=function(e){if(!e||3!==e.which&&("keyup"!==e.type||9===e.which))for(var n=t.makeArray(t(E)),s=0;s<n.length;s++){var r=a._getParentFromElement(n[s]),o=t(n[s]).data(i),l={relatedTarget:n[s]};if(o){var h=o._menu;if(t(r).hasClass(f)&&!(e&&("click"===e.type&&/input|textarea/i.test(e.target.tagName)||"keyup"===e.type&&9===e.which)&&t.contains(r,e.target))){var u=t.Event(c.HIDE,l);t(r).trigger(u),u.isDefaultPrevented()||("ontouchstart"in document.documentElement&&t("body").children().off("mouseover",null,t.noop),n[s].setAttribute("aria-expanded","fal
6se"),t(h).removeClass(f),t(r).removeClass(f).trigger(t.Event(c.HIDDEN,l)))}}}},a._getParentFromElement=function(e){var n,i=P.getSelectorFromElement(e);return i&&(n=t(i)[0]),n||e.parentNode},a._dataApiKeydownHandler=function(e){if((/input|textarea/i.test(e.target.tagName)?!(32===e.which||27!==e.which&&(40!==e.which&&38!==e.which||t(e.target).closest(y).length)):h.test(e.which))&&(e.preventDefault(),e.stopPropagation(),!this.disabled&&!t(this).hasClass(u))){var n=a._getParentFromElement(this),i=t(n).hasClass(f);if((i||27===e.which&&32===e.which)&&(!i||27!==e.which&&32!==e.which)){var s=t(n).find(I).get();if(0!==s.length){var r=s.indexOf(e.target);38===e.which&&r>0&&r--,40===e.which&&r<s.length-1&&r++,r<0&&(r=0),s[r].focus()}}else{if(27===e.which){var o=t(n).find(E)[0];t(o).trigger("focus")}t(this).trigger("click")}}},s(a,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return O}},{key:"DefaultType",get:function(){return k}}]),a}();return t(document).on(c.KEYDOWN_DATA_API,E,L._dataApiKeydownHandler).on(c.KEYDOWN_DATA_API,y,L._dataApiKeydownHandler).on(c.CLICK_DATA_API+" "+c.KEYUP_DATA_API,L._clearMenus).on(c.CLICK_DATA_API,E,function(e){e.preventDefault(),e.stopPropagation(),L._jQueryInterface.call(t(this),"toggle")}).on(c.CLICK_DATA_API,T,function(t){t.stopPropagation()}),t.fn[e]=L._jQueryInterface,t.fn[e].Constructor=L,t.fn[e].noConflict=function(){return t.fn[e]=l,L._jQueryInterface},L}(e),M=function(t){var e="modal",n="bs.modal",i="."+n,o=t.fn.modal,a={backdrop:!0,keyboard:!0,focus:!0,show:!0},l={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},h={HIDE:"hide"+i,HIDDEN:"hidden"+i,SHOW:"show"+i,SHOWN:"shown"+i,FOCUSIN:"focusin"+i,RESIZE:"resize"+i,CLICK_DISMISS:"click.dismiss"+i,KEYDOWN_DISMISS:"keydown.dismiss"+i,MOUSEUP_DISMISS:"mouseup.dismiss"+i,MOUSEDOWN_DISMISS:"mousedown.dismiss"+i,CLICK_DATA_API:"click"+i+".data-api"},c="modal-scrollbar-measure",u="modal-backdrop",f="modal-open",d="fade",_="show",g={DIALOG:".modal-dialog",DATA_TOGGLE:'[data-toggle="modal"]',DATA_DISMISS:'[data-dismiss="modal"]',FIXED_CONTENT:".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",STICKY_CONTENT:".sticky-top",NAVBAR_TOGGLER:".navbar-toggler"},p=function(){function o(e,n){this._config=this._getConfig(n),this._element=e,this._dialog=t(e).find(g.DIALOG)[0],this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._originalBodyPadding=0,this._scrollbarWidth=0}var p=o.prototype;return p.toggle=function(t){return this._isShown?this.hide():this.show(t)},p.show=function(e){var n=this;if(!this._isTransitioning&&!this._isShown){P.supportsTransitionEnd()&&t(this._element).hasClass(d)&&(this._isTransitioning=!0);var i=t.Event(h.SHOW,{relatedTarget:e});t(this._element).trigger(i),this._isShown||i.isDefaultPrevented()||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),t(document.body).addClass(f),this._setEscapeEvent(),this._setResizeEvent(),t(this._element).on(h.CLICK_DISMISS,g.DATA_DISMISS,function(t){return n.hide(t)}),t(this._dialog).on(h.MOUSEDOWN_DISMISS,function(){t(n._element).one(h.MOUSEUP_DISMISS,function(e){t(e.target).is(n._element)&&(n._ignoreBackdropClick=!0)})}),this._showBackdrop(function(){return n._showElement(e)}))}},p.hide=function(e){var n=this;if(e&&e.preventDefault(),!this._isTransitioning&&this._isShown){var i=t.Event(h.HIDE);if(t(this._element).trigger(i),this._isShown&&!i.isDefaultPrevented()){this._isShown=!1;var s=P.supportsTransitionEnd()&&t(this._element).hasClass(d);s&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),t(document).off(h.FOCUSIN),t(this._element).removeClass(_),t(this._element).off(h.CLICK_DISMISS),t(this._dialog).off(h.MOUSEDOWN_DISMISS),s?t(this._element).one(P.TRANSITION_END,function(t){return n._hideModal(t)}).emulateTransitionEnd(300):this._hideModal()}}},p.dispose=function(){t.removeData(this._element,n),t(window,document,this._element,this._backdrop).off(i),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._scrollbarWidth=null},p.handleUpdate=function(){this._adjustDialog()},p._getConfig=function(t){return t=r({},a,t),P.typeCheckConfig(e,t,l),t},p._showElement=function(e){var n=this,i=P.supportsTransitionEnd()&&t(this._element).hasClass(d);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.scrollTop=0,i&&P.reflow(this._element),t(this._element).addClass(_),this._config.focus&&this._enforceFocus();var s=t.Event(h.SHOWN,{relatedTarget:e}),r=function(){n._config.focus&&n._element.focus(),n._isTransitioning=!1,t(n._element).trigger(s)};i?t(this._dialog).one(P.TRANSITION_END,r).emulateTransitionEnd(300):r()},p._enforceFocus=function(){var e=this;t(document).off(h.FOCUSIN).on(h.FOCUSIN,function(n){document!==n.target&&e._element!==n.target&&0===t(e._element).has(n.target).length&&e._element.focus()})},p._setEscapeEvent=function(){var e=this;this._isShown&&this._config.keyboard?t(this._element).on(h.KEYDOWN_DISMISS,function(t){27===t.which&&(t.preventDefault(),e.hide())}):this._isShown||t(this._element).off(h.KEYDOWN_DISMISS)},p._setResizeEvent=function(){var e=this;this._isShown?t(window).on(h.RESIZE,function(t){return e.handleUpdate(t)}):t(window).off(h.RESIZE)},p._hideModal=function(){var e=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._isTransitioning=!1,this._showBackdrop(function(){t(document.body).removeClass(f),e._resetAdjustments(),e._resetScrollbar(),t(e._element).trigger(h.HIDDEN)})},p._removeBackdrop=function(){this._backdrop&&(t(this._backdrop).remove(),this._backdrop=null)},p._showBackdrop=function(e){var n=this,i=t(this._element).hasClass(d)?d:"";if(this._isShown&&this._config.backdrop){var s=P.supportsTransitionEnd()&&i;if(this._backdrop=document.createElement("div"),this._backdrop.className=u,i&&t(this._backdrop).addClass(i),t(this._backdrop).appendTo(document.body),t(this._element).on(h.CLICK_DISMISS,function(t){n._ignoreBackdropClick?n._ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"===n._config.backdrop?n._element.focus():n.hide())}),s&&P.reflow(this._backdrop),t(this._backdrop).addClass(_),!e)return;if(!s)return void e();t(this._backdrop).one(P.TRANSITION_END,e).emulateTransitionEnd(150)}else if(!this._isShown&&this._backdrop){t(this._backdrop).removeClass(_);var r=function(){n._removeBackdrop(),e&&e()};P.supportsTransitionEnd()&&t(this._element).hasClass(d)?t(this._backdrop).one(P.TRANSITION_END,r).emulateTransitionEnd(150):r()}else e&&e()},p._adjustDialog=function(){var t=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},p._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},p._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=t.left+t.right<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()},p._setScrollbar=function(){var e=this;if(this._isBodyOverflowing){t(g.FIXED_CONTENT).each(function(n,i){var s=t(i)[0].style.paddingRight,r=t(i).css("padding-right");t(i).data("padding-right",s).css("padding-right",parseFloat(r)+e._scrollbarWidth+"px")}),t(g.STICKY_CONTENT).each(function(n,i){var s=t(i)[0].style.marginRight,r=t(i).css("margin-right");t(i).data("margin-right",s).css("margin-right",parseFloat(r)-e._scrollbarWidth+"px")}),t(g.NAVBAR_TOGGLER).each(function(n,i){var s=t(i)[0].style.marginRight,r=t(i).css("margin-right");t(i).data("margin-right",s).css("margin-right",parseFloat(r)+e._scrollbarWidth+"px")});var n=document.body.style.paddingRight,i=t("body").css("padding-right");t("body").data("padding-right",n).css("padding-right",parseFloat(i)+this._scrollbarWidth+"px")}},p._resetScrollbar=function(){t(g.FIXED_CONTENT).each(function(e,n){var i=t(n).data("padding-right");"undefined"!=typeof i&&t(n).css("padding-right",i).removeData("padding-right")}),t(g.STICKY_CONTENT+", "+g.NAVBAR_TOGGLER).each(function(e,n){var i=t(n).data("margin-right");"undefined"!=typeof i&&t(n).css("margin-right",i).removeData("margin-right")});var e=t("body").data("padding-right");"undefined"!=typeof e&&t("body").css("padding-right",e).removeData("padding-right")},p._getScrollbarWidth=function(){var t=document.createElement("div");t.className=c,document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e},o._jQueryInterface=function(e,i){return this.each(function(){var s=t(this).data(n),a=r({},o.Default,t(this).data(),"object"==typeof e&&e);if(s||(s=new o(this,a),t(this).data(n,s)),"string"==typeof e){if("undefined"==typeof s[e])throw new TypeError('No method n
6amed "'+e+'"');s[e](i)}else a.show&&s.show(i)})},s(o,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return a}}]),o}();return t(document).on(h.CLICK_DATA_API,g.DATA_TOGGLE,function(e){var i,s=this,o=P.getSelectorFromElement(this);o&&(i=t(o)[0]);var a=t(i).data(n)?"toggle":r({},t(i).data(),t(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||e.preventDefault();var l=t(i).one(h.SHOW,function(e){e.isDefaultPrevented()||l.one(h.HIDDEN,function(){t(s).is(":visible")&&s.focus()})});p._jQueryInterface.call(t(i),a,this)}),t.fn.modal=p._jQueryInterface,t.fn.modal.Constructor=p,t.fn.modal.noConflict=function(){return t.fn.modal=o,p._jQueryInterface},p}(e),U=function(t){var e="tooltip",i="bs.tooltip",o="."+i,a=t.fn[e],l=new RegExp("(^|\\s)bs-tooltip\\S+","g"),h={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)"},c={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},u={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent"},f="show",d="out",_={HIDE:"hide"+o,HIDDEN:"hidden"+o,SHOW:"show"+o,SHOWN:"shown"+o,INSERTED:"inserted"+o,CLICK:"click"+o,FOCUSIN:"focusin"+o,FOCUSOUT:"focusout"+o,MOUSEENTER:"mouseenter"+o,MOUSELEAVE:"mouseleave"+o},g="fade",p="show",m=".tooltip-inner",v=".arrow",E="hover",T="focus",y="click",C="manual",I=function(){function a(t,e){if("undefined"==typeof n)throw new TypeError("Bootstrap tooltips require Popper.js (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var I=a.prototype;return I.enable=function(){this._isEnabled=!0},I.disable=function(){this._isEnabled=!1},I.toggleEnabled=function(){this._isEnabled=!this._isEnabled},I.toggle=function(e){if(this._isEnabled)if(e){var n=this.constructor.DATA_KEY,i=t(e.currentTarget).data(n);i||(i=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(n,i)),i._activeTrigger.click=!i._activeTrigger.click,i._isWithActiveTrigger()?i._enter(null,i):i._leave(null,i)}else{if(t(this.getTipElement()).hasClass(p))return void this._leave(null,this);this._enter(null,this)}},I.dispose=function(){clearTimeout(this._timeout),t.removeData(this.element,this.constructor.DATA_KEY),t(this.element).off(this.constructor.EVENT_KEY),t(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&t(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,null!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},I.show=function(){var e=this;if("none"===t(this.element).css("display"))throw new Error("Please use show on visible elements");var i=t.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){t(this.element).trigger(i);var s=t.contains(this.element.ownerDocument.documentElement,this.element);if(i.isDefaultPrevented()||!s)return;var r=this.getTipElement(),o=P.getUID(this.constructor.NAME);r.setAttribute("id",o),this.element.setAttribute("aria-describedby",o),this.setContent(),this.config.animation&&t(r).addClass(g);var l="function"==typeof this.config.placement?this.config.placement.call(this,r,this.element):this.config.placement,h=this._getAttachment(l);this.addAttachmentClass(h);var c=!1===this.config.container?document.body:t(this.config.container);t(r).data(this.constructor.DATA_KEY,this),t.contains(this.element.ownerDocument.documentElement,this.tip)||t(r).appendTo(c),t(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new n(this.element,r,{placement:h,modifiers:{offset:{offset:this.config.offset},flip:{behavior:this.config.fallbackPlacement},arrow:{element:v}
vendor: 5,344 bytes, line 6
6,preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){e._handlePopperPlacementChange(t)}}),t(r).addClass(p),"ontouchstart"in document.documentElement&&t("body").children().on("mouseover",null,t.noop);var u=function(){e.config.animation&&e._fixTransition();var n=e._hoverState;e._hoverState=null,t(e.element).trigger(e.constructor.Event.SHOWN),n===d&&e._leave(null,e)};P.supportsTransitionEnd()&&t(this.tip).hasClass(g)?t(this.tip).one(P.TRANSITION_END,u).emulateTransitionEnd(a._TRANSITION_DURATION):u()}},I.hide=function(e){var n=this,i=this.getTipElement(),s=t.Event(this.constructor.Event.HIDE),r=function(){n._hoverState!==f&&i.parentNode&&i.parentNode.removeChild(i),n._cleanTipClass(),n.element.removeAttribute("aria-describedby"),t(n.element).trigger(n.constructor.Event.HIDDEN),null!==n._popper&&n._popper.destroy(),e&&e()};t(this.element).trigger(s),s.isDefaultPrevented()||(t(i).removeClass(p),"ontouchstart"in document.documentElement&&t("body").children().off("mouseover",null,t.noop),this._activeTrigger[y]=!1,this._activeTrigger[T]=!1,this._activeTrigger[E]=!1,P.supportsTransitionEnd()&&t(this.tip).hasClass(g)?t(i).one(P.TRANSITION_END,r).emulateTransitionEnd(150):r(),this._hoverState="")},I.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},I.isWithContent=function(){return Boolean(this.getTitle())},I.addAttachmentClass=function(e){t(this.getTipElement()).addClass("bs-tooltip-"+e)},I.getTipElement=function(){return this.tip=this.tip||t(this.config.template)[0],this.tip},I.setContent=function(){var e=t(this.getTipElement());this.setElementContent(e.find(m),this.getTitle()),e.removeClass(g+" "+p)},I.setElementContent=function(e,n){var i=this.config.html;"object"==typeof n&&(n.nodeType||n.jquery)?i?t(n).parent().is(e)||e.empty().append(n):e.text(t(n).text()):e[i?"html":"text"](n)},I.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},I._getAttachment=function(t){return c[t.toUpperCase()]},I._setListeners=function(){var e=this;this.config.trigger.split(" ").forEach(function(n){if("click"===n)t(e.element).on(e.constructor.Event.CLICK,e.config.selector,function(t){return e.toggle(t)});else if(n!==C){var i=n===E?e.constructor.Event.MOUSEENTER:e.constructor.Event.FOCUSIN,s=n===E?e.constructor.Event.MOUSELEAVE:e.constructor.Event.FOCUSOUT;t(e.element).on(i,e.config.selector,function(t){return e._enter(t)}).on(s,e.config.selector,function(t){return e._leave(t)})}t(e.element).closest(".modal").on("hide.bs.modal",function(){return e.hide()})}),this.config.selector?this.config=r({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},I._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},I._enter=function(e,n){var i=this.constructor.DATA_KEY;(n=n||t(e.currentTarget).data(i))||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(i,n)),e&&(n._activeTrigger["focusin"===e.type?T:E]=!0),t(n.getTipElement()).hasClass(p)||n._hoverState===f?n._hoverState=f:(clearTimeout(n._timeout),n._hoverState=f,n.config.delay&&n.config.delay.show?n._timeout=setTimeout(function(){n._hoverState===f&&n.show()},n.config.delay.show):n.show())},I._leave=function(e,n){var i=this.constructor.DATA_KEY;(n=n||t(e.currentTarget).data(i))||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(i,n)),e&&(n._activeTrigger["focusout"===e.type?T:E]=!1),n._isWithActiveTrigger()||(clearTimeout(n._timeout),n._hoverState=d,n.config.delay&&n.config.delay.hide?n._timeout=setTimeout(function(){n._hoverState===d&&n.hide()},n.config.delay.hide):n.hide())},I._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},I._getConfig=function(n){return"number"==typeof(n=r({},this.constructor.Default,t(this.element).data(),n)).delay&&(n.delay={show:n.delay,hide:n.delay}),"number"==typeof n.title&&(n.title=n.title.toString()),"number"==typeof n.content&&(n.content=n.content.toString()),P.typeCheckConfig(e,n,this.constructor.DefaultType),n},I._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},I._cleanTipClass=function(){var e=t(this.getTipElement()),n=e.attr("class").match(l);null!==n&&n.length>0&&e.removeClass(n.join(""))},I._handlePopperPlacementChange=function(t){this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},I._fixTransition=function(){var e=this.getTipElement(),n=this.config.animation;null===e.getAttribute("x-placement")&&(t(e).removeClass(g),this.config.animation=!1,this.hide(),this.show(),this.config.animation=n)},a._jQueryInterface=function(e){return this.each(function(){var n=t(this).data(i),s="object"==typeof e&&e;if((n||!/dispose|hide/.test(e))&&(n||(n=new a(this,s),t(this).data(i,n)),"string"==typeof e)){if("undefined"==typeof n[e])throw new TypeError('No method n
6amed "'+e+'"');n[e]()}})},s(a,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return u}},{key:"NAME",get:function(){return e}},{key:"DATA_KEY",get:function(){return i}},{key:"Event",get:function(){return _}},{key:"EVENT_KEY",get:function(){return o}},{key:"DefaultType",get:function(){return h}}]),a}();return t.fn[e]=I._jQueryInterface,t.fn[e].Constructor=I,t.fn[e].noConflict=function(){return t.fn[e]=a,I._jQueryInterface},I}(e),x=function(t){var e="popover",n="bs.popover",i="."+n,o=t.fn[e],a=new RegExp("(^|\\s)bs-popover\\S+","g"),l=r({},U.Default,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),h=r({},U.DefaultType,{content:"(string|element|function)"}),c="fade",u="show",f=".popover-header",d=".popover-body",_={HIDE:"hide"+i,HIDDEN:"hidden"+i,SHOW:"show"+i,SHOWN:"shown"+i,INSERTED:"inserted"+i,CLICK:"click"+i,FOCUSIN:"focusin"+i,FOCUSOUT:"focusout"+i,MOUSEENTER:"mouseenter"+i,MOUSELEAVE:"mouseleave"+i},g=function(r){var o,g;function p(){return r.apply(this,arguments)||this}g=r,(o=p).prototype=Object.create(g.prototype),o.prototype.constructor=o,o.__proto__=g;var m=p.prototype;return m.isWithContent=function(){return this.getTitle()||this._getContent()},m.addAttachmentClass=function(e){t(this.getTipElement()).addClass("bs-popover-"+e)},m.getTipElement=function(){return this.tip=this.tip||t(this.config.template)[0],this.tip},m.setContent=function(){var e=t(this.getTipElement());this.setElementContent(e.find(f),this.getTitle());var n=this._getContent();"function"==typeof n&&(n=n.call(this.element)),this.setElementContent(e.find(d),n),e.removeClass(c+" "+u)},m._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},m._cleanTipClass=function(){var e=t(this.getTipElement()),n=e.attr("class").match(a);null!==n&&n.length>0&&e.removeClass(n.join(""))},p._jQueryInterface=function(e){return this.each(function(){var i=t(this).data(n),s="object"==typeof e?e:null;if((i||!/destroy|hide/.test(e))&&(i||(i=new p(this,s),t(this).data(n,i)),"string"==typeof e)){if("undefined"==typeof i[e])throw new TypeError('No method named "'+e+'"');i[e]()}})},s(p,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return l}},{key:"NAME",get:function(){return e}},{key:"DATA_KEY",get:function(){return n}},{key:"Event",get:function(){return _}},{key:"EVENT_KEY",get:function(){return i}},{key:"DefaultType",get:function(){return h}}]),p}(U);return t.fn[e]=g._jQueryInterface,t.fn[e].Constructor=g,t.fn[e].noConflict=function(){return t.fn[e]=o,g._jQueryInterface},g}(e),K=function(t){var e="scrollspy",n="bs.scrollspy",i="."+n,o=t.fn[e],a={offset:10,method:"auto",target:""},l={offset:"number",method:"string",target:"(string|element)"},h={ACTIVATE:"activate"+i,SCROLL:"scroll"+i,LOAD_DATA_API:"load"+i+".data-api"},c="dropdown-item",u="active",f={DATA_SPY:'[data-spy="scroll"]',ACTIVE:".active",NAV_LIST_GROUP:".nav, .list-group",NAV_LINKS:".nav-link",NAV_ITEMS:".nav-item",LIST_ITEMS:".list-group-item",DROPDOWN:".dropdown",DROPDOWN_ITEMS:".dropdown-item",DROPDOWN_TOGGLE:".dropdown-toggle"},d="offset",_="position",g=function(){function o(e,n){var i=this;this._element=e,this._scrollElement="BODY"===e.tagName?window:e,this._config=this._getConfig(n),this._selector=this._config.target+" "+f.NAV_LINKS+","+this._config.target+" "+f.LIST_ITEMS+","+this._config.target+" "+f.DROPDOWN_ITEMS,this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,t(this._scrollElement).on(h.SCROLL,function(t){return i._process(t)}),this.refresh(),this._process()}var g=o.prototype;return g.refresh=function(){var e=this,n=this._scrollElement===this._scrollElement.window?d:_,i="auto"===this._config.method?n:this._config.method,s=i===_?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),t.makeArray(t(this._selector)).map(function(e){var n,r=P.getSelectorFromElement(e);if(r&&(n=t(r)[0]),n){var o=n.getBoundingClientRect();if(o.width||o.height)return[t(n)[i]().top+s,r]}return null}).filter(function(t){return t}).sort(function(t,e){return t[0]-e[0]}
6).forEach(function(t){e._offsets.push(t[0]),e._targets.push(t[1])})},g.dispose=function(){t.removeData(this._element,n),t(this._scrollElement).off(i),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},g._getConfig=function(n){if("string"!=typeof(n=r({},a,n)).target){var i=t(n.target).attr("id");i||(i=P.getUID(e),t(n.target).attr("id",i)),n.target="#"+i}return P.typeCheckConfig(e,n,l),n},g._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},g._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},g._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},g._process=function(){var t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),n=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=n){var i=this._targets[this._targets.length-1];this._activeTarget!==i&&this._activate(i)}else{if(this._activeTarget&&t<this._offsets[0]&&this._offsets[0]>0)return this._activeTarget=null,void this._clear();for(var s=this._offsets.length;s--;){this._activeTarget!==this._targets[s]&&t>=this._offsets[s]&&("undefined"==typeof this._offsets[s+1]||t<this._offsets[s+1])&&this._activate(this._targets[s])}}},g._activate=function(e){this._activeTarget=e,this._clear();var n=this._selector.split(",");n=n.map(function(t){return t+'[data-target="'+e+'"],'+t+'[href="'+e+'"]'});var i=t(n.join(","));i.hasClass(c)?(i.closest(f.DROPDOWN).find(f.DROPDOWN_TOGGLE).addClass(u),i.addClass(u)):(i.addClass(u),i.parents(f.NAV_LIST_GROUP).prev(f.NAV_LINKS+", "+f.LIST_ITEMS).addClass(u),i.parents(f.NAV_LIST_GROUP).prev(f.NAV_ITEMS).children(f.NAV_LINKS).addClass(u)),t(this._scrollElement).trigger(h.ACTIVATE,{relatedTarget:e})},g._clear=function(){t(this._selector).filter(f.ACTIVE).removeClass(u)},o._jQueryInterface=function(e){return this.each(function(){var i=t(this).data(n);if(i||(i=new o(this,"object"==typeof e&&e),t(this).data(n,i)),"string"==typeof e){if("undefined"==typeof i[e])throw new TypeError('No method named "'+e+'"');i[e]()}})},s(o,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return a}}]),o}();return t(window).on(h.LOAD_DATA_API,function(){for(var e=t.makeArray(t(f.DATA_SPY)),n=e.length;n--;){var i=t(e[n]);g._jQueryInterface.call(i,i.data())}}),t.fn[e]=g._jQueryInterface,t.fn[e].Constructor=g,t.fn[e].noConflict=function(){return t.fn[e]=o,g._jQueryInterface},g}(e),V=function(t){var e="bs.tab",n="."+e,i=t.fn.tab,r={HIDE:"hide"+n,HIDDEN:"hidden"+n,SHOW:"show"+n,SHOWN:"shown"+n,CLICK_DATA_API:"click.bs.tab.data-api"},o="dropdown-menu",a="active",l="disabled",h="fade",c="show",u=".dropdown",f=".nav, .list-group",d=".active",_="> li > .active",g='[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',p=".dropdown-toggle",m="> .dropdown-menu .active",v=function(){function n(t){this._element=t}var i=n.prototype;return i.show=function(){var e=this;if(!(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&t(this._element).hasClass(a)||t(this._element).hasClass(l))){var n,i,s=t(this._element).closest(f)[0],o=P.getSelectorFromElement(this._element);if(s){var h="UL"===s.nodeName?_:d;i=(i=t.makeArray(t(s).find(h)))[i.length-1]}var c=t.Event(r.HIDE,{relatedTarget:this._element}),u=t.Event(r.SHOW,{relatedTarget:i});if(i&&t(i).trigger(c),t(this._element).trigger(u),!u.isDefaultPrevented()&&!c.isDefaultPrevented()){o&&(n=t(o)[0]),this._activate(this._element,s);var g=function(){var n=t.Event(r.HIDDEN,{relatedTarget:e._element}),s=t.Event(r.SHOWN,{relatedTarget:i});t(i).trigger(n),t(e._element).trigger(s)};n?this._activate(n,n.parentNode,g):g()}}},i.dispose=function(){t.removeData(this._element,e),this._element=null},i._activate=function(e,n,i){var s=this,r=("UL"===n.nodeName?t(n).find(_):t(n).children(d))[0],o=i&&P.supportsTransitionEnd()&&r&&t(r).hasClass(h),a=function(){return s._transitionComplete(e,r,i)};r&&o?t(r).one(P.TRANSITION_END,a).emulateTransitionEnd(150):a()},i._transitionComplete=function(e,n,i){if(n){t(n).removeClass(c+" "+a);var s=t(n.parentNode).find(m)[0];s&&t(s).removeClass(a),"tab"===n.getAttribute("role")&&n.setAttribute("aria-selected",!1)}if(t(e).addClass(a),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!0),P.reflow(e),t(e).addClass(c),e.parentNode&&t(e.parentNode).hasClass(o)){var r=t(e).closest(u)[0];r&&t(r).find(p).addClass(a),e.setAttribute("aria-expanded",!0)}i&&i()},n._jQueryInterface=function(i){return this.each(function(){var s=t(this),r=s.data(e);if(r||(r=new n(this),s.data(e,r)),"string"==typeof i){if("undefined"==typeof r[i])throw new TypeError('No method n
6amed "'+i+'"');r[i]()}})},s(n,null,[{key:"VERSION",get:function(){return"4.0.0"}}]),n}();return t(document).on(r.CLICK_DATA_API,g,function(e){e.preventDefault(),v._jQueryInterface.call(t(this),"show")}),t.fn.tab=v._jQueryInterface,t.fn.tab.Constructor=v,t.fn.tab.noConflict=function(){return t.fn.tab=i,v._jQueryInterface},v}(e);!function(t){if("undefined"==typeof t)throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.");var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1===e[0]&&9===e[1]&&e[2]<1||e[0]>=4)throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}(e),t.Util=P,t.Alert=L,t.Button=R,t.Carousel=j,t.Collapse=H,t.Dropdown=W,t.Modal=M,t.Popover=x,t.Scrollspy=K,t.Tab=V,t.Tooltip=U,Object.defineProperty(t,"__esModule",{value:!0})}); 7//# sourceMappingURL=bootstrap.min.js.map 8/*! 9 * Flickity PACKAGED v2.3.0 10 * Touch, responsive, flickable carousels 11 * 12 * Licensed GPLv3 for open source use 13 * or Flickity Commercial License for commercial use 14 * 15 * https://flickity.metafizzy.co 16 * Copyright 2015-2021 Metafizzy
vendor: 19,108 bytes, lines 16-780
16 17 */ 18 19/** 20 * Bridget makes jQuery widgets 21 * v2.0.1 22 * MIT license 23 */ 24 25/* jshint browser: true, strict: true, undef: true, unused: true */ 26 27( function( window, factory ) { 28 // universal module definition 29 /*jshint strict: false */ /* globals define, module, require */ 30 if ( typeof define == 'function' && define.amd ) { 31 // AMD 32 define( 'jquery-bridget/jquery-bridget',[ 'jquery' ], function( jQuery ) { 33 return factory( window, jQuery ); 34 }); 35 } else if ( typeof module == 'object' && module.exports ) { 36 // CommonJS 37 module.exports = factory( 38 window, 39 require('jquery') 40 ); 41 } else { 42 // browser global 43 window.jQueryBridget = factory( 44 window, 45 window.jQuery 46 ); 47 } 48 49}( window, function factory( window, jQuery ) { 50'use strict'; 51 52// ----- utils ----- // 53 54var arraySlice = Array.prototype.slice; 55 56// helper function for logging errors 57// $.error breaks jQuery chaining 58var console = window.console; 59var logError = typeof console == 'undefined' ? function() {} : 60 function( message ) { 61 console.error( message ); 62 }; 63 64// ----- jQueryBridget ----- // 65 66function jQueryBridget( namespace, PluginClass, $ ) { 67 $ = $ || jQuery || window.jQuery; 68 if ( !$ ) { 69 return; 70 } 71 72 // add option method -> $().plugin('option', {...}) 73 if ( !PluginClass.prototype.option ) { 74 // option setter 75 PluginClass.prototype.option = function( opts ) { 76 // bail out if not an object 77 if ( !$.isPlainObject( opts ) ){ 78 return; 79 } 80 this.options = $.extend( true, this.options, opts ); 81 }; 82 } 83 84 // make jQuery plugin 85 $.fn[ namespace ] = function( arg0 /*, arg1 */ ) { 86 if ( typeof arg0 == 'string' ) { 87 // method call $().plugin( 'methodName', { options } ) 88 // shift arguments by 1 89 var args = arraySlice.call( arguments, 1 ); 90 return methodCall( this, arg0, args ); 91 } 92 // just $().plugin({ options }) 93 plainCall( this, arg0 ); 94 return this; 95 }; 96 97 // $().plugin('methodName') 98 function methodCall( $elems, methodName, args ) { 99 var returnValue; 100 var pluginMethodStr = '$().' + namespace + '("' + methodName + '")'; 101 102 $elems.each( function( i, elem ) { 103 // get instance 104 var instance = $.data( elem, namespace ); 105 if ( !instance ) { 106 logError( namespace + ' not initialized. Cannot call methods, i.e. ' + 107 pluginMethodStr ); 108 return; 109 } 110 111 var method = instance[ methodName ]; 112 if ( !method || methodName.charAt(0) == '_' ) { 113 logError( pluginMethodStr + ' is not a valid method' ); 114 return; 115 } 116 117 // apply method, get return value 118 var value = method.apply( instance, args ); 119 // set return value if value is returned, use only first value 120 returnValue = returnValue === undefined ? value : returnValue; 121 }); 122 123 return returnValue !== undefined ? returnValue : $elems; 124 } 125 126 function plainCall( $elems, options ) { 127 $elems.each( function( i, elem ) { 128 var instance = $.data( elem, namespace ); 129 if ( instance ) { 130 // set options & init 131 instance.option( options ); 132 instance._init(); 133 } else { 134 // initialize new instance 135 instance = new PluginClass( elem, options ); 136 $.data( elem, namespace, instance ); 137 } 138 }); 139 } 140 141 updateJQuery( $ ); 142 143} 144 145// ----- updateJQuery ----- // 146 147// set $.bridget for v1 backwards compatibility 148function updateJQuery( $ ) { 149 if ( !$ || ( $ && $.bridget ) ) { 150 return; 151 } 152 $.bridget = jQueryBridget; 153} 154 155updateJQuery( jQuery || window.jQuery ); 156 157// ----- ----- // 158 159return jQueryBridget; 160 161})); 162 163/** 164 * EvEmitter v1.1.0 165 * Lil' event emitter 166 * MIT License 167 */ 168 169/* jshint unused: true, undef: true, strict: true */ 170 171( function( global, factory ) { 172 // universal module definition 173 /* jshint strict: false */ /* globals define, module, window */ 174 if ( typeof define == 'function' && define.amd ) { 175 // AMD - RequireJS 176 define( 'ev-emitter/ev-emitter',factory ); 177 } else if ( typeof module == 'object' && module.exports ) { 178 // CommonJS - Browserify, Webpack 179 module.exports = factory(); 180 } else { 181 // Browser globals 182 global.EvEmitter = factory(); 183 } 184 185}( typeof window != 'undefined' ? window : this, function() { 186 187 188 189function EvEmitter() {} 190 191var proto = EvEmitter.prototype; 192 193proto.on = function( eventName, listener ) { 194 if ( !eventName || !listener ) { 195 return; 196 } 197 // set events hash 198 var events = this._events = this._events || {}; 199 // set listeners array 200 var listeners = events[ eventName ] = events[ eventName ] || []; 201 // only add once 202 if ( listeners.indexOf( listener ) == -1 ) { 203 listeners.push( listener ); 204 } 205 206 return this; 207}; 208 209proto.once = function( eventName, listener ) { 210 if ( !eventName || !listener ) { 211 return; 212 } 213 // add event 214 this.on( eventName, listener ); 215 // set once flag 216 // set onceEvents hash 217 var onceEvents = this._onceEvents = this._onceEvents || {}; 218 // set onceListeners object 219 var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; 220 // set flag 221 onceListeners[ listener ] = true; 222 223 return this; 224}; 225 226proto.off = function( eventName, listener ) { 227 var listeners = this._events && this._events[ eventName ]; 228 if ( !listeners || !listeners.length ) { 229 return; 230 } 231 var index = listeners.indexOf( listener ); 232 if ( index != -1 ) { 233 listeners.splice( index, 1 ); 234 } 235 236 return this; 237}; 238 239proto.emitEvent = function( eventName, args ) { 240 var listeners = this._events && this._events[ eventName ]; 241 if ( !listeners || !listeners.length ) { 242 return; 243 } 244 // copy over to avoid interference if .off() in listener 245 listeners = listeners.slice(0); 246 args = args || []; 247 // once stuff 248 var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; 249 250 for ( var i=0; i < listeners.length; i++ ) { 251 var listener = listeners[i] 252 var isOnce = onceListeners && onceListeners[ listener ]; 253 if ( isOnce ) { 254 // remove listener 255 // remove before trigger to prevent recursion 256 this.off( eventName, listener ); 257 // unset once flag 258 delete onceListeners[ listener ]; 259 } 260 // trigger listener 261 listener.apply( this, args ); 262 } 263 264 return this; 265}; 266 267proto.allOff = function() { 268 delete this._events; 269 delete this._onceEvents; 270}; 271 272return EvEmitter; 273 274})); 275 276/*! 277 * getSize v2.0.3 278 * measure size of elements 279 * MIT license 280 */ 281 282/* jshint browser: true, strict: true, undef: true, unused: true */ 283/* globals console: false */ 284 285( function( window, factory ) { 286 /* jshint strict: false */ /* globals define, module */ 287 if ( typeof define == 'function' && define.amd ) { 288 // AMD 289 define( 'get-size/get-size',factory ); 290 } else if ( typeof module == 'object' && module.exports ) { 291 // CommonJS 292 module.exports = factory(); 293 } else { 294 // browser global 295 window.getSize = factory(); 296 } 297 298})( window, function factory() { 299'use strict'; 300 301// -------------------------- helpers -------------------------- // 302 303// get a number from a string, not a percentage 304function getStyleSize( value ) { 305 var num = parseFloat( value ); 306 // not a percent like '100%', and a number 307 var isValid = value.indexOf('%') == -1 && !isNaN( num ); 308 return isValid && num; 309} 310 311function noop() {} 312 313var logError = typeof console == 'undefined' ? noop : 314 function( message ) { 315 console.error( message ); 316 }; 317 318// -------------------------- measurements -------------------------- // 319 320var measurements = [ 321 'paddingLeft', 322 'paddingRight', 323 'paddingTop', 324 'paddingBottom', 325 'marginLeft', 326 'marginRight', 327 'marginTop', 328 'marginBottom', 329 'borderLeftWidth', 330 'borderRightWidth', 331 'borderTopWidth', 332 'borderBottomWidth' 333]; 334 335var measurementsLength = measurements.length; 336 337function getZeroSize() { 338 var size = { 339 width: 0, 340 height: 0, 341 innerWidth: 0, 342 innerHeight: 0, 343 outerWidth: 0, 344 outerHeight: 0 345 }; 346 for ( var i=0; i < measurementsLength; i++ ) { 347 var measurement = measurements[i]; 348 size[ measurement ] = 0; 349 } 350 return size; 351} 352 353// -------------------------- getStyle -------------------------- // 354 355/** 356 * getStyle, get style of element, check for Firefox bug 357 * https://bugzilla.mozilla.org/show_bug.cgi?id=548397 358 */ 359function getStyle( elem ) { 360 var style = getComputedStyle( elem ); 361 if ( !style ) { 362 logError( 'Style returned ' + style + 363 '. Are you running this code in a hidden iframe on Firefox? ' + 364 'See https://bit.ly/getsizebug1' ); 365 } 366 return style; 367} 368 369// -------------------------- setup -------------------------- // 370 371var isSetup = false; 372 373var isBoxSizeOuter; 374 375/** 376 * setup 377 * check isBoxSizerOuter 378 * do on first getSize() rather than on page load for Firefox bug 379 */ 380function setup() { 381 // setup once 382 if ( isSetup ) { 383 return; 384 } 385 isSetup = true; 386 387 // -------------------------- box sizing -------------------------- // 388 389 /** 390 * Chrome & Safari measure the outer-width on style.width on border-box elems 391 * IE11 & Firefox<29 measures the inner-width 392 */ 393 var div = document.createElement('div'); 394 div.style.width = '200px'; 395 div.style.padding = '1px 2px 3px 4px'; 396 div.style.borderStyle = 'solid'; 397 div.style.borderWidth = '1px 2px 3px 4px'; 398 div.style.boxSizing = 'border-box'; 399 400 var body = document.body || document.documentElement; 401 body.appendChild( div ); 402 var style = getStyle( div ); 403 // round value for browser zoom. desandro/masonry#928 404 isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200; 405 getSize.isBoxSizeOuter = isBoxSizeOuter; 406 407 body.removeChild( div ); 408} 409 410// -------------------------- getSize -------------------------- // 411 412function getSize( elem ) { 413 setup(); 414 415 // use querySeletor if elem is string 416 if ( typeof elem == 'string' ) { 417 elem = document.querySelector( elem ); 418 } 419 420 // do not proceed on non-objects 421 if ( !elem || typeof elem != 'object' || !elem.nodeType ) { 422 return; 423 } 424 425 var style = getStyle( elem ); 426 427 // if hidden, everything is 0 428 if ( style.display == 'none' ) { 429 return getZeroSize(); 430 } 431 432 var size = {}; 433 size.width = elem.offsetWidth; 434 size.height = elem.offsetHeight; 435 436 var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box'; 437 438 // get all measurements 439 for ( var i=0; i < measurementsLength; i++ ) { 440 var measurement = measurements[i]; 441 var value = style[ measurement ]; 442 var num = parseFloat( value ); 443 // any 'auto', 'medium' value will be 0 444 size[ measurement ] = !isNaN( num ) ? num : 0; 445 } 446 447 var paddingWidth = size.paddingLeft + size.paddingRight; 448 var paddingHeight = size.paddingTop + size.paddingBottom; 449 var marginWidth = size.marginLeft + size.marginRight; 450 var marginHeight = size.marginTop + size.marginBottom; 451 var borderWidth = size.borderLeftWidth + size.borderRightWidth; 452 var borderHeight = size.borderTopWidth + size.borderBottomWidth; 453 454 var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter; 455 456 // overwrite width and height if we can get it from style 457 var styleWidth = getStyleSize( style.width ); 458 if ( styleWidth !== false ) { 459 size.width = styleWidth + 460 // add padding and border unless it's already including it 461 ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth ); 462 } 463 464 var styleHeight = getStyleSize( style.height ); 465 if ( styleHeight !== false ) { 466 size.height = styleHeight + 467 // add padding and border unless it's already including it 468 ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight ); 469 } 470 471 size.innerWidth = size.width - ( paddingWidth + borderWidth ); 472 size.innerHeight = size.height - ( paddingHeight + borderHeight ); 473 474 size.outerWidth = size.width + marginWidth; 475 size.outerHeight = size.height + marginHeight; 476 477 return size; 478} 479 480return getSize; 481 482}); 483 484/** 485 * matchesSelector v2.0.2 486 * matchesSelector( element, '.selector' ) 487 * MIT license 488 */ 489 490/*jshint browser: true, strict: true, undef: true, unused: true */ 491 492( function( window, factory ) { 493 /*global define: false, module: false */ 494 'use strict'; 495 // universal module definition 496 if ( typeof define == 'function' && define.amd ) { 497 // AMD 498 define( 'desandro-matches-selector/matches-selector',factory ); 499 } else if ( typeof module == 'object' && module.exports ) { 500 // CommonJS 501 module.exports = factory(); 502 } else { 503 // browser global 504 window.matchesSelector = factory(); 505 } 506 507}( window, function factory() { 508 'use strict'; 509 510 var matchesMethod = ( function() { 511 var ElemProto = window.Element.prototype; 512 // check for the standard method name first 513 if ( ElemProto.matches ) { 514 return 'matches'; 515 } 516 // check un-prefixed 517 if ( ElemProto.matchesSelector ) { 518 return 'matchesSelector'; 519 } 520 // check vendor prefixes 521 var prefixes = [ 'webkit', 'moz', 'ms', 'o' ]; 522 523 for ( var i=0; i < prefixes.length; i++ ) { 524 var prefix = prefixes[i]; 525 var method = prefix + 'MatchesSelector'; 526 if ( ElemProto[ method ] ) { 527 return method; 528 } 529 } 530 })(); 531 532 return function matchesSelector( elem, selector ) { 533 return elem[ matchesMethod ]( selector ); 534 }; 535 536})); 537 538/** 539 * Fizzy UI utils v2.0.7 540 * MIT license 541 */ 542 543/*jshint browser: true, undef: true, unused: true, strict: true */ 544 545( function( window, factory ) { 546 // universal module definition 547 /*jshint strict: false */ /*globals define, module, require */ 548 549 if ( typeof define == 'function' && define.amd ) { 550 // AMD 551 define( 'fizzy-ui-utils/utils',[ 552 'desandro-matches-selector/matches-selector' 553 ], function( matchesSelector ) { 554 return factory( window, matchesSelector ); 555 }); 556 } else if ( typeof module == 'object' && module.exports ) { 557 // CommonJS 558 module.exports = factory( 559 window, 560 require('desandro-matches-selector') 561 ); 562 } else { 563 // browser global 564 window.fizzyUIUtils = factory( 565 window, 566 window.matchesSelector 567 ); 568 } 569 570}( window, function factory( window, matchesSelector ) { 571 572 573 574var utils = {}; 575 576// ----- extend ----- // 577 578// extends objects 579utils.extend = function( a, b ) { 580 for ( var prop in b ) { 581 a[ prop ] = b[ prop ]; 582 } 583 return a; 584}; 585 586// ----- modulo ----- // 587 588utils.modulo = function( num, div ) { 589 return ( ( num % div ) + div ) % div; 590}; 591 592// ----- makeArray ----- // 593 594var arraySlice = Array.prototype.slice; 595 596// turn element or nodeList into an array 597utils.makeArray = function( obj ) { 598 if ( Array.isArray( obj ) ) { 599 // use object if already an array 600 return obj; 601 } 602 // return empty array if undefined or null. #6 603 if ( obj === null || obj === undefined ) { 604 return []; 605 } 606 607 var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number'; 608 if ( isArrayLike ) { 609 // convert nodeList to array 610 return arraySlice.call( obj ); 611 } 612 613 // array of single index 614 return [ obj ]; 615}; 616 617// ----- removeFrom ----- // 618 619utils.removeFrom = function( ary, obj ) { 620 var index = ary.indexOf( obj ); 621 if ( index != -1 ) { 622 ary.splice( index, 1 ); 623 } 624}; 625 626// ----- getParent ----- // 627 628utils.getParent = function( elem, selector ) { 629 while ( elem.parentNode && elem != document.body ) { 630 elem = elem.parentNode; 631 if ( matchesSelector( elem, selector ) ) { 632 return elem; 633 } 634 } 635}; 636 637// ----- getQueryElement ----- // 638 639// use element as selector string 640utils.getQueryElement = function( elem ) { 641 if ( typeof elem == 'string' ) { 642 return document.querySelector( elem ); 643 } 644 return elem; 645}; 646 647// ----- handleEvent ----- // 648 649// enable .ontype to trigger from .addEventListener( elem, 'type' ) 650utils.handleEvent = function( event ) { 651 var method = 'on' + event.type; 652 if ( this[ method ] ) { 653 this[ method ]( event ); 654 } 655}; 656 657// ----- filterFindElements ----- // 658 659utils.filterFindElements = function( elems, selector ) { 660 // make array of elems 661 elems = utils.makeArray( elems ); 662 var ffElems = []; 663 664 elems.forEach( function( elem ) { 665 // check that elem is an actual element 666 if ( !( elem instanceof HTMLElement ) ) { 667 return; 668 } 669 // add elem if no selector 670 if ( !selector ) { 671 ffElems.push( elem ); 672 return; 673 } 674 // filter & find items if we have a selector 675 // filter 676 if ( matchesSelector( elem, selector ) ) { 677 ffElems.push( elem ); 678 } 679 // find children 680 var childElems = elem.querySelectorAll( selector ); 681 // concat childElems to filterFound array 682 for ( var i=0; i < childElems.length; i++ ) { 683 ffElems.push( childElems[i] ); 684 } 685 }); 686 687 return ffElems; 688}; 689 690// ----- debounceMethod ----- // 691 692utils.debounceMethod = function( _class, methodName, threshold ) { 693 threshold = threshold || 100; 694 // original method 695 var method = _class.prototype[ methodName ]; 696 var timeoutName = methodName + 'Timeout'; 697 698 _class.prototype[ methodName ] = function() { 699 var timeout = this[ timeoutName ]; 700 clearTimeout( timeout ); 701 702 var args = arguments; 703 var _this = this; 704 this[ timeoutName ] = setTimeout( function() { 705 method.apply( _this, args ); 706 delete _this[ timeoutName ]; 707 }, threshold ); 708 }; 709}; 710 711// ----- docReady ----- // 712 713utils.docReady = function( callback ) { 714 var readyState = document.readyState; 715 if ( readyState == 'complete' || readyState == 'interactive' ) { 716 // do async to allow for other scripts to run. metafizzy/flickity#441 717 setTimeout( callback ); 718 } else { 719 document.addEventListener( 'DOMContentLoaded', callback ); 720 } 721}; 722 723// ----- htmlInit ----- // 724 725// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/ 726utils.toDashed = function( str ) { 727 return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) { 728 return $1 + '-' + $2; 729 }).toLowerCase(); 730}; 731 732var console = window.console; 733/** 734 * allow user to initialize classes via [data-namespace] or .js-namespace class 735 * htmlInit( Widget, 'widgetName' ) 736 * options are parsed from data-namespace-options 737 */ 738utils.htmlInit = function( WidgetClass, namespace ) { 739 utils.docReady( function() { 740 var dashedNamespace = utils.toDashed( namespace ); 741 var dataAttr = 'data-' + dashedNamespace; 742 var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' ); 743 var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace ); 744 var elems = utils.makeArray( dataAttrElems ) 745 .concat( utils.makeArray( jsDashElems ) ); 746 var dataOptionsAttr = dataAttr + '-options'; 747 var jQuery = window.jQuery; 748 749 elems.forEach( function( elem ) { 750 var attr = elem.getAttribute( dataAttr ) || 751 elem.getAttribute( dataOptionsAttr ); 752 var options; 753 try { 754 options = attr && JSON.parse( attr ); 755 } catch ( error ) { 756 // log error, do not initialize 757 if ( console ) { 758 console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className + 759 ': ' + error ); 760 } 761 return; 762 } 763 // initialize 764 var instance = new WidgetClass( elem, options ); 765 // make available via $().data('namespace') 766 if ( jQuery ) { 767 jQuery.data( elem, namespace, instance ); 768 } 769 }); 770 771 }); 772}; 773 774// ----- ----- // 775 776return utils; 777 778})); 779 780/
780/ Flickity.Cell 781( function( window, factory ) { 782 // universal module definition 783 if ( typeof define == 'function' && define.amd ) { 784 // AMD 785 define( 'flickity/js/cell',[ 786 'get-size/get-size', 787 ], function( getSize ) { 788 return factory( window, getSize ); 789 } ); 790 } else if ( typeof module == 'object' && module.exports ) { 791 // CommonJS 792 module.exports = factory( 793 window, 794 require('get-size') 795 ); 796 } else { 797 // browser global 798 window.Flickity = window.Flickity || {}; 799 window.Flickity.Cell = factory( 800 window, 801 window.getSize 802 ); 803 } 804 805}( window, function factory( window, getSize ) { 806 807 808 809function Cell( elem, parent ) { 810 this.element = elem; 811 this.parent = parent; 812 813 this.create(); 814} 815 816var proto = Cell.prototype; 817 818proto.create = function() { 819 this.element.style.position = 'absolute'; 820 this.element.setAttribute( 'aria-hidden', 'true' ); 821 this.x = 0; 822 this.shift = 0; 823 this.element.style[ this.parent.originSide ] = 0; 824}; 825 826proto.destroy = function() { 827 // reset style 828 this.unselect(); 829 this.element.style.position = ''; 830 var side = this.parent.originSide; 831 this.element.style[ side ] = ''; 832 this.element.style.transform = ''; 833 this.element.removeAttribute('aria-hidden'); 834}; 835 836proto.getSize = function() { 837 this.size = getSize( this.element ); 838}; 839 840proto.setPosition = function( x ) { 841 this.x = x; 842 this.updateTarget(); 843 this.renderPosition( x ); 844}; 845 846// setDefaultTarget v1 method, backwards compatibility, remove in v3 847proto.updateTarget = proto.setDefaultTarget = function() { 848 var marginProperty = this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight'; 849 this.target = this.x + this.size[ marginProperty ] + 850 this.size.width * this.parent.cellAlign; 851}; 852 853proto.renderPosition = function( x ) { 854 // render position of cell with in slider 855 var sideOffset = this.parent.originSide === 'left' ? 1 : -1; 856 857 var adjustedX = this.parent.options.percentPosition ? 858 x * sideOffset * ( this.parent.size.innerWidth / this.size.width ) : 859 x * sideOffset; 860 861 this.element.style.transform = 'translateX(' + 862 this.parent.getPositionValue( adjustedX ) + ')'; 863}; 864 865proto.select = function() { 866 this.element.classList.add('is-selected'); 867 this.element.removeAttribute('aria-hidden'); 868}; 869 870proto.unselect = function() { 871 this.element.classList.remove('is-selected'); 872 this.element.setAttribute( 'aria-hidden', 'true' ); 873}; 874 875/** 876 * @param {Integer} shift - 0, 1, or -1 877 */ 878proto.wrapShift = function( shift ) { 879 this.shift = shift; 880 this.renderPosition( this.x + this.parent.slideableWidth * shift ); 881}; 882 883proto.remove = function() { 884 this.element.parentNode.removeChild( this.element ); 885}; 886 887return Cell; 888 889} ) ); 890 891// slide 892( function( window, factory ) { 893 // universal module definition 894 if ( typeof define == 'function' && define.amd ) { 895 // AMD 896 define( 'flickity/js/slide',factory ); 897 } else if ( typeof module == 'object' && module.exports ) { 898 // CommonJS 899 module.exports = factory(); 900 } else { 901 // browser global 902 window.Flickity = window.Flickity || {}; 903 window.Flickity.Slide = factory(); 904 } 905 906}( window, function factory() { 907'use strict'; 908 909function Slide( parent ) { 910 this.parent = parent; 911 this.isOriginLeft = parent.originSide == 'left'; 912 this.cells = []; 913 this.outerWidth = 0; 914 this.height = 0; 915} 916 917var proto = Slide.prototype; 918 919proto.addCell = function( cell ) { 920 this.cells.push( cell ); 921 this.outerWidth += cell.size.outerWidth; 922 this.height = Math.max( cell.size.outerHeight, this.height ); 923 // first cell stuff 924 if ( this.cells.length == 1 ) { 925 this.x = cell.x; // x comes from first cell 926 var beginMargin = this.isOriginLeft ? 'marginLeft' : 'marginRight'; 927 this.firstMargin = cell.size[ beginMargin ]; 928 } 929}; 930 931proto.updateTarget = function() { 932 var endMargin = this.isOriginLeft ? 'marginRight' : 'marginLeft'; 933 var lastCell = this.getLastCell(); 934 var lastMargin = lastCell ? lastCell.size[ endMargin ] : 0; 935 var slideWidth = this.outerWidth - ( this.firstMargin + lastMargin ); 936 this.target = this.x + this.firstMargin + slideWidth * this.parent.cellAlign; 937}; 938 939proto.getLastCell = function() { 940 return this.cells[ this.cells.length - 1 ]; 941}; 942 943proto.select = function() {
944 this.cells.forEach( function( cell ) { 945 cell.select(); 946 } ); 947}; 948 949proto.unselect = function() { 950 this.cells.forEach( function( cell ) { 951 cell.unselect(); 952 } ); 953}; 954 955proto.getCellElements = function() { 956 return this.cells.map( function( cell ) { 957 return cell.element; 958 } ); 959}; 960 961return Slide; 962 963} ) ); 964 965// animate 966( function( window, factory ) { 967 // universal module definition 968 if ( typeof define == 'function' && define.amd ) { 969 // AMD 970 define( 'flickity/js/animate',[ 971 'fizzy-ui-utils/utils', 972 ], function( utils ) { 973 return factory( window, utils ); 974 } ); 975 } else if ( typeof module == 'object' && module.exports ) { 976 // CommonJS 977 module.exports = factory( 978 window, 979 require('fizzy-ui-utils') 980 ); 981 } else { 982 // browser global 983 window.Flickity = window.Flickity || {}; 984 window.Flickity.animatePrototype = factory( 985 window, 986 window.fizzyUIUtils 987 ); 988 } 989 990}( window, function factory( window, utils ) { 991 992 993 994// -------------------------- animate -------------------------- // 995 996var proto = {}; 997 998proto.startAnimation = function() { 999 if ( this.isAnimating ) { 1000 return; 1001 } 1002 1003 this.isAnimating = true; 1004 this.restingFrames = 0; 1005 this.animate(); 1006}; 1007 1008proto.animate = function() { 1009 this.applyDragForce(); 1010 this.applySelectedAttraction(); 1011 1012 var previousX = this.x; 1013 1014 this.integratePhysics(); 1015 this.positionSlider(); 1016 this.settle( previousX ); 1017 // animate next frame 1018 if ( this.isAnimating ) { 1019 var _this = this; 1020 requestAnimationFrame( function animateFrame() { 1021 _this.animate(); 1022 } ); 1023 } 1024}; 1025 1026proto.positionSlider = function() { 1027 var x = this.x; 1028 // wrap position around 1029 if ( this.options.wrapAround && this.cells.length > 1 ) { 1030 x = utils.modulo( x, this.slideableWidth ); 1031 x -= this.slideableWidth; 1032 this.shiftWrapCells( x ); 1033 } 1034 1035 this.setTranslateX( x, this.isAnimating ); 1036 this.dispatchScrollEvent(); 1037}; 1038 1039proto.setTranslateX = function( x, is3d ) { 1040 x += this.cursorPosition; 1041 // reverse if right-to-left and using transform 1042 x = this.options.rightToLeft ? -x : x; 1043 var translateX = this.getPositionValue( x ); 1044 // use 3D transforms for hardware acceleration on iOS 1045 // but use 2D when settled, for better font-rendering 1046 this.slider.style.transform = is3d ? 1047 'translate3d(' + translateX + ',0,0)' : 'translateX(' + translateX + ')'; 1048}; 1049 1050proto.dispatchScrollEvent = function() { 1051 var firstSlide = this.slides[0]; 1052 if ( !firstSlide ) { 1053 return; 1054 } 1055 var positionX = -this.x - firstSlide.target; 1056 var progress = positionX / this.slidesWidth; 1057 this.dispatchEvent( 'scroll', null, [ progress, positionX ] ); 1058}; 1059 1060proto.positionSliderAtSelected = function() { 1061 if ( !this.cells.length ) { 1062 return; 1063 } 1064 this.x = -this.selectedSlide.target; 1065 this.velocity = 0; // stop wobble 1066 this.positionSlider(); 1067}; 1068 1069proto.getPositionValue = function( position ) { 1070 if ( this.options.percentPosition ) { 1071 // percent position, round to 2 digits, like 12.34% 1072 return ( Math.round( ( position / this.size.innerWidth ) * 10000 ) * 0.01 ) + '%'; 1073 } else { 1074 // pixel positioning 1075 return Math.round( position ) + 'px'; 1076 } 1077}; 1078 1079proto.settle = function( previousX ) { 1080 // keep track of frames where x hasn't moved 1081 var isResting = !this.isPointerDown && 1082 Math.round( this.x * 100 ) == Math.round( previousX * 100 ); 1083 if ( isResting ) { 1084 this.restingFrames++; 1085 } 1086 // stop animating if resting for 3 or more frames 1087 if ( this.restingFrames > 2 ) { 1088 this.isAnimating = false; 1089 delete this.isFreeScrolling; 1090 // render position with translateX when settled 1091 this.positionSlider(); 1092 this.dispatchEvent( 'settle', null, [ this.selectedIndex ] ); 1093 } 1094}; 1095 1096proto.shiftWrapCells = function( x ) { 1097 // shift before cells 1098 var beforeGap = this.cursorPosition + x; 1099 this._shiftCells( this.beforeShiftCells, beforeGap, -1 ); 1100 // shift after cells 1101 var afterGap = this.size.innerWidth - ( x + this.slideableWidth + this.cursorPosition ); 1102 this._shiftCells( this.afterShiftCells, afterGap, 1 ); 1103}; 1104 1105proto._shiftCells = function( cells, gap, shift ) { 1106 for ( var i = 0; i < cells.length; i++ ) { 1107 var cell = cells[i]; 1108 var cellShift = gap > 0 ? shift : 0; 1109 cell.wrapShift( cellShift ); 1110 gap -= cell.size.outerWidth; 1111 } 1112}; 1113 1114proto._unshiftCells = function( cells ) { 1115 if ( !cells || !cells.length ) { 1116 return; 1117 } 1118 for ( var i = 0; i < cells.length; i++ ) { 1119 cells[i].wrapShift( 0 ); 1120 } 1121}; 1122 1123// -------------------------- physics -------------------------- // 1124 1125proto.integratePhysics = function() { 1126 this.x += this.velocity; 1127 this.velocity *= this.getFrictionFactor(); 1128}; 1129 1130proto.applyForce = function( force ) { 1131 this.velocity += force; 1132}; 1133 1134proto.getFrictionFactor = function() { 1135 return 1 - this.options[ this.isFreeScrolling ? 'freeScrollFriction' : 'friction' ]; 1136}; 1137 1138proto.getRestingPosition = function() { 1139 // my thanks to Steven Wittens, who simplified this math greatly 1140 return this.x + this.velocity / ( 1 - this.getFrictionFactor() ); 1141}; 1142 1143proto.applyDragForce = function() { 1144 if ( !this.isDraggable || !this.isPointerDown ) { 1145 return; 1146 } 1147 // change the position to drag position by applying force 1148 var dragVelocity = this.dragX - this.x; 1149 var dragForce = dragVelocity - this.velocity; 1150 this.applyForce( dragForce ); 1151}; 1152 1153proto.applySelectedAttraction = function() { 1154 // do not attract if pointer down or no slides 1155 var dragDown = this.isDraggable && this.isPointerDown; 1156 if ( dragDown || this.isFreeScrolling || !this.slides.length ) { 1157 return; 1158 } 1159 var distance = this.selectedSlide.target * -1 - this.x; 1160 var force = distance * this.options.selectedAttraction; 1161 this.applyForce( force ); 1162}; 1163 1164return proto; 1165 1166} ) ); 1167 1168// Flickity main 1169/* eslint-disable max-params */ 1170( function( window, factory ) { 1171 // universal module definition 1172 if ( typeof define == 'function' && define.amd ) { 1173 // AMD 1174 define( 'flickity/js/flickity',[ 1175 'ev-emitter/ev-emitter', 1176 'get-size/get-size', 1177 'fizzy-ui-utils/utils', 1178 './cell', 1179 './slide', 1180 './animate', 1181 ], function( EvEmitter, getSize, utils, Cell, Slide, animatePrototype ) { 1182 return factory( window, EvEmitter, getSize, utils, Cell, Slide, animatePrototype ); 1183 } ); 1184 } else if ( typeof module == 'object' && module.exports ) { 1185 // CommonJS 1186 module.exports = factory( 1187 window, 1188 require('ev-emitter'), 1189 require('get-size'), 1190 require('fizzy-ui-utils'), 1191 require('./cell'), 1192 require('./slide'), 1193 require('./animate') 1194 ); 1195 } else { 1196 // browser global 1197 var _Flickity = window.Flickity; 1198 1199 window.Flickity = factory( 1200 window, 1201 window.EvEmitter, 1202 window.getSize, 1203 window.fizzyUIUtils, 1204 _Flickity.Cell, 1205 _Flickity.Slide, 1206 _Flickity.animatePrototype 1207 ); 1208 } 1209 1210}( window, function factory( window, EvEmitter, getSize, 1211 utils, Cell, Slide, animatePrototype ) { 1212 1213/* eslint-enable max-params */ 1214 1215 1216// vars 1217var jQuery = window.jQuery; 1218var getComputedStyle = window.getComputedStyle; 1219var console = window.console; 1220 1221function moveElements( elems, toElem ) { 1222 elems = utils.makeArray( elems ); 1223 while ( elems.length ) { 1224 toElem.appendChild( elems.shift() ); 1225 } 1226} 1227 1228// -------------------------- Flickity -------------------------- // 1229 1230// globally unique identifiers 1231var GUID = 0; 1232// internal store of all Flickity intances 1233var instances = {}; 1234 1235function Flickity( element, options ) { 1236 var queryElement = utils.getQueryElement( element ); 1237 if ( !queryElement ) { 1238 if ( console ) { 1239 console.error( 'Bad element for Flickity: ' + ( queryElement || element ) ); 1240 } 1241 return; 1242 } 1243 this.element = queryElement; 1244 // do not initialize twice on same element 1245 if ( this.element.flickityGUID ) { 1246 var instance = instances[ this.element.flickityGUID ]; 1247 if ( instance ) instance.option( options ); 1248 return instance; 1249 } 1250 1251 // add jQuery 1252 if ( jQuery ) { 1253 this.$element = jQuery( this.element ); 1254 } 1255 // options 1256 this.options = utils.extend( {}, this.constructor.defaults ); 1257 this.option( options ); 1258 1259 // kick things off 1260 this._create(); 1261} 1262 1263Flickity.defaults = { 1264 accessibility: true, 1265 // adaptiveHeight: false, 1266 cellAlign: 'center', 1267 // cellSelector: undefined,
vendor: 5,153 bytes, lines 1268-1460
1268 // contain: false, 1269 freeScrollFriction: 0.075, // friction when free-scrolling 1270 friction: 0.28, // friction when selecting 1271 namespaceJQueryEvents: true, 1272 // initialIndex: 0, 1273 percentPosition: true, 1274 resize: true, 1275 selectedAttraction: 0.025, 1276 setGallerySize: true, 1277 // watchCSS: false, 1278 // wrapAround: false 1279}; 1280 1281// hash of methods triggered on _create() 1282Flickity.createMethods = []; 1283 1284var proto = Flickity.prototype; 1285// inherit EventEmitter 1286utils.extend( proto, EvEmitter.prototype ); 1287 1288proto._create = function() { 1289 // add id for Flickity.data 1290 var id = this.guid = ++GUID; 1291 this.element.flickityGUID = id; // expando 1292 instances[ id ] = this; // associate via id 1293 // initial properties 1294 this.selectedIndex = 0; 1295 // how many frames slider has been in same position 1296 this.restingFrames = 0; 1297 // initial physics properties 1298 this.x = 0; 1299 this.velocity = 0; 1300 this.originSide = this.options.rightToLeft ? 'right' : 'left'; 1301 // create viewport & slider 1302 this.viewport = document.createElement('div'); 1303 this.viewport.className = 'flickity-viewport'; 1304 this._createSlider(); 1305 1306 if ( this.options.resize || this.options.watchCSS ) { 1307 window.addEventListener( 'resize', this ); 1308 } 1309 1310 // add listeners from on option 1311 for ( var eventName in this.options.on ) { 1312 var listener = this.options.on[ eventName ]; 1313 this.on( eventName, listener ); 1314 } 1315 1316 Flickity.createMethods.forEach( function( method ) { 1317 this[ method ](); 1318 }, this ); 1319 1320 if ( this.options.watchCSS ) { 1321 this.watchCSS(); 1322 } else { 1323 this.activate(); 1324 } 1325 1326}; 1327 1328/** 1329 * set options 1330 * @param {Object} opts - options to extend 1331 */ 1332proto.option = function( opts ) { 1333 utils.extend( this.options, opts ); 1334}; 1335 1336proto.activate = function() { 1337 if ( this.isActive ) { 1338 return; 1339 } 1340 this.isActive = true; 1341 this.element.classList.add('flickity-enabled'); 1342 if ( this.options.rightToLeft ) { 1343 this.element.classList.add('flickity-rtl'); 1344 } 1345 1346 this.getSize(); 1347 // move initial cell elements so they can be loaded as cells 1348 var cellElems = this._filterFindCellElements( this.element.children ); 1349 moveElements( cellElems, this.slider ); 1350 this.viewport.appendChild( this.slider ); 1351 this.element.appendChild( this.viewport ); 1352 // get cells from children 1353 this.reloadCells(); 1354 1355 if ( this.options.accessibility ) { 1356 // allow element to focusable 1357 this.element.tabIndex = 0; 1358 // listen for key presses 1359 this.element.addEventListener( 'keydown', this ); 1360 } 1361 1362 this.emitEvent('activate'); 1363 this.selectInitialIndex(); 1364 // flag for initial activation, for using initialIndex 1365 this.isInitActivated = true; 1366 // ready event. #493 1367 this.dispatchEvent('ready'); 1368}; 1369 1370// slider positions the cells 1371proto._createSlider = function() { 1372 // slider element does all the positioning 1373 var slider = document.createElement('div'); 1374 slider.className = 'flickity-slider'; 1375 slider.style[ this.originSide ] = 0; 1376 this.slider = slider; 1377}; 1378 1379proto._filterFindCellElements = function( elems ) { 1380 return utils.filterFindElements( elems, this.options.cellSelector ); 1381}; 1382 1383// goes through all children 1384proto.reloadCells = function() { 1385 // collection of item elements 1386 this.cells = this._makeCells( this.slider.children ); 1387 this.positionCells(); 1388 this._getWrapShiftCells(); 1389 this.setGallerySize(); 1390}; 1391 1392/** 1393 * turn elements into Flickity.Cells 1394 * @param {[Array, NodeList, HTMLElement]} elems - elements to make into cells 1395 * @returns {Array} items - collection of new Flickity Cells 1396 */ 1397proto._makeCells = function( elems ) { 1398 var cellElems = this._filterFindCellElements( elems ); 1399 1400 // create new Flickity for collection 1401 var cells = cellElems.map( function( cellElem ) { 1402 return new Cell( cellElem, this ); 1403 }, this ); 1404 1405 return cells; 1406}; 1407 1408proto.getLastCell = function() { 1409 return this.cells[ this.cells.length - 1 ]; 1410}; 1411 1412proto.getLastSlide = function() { 1413 return this.slides[ this.slides.length - 1 ]; 1414}; 1415 1416// positions all cells 1417proto.positionCells = function() { 1418 // size all cells 1419 this._sizeCells( this.cells ); 1420 // position all cells 1421 this._positionCells( 0 ); 1422}; 1423 1424/** 1425 * position certain cells 1426 * @param {Integer} index - which cell to start with 1427 */ 1428proto._positionCells = function( index ) { 1429 index = index || 0; 1430 // also measure maxCellHeight 1431 // start 0 if positioning all cells 1432 this.maxCellHeight = index ? this.maxCellHeight || 0 : 0; 1433 var cellX = 0; 1434 // get cellX 1435 if ( index > 0 ) { 1436 var startCell = this.cells[ index - 1 ]; 1437 cellX = startCell.x + startCell.size.outerWidth; 1438 } 1439 var len = this.cells.length; 1440 for ( var i = index; i < len; i++ ) { 1441 var cell = this.cells[i]; 1442 cell.setPosition( cellX ); 1443 cellX += cell.size.outerWidth; 1444 this.maxCellHeight = Math.max( cell.size.outerHeight, this.maxCellHeight ); 1445 } 1446 // keep track of cellX for wrap-around 1447 this.slideableWidth = cellX; 1448 // slides 1449 this.updateSlides(); 1450 // contain slides target 1451 this._containSlides(); 1452 // update slidesWidth 1453 this.slidesWidth = len ? this.getLastSlide().target - this.slides[0].target : 0; 1454}; 1455 1456/** 1457 * cell.getSize() on multiple cells 1458 * @param {Array} cells - cells to size 1459 */ 1460proto._sizeCells = function( cells ) {
1461 cells.forEach( function( cell ) { 1462 cell.getSize(); 1463 } ); 1464}; 1465 1466// -------------------------- -------------------------- // 1467 1468proto.updateSlides = function() { 1469 this.slides = []; 1470 if ( !this.cells.length ) { 1471 return; 1472 } 1473 1474 var slide = new Slide( this ); 1475 this.slides.push( slide ); 1476 var isOriginLeft = this.originSide == 'left'; 1477 var nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft'; 1478 1479 var canCellFit = this._getCanCellFit(); 1480 1481 this.cells.forEach( function( cell, i ) { 1482 // just add cell if first cell in slide 1483 if ( !slide.cells.length ) { 1484 slide.addCell( cell ); 1485 return; 1486 } 1487 1488 var slideWidth = ( slide.outerWidth - slide.firstMargin ) + 1489 ( cell.size.outerWidth - cell.size[ nextMargin ] ); 1490 1491 if ( canCellFit.call( this, i, slideWidth ) ) { 1492 slide.addCell( cell ); 1493 } else { 1494 // doesn't fit, new slide 1495 slide.updateTarget(); 1496 1497 slide = new Slide( this ); 1498 this.slides.push( slide ); 1499 slide.addCell( cell ); 1500 } 1501 }, this ); 1502 // last slide 1503 slide.updateTarget(); 1504 // update .selectedSlide 1505 this.updateSelectedSlide(); 1506}; 1507 1508proto._getCanCellFit = function() { 1509 var groupCells = this.options.groupCells; 1510 if ( !groupCells ) { 1511 return function() { 1512 return false; 1513 }; 1514 } else if ( typeof groupCells == 'number' ) { 1515 // group by number. 3 -> [0,1,2], [3,4,5], ... 1516 var number = parseInt( groupCells, 10 ); 1517 return function( i ) { 1518 return ( i % number ) !== 0; 1519 }; 1520 } 1521 // default, group by width of slide 1522 // parse '75% 1523 var percentMatch = typeof groupCells == 'string' && 1524 groupCells.match( /^(\d+)%$/ ); 1525 var percent = percentMatch ? parseInt( percentMatch[1], 10 ) / 100 : 1; 1526 return function( i, slideWidth ) { 1527 /* eslint-disable-next-line no-invalid-this */ 1528 return slideWidth <= ( this.size.innerWidth + 1 ) * percent; 1529 }; 1530}; 1531 1532// alias _init for jQuery plugin .flickity() 1533proto._init = 1534proto.reposition = function() { 1535 this.positionCells(); 1536 this.positionSliderAtSelected(); 1537}; 1538 1539proto.getSize = function() { 1540 this.size = getSize( this.element ); 1541 this.setCellAlign(); 1542 this.cursorPosition = this.size.innerWidth * this.cellAlign; 1543}; 1544 1545var cellAlignShorthands = { 1546 // cell align, then based on origin side 1547 center: { 1548 left: 0.5, 1549 right: 0.5, 1550 }, 1551 left: { 1552 left: 0, 1553 right: 1, 1554 }, 1555 right: { 1556 right: 0, 1557 left: 1, 1558 }, 1559}; 1560 1561proto.setCellAlign = function() { 1562 var shorthand = cellAlignShorthands[ this.options.cellAlign ]; 1563 this.cellAlign = shorthand ? shorthand[ this.originSide ] : this.options.cellAlign; 1564}; 1565 1566proto.setGallerySize = function() { 1567 if ( this.options.setGallerySize ) { 1568 var height = this.options.adaptiveHeight && this.selectedSlide ? 1569 this.selectedSlide.height : this.maxCellHeight; 1570 this.viewport.style.height = height + 'px'; 1571 } 1572}; 1573 1574proto._getWrapShiftCells = function() { 1575 // only for wrap-around 1576 if ( !this.options.wrapAround ) { 1577 return; 1578 } 1579 // unshift previous cells 1580 this._unshiftCells( this.beforeShiftCells ); 1581 this._unshiftCells( this.afterShiftCells ); 1582 // get before cells 1583 // initial gap 1584 var gapX = this.cursorPosition; 1585 var cellIndex = this.cells.length - 1; 1586 this.beforeShiftCells = this._getGapCells( gapX, cellIndex, -1 ); 1587 // get after cells 1588 // ending gap between last cell and end of gallery viewport 1589 gapX = this.size.innerWidth - this.cursorPosition; 1590 // start cloning at first cell, working forwards 1591 this.afterShiftCells = this._getGapCells( gapX, 0, 1 ); 1592}; 1593 1594proto._getGapCells = function( gapX, cellIndex, increment ) { 1595 // keep adding cells until the cover the initial gap 1596 var cells = []; 1597 while ( gapX > 0 ) { 1598 var cell = this.cells[ cellIndex ]; 1599 if ( !cell ) { 1600 break; 1601 } 1602 cells.push( cell ); 1603 cellIndex += increment; 1604 gapX -= cell.size.outerWidth; 1605 } 1606 return cells; 1607}; 1608 1609// ----- contain ----- // 1610 1611// contain cell targets so no excess sliding 1612proto._containSlides = function() { 1613 if ( !this.options.contain || this.options.wrapAround || !this.cells.length ) { 1614 return; 1615 } 1616 var isRightToLeft = this.options.rightToLeft; 1617 var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft'; 1618 var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight'; 1619 var contentWidth = this.slideableWidth - this.getLastCell().size[ endMargin ]; 1620 // content is less than gallery size 1621 var isContentSmaller = contentWidth < this.size.innerWidth; 1622 // bounds 1623 var beginBound = this.cursorPosition + this.cells[0].size[ beginMargin ]; 1624 var endBound = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign ); 1625 // contain each cell target
vendor: 11,604 bytes, lines 1626-2042
1626 this.slides.forEach( function( slide ) { 1627 if ( isContentSmaller ) { 1628 // all cells fit inside gallery 1629 slide.target = contentWidth * this.cellAlign; 1630 } else { 1631 // contain to bounds 1632 slide.target = Math.max( slide.target, beginBound ); 1633 slide.target = Math.min( slide.target, endBound ); 1634 } 1635 }, this ); 1636}; 1637 1638// ----- ----- // 1639 1640/** 1641 * emits events via eventEmitter and jQuery events 1642 * @param {String} type - name of event 1643 * @param {Event} event - original event 1644 * @param {Array} args - extra arguments 1645 */ 1646proto.dispatchEvent = function( type, event, args ) { 1647 var emitArgs = event ? [ event ].concat( args ) : args; 1648 this.emitEvent( type, emitArgs ); 1649 1650 if ( jQuery && this.$element ) { 1651 // default trigger with type if no event 1652 type += this.options.namespaceJQueryEvents ? '.flickity' : ''; 1653 var $event = type; 1654 if ( event ) { 1655 // create jQuery event 1656 var jQEvent = new jQuery.Event( event ); 1657 jQEvent.type = type; 1658 $event = jQEvent; 1659 } 1660 this.$element.trigger( $event, args ); 1661 } 1662}; 1663 1664// -------------------------- select -------------------------- // 1665 1666/** 1667 * @param {Integer} index - index of the slide 1668 * @param {Boolean} isWrap - will wrap-around to last/first if at the end 1669 * @param {Boolean} isInstant - will immediately set position at selected cell 1670 */ 1671proto.select = function( index, isWrap, isInstant ) { 1672 if ( !this.isActive ) { 1673 return; 1674 } 1675 index = parseInt( index, 10 ); 1676 this._wrapSelect( index ); 1677 1678 if ( this.options.wrapAround || isWrap ) { 1679 index = utils.modulo( index, this.slides.length ); 1680 } 1681 // bail if invalid index 1682 if ( !this.slides[ index ] ) { 1683 return; 1684 } 1685 var prevIndex = this.selectedIndex; 1686 this.selectedIndex = index; 1687 this.updateSelectedSlide(); 1688 if ( isInstant ) { 1689 this.positionSliderAtSelected(); 1690 } else { 1691 this.startAnimation(); 1692 } 1693 if ( this.options.adaptiveHeight ) { 1694 this.setGallerySize(); 1695 } 1696 // events 1697 this.dispatchEvent( 'select', null, [ index ] ); 1698 // change event if new index 1699 if ( index != prevIndex ) { 1700 this.dispatchEvent( 'change', null, [ index ] ); 1701 } 1702 // old v1 event name, remove in v3 1703 this.dispatchEvent('cellSelect'); 1704}; 1705 1706// wraps position for wrapAround, to move to closest slide. #113 1707proto._wrapSelect = function( index ) { 1708 var len = this.slides.length; 1709 var isWrapping = this.options.wrapAround && len > 1; 1710 if ( !isWrapping ) { 1711 return index; 1712 } 1713 var wrapIndex = utils.modulo( index, len ); 1714 // go to shortest 1715 var delta = Math.abs( wrapIndex - this.selectedIndex ); 1716 var backWrapDelta = Math.abs( ( wrapIndex + len ) - this.selectedIndex ); 1717 var forewardWrapDelta = Math.abs( ( wrapIndex - len ) - this.selectedIndex ); 1718 if ( !this.isDragSelect && backWrapDelta < delta ) { 1719 index += len; 1720 } else if ( !this.isDragSelect && forewardWrapDelta < delta ) { 1721 index -= len; 1722 } 1723 // wrap position so slider is within normal area 1724 if ( index < 0 ) { 1725 this.x -= this.slideableWidth; 1726 } else if ( index >= len ) { 1727 this.x += this.slideableWidth; 1728 } 1729}; 1730 1731proto.previous = function( isWrap, isInstant ) { 1732 this.select( this.selectedIndex - 1, isWrap, isInstant ); 1733}; 1734 1735proto.next = function( isWrap, isInstant ) { 1736 this.select( this.selectedIndex + 1, isWrap, isInstant ); 1737}; 1738 1739proto.updateSelectedSlide = function() { 1740 var slide = this.slides[ this.selectedIndex ]; 1741 // selectedIndex could be outside of slides, if triggered before resize() 1742 if ( !slide ) { 1743 return; 1744 } 1745 // unselect previous selected slide 1746 this.unselectSelectedSlide(); 1747 // update new selected slide 1748 this.selectedSlide = slide; 1749 slide.select(); 1750 this.selectedCells = slide.cells; 1751 this.selectedElements = slide.getCellElements(); 1752 // HACK: selectedCell & selectedElement is first cell in slide, backwards compatibility 1753 // Remove in v3? 1754 this.selectedCell = slide.cells[0]; 1755 this.selectedElement = this.selectedElements[0]; 1756}; 1757 1758proto.unselectSelectedSlide = function() { 1759 if ( this.selectedSlide ) { 1760 this.selectedSlide.unselect(); 1761 } 1762}; 1763 1764proto.selectInitialIndex = function() { 1765 var initialIndex = this.options.initialIndex; 1766 // already activated, select previous selectedIndex 1767 if ( this.isInitActivated ) { 1768 this.select( this.selectedIndex, false, true ); 1769 return; 1770 } 1771 // select with selector string 1772 if ( initialIndex && typeof initialIndex == 'string' ) { 1773 var cell = this.queryCell( initialIndex ); 1774 if ( cell ) { 1775 this.selectCell( initialIndex, false, true ); 1776 return; 1777 } 1778 } 1779 1780 var index = 0; 1781 // select with number 1782 if ( initialIndex && this.slides[ initialIndex ] ) { 1783 index = initialIndex; 1784 } 1785 // select instantly 1786 this.select( index, false, true ); 1787}; 1788 1789/** 1790 * select slide from number or cell element 1791 * @param {[Element, Number]} value - zero-based index or element to select 1792 * @param {Boolean} isWrap - enables wrapping around for extra index 1793 * @param {Boolean} isInstant - disables slide animation 1794 */ 1795proto.selectCell = function( value, isWrap, isInstant ) { 1796 // get cell 1797 var cell = this.queryCell( value ); 1798 if ( !cell ) { 1799 return; 1800 } 1801 1802 var index = this.getCellSlideIndex( cell ); 1803 this.select( index, isWrap, isInstant ); 1804}; 1805 1806proto.getCellSlideIndex = function( cell ) { 1807 // get index of slides that has cell 1808 for ( var i = 0; i < this.slides.length; i++ ) { 1809 var slide = this.slides[i]; 1810 var index = slide.cells.indexOf( cell ); 1811 if ( index != -1 ) { 1812 return i; 1813 } 1814 } 1815}; 1816 1817// -------------------------- get cells -------------------------- // 1818 1819/** 1820 * get Flickity.Cell, given an Element 1821 * @param {Element} elem - matching cell element 1822 * @returns {Flickity.Cell} cell - matching cell 1823 */ 1824proto.getCell = function( elem ) { 1825 // loop through cells to get the one that matches 1826 for ( var i = 0; i < this.cells.length; i++ ) { 1827 var cell = this.cells[i]; 1828 if ( cell.element == elem ) { 1829 return cell; 1830 } 1831 } 1832}; 1833 1834/** 1835 * get collection of Flickity.Cells, given Elements 1836 * @param {[Element, Array, NodeList]} elems - multiple elements 1837 * @returns {Array} cells - Flickity.Cells 1838 */ 1839proto.getCells = function( elems ) { 1840 elems = utils.makeArray( elems ); 1841 var cells = []; 1842 elems.forEach( function( elem ) { 1843 var cell = this.getCell( elem ); 1844 if ( cell ) { 1845 cells.push( cell ); 1846 } 1847 }, this ); 1848 return cells; 1849}; 1850 1851/** 1852 * get cell elements 1853 * @returns {Array} cellElems 1854 */ 1855proto.getCellElements = function() { 1856 return this.cells.map( function( cell ) { 1857 return cell.element; 1858 } ); 1859}; 1860 1861/** 1862 * get parent cell from an element 1863 * @param {Element} elem - child element 1864 * @returns {Flickit.Cell} cell - parent cell 1865 */ 1866proto.getParentCell = function( elem ) { 1867 // first check if elem is cell 1868 var cell = this.getCell( elem ); 1869 if ( cell ) { 1870 return cell; 1871 } 1872 // try to get parent cell elem 1873 elem = utils.getParent( elem, '.flickity-slider > *' ); 1874 return this.getCell( elem ); 1875}; 1876 1877/** 1878 * get cells adjacent to a slide 1879 * @param {Integer} adjCount - number of adjacent slides 1880 * @param {Integer} index - index of slide to start 1881 * @returns {Array} cells - array of Flickity.Cells 1882 */ 1883proto.getAdjacentCellElements = function( adjCount, index ) { 1884 if ( !adjCount ) { 1885 return this.selectedSlide.getCellElements(); 1886 } 1887 index = index === undefined ? this.selectedIndex : index; 1888 1889 var len = this.slides.length; 1890 if ( 1 + ( adjCount * 2 ) >= len ) { 1891 return this.getCellElements(); 1892 } 1893 1894 var cellElems = []; 1895 for ( var i = index - adjCount; i <= index + adjCount; i++ ) { 1896 var slideIndex = this.options.wrapAround ? utils.modulo( i, len ) : i; 1897 var slide = this.slides[ slideIndex ]; 1898 if ( slide ) { 1899 cellElems = cellElems.concat( slide.getCellElements() ); 1900 } 1901 } 1902 return cellElems; 1903}; 1904 1905/** 1906 * select slide from number or cell element 1907 * @param {[Element, String, Number]} selector - element, selector string, or index 1908 * @returns {Flickity.Cell} - matching cell 1909 */ 1910proto.queryCell = function( selector ) { 1911 if ( typeof selector == 'number' ) { 1912 // use number as index 1913 return this.cells[ selector ]; 1914 } 1915 if ( typeof selector == 'string' ) { 1916 // do not select invalid selectors from hash: #123, #/. #791 1917 if ( selector.match( /^[#.]?[\d/]/ ) ) { 1918 return; 1919 } 1920 // use string as selector, get element 1921 selector = this.element.querySelector( selector ); 1922 } 1923 // get cell from element 1924 return this.getCell( selector ); 1925}; 1926 1927// -------------------------- events -------------------------- // 1928 1929proto.uiChange = function() { 1930 this.emitEvent('uiChange'); 1931}; 1932 1933// keep focus on element when child UI elements are clicked 1934proto.childUIPointerDown = function( event ) { 1935 // HACK iOS does not allow touch events to bubble up?! 1936 if ( event.type != 'touchstart' ) { 1937 event.preventDefault(); 1938 } 1939 this.focus(); 1940}; 1941 1942// ----- resize ----- // 1943 1944proto.onresize = function() { 1945 this.watchCSS(); 1946 this.resize(); 1947}; 1948 1949utils.debounceMethod( Flickity, 'onresize', 150 ); 1950 1951proto.resize = function() { 1952 // #1177 disable resize behavior when animating or dragging for iOS 15 1953 if ( !this.isActive || this.isAnimating || this.isDragging ) { 1954 return; 1955 } 1956 this.getSize(); 1957 // wrap values 1958 if ( this.options.wrapAround ) { 1959 this.x = utils.modulo( this.x, this.slideableWidth ); 1960 } 1961 this.positionCells(); 1962 this._getWrapShiftCells(); 1963 this.setGallerySize(); 1964 this.emitEvent('resize'); 1965 // update selected index for group slides, instant 1966 // TODO: position can be lost between groups of various numbers 1967 var selectedElement = this.selectedElements && this.selectedElements[0]; 1968 this.selectCell( selectedElement, false, true ); 1969}; 1970 1971// watches the :after property, activates/deactivates 1972proto.watchCSS = function() { 1973 var watchOption = this.options.watchCSS; 1974 if ( !watchOption ) { 1975 return; 1976 } 1977 1978 var afterContent = getComputedStyle( this.element, ':after' ).content; 1979 // activate if :after { content: 'flickity' } 1980 if ( afterContent.indexOf('flickity') != -1 ) { 1981 this.activate(); 1982 } else { 1983 this.deactivate(); 1984 } 1985}; 1986 1987// ----- keydown ----- // 1988 1989// go previous/next if left/right keys pressed 1990proto.onkeydown = function( event ) { 1991 // only work if element is in focus 1992 var isNotFocused = document.activeElement && document.activeElement != this.element; 1993 if ( !this.options.accessibility || isNotFocused ) { 1994 return; 1995 } 1996 1997 var handler = Flickity.keyboardHandlers[ event.keyCode ]; 1998 if ( handler ) { 1999 handler.call( this ); 2000 } 2001}; 2002 2003Flickity.keyboardHandlers = { 2004 // left arrow 2005 37: function() { 2006 var leftMethod = this.options.rightToLeft ? 'next' : 'previous'; 2007 this.uiChange(); 2008 this[ leftMethod ](); 2009 }, 2010 // right arrow 2011 39: function() { 2012 var rightMethod = this.options.rightToLeft ? 'previous' : 'next'; 2013 this.uiChange(); 2014 this[ rightMethod ](); 2015 }, 2016}; 2017 2018// ----- focus ----- // 2019 2020proto.focus = function() { 2021 // TODO remove scrollTo once focus options gets more support 2022 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus ... 2023 // #Browser_compatibility 2024 var prevScrollY = window.pageYOffset; 2025 this.element.focus({ preventScroll: true }); 2026 // hack to fix scroll jump after focus, #76 2027 if ( window.pageYOffset != prevScrollY ) { 2028 window.scrollTo( window.pageXOffset, prevScrollY ); 2029 } 2030}; 2031 2032// -------------------------- destroy -------------------------- // 2033 2034// deactivate all Flickity functionality, but keep stuff available 2035proto.deactivate = function() { 2036 if ( !this.isActive ) { 2037 return; 2038 } 2039 this.element.classList.remove('flickity-enabled'); 2040 this.element.classList.remove('flickity-rtl'); 2041 this.unselectSelectedSlide(); 2042 // destroy cells
2043 this.cells.forEach( function( cell ) { 2044 cell.destroy(); 2045 } ); 2046 this.element.removeChild( this.viewport ); 2047 // move child elements back into element 2048 moveElements( this.slider.children, this.element ); 2049 if ( this.options.accessibility ) { 2050 this.element.removeAttribute('tabIndex'); 2051 this.element.removeEventListener( 'keydown', this ); 2052 } 2053 // set flags 2054 this.isActive = false; 2055 this.emitEvent('deactivate'); 2056}; 2057 2058proto.destroy = function() { 2059 this.deactivate(); 2060 window.removeEventListener( 'resize', this ); 2061 this.allOff(); 2062 this.emitEvent('destroy'); 2063 if ( jQuery && this.$element ) { 2064 jQuery.removeData( this.element, 'flickity' ); 2065 } 2066 delete this.element.flickityGUID; 2067 delete instances[ this.guid ]; 2068}; 2069 2070// -------------------------- prototype -------------------------- // 2071 2072utils.extend( proto, animatePrototype ); 2073 2074// -------------------------- extras -------------------------- // 2075 2076/** 2077 * get Flickity instance from element 2078 * @param {[Element, String]} elem - element or selector string 2079 * @returns {Flickity} - Flickity instance 2080 */ 2081Flickity.data = function( elem ) { 2082 elem = utils.getQueryElement( elem ); 2083 var id = elem && elem.flickityGUID; 2084 return id && instances[ id ]; 2085}; 2086 2087utils.htmlInit( Flickity, 'flickity' ); 2088 2089if ( jQuery && jQuery.bridget ) { 2090 jQuery.bridget( 'flickity', Flickity ); 2091} 2092 2093// set internal jQuery, for Webpack + jQuery v3, #478 2094Flickity.setJQuery = function( jq ) { 2095 jQuery = jq; 2096}; 2097 2098Flickity.Cell = Cell; 2099Flickity.Slide = Slide; 2100 2101return Flickity; 2102 2103} ) ); 2104 2105/*! 2106 * Unipointer v2.4.0 2107 * base class for doing one thing with pointer event 2108 * MIT license 2109 */ 2110 2111/*jshint browser: true, undef: true, unused: true, strict: true */ 2112 2113( function( window, factory ) { 2114 // universal module definition 2115 /* jshint strict: false */ /*global define, module, require */ 2116 if ( typeof define == 'function' && define.amd ) { 2117 // AMD 2118 define( 'unipointer/unipointer',[ 2119 'ev-emitter/ev-emitter' 2120 ], function( EvEmitter ) { 2121 return factory( window, EvEmitter ); 2122 }); 2123 } else if ( typeof module == 'object' && module.exports ) { 2124 // CommonJS 2125 module.exports = factory( 2126 window, 2127 require('ev-emitter') 2128 ); 2129 } else { 2130 // browser global 2131 window.Unipointer = factory( 2132 window, 2133 window.EvEmitter 2134 ); 2135 } 2136 2137}( window, function factory( window, EvEmitter ) { 2138 2139 2140 2141function noop() {} 2142 2143function Unipointer() {} 2144 2145// inherit EvEmitter 2146var proto = Unipointer.prototype = Object.create( EvEmitter.prototype ); 2147 2148proto.bindStartEvent = function( elem ) { 2149 this._bindStartEvent( elem, true ); 2150}; 2151 2152proto.unbindStartEvent = function( elem ) { 2153 this._bindStartEvent( elem, false ); 2154}; 2155 2156/** 2157 * Add or remove start event 2158 * @param {Boolean} isAdd - remove if falsey 2159 */ 2160proto._bindStartEvent = function( elem, isAdd ) { 2161 // munge isAdd, default to true 2162 isAdd = isAdd === undefined ? true : isAdd; 2163 var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener'; 2164 2165 // default to mouse events 2166 var startEvent = 'mousedown'; 2167 if ( 'ontouchstart' in window ) { 2168 // HACK prefer Touch Events as you can preventDefault on touchstart to 2169 // disable scroll in iOS & mobile Chrome metafizzy/flickity#1177 2170 startEvent = 'touchstart'; 2171 } else if ( window.PointerEvent ) { 2172 // Pointer Events 2173 startEvent = 'pointerdown'; 2174 } 2175 elem[ bindMethod ]( startEvent, this ); 2176}; 2177 2178// trigger handler methods for events 2179proto.handleEvent = function( event ) { 2180 var method = 'on' + event.type; 2181 if ( this[ method ] ) { 2182 this[ method ]( event ); 2183 } 2184}; 2185 2186// returns the touch that we're keeping track of 2187proto.getTouch = function( touches ) { 2188 for ( var i=0; i < touches.length; i++ ) { 2189 var touch = touches[i]; 2190 if ( touch.identifier == this.pointerIdentifier ) { 2191 return touch; 2192 } 2193 } 2194}; 2195 2196// ----- start event ----- // 2197 2198proto.onmousedown = function( event ) { 2199 // dismiss clicks from right or middle buttons 2200 var button = event.button; 2201 if ( button && ( button !== 0 && button !== 1 ) ) { 2202 return; 2203 } 2204 this._pointerDown( event, event ); 2205}; 2206 2207proto.ontouchstart = function( event ) { 2208 this._pointerDown( event, event.changedTouches[0] ); 2209}; 2210 2211proto.onpointerdown = function( event ) { 2212 this._pointerDown( event, event ); 2213}; 2214 2215/** 2216 * pointer start 2217 * @param {Event} event 2218 * @param {Event or Touch} pointer 2219 */ 2220proto._pointerDown = function( event, pointer ) { 2221 // dismiss right click and other pointers 2222 // button = 0 is okay, 1-4 not 2223 if ( event.button || this.isPointerDown ) { 2224 return; 2225 } 2226 2227 this.isPointerDown = true; 2228 // save pointer identifier to match up touch events 2229 this.pointerIdentifier = pointer.pointerId !== undefined ? 2230 // pointerId for pointer events, touch.indentifier for touch events 2231 pointer.pointerId : pointer.identifier; 2232 2233 this.pointerDown( event, pointer ); 2234}; 2235 2236proto.pointerDown = function( event, pointer ) { 2237 this._bindPostStartEvents( event ); 2238 this.emitEvent( 'pointerDown', [ event, pointer ] ); 2239}; 2240 2241// hash of events to be bound after start event 2242var postStartEvents = {
vendor: 5,426 bytes, lines 2243-2482
2243 mousedown: [ 'mousemove', 'mouseup' ], 2244 touchstart: [ 'touchmove', 'touchend', 'touchcancel' ], 2245 pointerdown: [ 'pointermove', 'pointerup', 'pointercancel' ], 2246}; 2247 2248proto._bindPostStartEvents = function( event ) { 2249 if ( !event ) { 2250 return; 2251 } 2252 // get proper events to match start event 2253 var events = postStartEvents[ event.type ]; 2254 // bind events to node 2255 events.forEach( function( eventName ) { 2256 window.addEventListener( eventName, this ); 2257 }, this ); 2258 // save these arguments 2259 this._boundPointerEvents = events; 2260}; 2261 2262proto._unbindPostStartEvents = function() { 2263 // check for _boundEvents, in case dragEnd triggered twice (old IE8 bug) 2264 if ( !this._boundPointerEvents ) { 2265 return; 2266 } 2267 this._boundPointerEvents.forEach( function( eventName ) { 2268 window.removeEventListener( eventName, this ); 2269 }, this ); 2270 2271 delete this._boundPointerEvents; 2272}; 2273 2274// ----- move event ----- // 2275 2276proto.onmousemove = function( event ) { 2277 this._pointerMove( event, event ); 2278}; 2279 2280proto.onpointermove = function( event ) { 2281 if ( event.pointerId == this.pointerIdentifier ) { 2282 this._pointerMove( event, event ); 2283 } 2284}; 2285 2286proto.ontouchmove = function( event ) { 2287 var touch = this.getTouch( event.changedTouches ); 2288 if ( touch ) { 2289 this._pointerMove( event, touch ); 2290 } 2291}; 2292 2293/** 2294 * pointer move 2295 * @param {Event} event 2296 * @param {Event or Touch} pointer 2297 * @private 2298 */ 2299proto._pointerMove = function( event, pointer ) { 2300 this.pointerMove( event, pointer ); 2301}; 2302 2303// public 2304proto.pointerMove = function( event, pointer ) { 2305 this.emitEvent( 'pointerMove', [ event, pointer ] ); 2306}; 2307 2308// ----- end event ----- // 2309 2310 2311proto.onmouseup = function( event ) { 2312 this._pointerUp( event, event ); 2313}; 2314 2315proto.onpointerup = function( event ) { 2316 if ( event.pointerId == this.pointerIdentifier ) { 2317 this._pointerUp( event, event ); 2318 } 2319}; 2320 2321proto.ontouchend = function( event ) { 2322 var touch = this.getTouch( event.changedTouches ); 2323 if ( touch ) { 2324 this._pointerUp( event, touch ); 2325 } 2326}; 2327 2328/** 2329 * pointer up 2330 * @param {Event} event 2331 * @param {Event or Touch} pointer 2332 * @private 2333 */ 2334proto._pointerUp = function( event, pointer ) { 2335 this._pointerDone(); 2336 this.pointerUp( event, pointer ); 2337}; 2338 2339// public 2340proto.pointerUp = function( event, pointer ) { 2341 this.emitEvent( 'pointerUp', [ event, pointer ] ); 2342}; 2343 2344// ----- pointer done ----- // 2345 2346// triggered on pointer up & pointer cancel 2347proto._pointerDone = function() { 2348 this._pointerReset(); 2349 this._unbindPostStartEvents(); 2350 this.pointerDone(); 2351}; 2352 2353proto._pointerReset = function() { 2354 // reset properties 2355 this.isPointerDown = false; 2356 delete this.pointerIdentifier; 2357}; 2358 2359proto.pointerDone = noop; 2360 2361// ----- pointer cancel ----- // 2362 2363proto.onpointercancel = function( event ) { 2364 if ( event.pointerId == this.pointerIdentifier ) { 2365 this._pointerCancel( event, event ); 2366 } 2367}; 2368 2369proto.ontouchcancel = function( event ) { 2370 var touch = this.getTouch( event.changedTouches ); 2371 if ( touch ) { 2372 this._pointerCancel( event, touch ); 2373 } 2374}; 2375 2376/** 2377 * pointer cancel 2378 * @param {Event} event 2379 * @param {Event or Touch} pointer 2380 * @private 2381 */ 2382proto._pointerCancel = function( event, pointer ) { 2383 this._pointerDone(); 2384 this.pointerCancel( event, pointer ); 2385}; 2386 2387// public 2388proto.pointerCancel = function( event, pointer ) { 2389 this.emitEvent( 'pointerCancel', [ event, pointer ] ); 2390}; 2391 2392// ----- ----- // 2393 2394// utility function for getting x/y coords from event 2395Unipointer.getPointerPoint = function( pointer ) { 2396 return { 2397 x: pointer.pageX, 2398 y: pointer.pageY 2399 }; 2400}; 2401 2402// ----- ----- // 2403 2404return Unipointer; 2405 2406})); 2407 2408/*! 2409 * Unidragger v2.4.0 2410 * Draggable base class 2411 * MIT license 2412 */ 2413 2414/*jshint browser: true, unused: true, undef: true, strict: true */ 2415 2416( function( window, factory ) { 2417 // universal module definition 2418 /*jshint strict: false */ /*globals define, module, require */ 2419 2420 if ( typeof define == 'function' && define.amd ) { 2421 // AMD 2422 define( 'unidragger/unidragger',[ 2423 'unipointer/unipointer' 2424 ], function( Unipointer ) { 2425 return factory( window, Unipointer ); 2426 }); 2427 } else if ( typeof module == 'object' && module.exports ) { 2428 // CommonJS 2429 module.exports = factory( 2430 window, 2431 require('unipointer') 2432 ); 2433 } else { 2434 // browser global 2435 window.Unidragger = factory( 2436 window, 2437 window.Unipointer 2438 ); 2439 } 2440 2441}( window, function factory( window, Unipointer ) { 2442 2443 2444 2445// -------------------------- Unidragger -------------------------- // 2446 2447function Unidragger() {} 2448 2449// inherit Unipointer & EvEmitter 2450var proto = Unidragger.prototype = Object.create( Unipointer.prototype ); 2451 2452// ----- bind start ----- // 2453 2454proto.bindHandles = function() { 2455 this._bindHandles( true ); 2456}; 2457 2458proto.unbindHandles = function() { 2459 this._bindHandles( false ); 2460}; 2461 2462/** 2463 * Add or remove start event 2464 * @param {Boolean} isAdd 2465 */ 2466proto._bindHandles = function( isAdd ) { 2467 // munge isAdd, default to true 2468 isAdd = isAdd === undefined ? true : isAdd; 2469 // bind each handle 2470 var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener'; 2471 var touchAction = isAdd ? this._touchActionValue : ''; 2472 for ( var i=0; i < this.handles.length; i++ ) { 2473 var handle = this.handles[i]; 2474 this._bindStartEvent( handle, isAdd ); 2475 handle[ bindMethod ]( 'click', this ); 2476 // touch-action: none to override browser touch gestures. metafizzy/flickity#540 2477 if ( window.PointerEvent ) { 2478 handle.style.touchAction = touchAction; 2479 } 2480 } 2481}; 2482
vendor: 3,209 bytes, lines 2483-2608
2483// prototype so it can be overwriteable by Flickity 2484proto._touchActionValue = 'none'; 2485 2486// ----- start event ----- // 2487 2488/** 2489 * pointer start 2490 * @param {Event} event 2491 * @param {Event or Touch} pointer 2492 */ 2493proto.pointerDown = function( event, pointer ) { 2494 var isOkay = this.okayPointerDown( event ); 2495 if ( !isOkay ) { 2496 return; 2497 } 2498 // track start event position 2499 // Safari 9 overrides pageX and pageY. These values needs to be copied. flickity#842 2500 this.pointerDownPointer = { 2501 pageX: pointer.pageX, 2502 pageY: pointer.pageY, 2503 }; 2504 2505 event.preventDefault(); 2506 this.pointerDownBlur(); 2507 // bind move and end events 2508 this._bindPostStartEvents( event ); 2509 this.emitEvent( 'pointerDown', [ event, pointer ] ); 2510}; 2511 2512// nodes that have text fields 2513var cursorNodes = { 2514 TEXTAREA: true, 2515 INPUT: true, 2516 SELECT: true, 2517 OPTION: true, 2518}; 2519 2520// input types that do not have text fields 2521var clickTypes = { 2522 radio: true, 2523 checkbox: true, 2524 button: true, 2525 submit: true, 2526 image: true, 2527 file: true, 2528}; 2529 2530// dismiss inputs with text fields. flickity#403, flickity#404 2531proto.okayPointerDown = function( event ) { 2532 var isCursorNode = cursorNodes[ event.target.nodeName ]; 2533 var isClickType = clickTypes[ event.target.type ]; 2534 var isOkay = !isCursorNode || isClickType; 2535 if ( !isOkay ) { 2536 this._pointerReset(); 2537 } 2538 return isOkay; 2539}; 2540 2541// kludge to blur previously focused input 2542proto.pointerDownBlur = function() { 2543 var focused = document.activeElement; 2544 // do not blur body for IE10, metafizzy/flickity#117 2545 var canBlur = focused && focused.blur && focused != document.body; 2546 if ( canBlur ) { 2547 focused.blur(); 2548 } 2549}; 2550 2551// ----- move event ----- // 2552 2553/** 2554 * drag move 2555 * @param {Event} event 2556 * @param {Event or Touch} pointer 2557 */ 2558proto.pointerMove = function( event, pointer ) { 2559 var moveVector = this._dragPointerMove( event, pointer ); 2560 this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] ); 2561 this._dragMove( event, pointer, moveVector ); 2562}; 2563 2564// base pointer move logic 2565proto._dragPointerMove = function( event, pointer ) { 2566 var moveVector = { 2567 x: pointer.pageX - this.pointerDownPointer.pageX, 2568 y: pointer.pageY - this.pointerDownPointer.pageY 2569 }; 2570 // start drag if pointer has moved far enough to start drag 2571 if ( !this.isDragging && this.hasDragStarted( moveVector ) ) { 2572 this._dragStart( event, pointer ); 2573 } 2574 return moveVector; 2575}; 2576 2577// condition if pointer has moved far enough to start drag 2578proto.hasDragStarted = function( moveVector ) { 2579 return Math.abs( moveVector.x ) > 3 || Math.abs( moveVector.y ) > 3; 2580}; 2581 2582// ----- end event ----- // 2583 2584/** 2585 * pointer up 2586 * @param {Event} event 2587 * @param {Event or Touch} pointer 2588 */ 2589proto.pointerUp = function( event, pointer ) { 2590 this.emitEvent( 'pointerUp', [ event, pointer ] ); 2591 this._dragPointerUp( event, pointer ); 2592}; 2593 2594proto._dragPointerUp = function( event, pointer ) { 2595 if ( this.isDragging ) { 2596 this._dragEnd( event, pointer ); 2597 } else { 2598 // pointer didn't move enough for drag to start 2599 this._staticClick( event, pointer ); 2600 } 2601}; 2602 2603// -------------------------- drag -------------------------- // 2604 2605// dragStart 2606proto._dragStart = function( event, pointer ) { 2607 this.isDragging = true; 2608 // prevent clicks
2609 this.isPreventingClicks = true; 2610 this.dragStart( event, pointer ); 2611}; 2612 2613proto.dragStart = function( event, pointer ) { 2614 this.emitEvent( 'dragStart', [ event, pointer ] ); 2615}; 2616 2617// dragMove 2618proto._dragMove = function( event, pointer, moveVector ) { 2619 // do not drag if not dragging yet 2620 if ( !this.isDragging ) { 2621 return; 2622 } 2623 2624 this.dragMove( event, pointer, moveVector ); 2625}; 2626 2627proto.dragMove = function( event, pointer, moveVector ) { 2628 event.preventDefault(); 2629 this.emitEvent( 'dragMove', [ event, pointer, moveVector ] ); 2630}; 2631 2632// dragEnd 2633proto._dragEnd = function( event, pointer ) { 2634 // set flags 2635 this.isDragging = false; 2636 // re-enable clicking async 2637 setTimeout( function() { 2638 delete this.isPreventingClicks; 2639 }.bind( this ) ); 2640 2641 this.dragEnd( event, pointer ); 2642}; 2643 2644proto.dragEnd = function( event, pointer ) { 2645 this.emitEvent( 'dragEnd', [ event, pointer ] ); 2646}; 2647 2648// ----- onclick ----- // 2649 2650// handle all clicks and prevent clicks when dragging 2651proto.onclick = function( event ) { 2652 if ( this.isPreventingClicks ) { 2653 event.preventDefault(); 2654 } 2655}; 2656 2657// ----- staticClick ----- // 2658 2659// triggered after pointer down & up with no/tiny movement 2660proto._staticClick = function( event, pointer ) { 2661 // ignore emulated mouse up clicks 2662 if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) { 2663 return; 2664 } 2665 2666 this.staticClick( event, pointer ); 2667 2668 // set flag for emulated clicks 300ms after touchend 2669 if ( event.type != 'mouseup' ) { 2670 this.isIgnoringMouseUp = true; 2671 // reset flag after 300ms 2672 setTimeout( function() { 2673 delete this.isIgnoringMouseUp; 2674 }.bind( this ), 400 ); 2675 } 2676}; 2677 2678proto.staticClick = function( event, pointer ) { 2679 this.emitEvent( 'staticClick', [ event, pointer ] ); 2680}; 2681 2682// ----- utils ----- // 2683 2684Unidragger.getPointerPoint = Unipointer.getPointerPoint; 2685 2686// ----- ----- // 2687 2688return Unidragger; 2689 2690})); 2691 2692// drag 2693( function( window, factory ) { 2694 // universal module definition 2695 if ( typeof define == 'function' && define.amd ) { 2696 // AMD 2697 define( 'flickity/js/drag',[ 2698 './flickity', 2699 'unidragger/unidragger', 2700 'fizzy-ui-utils/utils', 2701 ], function( Flickity, Unidragger, utils ) { 2702 return factory( window, Flickity, Unidragger, utils ); 2703 } ); 2704 } else if ( typeof module == 'object' && module.exports ) { 2705 // CommonJS 2706 module.exports = factory( 2707 window, 2708 require('./flickity'), 2709 require('unidragger'), 2710 require('fizzy-ui-utils') 2711 ); 2712 } else { 2713 // browser global 2714 window.Flickity = factory( 2715 window, 2716 window.Flickity, 2717 window.Unidragger, 2718 window.fizzyUIUtils 2719 ); 2720 } 2721 2722}( window, function factory( window, Flickity, Unidragger, utils ) { 2723 2724 2725 2726// ----- defaults ----- // 2727 2728utils.extend( Flickity.defaults, { 2729 draggable: '>1', 2730 dragThreshold: 3, 2731} ); 2732 2733// ----- create ----- // 2734 2735Flickity.createMethods.push('_createDrag'); 2736 2737// -------------------------- drag prototype -------------------------- // 2738 2739var proto = Flickity.prototype; 2740utils.extend( proto, Unidragger.prototype ); 2741proto._touchActionValue = 'pan-y'; 2742 2743// -------------------------- -------------------------- // 2744 2745proto._createDrag = function() { 2746 this.on( 'activate', this.onActivateDrag ); 2747 this.on( 'uiChange', this._uiChangeDrag ); 2748 this.on( 'deactivate', this.onDeactivateDrag ); 2749 this.on( 'cellChange', this.updateDraggable ); 2750 // TODO updateDraggable on resize? if groupCells & slides change 2751}; 2752 2753proto.onActivateDrag = function() { 2754 this.handles = [ this.viewport ]; 2755 this.bindHandles(); 2756 this.updateDraggable(); 2757}; 2758 2759proto.onDeactivateDrag = function() { 2760 this.unbindHandles(); 2761 this.element.classList.remove('is-draggable'); 2762}; 2763 2764proto.updateDraggable = function() { 2765 // disable dragging if less than 2 slides. #278 2766 if ( this.options.draggable == '>1' ) { 2767 this.isDraggable = this.slides.length > 1; 2768 } else { 2769 this.isDraggable = this.options.draggable; 2770 } 2771 if ( this.isDraggable ) { 2772 this.element.classList.add('is-draggable'); 2773 } else { 2774 this.element.classList.remove('is-draggable'); 2775 } 2776}; 2777 2778// backwards compatibility 2779proto.bindDrag = function() { 2780 this.options.draggable = true; 2781 this.updateDraggable(); 2782}; 2783 2784proto.unbindDrag = function() { 2785 this.options.draggable = false;
vendor: 5,130 bytes, lines 2786-2958
2786 this.updateDraggable(); 2787}; 2788 2789proto._uiChangeDrag = function() { 2790 delete this.isFreeScrolling; 2791}; 2792 2793// -------------------------- pointer events -------------------------- // 2794 2795proto.pointerDown = function( event, pointer ) { 2796 if ( !this.isDraggable ) { 2797 this._pointerDownDefault( event, pointer ); 2798 return; 2799 } 2800 var isOkay = this.okayPointerDown( event ); 2801 if ( !isOkay ) { 2802 return; 2803 } 2804 2805 this._pointerDownPreventDefault( event ); 2806 this.pointerDownFocus( event ); 2807 // blur 2808 if ( document.activeElement != this.element ) { 2809 // do not blur if already focused 2810 this.pointerDownBlur(); 2811 } 2812 2813 // stop if it was moving 2814 this.dragX = this.x; 2815 this.viewport.classList.add('is-pointer-down'); 2816 // track scrolling 2817 this.pointerDownScroll = getScrollPosition(); 2818 window.addEventListener( 'scroll', this ); 2819 2820 this._pointerDownDefault( event, pointer ); 2821}; 2822 2823// default pointerDown logic, used for staticClick 2824proto._pointerDownDefault = function( event, pointer ) { 2825 // track start event position 2826 // Safari 9 overrides pageX and pageY. These values needs to be copied. #779 2827 this.pointerDownPointer = { 2828 pageX: pointer.pageX, 2829 pageY: pointer.pageY, 2830 }; 2831 // bind move and end events 2832 this._bindPostStartEvents( event ); 2833 this.dispatchEvent( 'pointerDown', event, [ pointer ] ); 2834}; 2835 2836var focusNodes = { 2837 INPUT: true, 2838 TEXTAREA: true, 2839 SELECT: true, 2840}; 2841 2842proto.pointerDownFocus = function( event ) { 2843 var isFocusNode = focusNodes[ event.target.nodeName ]; 2844 if ( !isFocusNode ) { 2845 this.focus(); 2846 } 2847}; 2848 2849proto._pointerDownPreventDefault = function( event ) { 2850 var isTouchStart = event.type == 'touchstart'; 2851 var isTouchPointer = event.pointerType == 'touch'; 2852 var isFocusNode = focusNodes[ event.target.nodeName ]; 2853 if ( !isTouchStart && !isTouchPointer && !isFocusNode ) { 2854 event.preventDefault(); 2855 } 2856}; 2857 2858// ----- move ----- // 2859 2860proto.hasDragStarted = function( moveVector ) { 2861 return Math.abs( moveVector.x ) > this.options.dragThreshold; 2862}; 2863 2864// ----- up ----- // 2865 2866proto.pointerUp = function( event, pointer ) { 2867 delete this.isTouchScrolling; 2868 this.viewport.classList.remove('is-pointer-down'); 2869 this.dispatchEvent( 'pointerUp', event, [ pointer ] ); 2870 this._dragPointerUp( event, pointer ); 2871}; 2872 2873proto.pointerDone = function() { 2874 window.removeEventListener( 'scroll', this ); 2875 delete this.pointerDownScroll; 2876}; 2877 2878// -------------------------- dragging -------------------------- // 2879 2880proto.dragStart = function( event, pointer ) { 2881 if ( !this.isDraggable ) { 2882 return; 2883 } 2884 this.dragStartPosition = this.x; 2885 this.startAnimation(); 2886 window.removeEventListener( 'scroll', this ); 2887 this.dispatchEvent( 'dragStart', event, [ pointer ] ); 2888}; 2889 2890proto.pointerMove = function( event, pointer ) { 2891 var moveVector = this._dragPointerMove( event, pointer ); 2892 this.dispatchEvent( 'pointerMove', event, [ pointer, moveVector ] ); 2893 this._dragMove( event, pointer, moveVector ); 2894}; 2895 2896proto.dragMove = function( event, pointer, moveVector ) { 2897 if ( !this.isDraggable ) { 2898 return; 2899 } 2900 event.preventDefault(); 2901 2902 this.previousDragX = this.dragX; 2903 // reverse if right-to-left 2904 var direction = this.options.rightToLeft ? -1 : 1; 2905 if ( this.options.wrapAround ) { 2906 // wrap around move. #589 2907 moveVector.x %= this.slideableWidth; 2908 } 2909 var dragX = this.dragStartPosition + moveVector.x * direction; 2910 2911 if ( !this.options.wrapAround && this.slides.length ) { 2912 // slow drag 2913 var originBound = Math.max( -this.slides[0].target, this.dragStartPosition ); 2914 dragX = dragX > originBound ? ( dragX + originBound ) * 0.5 : dragX; 2915 var endBound = Math.min( -this.getLastSlide().target, this.dragStartPosition ); 2916 dragX = dragX < endBound ? ( dragX + endBound ) * 0.5 : dragX; 2917 } 2918 2919 this.dragX = dragX; 2920 2921 this.dragMoveTime = new Date(); 2922 this.dispatchEvent( 'dragMove', event, [ pointer, moveVector ] ); 2923}; 2924 2925proto.dragEnd = function( event, pointer ) { 2926 if ( !this.isDraggable ) { 2927 return; 2928 } 2929 if ( this.options.freeScroll ) { 2930 this.isFreeScrolling = true; 2931 } 2932 // set selectedIndex based on where flick will end up 2933 var index = this.dragEndRestingSelect(); 2934 2935 if ( this.options.freeScroll && !this.options.wrapAround ) { 2936 // if free-scroll & not wrap around 2937 // do not free-scroll if going outside of bounding slides 2938 // so bounding slides can attract slider, and keep it in bounds 2939 var restingX = this.getRestingPosition(); 2940 this.isFreeScrolling = -restingX > this.slides[0].target && 2941 -restingX < this.getLastSlide().target; 2942 } else if ( !this.options.freeScroll && index == this.selectedIndex ) { 2943 // boost selection if selected index has not changed 2944 index += this.dragEndBoostSelect(); 2945 } 2946 delete this.previousDragX; 2947 // apply selection 2948 // TODO refactor this, selecting here feels weird 2949 // HACK, set flag so dragging stays in correct direction 2950 this.isDragSelect = this.options.wrapAround; 2951 this.select( index ); 2952 delete this.isDragSelect; 2953 this.dispatchEvent( 'dragEnd', event, [ pointer ] ); 2954}; 2955 2956proto.dragEndRestingSelect = function() { 2957 var restingX = this.getRestingPosition(); 2958 // how far away from selected slide
2959 var distance = Math.abs( this.getSlideDistance( -restingX, this.selectedIndex ) ); 2960 // get closet resting going up and going down 2961 var positiveResting = this._getClosestResting( restingX, distance, 1 ); 2962 var negativeResting = this._getClosestResting( restingX, distance, -1 ); 2963 // use closer resting for wrap-around 2964 var index = positiveResting.distance < negativeResting.distance ? 2965 positiveResting.index : negativeResting.index; 2966 return index; 2967}; 2968 2969/** 2970 * given resting X and distance to selected cell 2971 * get the distance and index of the closest cell 2972 * @param {Number} restingX - estimated post-flick resting position 2973 * @param {Number} distance - distance to selected cell 2974 * @param {Integer} increment - +1 or -1, going up or down 2975 * @returns {Object} - { distance: {Number}, index: {Integer} } 2976 */ 2977proto._getClosestResting = function( restingX, distance, increment ) { 2978 var index = this.selectedIndex; 2979 var minDistance = Infinity; 2980 var condition = this.options.contain && !this.options.wrapAround ? 2981 // if contain, keep going if distance is equal to minDistance 2982 function( dist, minDist ) { 2983 return dist <= minDist; 2984 } : function( dist, minDist ) { 2985 return dist < minDist; 2986 }; 2987 while ( condition( distance, minDistance ) ) { 2988 // measure distance to next cell 2989 index += increment; 2990 minDistance = distance; 2991 distance = this.getSlideDistance( -restingX, index ); 2992 if ( distance === null ) { 2993 break; 2994 } 2995 distance = Math.abs( distance ); 2996 } 2997 return { 2998 distance: minDistance, 2999 // selected was previous index 3000 index: index - increment, 3001 }; 3002}; 3003 3004/** 3005 * measure distance between x and a slide target 3006 * @param {Number} x - horizontal position 3007 * @param {Integer} index - slide index 3008 * @returns {Number} - slide distance 3009 */ 3010proto.getSlideDistance = function( x, index ) { 3011 var len = this.slides.length; 3012 // wrap around if at least 2 slides 3013 var isWrapAround = this.options.wrapAround && len > 1; 3014 var slideIndex = isWrapAround ? utils.modulo( index, len ) : index; 3015 var slide = this.slides[ slideIndex ]; 3016 if ( !slide ) { 3017 return null; 3018 } 3019 // add distance for wrap-around slides 3020 var wrap = isWrapAround ? this.slideableWidth * Math.floor( index/len ) : 0; 3021 return x - ( slide.target + wrap ); 3022}; 3023 3024proto.dragEndBoostSelect = function() { 3025 // do not boost if no previousDragX or dragMoveTime 3026 if ( this.previousDragX === undefined || !this.dragMoveTime || 3027 // or if drag was held for 100 ms 3028 new Date() - this.dragMoveTime > 100 ) { 3029 return 0; 3030 } 3031 3032 var distance = this.getSlideDistance( -this.dragX, this.selectedIndex ); 3033 var delta = this.previousDragX - this.dragX; 3034 if ( distance > 0 && delta > 0 ) { 3035 // boost to next if moving towards the right, and positive velocity 3036 return 1; 3037 } else if ( distance < 0 && delta < 0 ) { 3038 // boost to previous if moving towards the left, and negative velocity 3039 return -1; 3040 } 3041 return 0; 3042}; 3043 3044// ----- staticClick ----- // 3045 3046proto.staticClick = function( event, pointer ) { 3047 // get clickedCell, if cell was clicked 3048 var clickedCell = this.getParentCell( event.target ); 3049 var cellElem = clickedCell && clickedCell.element; 3050 var cellIndex = clickedCell && this.cells.indexOf( clickedCell ); 3051 this.dispatchEvent( 'staticClick', event, [ pointer, cellElem, cellIndex ] ); 3052}; 3053 3054// ----- scroll ----- // 3055 3056proto.onscroll = function() { 3057 var scroll = getScrollPosition(); 3058 var scrollMoveX = this.pointerDownScroll.x - scroll.x; 3059 var scrollMoveY = this.pointerDownScroll.y - scroll.y; 3060 // cancel click/tap if scroll is too much 3061 if ( Math.abs( scrollMoveX ) > 3 || Math.abs( scrollMoveY ) > 3 ) { 3062 this._pointerDone(); 3063 } 3064}; 3065 3066// ----- utils ----- // 3067 3068function getScrollPosition() { 3069 return { 3070 x: window.pageXOffset, 3071 y: window.pageYOffset, 3072 }; 3073} 3074 3075// ----- ----- // 3076 3077return Flickity; 3078 3079} ) ); 3080 3081// prev/next buttons 3082( function( window, factory ) { 3083 // universal module definition 3084 if ( typeof define == 'function' && define.amd ) { 3085 // AMD 3086 define( 'flickity/js/prev-next-button',[ 3087 './flickity', 3088 'unipointer/unipointer', 3089 'fizzy-ui-utils/utils', 3090 ], function( Flickity, Unipointer, utils ) { 3091 return factory( window, Flickity, Unipointer, utils ); 3092 } ); 3093 } else if ( typeof module == 'object' && module.exports ) { 3094 // CommonJS 3095 module.exports = factory( 3096 window, 3097 require('./flickity'), 3098 require('unipointer'), 3099 require('fizzy-ui-utils') 3100 ); 3101 } else { 3102 // browser global 3103 factory( 3104 window, 3105 window.Flickity, 3106 window.Unipointer, 3107 window.fizzyUIUtils 3108 ); 3109 } 3110 3111}( window, function factory( window, Flickity, Unipointer, utils ) { 3112'use strict'; 3113 3114var svgURI = 'http://www.w3.org/2000/svg'; 3115
3116// -------------------------- PrevNextButton -------------------------- // 3117 3118function PrevNextButton( direction, parent ) { 3119 this.direction = direction; 3120 this.parent = parent; 3121 this._create(); 3122} 3123 3124PrevNextButton.prototype = Object.create( Unipointer.prototype ); 3125 3126PrevNextButton.prototype._create = function() { 3127 // properties 3128 this.isEnabled = true; 3129 this.isPrevious = this.direction == -1; 3130 var leftDirection = this.parent.options.rightToLeft ? 1 : -1; 3131 this.isLeft = this.direction == leftDirection; 3132 3133 var element = this.element = document.createElement('button'); 3134 element.className = 'flickity-button flickity-prev-next-button'; 3135 element.className += this.isPrevious ? ' previous' : ' next'; 3136 // prevent button from submitting form http://stackoverflow.com/a/10836076/182183 3137 element.setAttribute( 'type', 'button' ); 3138 // init as disabled 3139 this.disable(); 3140 3141 element.setAttribute( 'aria-label', this.isPrevious ? 'Previous' : 'Next' ); 3142 3143 // create arrow 3144 var svg = this.createSVG(); 3145 element.appendChild( svg ); 3146 // events 3147 this.parent.on( 'select', this.update.bind( this ) ); 3148 this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) ); 3149}; 3150 3151PrevNextButton.prototype.activate = function() { 3152 this.bindStartEvent( this.element ); 3153 this.element.addEventListener( 'click', this ); 3154 // add to DOM 3155 this.parent.element.appendChild( this.element ); 3156}; 3157 3158PrevNextButton.prototype.deactivate = function() { 3159 // remove from DOM 3160 this.parent.element.removeChild( this.element ); 3161 // click events 3162 this.unbindStartEvent( this.element ); 3163 this.element.removeEventListener( 'click', this ); 3164}; 3165 3166PrevNextButton.prototype.createSVG = function() { 3167 var svg = document.createElementNS( svgURI, 'svg' ); 3168 svg.setAttribute( 'class', 'flickity-button-icon' ); 3169 svg.setAttribute( 'viewBox', '0 0 100 100' ); 3170 var path = document.createElementNS( svgURI, 'path' ); 3171 var pathMovements = getArrowMovements( this.parent.options.arrowShape ); 3172 path.setAttribute( 'd', pathMovements ); 3173 path.setAttribute( 'class', 'arrow' ); 3174 // rotate arrow 3175 if ( !this.isLeft ) { 3176 path.setAttribute( 'transform', 'translate(100, 100) rotate(180) ' ); 3177 } 3178 svg.appendChild( path ); 3179 return svg; 3180}; 3181 3182// get SVG path movmement 3183function getArrowMovements( shape ) { 3184 // use shape as movement if string 3185 if ( typeof shape == 'string' ) { 3186 return shape; 3187 } 3188 // create movement string 3189 return 'M ' + shape.x0 + ',50' + 3190 ' L ' + shape.x1 + ',' + ( shape.y1 + 50 ) + 3191 ' L ' + shape.x2 + ',' + ( shape.y2 + 50 ) + 3192 ' L ' + shape.x3 + ',50 ' + 3193 ' L ' + shape.x2 + ',' + ( 50 - shape.y2 ) + 3194 ' L ' + shape.x1 + ',' + ( 50 - shape.y1 ) + 3195 ' Z'; 3196} 3197 3198PrevNextButton.prototype.handleEvent = utils.handleEvent; 3199 3200PrevNextButton.prototype.onclick = function() { 3201 if ( !this.isEnabled ) { 3202 return; 3203 } 3204 this.parent.uiChange(); 3205 var method = this.isPrevious ? 'previous' : 'next'; 3206 this.parent[ method ](); 3207}; 3208 3209// ----- ----- // 3210 3211PrevNextButton.prototype.enable = function() { 3212 if ( this.isEnabled ) { 3213 return; 3214 } 3215 this.element.disabled = false; 3216 this.isEnabled = true; 3217}; 3218 3219PrevNextButton.prototype.disable = function() { 3220 if ( !this.isEnabled ) { 3221 return; 3222 } 3223 this.element.disabled = true; 3224 this.isEnabled = false; 3225}; 3226 3227PrevNextButton.prototype.update = function() { 3228 // index of first or last slide, if previous or next 3229 var slides = this.parent.slides; 3230 // enable is wrapAround and at least 2 slides 3231 if ( this.parent.options.wrapAround && slides.length > 1 ) { 3232 this.enable(); 3233 return; 3234 } 3235 var lastIndex = slides.length ? slides.length - 1 : 0; 3236 var boundIndex = this.isPrevious ? 0 : lastIndex; 3237 var method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable'; 3238 this[ method ](); 3239}; 3240 3241PrevNextButton.prototype.destroy = function() { 3242 this.deactivate(); 3243 this.allOff(); 3244}; 3245 3246// -------------------------- Flickity prototype -------------------------- // 3247 3248utils.extend( Flickity.defaults, { 3249 prevNextButtons: true, 3250 arrowShape: { 3251 x0: 10, 3252 x1: 60, y1: 50, 3253 x2: 70, y2: 40, 3254 x3: 30, 3255 }, 3256} ); 3257 3258Flickity.createMethods.push('_createPrevNextButtons'); 3259var proto = Flickity.prototype; 3260 3261proto._createPrevNextButtons = function() { 3262 if ( !this.options.prevNextButtons ) { 3263 return; 3264 } 3265 3266 this.prevButton = new PrevNextButton( -1, this ); 3267 this.nextButton = new PrevNextButton( 1, this ); 3268 3269 this.on( 'activate', this.activatePrevNextButtons ); 3270}; 3271 3272proto.activatePrevNextButtons = function() { 3273 this.prevButton.activate(); 3274 this.nextButton.activate(); 3275 this.on( 'deactivate', this.deactivatePrevNextButtons ); 3276}; 3277 3278proto.deactivatePrevNextButtons = function() { 3279 this.prevButton.deactivate(); 3280 this.nextButton.deactivate(); 3281 this.off( 'deactivate', this.deactivatePrevNextButtons ); 3282}; 3283 3284// -------------------------- -------------------------- // 3285 3286Flickity.PrevNextButton = PrevNextButton; 3287 3288return Flickity; 3289 3290} ) ); 3291 3292// page dots 3293( function( window, factory ) { 3294 // universal module definition 3295 if ( typeof define == 'function' && define.amd ) { 3296 // AMD 3297 define( 'flickity/js/page-dots',[ 3298 './flickity',
3299 'unipointer/unipointer', 3300 'fizzy-ui-utils/utils', 3301 ], function( Flickity, Unipointer, utils ) { 3302 return factory( window, Flickity, Unipointer, utils ); 3303 } ); 3304 } else if ( typeof module == 'object' && module.exports ) { 3305 // CommonJS 3306 module.exports = factory( 3307 window, 3308 require('./flickity'), 3309 require('unipointer'), 3310 require('fizzy-ui-utils') 3311 ); 3312 } else { 3313 // browser global 3314 factory( 3315 window, 3316 window.Flickity, 3317 window.Unipointer, 3318 window.fizzyUIUtils 3319 ); 3320 } 3321 3322}( window, function factory( window, Flickity, Unipointer, utils ) { 3323 3324// -------------------------- PageDots -------------------------- // 3325 3326 3327 3328function PageDots( parent ) { 3329 this.parent = parent; 3330 this._create(); 3331} 3332 3333PageDots.prototype = Object.create( Unipointer.prototype ); 3334 3335PageDots.prototype._create = function() { 3336 // create holder element 3337 this.holder = document.createElement('ol'); 3338 this.holder.className = 'flickity-page-dots'; 3339 // create dots, array of elements 3340 this.dots = []; 3341 // events 3342 this.handleClick = this.onClick.bind( this ); 3343 this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) ); 3344}; 3345 3346PageDots.prototype.activate = function() { 3347 this.setDots(); 3348 this.holder.addEventListener( 'click', this.handleClick ); 3349 this.bindStartEvent( this.holder ); 3350 // add to DOM 3351 this.parent.element.appendChild( this.holder ); 3352}; 3353 3354PageDots.prototype.deactivate = function() { 3355 this.holder.removeEventListener( 'click', this.handleClick ); 3356 this.unbindStartEvent( this.holder ); 3357 // remove from DOM 3358 this.parent.element.removeChild( this.holder ); 3359}; 3360 3361PageDots.prototype.setDots = function() { 3362 // get difference between number of slides and number of dots 3363 var delta = this.parent.slides.length - this.dots.length; 3364 if ( delta > 0 ) { 3365 this.addDots( delta ); 3366 } else if ( delta < 0 ) { 3367 this.removeDots( -delta ); 3368 } 3369}; 3370 3371PageDots.prototype.addDots = function( count ) { 3372 var fragment = document.createDocumentFragment(); 3373 var newDots = []; 3374 var length = this.dots.length; 3375 var max = length + count; 3376 3377 for ( var i = length; i < max; i++ ) { 3378 var dot = document.createElement('li'); 3379 dot.className = 'dot'; 3380 dot.setAttribute( 'aria-label', 'Page dot ' + ( i + 1 ) ); 3381 fragment.appendChild( dot ); 3382 newDots.push( dot ); 3383 } 3384 3385 this.holder.appendChild( fragment ); 3386 this.dots = this.dots.concat( newDots ); 3387}; 3388 3389PageDots.prototype.removeDots = function( count ) { 3390 // remove from this.dots collection 3391 var removeDots = this.dots.splice( this.dots.length - count, count ); 3392 // remove from DOM 3393 removeDots.forEach( function( dot ) { 3394 this.holder.removeChild( dot ); 3395 }, this ); 3396}; 3397 3398PageDots.prototype.updateSelected = function() { 3399 // remove selected class on previous 3400 if ( this.selectedDot ) { 3401 this.selectedDot.className = 'dot'; 3402 this.selectedDot.removeAttribute('aria-current'); 3403 } 3404 // don't proceed if no dots 3405 if ( !this.dots.length ) { 3406 return; 3407 } 3408 this.selectedDot = this.dots[ this.parent.selectedIndex ]; 3409 this.selectedDot.className = 'dot is-selected'; 3410 this.selectedDot.setAttribute( 'aria-current', 'step' ); 3411}; 3412 3413PageDots.prototype.onTap = // old method name, backwards-compatible 3414PageDots.prototype.onClick = function( event ) { 3415 var target = event.target; 3416 // only care about dot clicks 3417 if ( target.nodeName != 'LI' ) { 3418 return; 3419 } 3420 3421 this.parent.uiChange(); 3422 var index = this.dots.indexOf( target ); 3423 this.parent.select( index ); 3424}; 3425 3426PageDots.prototype.destroy = function() { 3427 this.deactivate(); 3428 this.allOff(); 3429}; 3430 3431Flickity.PageDots = PageDots; 3432 3433// -------------------------- Flickity -------------------------- // 3434 3435utils.extend( Flickity.defaults, { 3436 pageDots: true, 3437} ); 3438 3439Flickity.createMethods.push('_createPageDots'); 3440 3441var proto = Flickity.prototype; 3442 3443proto._createPageDots = function() { 3444 if ( !this.options.pageDots ) { 3445 return; 3446 } 3447 this.pageDots = new PageDots( this ); 3448 // events 3449 this.on( 'activate', this.activatePageDots ); 3450 this.on( 'select', this.updateSelectedPageDots ); 3451 this.on( 'cellChange', this.updatePageDots ); 3452 this.on( 'resize', this.updatePageDots ); 3453 this.on( 'deactivate', this.deactivatePageDots ); 3454}; 3455 3456proto.activatePageDots = function() { 3457 this.pageDots.activate(); 3458}; 3459 3460proto.updateSelectedPageDots = function() { 3461 this.pageDots.updateSelected(); 3462}; 3463 3464proto.updatePageDots = function() { 3465 this.pageDots.setDots(); 3466}; 3467 3468proto.deactivatePageDots = function() { 3469 this.pageDots.deactivate(); 3470}; 3471 3472// ----- ----- // 3473 3474Flickity.PageDots = PageDots; 3475 3476return Flickity; 3477 3478} ) ); 3479 3480// player & autoPlay 3481( function( window, factory ) { 3482 // universal module definition 3483 if ( typeof define == 'function' && define.amd ) { 3484 // AMD 3485 define( 'flickity/js/player',[ 3486 'ev-emitter/ev-emitter', 3487 'fizzy-ui-utils/utils', 3488 './flickity', 3489 ], function( EvEmitter, utils, Flickity ) { 3490 return factory( EvEmitter, utils, Flickity ); 3491 } ); 3492 } else if ( typeof module == 'object' && module.exports ) { 3493 // CommonJS 3494 module.exports = factory( 3495 require('ev-emitter'), 3496 require('fizzy-ui-utils'), 3497 require('./flickity') 3498 ); 3499 } else { 3500 // browser global 3501 factory( 3502 window.EvEmitter, 3503 window.fizzyUIUtils, 3504 window.Flickity 3505 ); 3506 } 3507 3508}( window, function factory( EvEmitter, utils, Flickity ) { 3509 3510 3511 3512// -------------------------- Player -------------------------- // 3513 3514function Player( parent ) { 3515 this.parent = parent; 3516 this.state = 'stopped'; 3517 // visibility change event handler 3518 this.onVisibilityChange = this.visibilityChange.bind( this ); 3519 this.onVisibilityPlay = this.visibilityPlay.bind( this ); 3520} 3521 3522Player.prototype = Object.create( EvEmitter.prototype ); 3523 3524// start play 3525Player.prototype.play = function() { 3526 if ( this.state == 'playing' ) { 3527 return; 3528 } 3529 // do not play if page is hidden, start playing when page is visible 3530 var isPageHidden = document.hidden; 3531 if ( isPageHidden ) { 3532 document.addEventListener( 'visibilitychange', this.onVisibilityPlay ); 3533 return; 3534 } 3535 3536 this.state = 'playing'; 3537 // listen to visibility change 3538 document.addEventListener( 'visibilitychange', this.onVisibilityChange ); 3539 // start ticking 3540 this.tick(); 3541}; 3542 3543Player.prototype.tick = function() { 3544 // do not tick if not playing 3545 if ( this.state != 'playing' ) { 3546 return; 3547 } 3548 3549 var time = this.parent.options.autoPlay; 3550 // default to 3 seconds 3551 time = typeof time == 'number' ? time : 3000; 3552 var _this = this; 3553 // HACK: reset ticks if stopped and started within interval 3554 this.clear(); 3555 this.timeout = setTimeout( function() { 3556 _this.parent.next( true ); 3557 _this.tick(); 3558 }, time ); 3559}; 3560 3561Player.prototype.stop = function() { 3562 this.state = 'stopped'; 3563 this.clear(); 3564 // remove visibility change event 3565 document.removeEventListener( 'visibilitychange', this.onVisibilityChange ); 3566}; 3567 3568Player.prototype.clear = function() { 3569 clearTimeout( this.timeout ); 3570}; 3571 3572Player.prototype.pause = function() { 3573 if ( this.state == 'playing' ) { 3574 this.state = 'paused'; 3575 this.clear(); 3576 } 3577}; 3578 3579Player.prototype.unpause = function() { 3580 // re-start play if paused 3581 if ( this.state == 'paused' ) { 3582 this.play(); 3583 } 3584}; 3585 3586// pause if page visibility is hidden, unpause if visible 3587Player.prototype.visibilityChange = function() { 3588 var isPageHidden = document.hidden; 3589 this[ isPageHidden ? 'pause' : 'unpause' ](); 3590}; 3591 3592Player.prototype.visibilityPlay = function() { 3593 this.play(); 3594 document.removeEventListener( 'visibilitychange', this.onVisibilityPlay ); 3595}; 3596 3597// -------------------------- Flickity -------------------------- // 3598 3599utils.extend( Flickity.defaults, { 3600 pauseAutoPlayOnHover: true, 3601} ); 3602 3603Flickity.createMethods.push('_createPlayer'); 3604var proto = Flickity.prototype; 3605 3606proto._createPlayer = function() { 3607 this.player = new Player( this ); 3608 3609 this.on( 'activate', this.activatePlayer ); 3610 this.on( 'uiChange', this.stopPlayer ); 3611 this.on( 'pointerDown', this.stopPlayer ); 3612 this.on( 'deactivate', this.deactivatePlayer ); 3613}; 3614 3615proto.activatePlayer = function() { 3616 if ( !this.options.autoPlay ) { 3617 return; 3618 } 3619 this.player.play(); 3620 this.element.addEventListener( 'mouseenter', this ); 3621}; 3622 3623// Player API, don't hate the ... thanks I know where the door is 3624 3625proto.playPlayer = function() { 3626 this.player.play(); 3627}; 3628 3629proto.stopPlayer = function() { 3630 this.player.stop(); 3631}; 3632 3633proto.pausePlayer = function() { 3634 this.player.pause(); 3635}; 3636 3637proto.unpausePlayer = function() { 3638 this.player.unpause(); 3639}; 3640 3641proto.deactivatePlayer = function() { 3642 this.player.stop(); 3643 this.element.removeEventListener( 'mouseenter', this ); 3644}; 3645 3646// ----- mouseenter/leave ----- // 3647 3648// pause auto-play on hover 3649proto.onmouseenter = function() { 3650 if ( !this.options.pauseAutoPlayOnHover ) { 3651 return; 3652 } 3653 this.player.pause(); 3654 this.element.addEventListener( 'mouseleave', this ); 3655}; 3656 3657// resume auto-play on hover off 3658proto.onmouseleave = function() { 3659 this.player.unpause(); 3660 this.element.removeEventListener( 'mouseleave', this ); 3661}; 3662 3663// ----- ----- // 3664 3665Flickity.Player = Player; 3666 3667return Flickity; 3668 3669} ) ); 3670 3671// add, remove cell 3672( function( window, factory ) { 3673 // universal module definition 3674 if ( typeof define == 'function' && define.amd ) { 3675 // AMD 3676 define( 'flickity/js/add-remove-cell',[ 3677 './flickity', 3678 'fizzy-ui-utils/utils', 3679 ], function( Flickity, utils ) { 3680 return factory( window, Flickity, utils ); 3681 } ); 3682 } else if ( typeof module == 'object' && module.exports ) { 3683 // CommonJS 3684 module.exports = factory( 3685 window, 3686 require('./flickity'), 3687 require('fizzy-ui-utils') 3688 ); 3689 } else { 3690 // browser global 3691 factory( 3692 window, 3693 window.Flickity, 3694 window.fizzyUIUtils 3695 ); 3696 } 3697 3698}( window, function factory( window, Flickity, utils ) { 3699 3700 3701 3702// append cells to a document fragment 3703function getCellsFragment( cells ) { 3704 var fragment = document.createDocumentFragment();
3705 cells.forEach( function( cell ) { 3706 fragment.appendChild( cell.element ); 3707 } ); 3708 return fragment; 3709} 3710 3711// -------------------------- add/remove cell prototype -------------------------- // 3712 3713var proto = Flickity.prototype; 3714 3715/** 3716 * Insert, prepend, or append cells 3717 * @param {[Element, Array, NodeList]} elems - Elements to insert 3718 * @param {Integer} index - Zero-based number to insert 3719 */ 3720proto.insert = function( elems, index ) { 3721 var cells = this._makeCells( elems ); 3722 if ( !cells || !cells.length ) { 3723 return; 3724 } 3725 var len = this.cells.length; 3726 // default to append 3727 index = index === undefined ? len : index; 3728 // add cells with document fragment 3729 var fragment = getCellsFragment( cells ); 3730 // append to slider 3731 var isAppend = index == len; 3732 if ( isAppend ) { 3733 this.slider.appendChild( fragment ); 3734 } else { 3735 var insertCellElement = this.cells[ index ].element; 3736 this.slider.insertBefore( fragment, insertCellElement ); 3737 } 3738 // add to this.cells 3739 if ( index === 0 ) { 3740 // prepend, add to start 3741 this.cells = cells.concat( this.cells ); 3742 } else if ( isAppend ) { 3743 // append, add to end 3744 this.cells = this.cells.concat( cells ); 3745 } else { 3746 // insert in this.cells 3747 var endCells = this.cells.splice( index, len - index ); 3748 this.cells = this.cells.concat( cells ).concat( endCells ); 3749 } 3750 3751 this._sizeCells( cells ); 3752 this.cellChange( index, true ); 3753}; 3754 3755proto.append = function( elems ) { 3756 this.insert( elems, this.cells.length ); 3757}; 3758 3759proto.prepend = function( elems ) { 3760 this.insert( elems, 0 ); 3761}; 3762 3763/** 3764 * Remove cells 3765 * @param {[Element, Array, NodeList]} elems - ELements to remove 3766 */ 3767proto.remove = function( elems ) { 3768 var cells = this.getCells( elems ); 3769 if ( !cells || !cells.length ) { 3770 return; 3771 } 3772 3773 var minCellIndex = this.cells.length - 1; 3774 // remove cells from collection & DOM 3775 cells.forEach( function( cell ) { 3776 cell.remove(); 3777 var index = this.cells.indexOf( cell ); 3778 minCellIndex = Math.min( index, minCellIndex ); 3779 utils.removeFrom( this.cells, cell ); 3780 }, this ); 3781 3782 this.cellChange( minCellIndex, true ); 3783}; 3784 3785/** 3786 * logic to be run after a cell's size changes 3787 * @param {Element} elem - cell's element 3788 */ 3789proto.cellSizeChange = function( elem ) { 3790 var cell = this.getCell( elem ); 3791 if ( !cell ) { 3792 return; 3793 } 3794 cell.getSize(); 3795 3796 var index = this.cells.indexOf( cell ); 3797 this.cellChange( index ); 3798}; 3799 3800/** 3801 * logic any time a cell is changed: added, removed, or size changed 3802 * @param {Integer} changedCellIndex - index of the changed cell, optional 3803 * @param {Boolean} isPositioningSlider - Positions slider after selection 3804 */ 3805proto.cellChange = function( changedCellIndex, isPositioningSlider ) { 3806 var prevSelectedElem = this.selectedElement; 3807 this._positionCells( changedCellIndex ); 3808 this._getWrapShiftCells(); 3809 this.setGallerySize(); 3810 // update selectedIndex 3811 // try to maintain position & select previous selected element 3812 var cell = this.getCell( prevSelectedElem ); 3813 if ( cell ) { 3814 this.selectedIndex = this.getCellSlideIndex( cell ); 3815 } 3816 this.selectedIndex = Math.min( this.slides.length - 1, this.selectedIndex ); 3817 3818 this.emitEvent( 'cellChange', [ changedCellIndex ] ); 3819 // position slider 3820 this.select( this.selectedIndex ); 3821 // do not position slider after lazy load 3822 if ( isPositioningSlider ) { 3823 this.positionSliderAtSelected(); 3824 } 3825}; 3826 3827// ----- ----- // 3828 3829return Flickity; 3830 3831} ) ); 3832 3833// lazyload 3834( function( window, factory ) { 3835 // universal module definition 3836 if ( typeof define == 'function' && define.amd ) { 3837 // AMD 3838 define( 'flickity/js/lazyload',[ 3839 './flickity', 3840 'fizzy-ui-utils/utils', 3841 ], function( Flickity, utils ) { 3842 return factory( window, Flickity, utils ); 3843 } ); 3844 } else if ( typeof module == 'object' && module.exports ) { 3845 // CommonJS 3846 module.exports = factory( 3847 window, 3848 require('./flickity'), 3849 require('fizzy-ui-utils') 3850 ); 3851 } else { 3852 // browser global 3853 factory( 3854 window, 3855 window.Flickity, 3856 window.fizzyUIUtils 3857 ); 3858 } 3859 3860}( window, function factory( window, Flickity, utils ) { 3861'use strict'; 3862 3863Flickity.createMethods.push('_createLazyload'); 3864var proto = Flickity.prototype; 3865 3866proto._createLazyload = function() { 3867 this.on( 'select', this.lazyLoad ); 3868}; 3869 3870proto.lazyLoad = function() { 3871 var lazyLoad = this.options.lazyLoad; 3872 if ( !lazyLoad ) { 3873 return; 3874 } 3875 // get adjacent cells, use lazyLoad option for adjacent count 3876 var adjCount = typeof lazyLoad == 'number' ? lazyLoad : 0; 3877 var cellElems = this.getAdjacentCellElements( adjCount ); 3878 // get lazy images in those cells 3879 var lazyImages = [];
3880 cellElems.forEach( function( cellElem ) { 3881 var lazyCellImages = getCellLazyImages( cellElem ); 3882 lazyImages = lazyImages.concat( lazyCellImages ); 3883 } ); 3884 // load lazy images 3885 lazyImages.forEach( function( img ) { 3886 new LazyLoader( img, this ); 3887 }, this ); 3888}; 3889 3890function getCellLazyImages( cellElem ) { 3891 // check if cell element is lazy image 3892 if ( cellElem.nodeName == 'IMG' ) { 3893 var lazyloadAttr = cellElem.getAttribute('data-flickity-lazyload'); 3894 var srcAttr = cellElem.getAttribute('data-flickity-lazyload-src'); 3895 var srcsetAttr = cellElem.getAttribute('data-flickity-lazyload-srcset'); 3896 if ( lazyloadAttr || srcAttr || srcsetAttr ) { 3897 return [ cellElem ]; 3898 } 3899 } 3900 // select lazy images in cell 3901 var lazySelector = 'img[data-flickity-lazyload], ' + 3902 'img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]'; 3903 var imgs = cellElem.querySelectorAll( lazySelector ); 3904 return utils.makeArray( imgs ); 3905} 3906 3907// -------------------------- LazyLoader -------------------------- // 3908 3909/** 3910 * class to handle loading images 3911 * @param {Image} img - Image element 3912 * @param {Flickity} flickity - Flickity instance 3913 */ 3914function LazyLoader( img, flickity ) { 3915 this.img = img; 3916 this.flickity = flickity; 3917 this.load(); 3918} 3919 3920LazyLoader.prototype.handleEvent = utils.handleEvent; 3921 3922LazyLoader.prototype.load = function() { 3923 this.img.addEventListener( 'load', this ); 3924 this.img.addEventListener( 'error', this ); 3925 // get src & srcset 3926 var src = this.img.getAttribute('data-flickity-lazyload') || 3927 this.img.getAttribute('data-flickity-lazyload-src'); 3928 var srcset = this.img.getAttribute('data-flickity-lazyload-srcset'); 3929 // set src & serset 3930 this.img.src = src; 3931 if ( srcset ) { 3932 this.img.setAttribute( 'srcset', srcset ); 3933 } 3934 // remove attr 3935 this.img.removeAttribute('data-flickity-lazyload'); 3936 this.img.removeAttribute('data-flickity-lazyload-src'); 3937 this.img.removeAttribute('data-flickity-lazyload-srcset'); 3938}; 3939 3940LazyLoader.prototype.onload = function( event ) { 3941 this.complete( event, 'flickity-lazyloaded' ); 3942}; 3943 3944LazyLoader.prototype.onerror = function( event ) { 3945 this.complete( event, 'flickity-lazyerror' ); 3946}; 3947 3948LazyLoader.prototype.complete = function( event, className ) { 3949 // unbind events 3950 this.img.removeEventListener( 'load', this ); 3951 this.img.removeEventListener( 'error', this ); 3952 3953 var cell = this.flickity.getParentCell( this.img ); 3954 var cellElem = cell && cell.element; 3955 this.flickity.cellSizeChange( cellElem ); 3956 3957 this.img.classList.add( className ); 3958 this.flickity.dispatchEvent( 'lazyLoad', event, cellElem ); 3959}; 3960 3961// ----- ----- // 3962 3963Flickity.LazyLoader = LazyLoader; 3964 3965return Flickity; 3966 3967} ) ); 3968 3969/*! 3970 * Flickity v2.3.0 3971 * Touch, responsive, flickable carousels 3972 * 3973 * Licensed GPLv3 for open source use 3974 * or Flickity Commercial License for commercial use 3975 * 3976 * https://flickity.metafizzy.co 3977 * Copyright 2015-2021 Metafizzy 3978 */ 3979 3980( function( window, factory ) { 3981 // universal module definition 3982 if ( typeof define == 'function' && define.amd ) { 3983 // AMD 3984 define( 'flickity/js/index',[ 3985 './flickity', 3986 './drag', 3987 './prev-next-button', 3988 './page-dots', 3989 './player', 3990 './add-remove-cell', 3991 './lazyload', 3992 ], factory ); 3993 } else if ( typeof module == 'object' && module.exports ) { 3994 // CommonJS 3995 module.exports = factory( 3996 require('./flickity'), 3997 require('./drag'), 3998 require('./prev-next-button'), 3999 require('./page-dots'), 4000 require('./player'), 4001 require('./add-remove-cell'), 4002 require('./lazyload') 4003 ); 4004 } 4005 4006} )( window, function factory( Flickity ) { 4007 return Flickity; 4008} ); 4009 4010/*! 4011 * Flickity asNavFor v2.0.2 4012 * enable asNavFor for Flickity 4013 */ 4014 4015/*jshint browser: true, undef: true, unused: true, strict: true*/ 4016 4017( function( window, factory ) { 4018 // universal module definition 4019 /*jshint strict: false */ /*globals define, module, require */ 4020 if ( typeof define == 'function' && define.amd ) { 4021 // AMD 4022 define( 'flickity-as-nav-for/as-nav-for',[ 4023 'flickity/js/index', 4024 'fizzy-ui-utils/utils' 4025 ], factory ); 4026 } else if ( typeof module == 'object' && module.exports ) { 4027 // CommonJS 4028 module.exports = factory( 4029 require('flickity'), 4030 require('fizzy-ui-utils') 4031 ); 4032 } else { 4033 // browser global 4034 window.Flickity = factory( 4035 window.Flickity, 4036 window.fizzyUIUtils 4037 ); 4038 } 4039 4040}( window, function factory( Flickity, utils ) { 4041 4042 4043 4044// -------------------------- asNavFor prototype -------------------------- // 4045 4046// Flickity.defaults.asNavFor = null; 4047 4048Flickity.createMethods.push('_createAsNavFor'); 4049 4050var proto = Flickity.prototype; 4051 4052proto._createAsNavFor = function() { 4053 this.on( 'activate', this.activateAsNavFor ); 4054 this.on( 'deactivate', this.deactivateAsNavFor ); 4055 this.on( 'destroy', this.destroyAsNavFor ); 4056 4057 var asNavForOption = this.options.asNavFor; 4058 if ( !asNavForOption ) { 4059 return; 4060 } 4061 // HACK do async, give time for other flickity to be initalized 4062 var _this = this; 4063 setTimeout( function initNavCompanion() { 4064 _this.setNavCompanion( asNavForOption ); 4065 }); 4066}; 4067 4068proto.setNavCompanion = function( elem ) { 4069 elem = utils.getQueryElement( elem ); 4070 var companion = Flickity.data( elem ); 4071 // stop if no companion or companion is self 4072 if ( !companion || companion == this ) { 4073 return; 4074 } 4075 4076 this.navCompanion = companion; 4077 // companion select 4078 var _this = this; 4079 this.onNavCompanionSelect = function() { 4080 _this.navCompanionSelect(); 4081 }; 4082 companion.on( 'select', this.onNavCompanionSelect ); 4083 // click 4084 this.on( 'staticClick', this.onNavStaticClick ); 4085 4086 this.navCompanionSelect( true ); 4087}; 4088 4089proto.navCompanionSelect = function( isInstant ) { 4090 // wait for companion & selectedCells first. #8 4091 var companionCells = this.navCompanion && this.navCompanion.selectedCells; 4092 if ( !companionCells ) { 4093 return; 4094 } 4095 // select slide that matches first cell of slide 4096 var selectedCell = companionCells[0]; 4097 var firstIndex = this.navCompanion.cells.indexOf( selectedCell ); 4098 var lastIndex = firstIndex + companionCells.length - 1; 4099 var selectIndex = Math.floor( lerp( firstIndex, lastIndex, 4100 this.navCompanion.cellAlign ) ); 4101 this.selectCell( selectIndex, false, isInstant ); 4102 // set nav selected class 4103 this.removeNavSelectedElements();
vendor: 4,404 bytes, lines 4104-4289
4104 // stop if companion has more cells than this one 4105 if ( selectIndex >= this.cells.length ) { 4106 return; 4107 } 4108 4109 var selectedCells = this.cells.slice( firstIndex, lastIndex + 1 ); 4110 this.navSelectedElements = selectedCells.map( function( cell ) { 4111 return cell.element; 4112 }); 4113 this.changeNavSelectedClass('add'); 4114}; 4115 4116function lerp( a, b, t ) { 4117 return ( b - a ) * t + a; 4118} 4119 4120proto.changeNavSelectedClass = function( method ) { 4121 this.navSelectedElements.forEach( function( navElem ) { 4122 navElem.classList[ method ]('is-nav-selected'); 4123 }); 4124}; 4125 4126proto.activateAsNavFor = function() { 4127 this.navCompanionSelect( true ); 4128}; 4129 4130proto.removeNavSelectedElements = function() { 4131 if ( !this.navSelectedElements ) { 4132 return; 4133 } 4134 this.changeNavSelectedClass('remove'); 4135 delete this.navSelectedElements; 4136}; 4137 4138proto.onNavStaticClick = function( event, pointer, cellElement, cellIndex ) { 4139 if ( typeof cellIndex == 'number' ) { 4140 this.navCompanion.selectCell( cellIndex ); 4141 } 4142}; 4143 4144proto.deactivateAsNavFor = function() { 4145 this.removeNavSelectedElements(); 4146}; 4147 4148proto.destroyAsNavFor = function() { 4149 if ( !this.navCompanion ) { 4150 return; 4151 } 4152 this.navCompanion.off( 'select', this.onNavCompanionSelect ); 4153 this.off( 'staticClick', this.onNavStaticClick ); 4154 delete this.navCompanion; 4155}; 4156 4157// ----- ----- // 4158 4159return Flickity; 4160 4161})); 4162 4163/*! 4164 * imagesLoaded v4.1.4 4165 * JavaScript is all like "You images are done yet or what?" 4166 * MIT License 4167 */ 4168 4169( function( window, factory ) { 'use strict'; 4170 // universal module definition 4171 4172 /*global define: false, module: false, require: false */ 4173 4174 if ( typeof define == 'function' && define.amd ) { 4175 // AMD 4176 define( 'imagesloaded/imagesloaded',[ 4177 'ev-emitter/ev-emitter' 4178 ], function( EvEmitter ) { 4179 return factory( window, EvEmitter ); 4180 }); 4181 } else if ( typeof module == 'object' && module.exports ) { 4182 // CommonJS 4183 module.exports = factory( 4184 window, 4185 require('ev-emitter') 4186 ); 4187 } else { 4188 // browser global 4189 window.imagesLoaded = factory( 4190 window, 4191 window.EvEmitter 4192 ); 4193 } 4194 4195})( typeof window !== 'undefined' ? window : this, 4196 4197// -------------------------- factory -------------------------- // 4198 4199function factory( window, EvEmitter ) { 4200 4201 4202 4203var $ = window.jQuery; 4204var console = window.console; 4205 4206// -------------------------- helpers -------------------------- // 4207 4208// extend objects 4209function extend( a, b ) { 4210 for ( var prop in b ) { 4211 a[ prop ] = b[ prop ]; 4212 } 4213 return a; 4214} 4215 4216var arraySlice = Array.prototype.slice; 4217 4218// turn element or nodeList into an array 4219function makeArray( obj ) { 4220 if ( Array.isArray( obj ) ) { 4221 // use object if already an array 4222 return obj; 4223 } 4224 4225 var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number'; 4226 if ( isArrayLike ) { 4227 // convert nodeList to array 4228 return arraySlice.call( obj ); 4229 } 4230 4231 // array of single index 4232 return [ obj ]; 4233} 4234 4235// -------------------------- imagesLoaded -------------------------- // 4236 4237/** 4238 * @param {Array, Element, NodeList, String} elem 4239 * @param {Object or Function} options - if function, use as callback 4240 * @param {Function} onAlways - callback function 4241 */ 4242function ImagesLoaded( elem, options, onAlways ) { 4243 // coerce ImagesLoaded() without new, to be new ImagesLoaded() 4244 if ( !( this instanceof ImagesLoaded ) ) { 4245 return new ImagesLoaded( elem, options, onAlways ); 4246 } 4247 // use elem as selector string 4248 var queryElem = elem; 4249 if ( typeof elem == 'string' ) { 4250 queryElem = document.querySelectorAll( elem ); 4251 } 4252 // bail if bad element 4253 if ( !queryElem ) { 4254 console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) ); 4255 return; 4256 } 4257 4258 this.elements = makeArray( queryElem ); 4259 this.options = extend( {}, this.options ); 4260 // shift arguments if no options set 4261 if ( typeof options == 'function' ) { 4262 onAlways = options; 4263 } else { 4264 extend( this.options, options ); 4265 } 4266 4267 if ( onAlways ) { 4268 this.on( 'always', onAlways ); 4269 } 4270 4271 this.getImages(); 4272 4273 if ( $ ) { 4274 // add jQuery Deferred object 4275 this.jqDeferred = new $.Deferred(); 4276 } 4277 4278 // HACK check async to allow time to bind listeners 4279 setTimeout( this.check.bind( this ) ); 4280} 4281 4282ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); 4283 4284ImagesLoaded.prototype.options = {}; 4285 4286ImagesLoaded.prototype.getImages = function() { 4287 this.images = []; 4288 4289 // filter & find items if we have an item selector
vendor: 4,347 bytes, lines 4290-4446
4290 this.elements.forEach( this.addElementImages, this ); 4291}; 4292 4293/** 4294 * @param {Node} element 4295 */ 4296ImagesLoaded.prototype.addElementImages = function( elem ) { 4297 // filter siblings 4298 if ( elem.nodeName == 'IMG' ) { 4299 this.addImage( elem ); 4300 } 4301 // get background image on element 4302 if ( this.options.background === true ) { 4303 this.addElementBackgroundImages( elem ); 4304 } 4305 4306 // find children 4307 // no non-element nodes, #143 4308 var nodeType = elem.nodeType; 4309 if ( !nodeType || !elementNodeTypes[ nodeType ] ) { 4310 return; 4311 } 4312 var childImgs = elem.querySelectorAll('img'); 4313 // concat childElems to filterFound array 4314 for ( var i=0; i < childImgs.length; i++ ) { 4315 var img = childImgs[i]; 4316 this.addImage( img ); 4317 } 4318 4319 // get child background images 4320 if ( typeof this.options.background == 'string' ) { 4321 var children = elem.querySelectorAll( this.options.background ); 4322 for ( i=0; i < children.length; i++ ) { 4323 var child = children[i]; 4324 this.addElementBackgroundImages( child ); 4325 } 4326 } 4327}; 4328 4329var elementNodeTypes = { 4330 1: true, 4331 9: true, 4332 11: true 4333}; 4334 4335ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { 4336 var style = getComputedStyle( elem ); 4337 if ( !style ) { 4338 // Firefox returns null if in a hidden iframe https://bugzil.la/548397 4339 return; 4340 } 4341 // get url inside url("...") 4342 var reURL = /url\((['"])?(.*?)\1\)/gi; 4343 var matches = reURL.exec( style.backgroundImage ); 4344 while ( matches !== null ) { 4345 var url = matches && matches[2]; 4346 if ( url ) { 4347 this.addBackground( url, elem ); 4348 } 4349 matches = reURL.exec( style.backgroundImage ); 4350 } 4351}; 4352 4353/** 4354 * @param {Image} img 4355 */ 4356ImagesLoaded.prototype.addImage = function( img ) { 4357 var loadingImage = new LoadingImage( img ); 4358 this.images.push( loadingImage ); 4359}; 4360 4361ImagesLoaded.prototype.addBackground = function( url, elem ) { 4362 var background = new Background( url, elem ); 4363 this.images.push( background ); 4364}; 4365 4366ImagesLoaded.prototype.check = function() { 4367 var _this = this; 4368 this.progressedCount = 0; 4369 this.hasAnyBroken = false; 4370 // complete if no images 4371 if ( !this.images.length ) { 4372 this.complete(); 4373 return; 4374 } 4375 4376 function onProgress( image, elem, message ) { 4377 // HACK - Chrome triggers event before object properties have changed. #83 4378 setTimeout( function() { 4379 _this.progress( image, elem, message ); 4380 }); 4381 } 4382 4383 this.images.forEach( function( loadingImage ) { 4384 loadingImage.once( 'progress', onProgress ); 4385 loadingImage.check(); 4386 }); 4387}; 4388 4389ImagesLoaded.prototype.progress = function( image, elem, message ) { 4390 this.progressedCount++; 4391 this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; 4392 // progress event 4393 this.emitEvent( 'progress', [ this, image, elem ] ); 4394 if ( this.jqDeferred && this.jqDeferred.notify ) { 4395 this.jqDeferred.notify( this, image ); 4396 } 4397 // check if completed 4398 if ( this.progressedCount == this.images.length ) { 4399 this.complete(); 4400 } 4401 4402 if ( this.options.debug && console ) { 4403 console.log( 'progress: ' + message, image, elem ); 4404 } 4405}; 4406 4407ImagesLoaded.prototype.complete = function() { 4408 var eventName = this.hasAnyBroken ? 'fail' : 'done'; 4409 this.isComplete = true; 4410 this.emitEvent( eventName, [ this ] ); 4411 this.emitEvent( 'always', [ this ] ); 4412 if ( this.jqDeferred ) { 4413 var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; 4414 this.jqDeferred[ jqMethod ]( this ); 4415 } 4416}; 4417 4418// -------------------------- -------------------------- // 4419 4420function LoadingImage( img ) { 4421 this.img = img; 4422} 4423 4424LoadingImage.prototype = Object.create( EvEmitter.prototype ); 4425 4426LoadingImage.prototype.check = function() { 4427 // If complete is true and browser supports natural sizes, 4428 // try to check for image status manually. 4429 var isComplete = this.getIsImageComplete(); 4430 if ( isComplete ) { 4431 // report based on naturalWidth 4432 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 4433 return; 4434 } 4435 4436 // If none of the checks above matched, simulate loading on detached element. 4437 this.proxyImage = new Image(); 4438 this.proxyImage.addEventListener( 'load', this ); 4439 this.proxyImage.addEventListener( 'error', this ); 4440 // bind to image as well for Firefox. #191 4441 this.img.addEventListener( 'load', this ); 4442 this.img.addEventListener( 'error', this ); 4443 this.proxyImage.src = this.img.src; 4444}; 4445 4446LoadingImage.prototype.getIsImageComplete = function() {
4447 // check for non-zero, non-undefined naturalWidth 4448 // fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671 4449 return this.img.complete && this.img.naturalWidth; 4450}; 4451 4452LoadingImage.prototype.confirm = function( isLoaded, message ) { 4453 this.isLoaded = isLoaded; 4454 this.emitEvent( 'progress', [ this, this.img, message ] ); 4455}; 4456 4457// ----- events ----- // 4458 4459// trigger specified handler for event type 4460LoadingImage.prototype.handleEvent = function( event ) { 4461 var method = 'on' + event.type; 4462 if ( this[ method ] ) { 4463 this[ method ]( event ); 4464 } 4465}; 4466 4467LoadingImage.prototype.onload = function() { 4468 this.confirm( true, 'onload' ); 4469 this.unbindEvents(); 4470}; 4471 4472LoadingImage.prototype.onerror = function() { 4473 this.confirm( false, 'onerror' ); 4474 this.unbindEvents(); 4475}; 4476 4477LoadingImage.prototype.unbindEvents = function() { 4478 this.proxyImage.removeEventListener( 'load', this ); 4479 this.proxyImage.removeEventListener( 'error', this ); 4480 this.img.removeEventListener( 'load', this ); 4481 this.img.removeEventListener( 'error', this ); 4482}; 4483 4484// -------------------------- Background -------------------------- // 4485 4486function Background( url, element ) { 4487 this.url = url; 4488 this.element = element; 4489 this.img = new Image(); 4490} 4491 4492// inherit LoadingImage prototype 4493Background.prototype = Object.create( LoadingImage.prototype ); 4494 4495Background.prototype.check = function() { 4496 this.img.addEventListener( 'load', this ); 4497 this.img.addEventListener( 'error', this ); 4498 this.img.src = this.url; 4499 // check if image is already complete 4500 var isComplete = this.getIsImageComplete(); 4501 if ( isComplete ) { 4502 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 4503 this.unbindEvents(); 4504 } 4505}; 4506 4507Background.prototype.unbindEvents = function() { 4508 this.img.removeEventListener( 'load', this ); 4509 this.img.removeEventListener( 'error', this ); 4510}; 4511 4512Background.prototype.confirm = function( isLoaded, message ) { 4513 this.isLoaded = isLoaded; 4514 this.emitEvent( 'progress', [ this, this.element, message ] ); 4515}; 4516 4517// -------------------------- jQuery -------------------------- // 4518 4519ImagesLoaded.makeJQueryPlugin = function( jQuery ) { 4520 jQuery = jQuery || window.jQuery; 4521 if ( !jQuery ) { 4522 return; 4523 } 4524 // set local variable 4525 $ = jQuery; 4526 // $().imagesLoaded() 4527 $.fn.imagesLoaded = function( options, callback ) { 4528 var instance = new ImagesLoaded( this, options, callback ); 4529 return instance.jqDeferred.promise( $(this) ); 4530 }; 4531}; 4532// try making plugin 4533ImagesLoaded.makeJQueryPlugin(); 4534 4535// -------------------------- -------------------------- // 4536 4537return ImagesLoaded; 4538 4539}); 4540 4541/*! 4542 * Flickity imagesLoaded v2.0.0 4543 * enables imagesLoaded option for Flickity 4544 */ 4545 4546/*jshint browser: true, strict: true, undef: true, unused: true */ 4547 4548( function( window, factory ) { 4549 // universal module definition 4550 /*jshint strict: false */ /*globals define, module, require */ 4551 if ( typeof define == 'function' && define.amd ) { 4552 // AMD 4553 define( [ 4554 'flickity/js/index', 4555 'imagesloaded/imagesloaded' 4556 ], function( Flickity, imagesLoaded ) { 4557 return factory( window, Flickity, imagesLoaded ); 4558 }); 4559 } else if ( typeof module == 'object' && module.exports ) { 4560 // CommonJS 4561 module.exports = factory( 4562 window, 4563 require('flickity'), 4564 require('imagesloaded') 4565 ); 4566 } else { 4567 // browser global 4568 window.Flickity = factory( 4569 window, 4570 window.Flickity, 4571 window.imagesLoaded 4572 ); 4573 } 4574 4575}( window, function factory( window, Flickity, imagesLoaded ) { 4576'use strict'; 4577 4578Flickity.createMethods.push('_createImagesLoaded'); 4579 4580var proto = Flickity.prototype; 4581 4582proto._createImagesLoaded = function() { 4583 this.on( 'activate', this.imagesLoaded ); 4584}; 4585 4586proto.imagesLoaded = function() { 4587 if ( !this.options.imagesLoaded ) { 4588 return; 4589 } 4590 var _this = this; 4591 function onImagesLoadedProgress( instance, image ) { 4592 var cell = _this.getParentCell( image.img ); 4593 _this.cellSizeChange( cell && cell.element ); 4594 if ( !_this.options.freeScroll ) { 4595 _this.positionSliderAtSelected(); 4596 } 4597 } 4598 imagesLoaded( this.slider ).on( 'progress', onImagesLoadedProgress ); 4599}; 4600 4601return Flickity; 4602 4603})); 4604 4605 4606(function (global, factory) { 4607 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : 4608 typeof define === 'function' && define.amd ? define(['exports'], factory) : 4609 (global = global || self, factory(global.window = global.window || {})); 4610}(this, (function (exports) { 4611 'use strict'; 4612 4613 function _inheritsLoose(subClass, superClass) { 4614 subClass.prototype = Object.create(superClass.prototype); 4615 subClass.prototype.constructor = subClass; 4616 subClass.__proto__ = superClass; 4617 } 4618 4619 function _assertThisInitialized(self) { 4620 if (self === void 0) { 4621 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4622 } 4623 4624 return self; 4625 } 4626 4627 /*! 4628 * GSAP 3.7.1 4629 * https://greensock.com 4630 * 4631 * @license Copyright 2008-2021, GreenSock. All rights reserved. 4632 * Subject to the terms at https://greensock.com/standard-license or for 4633 * Club GreenSock members, the agreement issued with that membership. 4634 * @author: Jack Doyle, [email protected] 4635 */ 4636 var _config = { 4637 autoSleep: 120, 4638 force3D: "auto", 4639 nullTargetWarn: 1, 4640 units: { 4641 lineHeight: "" 4642 } 4643 }, 4644 _defaults = { 4645 duration: .5, 4646 overwrite: false, 4647 delay: 0 4648 }, 4649 _suppressOverwrites, 4650 _bigNum = 1e8, 4651 _tinyNum = 1 / _bigNum, 4652 _2PI = Math.PI * 2, 4653 _HALF_PI = _2PI / 4, 4654 _gsID = 0, 4655 _sqrt = Math.sqrt, 4656 _cos = Math.cos, 4657 _sin = Math.sin, 4658 _isString = function _isString(value) { 4659 return typeof value === "string"; 4660 }, 4661 _isFunction = function _isFunction(value) { 4662 return typeof value === "function"; 4663 }, 4664 _isNumber = function _isNumber(value) { 4665 return typeof value === "number"; 4666 }, 4667 _isUndefined = function _isUndefined(value) { 4668 return typeof value === "undefined"; 4669 }, 4670 _isObject = function _isObject(value) { 4671 return typeof value === "object"; 4672 }, 4673 _isNotFalse = function _isNotFalse(value) { 4674 return value !== false; 4675 }, 4676 _windowExists = function _windowExists() { 4677 return typeof window !== "undefined"; 4678 }, 4679 _isFuncOrString = function _isFuncOrString(value) { 4680 return _isFunction(value) || _isString(value); 4681 }, 4682 _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function () { }, 4683 _isArray = Array.isArray, 4684 _strictNumExp = /(?:-?\.?\d|\.)+/gi, 4685 _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, 4686 _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, 4687 _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, 4688 _relExp = /[+-]=-?[.\d]+/, 4689 _delimitedValueExp = /[^,'"\[\]\s]+/gi, 4690 _unitExp = /[\d.+\-=]+(?:e[-+]\d*)*/i, 4691 _globalTimeline, 4692 _win, 4693 _coreInitted, 4694 _doc, 4695 _globals = {}, 4696 _installScope = {}, 4697 _coreReady, 4698 _install = function _install(scope) {
vendor: 31,477 bytes, lines 4699-5376
4699 return (_installScope = _merge(scope, _globals)) && gsap; 4700 }, 4701 _missingPlugin = function _missingPlugin(property, value) { 4702 return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()"); 4703 }, 4704 _warn = function _warn(message, suppress) { 4705 return !suppress && console.warn(message); 4706 }, 4707 _addGlobal = function _addGlobal(name, obj) { 4708 return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals; 4709 }, 4710 _emptyFunc = function _emptyFunc() { 4711 return 0; 4712 }, 4713 _reservedProps = {}, 4714 _lazyTweens = [], 4715 _lazyLookup = {}, 4716 _lastRenderedFrame, 4717 _plugins = {}, 4718 _effects = {}, 4719 _nextGCFrame = 30, 4720 _harnessPlugins = [], 4721 _callbackNames = "", 4722 _harness = function _harness(targets) { 4723 var target = targets[0], 4724 harnessPlugin, 4725 i; 4726 _isObject(target) || _isFunction(target) || (targets = [targets]); 4727 4728 if (!(harnessPlugin = (target._gsap || {}).harness)) { 4729 i = _harnessPlugins.length; 4730 4731 while (i-- && !_harnessPlugins[i].targetTest(target)) { } 4732 4733 harnessPlugin = _harnessPlugins[i]; 4734 } 4735 4736 i = targets.length; 4737 4738 while (i--) { 4739 targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1); 4740 } 4741 4742 return targets; 4743 }, 4744 _getCache = function _getCache(target) { 4745 return target._gsap || _harness(toArray(target))[0]._gsap; 4746 }, 4747 _getProperty = function _getProperty(target, property, v) { 4748 return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v; 4749 }, 4750 _forEachName = function _forEachName(names, func) { 4751 return (names = names.split(",")).forEach(func) || names; 4752 }, 4753 _round = function _round(value) { 4754 return Math.round(value * 100000) / 100000 || 0; 4755 }, 4756 _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) { 4757 var l = toFind.length, 4758 i = 0; 4759 4760 for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l;) { } 4761 4762 return i < l; 4763 }, 4764 _lazyRender = function _lazyRender() { 4765 var l = _lazyTweens.length, 4766 a = _lazyTweens.slice(0), 4767 i, 4768 tween; 4769 4770 _lazyLookup = {}; 4771 _lazyTweens.length = 0; 4772 4773 for (i = 0; i < l; i++) { 4774 tween = a[i]; 4775 tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0); 4776 } 4777 }, 4778 _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) { 4779 _lazyTweens.length && _lazyRender(); 4780 animation.render(time, suppressEvents, force); 4781 _lazyTweens.length && _lazyRender(); 4782 }, 4783 _numericIfPossible = function _numericIfPossible(value) { 4784 var n = parseFloat(value); 4785 return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value; 4786 }, 4787 _passThrough = function _passThrough(p) { 4788 return p; 4789 }, 4790 _setDefaults = function _setDefaults(obj, defaults) { 4791 for (var p in defaults) { 4792 p in obj || (obj[p] = defaults[p]); 4793 } 4794 4795 return obj; 4796 }, 4797 _setKeyframeDefaults = function _setKeyframeDefaults(obj, defaults) { 4798 for (var p in defaults) { 4799 p in obj || p === "duration" || p === "ease" || (obj[p] = defaults[p]); 4800 } 4801 }, 4802 _merge = function _merge(base, toMerge) { 4803 for (var p in toMerge) { 4804 base[p] = toMerge[p]; 4805 } 4806 4807 return base; 4808 }, 4809 _mergeDeep = function _mergeDeep(base, toMerge) { 4810 for (var p in toMerge) { 4811 p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]); 4812 } 4813 4814 return base; 4815 }, 4816 _copyExcluding = function _copyExcluding(obj, excluding) { 4817 var copy = {}, 4818 p; 4819 4820 for (p in obj) { 4821 p in excluding || (copy[p] = obj[p]); 4822 } 4823 4824 return copy; 4825 }, 4826 _inheritDefaults = function _inheritDefaults(vars) { 4827 var parent = vars.parent || _globalTimeline, 4828 func = vars.keyframes ? _setKeyframeDefaults : _setDefaults; 4829 4830 if (_isNotFalse(vars.inherit)) { 4831 while (parent) { 4832 func(vars, parent.vars.defaults); 4833 parent = parent.parent || parent._dp; 4834 } 4835 } 4836 4837 return vars; 4838 }, 4839 _arraysMatch = function _arraysMatch(a1, a2) { 4840 var i = a1.length, 4841 match = i === a2.length; 4842 4843 while (match && i-- && a1[i] === a2[i]) { } 4844 4845 return i < 0; 4846 }, 4847 _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) { 4848 if (firstProp === void 0) { 4849 firstProp = "_first"; 4850 } 4851 4852 if (lastProp === void 0) { 4853 lastProp = "_last"; 4854 } 4855 4856 var prev = parent[lastProp], 4857 t; 4858 4859 if (sortBy) { 4860 t = child[sortBy]; 4861 4862 while (prev && prev[sortBy] > t) { 4863 prev = prev._prev; 4864 } 4865 } 4866 4867 if (prev) { 4868 child._next = prev._next; 4869 prev._next = child; 4870 } else { 4871 child._next = parent[firstProp]; 4872 parent[firstProp] = child; 4873 } 4874 4875 if (child._next) { 4876 child._next._prev = child; 4877 } else { 4878 parent[lastProp] = child; 4879 } 4880 4881 child._prev = prev; 4882 child.parent = child._dp = parent; 4883 return child; 4884 }, 4885 _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) { 4886 if (firstProp === void 0) { 4887 firstProp = "_first"; 4888 } 4889 4890 if (lastProp === void 0) { 4891 lastProp = "_last"; 4892 } 4893 4894 var prev = child._prev, 4895 next = child._next; 4896 4897 if (prev) { 4898 prev._next = next; 4899 } else if (parent[firstProp] === child) { 4900 parent[firstProp] = next; 4901 } 4902 4903 if (next) { 4904 next._prev = prev; 4905 } else if (parent[lastProp] === child) { 4906 parent[lastProp] = prev; 4907 } 4908 4909 child._next = child._prev = child.parent = null; 4910 }, 4911 _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) { 4912 child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove(child); 4913 child._act = 0; 4914 }, 4915 _uncache = function _uncache(animation, child) { 4916 if (animation && (!child || child._end > animation._dur || child._start < 0)) { 4917 var a = animation; 4918 4919 while (a) { 4920 a._dirty = 1; 4921 a = a.parent; 4922 } 4923 } 4924 4925 return animation; 4926 }, 4927 _recacheAncestors = function _recacheAncestors(animation) { 4928 var parent = animation.parent; 4929 4930 while (parent && parent.parent) { 4931 parent._dirty = 1; 4932 parent.totalDuration(); 4933 parent = parent.parent; 4934 } 4935 4936 return animation; 4937 }, 4938 _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) { 4939 return !animation || animation._ts && _hasNoPausedAncestors(animation.parent); 4940 }, 4941 _elapsedCycleDuration = function _elapsedCycleDuration(animation) { 4942 return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0; 4943 }, 4944 _animationCycle = function _animationCycle(tTime, cycleDuration) { 4945 var whole = Math.floor(tTime /= cycleDuration); 4946 return tTime && whole === tTime ? whole - 1 : whole; 4947 }, 4948 _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) { 4949 return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur); 4950 }, 4951 _setEnd = function _setEnd(animation) { 4952 return animation._end = _round(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0)); 4953 }, 4954 _alignPlayhead = function _alignPlayhead(animation, totalTime) { 4955 var parent = animation._dp; 4956 4957 if (parent && parent.smoothChildTiming && animation._ts) { 4958 animation._start = _round(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts)); 4959 4960 _setEnd(animation); 4961 4962 parent._dirty || _uncache(parent, animation); 4963 } 4964 4965 return animation; 4966 }, 4967 _postAddChecks = function _postAddChecks(timeline, child) { 4968 var t; 4969 4970 if (child._time || child._initted && !child._dur) { 4971 t = _parentToChildTotalTime(timeline.rawTime(), child); 4972 4973 if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) { 4974 child.render(t, true); 4975 } 4976 } 4977 4978 if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) { 4979 if (timeline._dur < timeline.duration()) { 4980 t = timeline; 4981 4982 while (t._dp) { 4983 t.rawTime() >= 0 && t.totalTime(t._tTime); 4984 t = t._dp; 4985 } 4986 } 4987 4988 timeline._zTime = -_tinyNum; 4989 } 4990 }, 4991 _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) { 4992 child.parent && _removeFromParent(child); 4993 child._start = _round((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay); 4994 child._end = _round(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0)); 4995 4996 _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0); 4997 4998 _isFromOrFromStart(child) || (timeline._recent = child); 4999 skipChecks || _postAddChecks(timeline, child); 5000 return timeline; 5001 }, 5002 _scrollTrigger = function _scrollTrigger(animation, trigger) { 5003 return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation); 5004 }, 5005 _attemptInitTween = function _attemptInitTween(tween, totalTime, force, suppressEvents) { 5006 _initTween(tween, totalTime); 5007 5008 if (!tween._initted) { 5009 return 1; 5010 } 5011 5012 if (!force && tween._pt && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) { 5013 _lazyTweens.push(tween); 5014 5015 tween._lazy = [totalTime, suppressEvents]; 5016 return 1; 5017 } 5018 }, 5019 _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) { 5020 var parent = _ref.parent; 5021 return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent)); 5022 }, 5023 _isFromOrFromStart = function _isFromOrFromStart(_ref2) { 5024 var data = _ref2.data; 5025 return data === "isFromStart" || data === "isStart"; 5026 }, 5027 _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) { 5028 var prevRatio = tween.ratio, 5029 ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1, 5030 repeatDelay = tween._rDelay, 5031 tTime = 0, 5032 pt, 5033 iteration, 5034 prevIteration; 5035 5036 if (repeatDelay && tween._repeat) { 5037 tTime = _clamp(0, tween._tDur, totalTime); 5038 iteration = _animationCycle(tTime, repeatDelay); 5039 prevIteration = _animationCycle(tween._tTime, repeatDelay); 5040 tween._yoyo && iteration & 1 && (ratio = 1 - ratio); 5041 5042 if (iteration !== prevIteration) { 5043 prevRatio = 1 - ratio; 5044 tween.vars.repeatRefresh && tween._initted && tween.invalidate(); 5045 } 5046 } 5047 5048 if (ratio !== prevRatio || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) { 5049 if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents)) { 5050 return; 5051 } 5052 5053 prevIteration = tween._zTime; 5054 tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0); 5055 suppressEvents || (suppressEvents = totalTime && !prevIteration); 5056 tween.ratio = ratio; 5057 tween._from && (ratio = 1 - ratio); 5058 tween._time = 0; 5059 tween._tTime = tTime; 5060 pt = tween._pt; 5061 5062 while (pt) { 5063 pt.r(ratio, pt.d); 5064 pt = pt._next; 5065 } 5066 5067 tween._startAt && totalTime < 0 && tween._startAt.render(totalTime, true, true); 5068 tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate"); 5069 tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat"); 5070 5071 if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) { 5072 ratio && _removeFromParent(tween, 1); 5073 5074 if (!suppressEvents) { 5075 _callback(tween, ratio ? "onComplete" : "onReverseComplete", true); 5076 5077 tween._prom && tween._prom(); 5078 } 5079 } 5080 } else if (!tween._zTime) { 5081 tween._zTime = totalTime; 5082 } 5083 }, 5084 _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) { 5085 var child; 5086 5087 if (time > prevTime) { 5088 child = animation._first; 5089 5090 while (child && child._start <= time) { 5091 if (!child._dur && child.data === "isPause" && child._start > prevTime) { 5092 return child; 5093 } 5094 5095 child = child._next; 5096 } 5097 } else { 5098 child = animation._last; 5099 5100 while (child && child._start >= time) { 5101 if (!child._dur && child.data === "isPause" && child._start < prevTime) { 5102 return child; 5103 } 5104 5105 child = child._prev; 5106 } 5107 } 5108 }, 5109 _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) { 5110 var repeat = animation._repeat, 5111 dur = _round(duration) || 0, 5112 totalProgress = animation._tTime / animation._tDur; 5113 totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur); 5114 animation._dur = dur; 5115 animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _round(dur * (repeat + 1) + animation._rDelay * repeat); 5116 totalProgress && !leavePlayhead ? _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress) : animation.parent && _setEnd(animation); 5117 skipUncache || _uncache(animation.parent, animation); 5118 return animation; 5119 }, 5120 _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) { 5121 return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur); 5122 }, 5123 _zeroPosition = { 5124 _start: 0, 5125 endTime: _emptyFunc, 5126 totalDuration: _emptyFunc 5127 }, 5128 _parsePosition = function _parsePosition(animation, position, percentAnimation) { 5129 var labels = animation.labels, 5130 recent = animation._recent || _zeroPosition, 5131 clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur, 5132 i, 5133 offset, 5134 isPercent; 5135 5136 if (_isString(position) && (isNaN(position) || position in labels)) { 5137 offset = position.charAt(0); 5138 isPercent = position.substr(-1) === "%"; 5139 i = position.indexOf("="); 5140 5141 if (offset === "<" || offset === ">") { 5142 i >= 0 && (position = position.replace(/=/, "")); 5143 return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1); 5144 } 5145 5146 if (i < 0) { 5147 position in labels || (labels[position] = clippedDuration); 5148 return labels[position]; 5149 } 5150 5151 offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1)); 5152 5153 if (isPercent && percentAnimation) { 5154 offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration(); 5155 } 5156 5157 return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset; 5158 } 5159 5160 return position == null ? clippedDuration : +position; 5161 }, 5162 _createTweenType = function _createTweenType(type, params, timeline) { 5163 var isLegacy = _isNumber(params[1]), 5164 varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), 5165 vars = params[varsIndex], 5166 irVars, 5167 parent; 5168 5169 isLegacy && (vars.duration = params[1]); 5170 vars.parent = timeline; 5171 5172 if (type) { 5173 irVars = vars; 5174 parent = timeline; 5175 5176 while (parent && !("immediateRender" in irVars)) { 5177 irVars = parent.vars.defaults || {}; 5178 parent = _isNotFalse(parent.vars.inherit) && parent.parent; 5179 } 5180 5181 vars.immediateRender = _isNotFalse(irVars.immediateRender); 5182 type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1]; 5183 } 5184 5185 return new Tween(params[0], vars, params[varsIndex + 1]); 5186 }, 5187 _conditionalReturn = function _conditionalReturn(value, func) { 5188 return value || value === 0 ? func(value) : func; 5189 }, 5190 _clamp = function _clamp(min, max, value) { 5191 return value < min ? min : value > max ? max : value; 5192 }, 5193 getUnit = function getUnit(value) { 5194 if (typeof value !== "string") { 5195 return ""; 5196 } 5197 5198 var v = _unitExp.exec(value); 5199 5200 return v ? value.substr(v.index + v[0].length) : ""; 5201 }, 5202 clamp = function clamp(min, max, value) { 5203 return _conditionalReturn(value, function (v) { 5204 return _clamp(min, max, v); 5205 }); 5206 }, 5207 _slice = [].slice, 5208 _isArrayLike = function _isArrayLike(value, nonEmpty) { 5209 return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win; 5210 }, 5211 _flatten = function _flatten(ar, leaveStrings, accumulator) { 5212 if (accumulator === void 0) { 5213 accumulator = []; 5214 } 5215 5216 return ar.forEach(function (value) { 5217 var _accumulator; 5218 5219 return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value); 5220 }) || accumulator; 5221 }, 5222 toArray = function toArray(value, scope, leaveStrings) { 5223 return _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call((scope || _doc).querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [value] : []; 5224 }, 5225 selector = function selector(value) { 5226 value = toArray(value)[0] || _warn("Invalid scope") || {}; 5227 return function (v) { 5228 var el = value.current || value.nativeElement || value; 5229 return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value); 5230 }; 5231 }, 5232 shuffle = function shuffle(a) { 5233 return a.sort(function () { 5234 return .5 - Math.random(); 5235 }); 5236 }, 5237 distribute = function distribute(v) { 5238 if (_isFunction(v)) { 5239 return v; 5240 } 5241 5242 var vars = _isObject(v) ? v : { 5243 each: v 5244 }, 5245 ease = _parseEase(vars.ease), 5246 from = vars.from || 0, 5247 base = parseFloat(vars.base) || 0, 5248 cache = {}, 5249 isDecimal = from > 0 && from < 1, 5250 ratios = isNaN(from) || isDecimal, 5251 axis = vars.axis, 5252 ratioX = from, 5253 ratioY = from; 5254 5255 if (_isString(from)) { 5256 ratioX = ratioY = { 5257 center: .5, 5258 edges: .5, 5259 end: 1 5260 }[from] || 0; 5261 } else if (!isDecimal && ratios) { 5262 ratioX = from[0]; 5263 ratioY = from[1]; 5264 } 5265 5266 return function (i, target, a) { 5267 var l = (a || vars).length, 5268 distances = cache[l], 5269 originX, 5270 originY, 5271 x, 5272 y, 5273 d, 5274 j, 5275 max, 5276 min, 5277 wrapAt; 5278 5279 if (!distances) { 5280 wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1]; 5281 5282 if (!wrapAt) { 5283 max = -_bigNum; 5284 5285 while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l) { } 5286 5287 wrapAt--; 5288 } 5289 5290 distances = cache[l] = []; 5291 originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt; 5292 originY = ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0; 5293 max = 0; 5294 min = _bigNum; 5295 5296 for (j = 0; j < l; j++) { 5297 x = j % wrapAt - originX; 5298 y = originY - (j / wrapAt | 0); 5299 distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x); 5300 d > max && (max = d); 5301 d < min && (min = d); 5302 } 5303 5304 from === "random" && shuffle(distances); 5305 distances.max = max - min; 5306 distances.min = min; 5307 distances.v = l = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l ? l - 1 : !axis ? Math.max(wrapAt, l / wrapAt) : axis === "y" ? l / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1); 5308 distances.b = l < 0 ? base - l : base; 5309 distances.u = getUnit(vars.amount || vars.each) || 0; 5310 ease = ease && l < 0 ? _invertEase(ease) : ease; 5311 } 5312 5313 l = (distances[i] - distances.min) / distances.max || 0; 5314 return _round(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u; 5315 }; 5316 }, 5317 _roundModifier = function _roundModifier(v) { 5318 var p = v < 1 ? Math.pow(10, (v + "").length - 2) : 1; 5319 return function (raw) { 5320 var n = Math.round(parseFloat(raw) / v) * v * p; 5321 return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw)); 5322 }; 5323 }, 5324 snap = function snap(snapTo, value) { 5325 var isArray = _isArray(snapTo), 5326 radius, 5327 is2D; 5328 5329 if (!isArray && _isObject(snapTo)) { 5330 radius = isArray = snapTo.radius || _bigNum; 5331 5332 if (snapTo.values) { 5333 snapTo = toArray(snapTo.values); 5334 5335 if (is2D = !_isNumber(snapTo[0])) { 5336 radius *= radius; 5337 } 5338 } else { 5339 snapTo = _roundModifier(snapTo.increment); 5340 } 5341 } 5342 5343 return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function (raw) { 5344 is2D = snapTo(raw); 5345 return Math.abs(is2D - raw) <= radius ? is2D : raw; 5346 } : function (raw) { 5347 var x = parseFloat(is2D ? raw.x : raw), 5348 y = parseFloat(is2D ? raw.y : 0), 5349 min = _bigNum, 5350 closest = 0, 5351 i = snapTo.length, 5352 dx, 5353 dy; 5354 5355 while (i--) { 5356 if (is2D) { 5357 dx = snapTo[i].x - x; 5358 dy = snapTo[i].y - y; 5359 dx = dx * dx + dy * dy; 5360 } else { 5361 dx = Math.abs(snapTo[i] - x); 5362 } 5363 5364 if (dx < min) { 5365 min = dx; 5366 closest = i; 5367 } 5368 } 5369 5370 closest = !radius || min <= radius ? snapTo[closest] : raw; 5371 return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw); 5372 }); 5373 }, 5374 random = function random(min, max, roundingIncrement, returnFunction) { 5375 return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function () { 5376 return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e
vendor: 5,051 bytes, lines 5376-5483
5376-5) && (returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min - roundingIncrement / 2 + Math.random() * (max - min + roundingIncrement * .99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction; 5377 }); 5378 }, 5379 pipe = function pipe() { 5380 for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) { 5381 functions[_key] = arguments[_key]; 5382 } 5383 5384 return function (value) { 5385 return functions.reduce(function (v, f) { 5386 return f(v); 5387 }, value); 5388 }; 5389 }, 5390 unitize = function unitize(func, unit) { 5391 return function (value) { 5392 return func(parseFloat(value)) + (unit || getUnit(value)); 5393 }; 5394 }, 5395 normalize = function normalize(min, max, value) { 5396 return mapRange(min, max, 0, 1, value); 5397 }, 5398 _wrapArray = function _wrapArray(a, wrapper, value) { 5399 return _conditionalReturn(value, function (index) { 5400 return a[~~wrapper(index)]; 5401 }); 5402 }, 5403 wrap = function wrap(min, max, value) { 5404 var range = max - min; 5405 return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function (value) { 5406 return (range + (value - min) % range) % range + min; 5407 }); 5408 }, 5409 wrapYoyo = function wrapYoyo(min, max, value) { 5410 var range = max - min, 5411 total = range * 2; 5412 return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function (value) { 5413 value = (total + (value - min) % total) % total || 0; 5414 return min + (value > range ? total - value : value); 5415 }); 5416 }, 5417 _replaceRandom = function _replaceRandom(value) { 5418 var prev = 0, 5419 s = "", 5420 i, 5421 nums, 5422 end, 5423 isArray; 5424 5425 while (~(i = value.indexOf("random(", prev))) { 5426 end = value.indexOf(")", i); 5427 isArray = value.charAt(i + 7) === "["; 5428 nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp); 5429 s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5); 5430 prev = end + 1; 5431 } 5432 5433 return s + value.substr(prev, value.length - prev); 5434 }, 5435 mapRange = function mapRange(inMin, inMax, outMin, outMax, value) { 5436 var inRange = inMax - inMin, 5437 outRange = outMax - outMin; 5438 return _conditionalReturn(value, function (value) { 5439 return outMin + ((value - inMin) / inRange * outRange || 0); 5440 }); 5441 }, 5442 interpolate = function interpolate(start, end, progress, mutate) { 5443 var func = isNaN(start + end) ? 0 : function (p) { 5444 return (1 - p) * start + p * end; 5445 }; 5446 5447 if (!func) { 5448 var isString = _isString(start), 5449 master = {}, 5450 p, 5451 i, 5452 interpolators, 5453 l, 5454 il; 5455 5456 progress === true && (mutate = 1) && (progress = null); 5457 5458 if (isString) { 5459 start = { 5460 p: start 5461 }; 5462 end = { 5463 p: end 5464 }; 5465 } else if (_isArray(start) && !_isArray(end)) { 5466 interpolators = []; 5467 l = start.length; 5468 il = l - 2; 5469 5470 for (i = 1; i < l; i++) { 5471 interpolators.push(interpolate(start[i - 1], start[i])); 5472 } 5473 5474 l--; 5475 5476 func = function func(p) { 5477 p *= l; 5478 var i = Math.min(il, ~~p); 5479 return interpolators[i](p - i); 5480 }; 5481 5482 progress = end; 5483 } else if (!mutate) {
vendor: 18,330 bytes, lines 5484-5913
5484 start = _merge(_isArray(start) ? [] : {}, start); 5485 } 5486 5487 if (!interpolators) { 5488 for (p in end) { 5489 _addPropTween.call(master, start, p, "get", end[p]); 5490 } 5491 5492 func = function func(p) { 5493 return _renderPropTweens(p, master) || (isString ? start.p : start); 5494 }; 5495 } 5496 } 5497 5498 return _conditionalReturn(progress, func); 5499 }, 5500 _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) { 5501 var labels = timeline.labels, 5502 min = _bigNum, 5503 p, 5504 distance, 5505 label; 5506 5507 for (p in labels) { 5508 distance = labels[p] - fromTime; 5509 5510 if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) { 5511 label = p; 5512 min = distance; 5513 } 5514 } 5515 5516 return label; 5517 }, 5518 _callback = function _callback(animation, type, executeLazyFirst) { 5519 var v = animation.vars, 5520 callback = v[type], 5521 params, 5522 scope; 5523 5524 if (!callback) { 5525 return; 5526 } 5527 5528 params = v[type + "Params"]; 5529 scope = v.callbackScope || animation; 5530 executeLazyFirst && _lazyTweens.length && _lazyRender(); 5531 return params ? callback.apply(scope, params) : callback.call(scope); 5532 }, 5533 _interrupt = function _interrupt(animation) { 5534 _removeFromParent(animation); 5535 5536 animation.scrollTrigger && animation.scrollTrigger.kill(false); 5537 animation.progress() < 1 && _callback(animation, "onInterrupt"); 5538 return animation; 5539 }, 5540 _quickTween, 5541 _createPlugin = function _createPlugin(config) { 5542 config = !config.name && config["default"] || config; 5543 5544 var name = config.name, 5545 isFunc = _isFunction(config), 5546 Plugin = name && !isFunc && config.init ? function () { 5547 this._props = []; 5548 } : config, 5549 instanceDefaults = { 5550 init: _emptyFunc, 5551 render: _renderPropTweens, 5552 add: _addPropTween, 5553 kill: _killPropTweensOf, 5554 modifier: _addPluginModifier, 5555 rawVars: 0 5556 }, 5557 statics = { 5558 targetTest: 0, 5559 get: 0, 5560 getSetter: _getSetter, 5561 aliases: {}, 5562 register: 0 5563 }; 5564 5565 _wake(); 5566 5567 if (config !== Plugin) { 5568 if (_plugins[name]) { 5569 return; 5570 } 5571 5572 _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics)); 5573 5574 _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics))); 5575 5576 _plugins[Plugin.prop = name] = Plugin; 5577 5578 if (config.targetTest) { 5579 _harnessPlugins.push(Plugin); 5580 5581 _reservedProps[name] = 1; 5582 } 5583 5584 name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin"; 5585 } 5586 5587 _addGlobal(name, Plugin); 5588 5589 config.register && config.register(gsap, Plugin, PropTween); 5590 }, 5591 _255 = 255, 5592 _colorLookup = { 5593 aqua: [0, _255, _255], 5594 lime: [0, _255, 0], 5595 silver: [192, 192, 192], 5596 black: [0, 0, 0], 5597 maroon: [128, 0, 0], 5598 teal: [0, 128, 128], 5599 blue: [0, 0, _255], 5600 navy: [0, 0, 128], 5601 white: [_255, _255, _255], 5602 olive: [128, 128, 0], 5603 yellow: [_255, _255, 0], 5604 orange: [_255, 165, 0], 5605 gray: [128, 128, 128], 5606 purple: [128, 0, 128], 5607 green: [0, 128, 0], 5608 red: [_255, 0, 0], 5609 pink: [_255, 192, 203], 5610 cyan: [0, _255, _255], 5611 transparent: [_255, _255, _255, 0] 5612 }, 5613 _hue = function _hue(h, m1, m2) { 5614 h = h < 0 ? h + 1 : h > 1 ? h - 1 : h; 5615 return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < .5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + .5 | 0; 5616 }, 5617 splitColor = function splitColor(v, toHSL, forceAlpha) { 5618 var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0, 5619 r, 5620 g, 5621 b, 5622 h, 5623 s, 5624 l, 5625 max, 5626 min, 5627 d, 5628 wasHSL; 5629 5630 if (!a) { 5631 if (v.substr(-1) === ",") { 5632 v = v.substr(0, v.length - 1); 5633 } 5634 5635 if (_colorLookup[v]) { 5636 a = _colorLookup[v]; 5637 } else if (v.charAt(0) === "#") { 5638 if (v.length < 6) { 5639 r = v.charAt(1); 5640 g = v.charAt(2); 5641 b = v.charAt(3); 5642 v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : ""); 5643 } 5644 5645 if (v.length === 9) { 5646 a = parseInt(v.substr(1, 6), 16); 5647 return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255]; 5648 } 5649 5650 v = parseInt(v.substr(1), 16); 5651 a = [v >> 16, v >> 8 & _255, v & _255]; 5652 } else if (v.substr(0, 3) === "hsl") { 5653 a = wasHSL = v.match(_strictNumExp); 5654 5655 if (!toHSL) { 5656 h = +a[0] % 360 / 360; 5657 s = +a[1] / 100; 5658 l = +a[2] / 100; 5659 g = l <= .5 ? l * (s + 1) : l + s - l * s; 5660 r = l * 2 - g; 5661 a.length > 3 && (a[3] *= 1); 5662 a[0] = _hue(h + 1 / 3, r, g); 5663 a[1] = _hue(h, r, g); 5664 a[2] = _hue(h - 1 / 3, r, g); 5665 } else if (~v.indexOf("=")) { 5666 a = v.match(_numExp); 5667 forceAlpha && a.length < 4 && (a[3] = 1); 5668 return a; 5669 } 5670 } else { 5671 a = v.match(_strictNumExp) || _colorLookup.transparent; 5672 } 5673 5674 a = a.map(Number); 5675 } 5676 5677 if (toHSL && !wasHSL) { 5678 r = a[0] / _255; 5679 g = a[1] / _255; 5680 b = a[2] / _255; 5681 max = Math.max(r, g, b); 5682 min = Math.min(r, g, b); 5683 l = (max + min) / 2; 5684 5685 if (max === min) { 5686 h = s = 0; 5687 } else { 5688 d = max - min; 5689 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 5690 h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4; 5691 h *= 60; 5692 } 5693 5694 a[0] = ~~(h + .5); 5695 a[1] = ~~(s * 100 + .5); 5696 a[2] = ~~(l * 100 + .5); 5697 } 5698 5699 forceAlpha && a.length < 4 && (a[3] = 1); 5700 return a; 5701 }, 5702 _colorOrderData = function _colorOrderData(v) { 5703 var values = [], 5704 c = [], 5705 i = -1; 5706 v.split(_colorExp).forEach(function (v) { 5707 var a = v.match(_numWithUnitExp) || []; 5708 values.push.apply(values, a); 5709 c.push(i += a.length + 1); 5710 }); 5711 values.c = c; 5712 return values; 5713 }, 5714 _formatColors = function _formatColors(s, toHSL, orderMatchData) { 5715 var result = "", 5716 colors = (s + result).match(_colorExp), 5717 type = toHSL ? "hsla(" : "rgba(", 5718 i = 0, 5719 c, 5720 shell, 5721 d, 5722 l; 5723 5724 if (!colors) { 5725 return s; 5726 } 5727 5728 colors = colors.map(function (color) { 5729 return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")"; 5730 }); 5731 5732 if (orderMatchData) { 5733 d = _colorOrderData(s); 5734 c = orderMatchData.c; 5735 5736 if (c.join(result) !== d.c.join(result)) { 5737 shell = s.replace(_colorExp, "1").split(_numWithUnitExp); 5738 l = shell.length - 1; 5739 5740 for (; i < l; i++) { 5741 result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift()); 5742 } 5743 } 5744 } 5745 5746 if (!shell) { 5747 shell = s.split(_colorExp); 5748 l = shell.length - 1; 5749 5750 for (; i < l; i++) { 5751 result += shell[i] + colors[i]; 5752 } 5753 } 5754 5755 return result + shell[l]; 5756 }, 5757 _colorExp = function () { 5758 var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", 5759 p; 5760 5761 for (p in _colorLookup) { 5762 s += "|" + p + "\\b"; 5763 } 5764 5765 return new RegExp(s + ")", "gi"); 5766 }(), 5767 _hslExp = /hsl[a]?\(/, 5768 _colorStringFilter = function _colorStringFilter(a) { 5769 var combined = a.join(" "), 5770 toHSL; 5771 _colorExp.lastIndex = 0; 5772 5773 if (_colorExp.test(combined)) { 5774 toHSL = _hslExp.test(combined); 5775 a[1] = _formatColors(a[1], toHSL); 5776 a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1])); 5777 return true; 5778 } 5779 }, 5780 _tickerActive, 5781 _ticker = function () { 5782 var _getTime = Date.now, 5783 _lagThreshold = 500, 5784 _adjustedLag = 33, 5785 _startTime = _getTime(), 5786 _lastUpdate = _startTime, 5787 _gap = 1000 / 240, 5788 _nextTime = _gap, 5789 _listeners = [], 5790 _id, 5791 _req, 5792 _raf, 5793 _self, 5794 _delta, 5795 _i, 5796 _tick = function _tick(v) { 5797 var elapsed = _getTime() - _lastUpdate, 5798 manual = v === true, 5799 overlap, 5800 dispatch, 5801 time, 5802 frame; 5803 5804 elapsed > _lagThreshold && (_startTime += elapsed - _adjustedLag); 5805 _lastUpdate += elapsed; 5806 time = _lastUpdate - _startTime; 5807 overlap = time - _nextTime; 5808 5809 if (overlap > 0 || manual) { 5810 frame = ++_self.frame; 5811 _delta = time - _self.time * 1000; 5812 _self.time = time = time / 1000; 5813 _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap); 5814 dispatch = 1; 5815 } 5816 5817 manual || (_id = _req(_tick)); 5818 5819 if (dispatch) { 5820 for (_i = 0; _i < _listeners.length; _i++) { 5821 _listeners[_i](time, _delta, frame, v); 5822 } 5823 } 5824 }; 5825 5826 _self = { 5827 time: 0, 5828 frame: 0, 5829 tick: function tick() { 5830 _tick(true); 5831 }, 5832 deltaRatio: function deltaRatio(fps) { 5833 return _delta / (1000 / (fps || 60)); 5834 }, 5835 wake: function wake() { 5836 if (_coreReady) { 5837 if (!_coreInitted && _windowExists()) { 5838 _win = _coreInitted = window; 5839 _doc = _win.document || {}; 5840 _globals.gsap = gsap; 5841 (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version); 5842 5843 _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {}); 5844 5845 _raf = _win.requestAnimationFrame; 5846 } 5847 5848 _id && _self.sleep(); 5849 5850 _req = _raf || function (f) { 5851 return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0); 5852 }; 5853 5854 _tickerActive = 1; 5855 5856 _tick(2); 5857 } 5858 }, 5859 sleep: function sleep() { 5860 (_raf ? _win.cancelAnimationFrame : clearTimeout)(_id); 5861 _tickerActive = 0; 5862 _req = _emptyFunc; 5863 }, 5864 lagSmoothing: function lagSmoothing(threshold, adjustedLag) { 5865 _lagThreshold = threshold || 1 / _tinyNum; 5866 _adjustedLag = Math.min(adjustedLag, _lagThreshold, 0); 5867 }, 5868 fps: function fps(_fps) { 5869 _gap = 1000 / (_fps || 240); 5870 _nextTime = _self.time * 1000 + _gap; 5871 }, 5872 add: function add(callback) { 5873 _listeners.indexOf(callback) < 0 && _listeners.push(callback); 5874 5875 _wake(); 5876 }, 5877 remove: function remove(callback) { 5878 var i; 5879 ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--; 5880 }, 5881 _listeners: _listeners 5882 }; 5883 return _self; 5884 }(), 5885 _wake = function _wake() { 5886 return !_tickerActive && _ticker.wake(); 5887 }, 5888 _easeMap = {}, 5889 _customEaseExp = /^[\d.\-M][\d.\-,\s]/, 5890 _quotesExp = /["']/g, 5891 _parseObjectInString = function _parseObjectInString(value) { 5892 var obj = {}, 5893 split = value.substr(1, value.length - 3).split(":"), 5894 key = split[0], 5895 i = 1, 5896 l = split.length, 5897 index, 5898 val, 5899 parsedVal; 5900 5901 for (; i < l; i++) { 5902 val = split[i]; 5903 index = i !== l - 1 ? val.lastIndexOf(",") : val.length; 5904 parsedVal = val.substr(0, index); 5905 obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal; 5906 key = val.substr(index + 1).trim(); 5907 } 5908 5909 return obj; 5910 }, 5911 _valueInParentheses = function _valueInParentheses(value) { 5912 var open = value.indexOf("(") + 1, 5913 close = value.indexOf(")"),
vendor: 5,209 bytes, lines 5914-6024
5914 nested = value.indexOf("(", open); 5915 return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close); 5916 }, 5917 _configEaseFromString = function _configEaseFromString(name) { 5918 var split = (name + "").split("("), 5919 ease = _easeMap[split[0]]; 5920 return ease && split.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [_parseObjectInString(split[1])] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease; 5921 }, 5922 _invertEase = function _invertEase(ease) { 5923 return function (p) { 5924 return 1 - ease(1 - p); 5925 }; 5926 }, 5927 _propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) { 5928 var child = timeline._first, 5929 ease; 5930 5931 while (child) { 5932 if (child instanceof Timeline) { 5933 _propagateYoyoEase(child, isYoyo); 5934 } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) { 5935 if (child.timeline) { 5936 _propagateYoyoEase(child.timeline, isYoyo); 5937 } else { 5938 ease = child._ease; 5939 child._ease = child._yEase; 5940 child._yEase = ease; 5941 child._yoyo = isYoyo; 5942 } 5943 } 5944 5945 child = child._next; 5946 } 5947 }, 5948 _parseEase = function _parseEase(ease, defaultEase) { 5949 return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase; 5950 }, 5951 _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) { 5952 if (easeOut === void 0) { 5953 easeOut = function easeOut(p) { 5954 return 1 - easeIn(1 - p); 5955 }; 5956 } 5957 5958 if (easeInOut === void 0) { 5959 easeInOut = function easeInOut(p) { 5960 return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2; 5961 }; 5962 } 5963 5964 var ease = { 5965 easeIn: easeIn, 5966 easeOut: easeOut, 5967 easeInOut: easeInOut 5968 }, 5969 lowercaseName; 5970 5971 _forEachName(names, function (name) { 5972 _easeMap[name] = _globals[name] = ease; 5973 _easeMap[lowercaseName = name.toLowerCase()] = easeOut; 5974 5975 for (var p in ease) { 5976 _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p]; 5977 } 5978 }); 5979 5980 return ease; 5981 }, 5982 _easeInOutFromOut = function _easeInOutFromOut(easeOut) { 5983 return function (p) { 5984 return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2; 5985 }; 5986 }, 5987 _configElastic = function _configElastic(type, amplitude, period) { 5988 var p1 = amplitude >= 1 ? amplitude : 1, 5989 p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1), 5990 p3 = p2 / _2PI * (Math.asin(1 / p1) || 0), 5991 easeOut = function easeOut(p) { 5992 return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1; 5993 }, 5994 ease = type === "out" ? easeOut : type === "in" ? function (p) { 5995 return 1 - easeOut(1 - p); 5996 } : _easeInOutFromOut(easeOut); 5997 5998 p2 = _2PI / p2; 5999 6000 ease.config = function (amplitude, period) { 6001 return _configElastic(type, amplitude, period); 6002 }; 6003 6004 return ease; 6005 }, 6006 _configBack = function _configBack(type, overshoot) { 6007 if (overshoot === void 0) { 6008 overshoot = 1.70158; 6009 } 6010 6011 var easeOut = function easeOut(p) { 6012 return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0; 6013 }, 6014 ease = type === "out" ? easeOut : type === "in" ? function (p) { 6015 return 1 - easeOut(1 - p); 6016 } : _easeInOutFromOut(easeOut); 6017 6018 ease.config = function (overshoot) { 6019 return _configBack(type, overshoot); 6020 }; 6021 6022 return ease; 6023 }; 6024
vendor: 5,473 bytes, lines 6025-6164
6025 _forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function (name, i) { 6026 var power = i < 5 ? i + 1 : i; 6027 6028 _insertEase(name + ",Power" + (power - 1), i ? function (p) { 6029 return Math.pow(p, power); 6030 } : function (p) { 6031 return p; 6032 }, function (p) { 6033 return 1 - Math.pow(1 - p, power); 6034 }, function (p) { 6035 return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2; 6036 }); 6037 }); 6038 6039 _easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn; 6040 6041 _insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic()); 6042 6043 (function (n, c) { 6044 var n1 = 1 / c, 6045 n2 = 2 * n1, 6046 n3 = 2.5 * n1, 6047 easeOut = function easeOut(p) { 6048 return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + .75 : p < n3 ? n * (p -= 2.25 / c) * p + .9375 : n * Math.pow(p - 2.625 / c, 2) + .984375; 6049 }; 6050 6051 _insertEase("Bounce", function (p) { 6052 return 1 - easeOut(1 - p); 6053 }, easeOut); 6054 })(7.5625, 2.75); 6055 6056 _insertEase("Expo", function (p) { 6057 return p ? Math.pow(2, 10 * (p - 1)) : 0; 6058 }); 6059 6060 _insertEase("Circ", function (p) { 6061 return -(_sqrt(1 - p * p) - 1); 6062 }); 6063 6064 _insertEase("Sine", function (p) { 6065 return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1; 6066 }); 6067 6068 _insertEase("Back", _configBack("in"), _configBack("out"), _configBack()); 6069 6070 _easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = { 6071 config: function config(steps, immediateStart) { 6072 if (steps === void 0) { 6073 steps = 1; 6074 } 6075 6076 var p1 = 1 / steps, 6077 p2 = steps + (immediateStart ? 0 : 1), 6078 p3 = immediateStart ? 1 : 0, 6079 max = 1 - _tinyNum; 6080 return function (p) { 6081 return ((p2 * _clamp(0, max, p) | 0) + p3) * p1; 6082 }; 6083 } 6084 }; 6085 _defaults.ease = _easeMap["quad.out"]; 6086 6087 _forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function (name) { 6088 return _callbackNames += name + "," + name + "Params,"; 6089 }); 6090 6091 var GSCache = function GSCache(target, harness) { 6092 this.id = _gsID++; 6093 target._gsap = this; 6094 this.target = target; 6095 this.harness = harness; 6096 this.get = harness ? harness.get : _getProperty; 6097 this.set = harness ? harness.getSetter : _getSetter; 6098 }; 6099 var Animation = function () { 6100 function Animation(vars) { 6101 this.vars = vars; 6102 this._delay = +vars.delay || 0; 6103 6104 if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) { 6105 this._rDelay = vars.repeatDelay || 0; 6106 this._yoyo = !!vars.yoyo || !!vars.yoyoEase; 6107 } 6108 6109 this._ts = 1; 6110 6111 _setDuration(this, +vars.duration, 1, 1); 6112 6113 this.data = vars.data; 6114 _tickerActive || _ticker.wake(); 6115 } 6116 6117 var _proto = Animation.prototype; 6118 6119 _proto.delay = function delay(value) { 6120 if (value || value === 0) { 6121 this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay); 6122 this._delay = value; 6123 return this; 6124 } 6125 6126 return this._delay; 6127 }; 6128 6129 _proto.duration = function duration(value) { 6130 return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur; 6131 }; 6132 6133 _proto.totalDuration = function totalDuration(value) { 6134 if (!arguments.length) { 6135 return this._tDur; 6136 } 6137 6138 this._dirty = 0; 6139 return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1)); 6140 }; 6141 6142 _proto.totalTime = function totalTime(_totalTime, suppressEvents) { 6143 _wake(); 6144 6145 if (!arguments.length) { 6146 return this._tTime; 6147 } 6148 6149 var parent = this._dp; 6150 6151 if (parent && parent.smoothChildTiming && this._ts) { 6152 _alignPlayhead(this, _totalTime); 6153 6154 !parent._dp || parent.parent || _postAddChecks(parent, this); 6155 6156 while (parent.parent) { 6157 if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) { 6158 parent.totalTime(parent._tTime, true); 6159 } 6160 6161 parent = parent.parent; 6162 } 6163 6164 if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) {
vendor: 7,275 bytes, lines 6165-6331
6165 _addToTimeline(this._dp, this, this._start - this._delay); 6166 } 6167 } 6168 6169 if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) { 6170 this._ts || (this._pTime = _totalTime); 6171 6172 _lazySafeRender(this, _totalTime, suppressEvents); 6173 } 6174 6175 return this; 6176 }; 6177 6178 _proto.time = function time(value, suppressEvents) { 6179 return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time; 6180 }; 6181 6182 _proto.totalProgress = function totalProgress(value, suppressEvents) { 6183 return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.ratio; 6184 }; 6185 6186 _proto.progress = function progress(value, suppressEvents) { 6187 return arguments.length ? this.totalTime(this.duration() * (this._yoyo && !(this.iteration() & 1) ? 1 - value : value) + _elapsedCycleDuration(this), suppressEvents) : this.duration() ? Math.min(1, this._time / this._dur) : this.ratio; 6188 }; 6189 6190 _proto.iteration = function iteration(value, suppressEvents) { 6191 var cycleDuration = this.duration() + this._rDelay; 6192 6193 return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1; 6194 }; 6195 6196 _proto.timeScale = function timeScale(value) { 6197 if (!arguments.length) { 6198 return this._rts === -_tinyNum ? 0 : this._rts; 6199 } 6200 6201 if (this._rts === value) { 6202 return this; 6203 } 6204 6205 var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime; 6206 this._rts = +value || 0; 6207 this._ts = this._ps || value === -_tinyNum ? 0 : this._rts; 6208 return _recacheAncestors(this.totalTime(_clamp(-this._delay, this._tDur, tTime), true)); 6209 }; 6210 6211 _proto.paused = function paused(value) { 6212 if (!arguments.length) { 6213 return this._ps; 6214 } 6215 6216 if (this._ps !== value) { 6217 this._ps = value; 6218 6219 if (value) { 6220 this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()); 6221 this._ts = this._act = 0; 6222 } else { 6223 _wake(); 6224 6225 this._ts = this._rts; 6226 this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum)); 6227 } 6228 } 6229 6230 return this; 6231 }; 6232 6233 _proto.startTime = function startTime(value) { 6234 if (arguments.length) { 6235 this._start = value; 6236 var parent = this.parent || this._dp; 6237 parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay); 6238 return this; 6239 } 6240 6241 return this._start; 6242 }; 6243 6244 _proto.endTime = function endTime(includeRepeats) { 6245 return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts); 6246 }; 6247 6248 _proto.rawTime = function rawTime(wrapRepeats) { 6249 var parent = this.parent || this._dp; 6250 return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this); 6251 }; 6252 6253 _proto.globalTime = function globalTime(rawTime) { 6254 var animation = this, 6255 time = arguments.length ? rawTime : animation.rawTime(); 6256 6257 while (animation) { 6258 time = animation._start + time / (animation._ts || 1); 6259 animation = animation._dp; 6260 } 6261 6262 return time; 6263 }; 6264 6265 _proto.repeat = function repeat(value) { 6266 if (arguments.length) { 6267 this._repeat = value === Infinity ? -2 : value; 6268 return _onUpdateTotalDuration(this); 6269 } 6270 6271 return this._repeat === -2 ? Infinity : this._repeat; 6272 }; 6273 6274 _proto.repeatDelay = function repeatDelay(value) { 6275 if (arguments.length) { 6276 var time = this._time; 6277 this._rDelay = value; 6278 6279 _onUpdateTotalDuration(this); 6280 6281 return time ? this.time(time) : this; 6282 } 6283 6284 return this._rDelay; 6285 }; 6286 6287 _proto.yoyo = function yoyo(value) { 6288 if (arguments.length) { 6289 this._yoyo = value; 6290 return this; 6291 } 6292 6293 return this._yoyo; 6294 }; 6295 6296 _proto.seek = function seek(position, suppressEvents) { 6297 return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents)); 6298 }; 6299 6300 _proto.restart = function restart(includeDelay, suppressEvents) { 6301 return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents)); 6302 }; 6303 6304 _proto.play = function play(from, suppressEvents) { 6305 from != null && this.seek(from, suppressEvents); 6306 return this.reversed(false).paused(false); 6307 }; 6308 6309 _proto.reverse = function reverse(from, suppressEvents) { 6310 from != null && this.seek(from || this.totalDuration(), suppressEvents); 6311 return this.reversed(true).paused(false); 6312 }; 6313 6314 _proto.pause = function pause(atTime, suppressEvents) { 6315 atTime != null && this.seek(atTime, suppressEvents); 6316 return this.paused(true); 6317 }; 6318 6319 _proto.resume = function resume() { 6320 return this.paused(false); 6321 }; 6322 6323 _proto.reversed = function reversed(value) { 6324 if (arguments.length) { 6325 !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0)); 6326 return this; 6327 } 6328 6329 return this._rts < 0; 6330 }; 6331
vendor: 11,896 bytes, lines 6332-6602
6332 _proto.invalidate = function invalidate() { 6333 this._initted = this._act = 0; 6334 this._zTime = -_tinyNum; 6335 return this; 6336 }; 6337 6338 _proto.isActive = function isActive() { 6339 var parent = this.parent || this._dp, 6340 start = this._start, 6341 rawTime; 6342 return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum); 6343 }; 6344 6345 _proto.eventCallback = function eventCallback(type, callback, params) { 6346 var vars = this.vars; 6347 6348 if (arguments.length > 1) { 6349 if (!callback) { 6350 delete vars[type]; 6351 } else { 6352 vars[type] = callback; 6353 params && (vars[type + "Params"] = params); 6354 type === "onUpdate" && (this._onUpdate = callback); 6355 } 6356 6357 return this; 6358 } 6359 6360 return vars[type]; 6361 }; 6362 6363 _proto.then = function then(onFulfilled) { 6364 var self = this; 6365 return new Promise(function (resolve) { 6366 var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough, 6367 _resolve = function _resolve() { 6368 var _then = self.then; 6369 self.then = null; 6370 _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then); 6371 resolve(f); 6372 self.then = _then; 6373 }; 6374 6375 if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) { 6376 _resolve(); 6377 } else { 6378 self._prom = _resolve; 6379 } 6380 }); 6381 }; 6382 6383 _proto.kill = function kill() { 6384 _interrupt(this); 6385 }; 6386 6387 return Animation; 6388 }(); 6389 6390 _setDefaults(Animation.prototype, { 6391 _time: 0, 6392 _start: 0, 6393 _end: 0, 6394 _tTime: 0, 6395 _tDur: 0, 6396 _dirty: 0, 6397 _repeat: 0, 6398 _yoyo: false, 6399 parent: null, 6400 _initted: false, 6401 _rDelay: 0, 6402 _ts: 1, 6403 _dp: 0, 6404 ratio: 0, 6405 _zTime: -_tinyNum, 6406 _prom: 0, 6407 _ps: false, 6408 _rts: 1 6409 }); 6410 6411 var Timeline = function (_Animation) { 6412 _inheritsLoose(Timeline, _Animation); 6413 6414 function Timeline(vars, position) { 6415 var _this; 6416 6417 if (vars === void 0) { 6418 vars = {}; 6419 } 6420 6421 _this = _Animation.call(this, vars) || this; 6422 _this.labels = {}; 6423 _this.smoothChildTiming = !!vars.smoothChildTiming; 6424 _this.autoRemoveChildren = !!vars.autoRemoveChildren; 6425 _this._sort = _isNotFalse(vars.sortChildren); 6426 _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position); 6427 vars.reversed && _this.reverse(); 6428 vars.paused && _this.paused(true); 6429 vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger); 6430 return _this; 6431 } 6432 6433 var _proto2 = Timeline.prototype; 6434 6435 _proto2.to = function to(targets, vars, position) { 6436 _createTweenType(0, arguments, this); 6437 6438 return this; 6439 }; 6440 6441 _proto2.from = function from(targets, vars, position) { 6442 _createTweenType(1, arguments, this); 6443 6444 return this; 6445 }; 6446 6447 _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) { 6448 _createTweenType(2, arguments, this); 6449 6450 return this; 6451 }; 6452 6453 _proto2.set = function set(targets, vars, position) { 6454 vars.duration = 0; 6455 vars.parent = this; 6456 _inheritDefaults(vars).repeatDelay || (vars.repeat = 0); 6457 vars.immediateRender = !!vars.immediateRender; 6458 new Tween(targets, vars, _parsePosition(this, position), 1); 6459 return this; 6460 }; 6461 6462 _proto2.call = function call(callback, params, position) { 6463 return _addToTimeline(this, Tween.delayedCall(0, callback, params), position); 6464 }; 6465 6466 _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 6467 vars.duration = duration; 6468 vars.stagger = vars.stagger || stagger; 6469 vars.onComplete = onCompleteAll; 6470 vars.onCompleteParams = onCompleteAllParams; 6471 vars.parent = this; 6472 new Tween(targets, vars, _parsePosition(this, position)); 6473 return this; 6474 }; 6475 6476 _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 6477 vars.runBackwards = 1; 6478 _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender); 6479 return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams); 6480 }; 6481 6482 _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) { 6483 toVars.startAt = fromVars; 6484 _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender); 6485 return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams); 6486 }; 6487 6488 _proto2.render = function render(totalTime, suppressEvents, force) { 6489 var prevTime = this._time, 6490 tDur = this._dirty ? this.totalDuration() : this._tDur, 6491 dur = this._dur, 6492 tTime = this !== _globalTimeline && totalTime > tDur - _tinyNum && totalTime >= 0 ? tDur : totalTime < _tinyNum ? 0 : totalTime, 6493 crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur), 6494 time, 6495 child, 6496 next, 6497 iteration, 6498 cycleDuration, 6499 prevPaused, 6500 pauseTween, 6501 timeScale, 6502 prevStart, 6503 prevIteration, 6504 yoyo, 6505 isYoyo; 6506 6507 if (tTime !== this._tTime || force || crossingStart) { 6508 if (prevTime !== this._time && dur) { 6509 tTime += this._time - prevTime; 6510 totalTime += this._time - prevTime; 6511 } 6512 6513 time = tTime; 6514 prevStart = this._start; 6515 timeScale = this._ts; 6516 prevPaused = !timeScale; 6517 6518 if (crossingStart) { 6519 dur || (prevTime = this._zTime); 6520 (totalTime || !suppressEvents) && (this._zTime = totalTime); 6521 } 6522 6523 if (this._repeat) { 6524 yoyo = this._yoyo; 6525 cycleDuration = dur + this._rDelay; 6526 6527 if (this._repeat < -1 && totalTime < 0) { 6528 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 6529 } 6530 6531 time = _round(tTime % cycleDuration); 6532 6533 if (tTime === tDur) { 6534 iteration = this._repeat; 6535 time = dur; 6536 } else { 6537 iteration = ~~(tTime / cycleDuration); 6538 6539 if (iteration && iteration === tTime / cycleDuration) { 6540 time = dur; 6541 iteration--; 6542 } 6543 6544 time > dur && (time = dur); 6545 } 6546 6547 prevIteration = _animationCycle(this._tTime, cycleDuration); 6548 !prevTime && this._tTime && prevIteration !== iteration && (prevIteration = iteration); 6549 6550 if (yoyo && iteration & 1) { 6551 time = dur - time; 6552 isYoyo = 1; 6553 } 6554 6555 if (iteration !== prevIteration && !this._lock) { 6556 var rewinding = yoyo && prevIteration & 1, 6557 doesWrap = rewinding === (yoyo && iteration & 1); 6558 iteration < prevIteration && (rewinding = !rewinding); 6559 prevTime = rewinding ? 0 : dur; 6560 this._lock = 1; 6561 this.render(prevTime || (isYoyo ? 0 : _round(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0; 6562 this._tTime = tTime; 6563 !suppressEvents && this.parent && _callback(this, "onRepeat"); 6564 this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1); 6565 6566 if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) { 6567 return this; 6568 } 6569 6570 dur = this._dur; 6571 tDur = this._tDur; 6572 6573 if (doesWrap) { 6574 this._lock = 2; 6575 prevTime = rewinding ? dur : -0.0001; 6576 this.render(prevTime, true); 6577 this.vars.repeatRefresh && !isYoyo && this.invalidate(); 6578 } 6579 6580 this._lock = 0; 6581 6582 if (!this._ts && !prevPaused) { 6583 return this; 6584 } 6585 6586 _propagateYoyoEase(this, isYoyo); 6587 } 6588 } 6589 6590 if (this._hasPause && !this._forcing && this._lock < 2) { 6591 pauseTween = _findNextPauseTween(this, _round(prevTime), _round(time)); 6592 6593 if (pauseTween) { 6594 tTime -= time - (time = pauseTween._start); 6595 } 6596 } 6597 6598 this._tTime = tTime; 6599 this._time = time; 6600 this._act = !timeScale; 6601 6602 if (!this._initted) {
vendor: 8,164 bytes, lines 6603-6792
6603 this._onUpdate = this.vars.onUpdate; 6604 this._initted = 1; 6605 this._zTime = totalTime; 6606 prevTime = 0; 6607 } 6608 6609 if (!prevTime && time && !suppressEvents) { 6610 _callback(this, "onStart"); 6611 6612 if (this._tTime !== tTime) { 6613 return this; 6614 } 6615 } 6616 6617 if (time >= prevTime && totalTime >= 0) { 6618 child = this._first; 6619 6620 while (child) { 6621 next = child._next; 6622 6623 if ((child._act || time >= child._start) && child._ts && pauseTween !== child) { 6624 if (child.parent !== this) { 6625 return this.render(totalTime, suppressEvents, force); 6626 } 6627 6628 child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force); 6629 6630 if (time !== this._time || !this._ts && !prevPaused) { 6631 pauseTween = 0; 6632 next && (tTime += this._zTime = -_tinyNum); 6633 break; 6634 } 6635 } 6636 6637 child = next; 6638 } 6639 } else { 6640 child = this._last; 6641 var adjustedTime = totalTime < 0 ? totalTime : time; 6642 6643 while (child) { 6644 next = child._prev; 6645 6646 if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) { 6647 if (child.parent !== this) { 6648 return this.render(totalTime, suppressEvents, force); 6649 } 6650 6651 child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force); 6652 6653 if (time !== this._time || !this._ts && !prevPaused) { 6654 pauseTween = 0; 6655 next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum); 6656 break; 6657 } 6658 } 6659 6660 child = next; 6661 } 6662 } 6663 6664 if (pauseTween && !suppressEvents) { 6665 this.pause(); 6666 pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1; 6667 6668 if (this._ts) { 6669 this._start = prevStart; 6670 6671 _setEnd(this); 6672 6673 return this.render(totalTime, suppressEvents, force); 6674 } 6675 } 6676 6677 this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true); 6678 if (tTime === tDur && tDur >= this.totalDuration() || !tTime && prevTime) if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) if (!this._lock) { 6679 (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); 6680 6681 if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) { 6682 _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true); 6683 6684 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 6685 } 6686 } 6687 } 6688 6689 return this; 6690 }; 6691 6692 _proto2.add = function add(child, position) { 6693 var _this2 = this; 6694 6695 _isNumber(position) || (position = _parsePosition(this, position, child)); 6696 6697 if (!(child instanceof Animation)) { 6698 if (_isArray(child)) { 6699 child.forEach(function (obj) { 6700 return _this2.add(obj, position); 6701 }); 6702 return this; 6703 } 6704 6705 if (_isString(child)) { 6706 return this.addLabel(child, position); 6707 } 6708 6709 if (_isFunction(child)) { 6710 child = Tween.delayedCall(0, child); 6711 } else { 6712 return this; 6713 } 6714 } 6715 6716 return this !== child ? _addToTimeline(this, child, position) : this; 6717 }; 6718 6719 _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) { 6720 if (nested === void 0) { 6721 nested = true; 6722 } 6723 6724 if (tweens === void 0) { 6725 tweens = true; 6726 } 6727 6728 if (timelines === void 0) { 6729 timelines = true; 6730 } 6731 6732 if (ignoreBeforeTime === void 0) { 6733 ignoreBeforeTime = -_bigNum; 6734 } 6735 6736 var a = [], 6737 child = this._first; 6738 6739 while (child) { 6740 if (child._start >= ignoreBeforeTime) { 6741 if (child instanceof Tween) { 6742 tweens && a.push(child); 6743 } else { 6744 timelines && a.push(child); 6745 nested && a.push.apply(a, child.getChildren(true, tweens, timelines)); 6746 } 6747 } 6748 6749 child = child._next; 6750 } 6751 6752 return a; 6753 }; 6754 6755 _proto2.getById = function getById(id) { 6756 var animations = this.getChildren(1, 1, 1), 6757 i = animations.length; 6758 6759 while (i--) { 6760 if (animations[i].vars.id === id) { 6761 return animations[i]; 6762 } 6763 } 6764 }; 6765 6766 _proto2.remove = function remove(child) { 6767 if (_isString(child)) { 6768 return this.removeLabel(child); 6769 } 6770 6771 if (_isFunction(child)) { 6772 return this.killTweensOf(child); 6773 } 6774 6775 _removeLinkedListItem(this, child); 6776 6777 if (child === this._recent) { 6778 this._recent = this._last; 6779 } 6780 6781 return _uncache(this); 6782 }; 6783 6784 _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) { 6785 if (!arguments.length) { 6786 return this._tTime; 6787 } 6788 6789 this._forcing = 1; 6790 6791 if (!this._dp && this._ts) { 6792 this._start = _round(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts
vendor: 6,744 bytes, lines 6792-6958
6792)); 6793 } 6794 6795 _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents); 6796 6797 this._forcing = 0; 6798 return this; 6799 }; 6800 6801 _proto2.addLabel = function addLabel(label, position) { 6802 this.labels[label] = _parsePosition(this, position); 6803 return this; 6804 }; 6805 6806 _proto2.removeLabel = function removeLabel(label) { 6807 delete this.labels[label]; 6808 return this; 6809 }; 6810 6811 _proto2.addPause = function addPause(position, callback, params) { 6812 var t = Tween.delayedCall(0, callback || _emptyFunc, params); 6813 t.data = "isPause"; 6814 this._hasPause = 1; 6815 return _addToTimeline(this, t, _parsePosition(this, position)); 6816 }; 6817 6818 _proto2.removePause = function removePause(position) { 6819 var child = this._first; 6820 position = _parsePosition(this, position); 6821 6822 while (child) { 6823 if (child._start === position && child.data === "isPause") { 6824 _removeFromParent(child); 6825 } 6826 6827 child = child._next; 6828 } 6829 }; 6830 6831 _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) { 6832 var tweens = this.getTweensOf(targets, onlyActive), 6833 i = tweens.length; 6834 6835 while (i--) { 6836 _overwritingTween !== tweens[i] && tweens[i].kill(targets, props); 6837 } 6838 6839 return this; 6840 }; 6841 6842 _proto2.getTweensOf = function getTweensOf(targets, onlyActive) { 6843 var a = [], 6844 parsedTargets = toArray(targets), 6845 child = this._first, 6846 isGlobalTime = _isNumber(onlyActive), 6847 children; 6848 6849 while (child) { 6850 if (child instanceof Tween) { 6851 if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) { 6852 a.push(child); 6853 } 6854 } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) { 6855 a.push.apply(a, children); 6856 } 6857 6858 child = child._next; 6859 } 6860 6861 return a; 6862 }; 6863 6864 _proto2.tweenTo = function tweenTo(position, vars) { 6865 vars = vars || {}; 6866 6867 var tl = this, 6868 endTime = _parsePosition(tl, position), 6869 _vars = vars, 6870 startAt = _vars.startAt, 6871 _onStart = _vars.onStart, 6872 onStartParams = _vars.onStartParams, 6873 immediateRender = _vars.immediateRender, 6874 initted, 6875 tween = Tween.to(tl, _setDefaults({ 6876 ease: vars.ease || "none", 6877 lazy: false, 6878 immediateRender: false, 6879 time: endTime, 6880 overwrite: "auto", 6881 duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum, 6882 onStart: function onStart() { 6883 tl.pause(); 6884 6885 if (!initted) { 6886 var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()); 6887 tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true); 6888 initted = 1; 6889 } 6890 6891 _onStart && _onStart.apply(tween, onStartParams || []); 6892 } 6893 }, vars)); 6894 6895 return immediateRender ? tween.render(0) : tween; 6896 }; 6897 6898 _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) { 6899 return this.tweenTo(toPosition, _setDefaults({ 6900 startAt: { 6901 time: _parsePosition(this, fromPosition) 6902 } 6903 }, vars)); 6904 }; 6905 6906 _proto2.recent = function recent() { 6907 return this._recent; 6908 }; 6909 6910 _proto2.nextLabel = function nextLabel(afterTime) { 6911 if (afterTime === void 0) { 6912 afterTime = this._time; 6913 } 6914 6915 return _getLabelInDirection(this, _parsePosition(this, afterTime)); 6916 }; 6917 6918 _proto2.previousLabel = function previousLabel(beforeTime) { 6919 if (beforeTime === void 0) { 6920 beforeTime = this._time; 6921 } 6922 6923 return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1); 6924 }; 6925 6926 _proto2.currentLabel = function currentLabel(value) { 6927 return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum); 6928 }; 6929 6930 _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) { 6931 if (ignoreBeforeTime === void 0) { 6932 ignoreBeforeTime = 0; 6933 } 6934 6935 var child = this._first, 6936 labels = this.labels, 6937 p; 6938 6939 while (child) { 6940 if (child._start >= ignoreBeforeTime) { 6941 child._start += amount; 6942 child._end += amount; 6943 } 6944 6945 child = child._next; 6946 } 6947 6948 if (adjustLabels) { 6949 for (p in labels) { 6950 if (labels[p] >= ignoreBeforeTime) { 6951 labels[p] += amount; 6952 } 6953 } 6954 } 6955 6956 return _uncache(this); 6957 }; 6958
vendor: 10,535 bytes, lines 6959-7208
6959 _proto2.invalidate = function invalidate() { 6960 var child = this._first; 6961 this._lock = 0; 6962 6963 while (child) { 6964 child.invalidate(); 6965 child = child._next; 6966 } 6967 6968 return _Animation.prototype.invalidate.call(this); 6969 }; 6970 6971 _proto2.clear = function clear(includeLabels) { 6972 if (includeLabels === void 0) { 6973 includeLabels = true; 6974 } 6975 6976 var child = this._first, 6977 next; 6978 6979 while (child) { 6980 next = child._next; 6981 this.remove(child); 6982 child = next; 6983 } 6984 6985 this._dp && (this._time = this._tTime = this._pTime = 0); 6986 includeLabels && (this.labels = {}); 6987 return _uncache(this); 6988 }; 6989 6990 _proto2.totalDuration = function totalDuration(value) { 6991 var max = 0, 6992 self = this, 6993 child = self._last, 6994 prevStart = _bigNum, 6995 prev, 6996 start, 6997 parent; 6998 6999 if (arguments.length) { 7000 return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value)); 7001 } 7002 7003 if (self._dirty) { 7004 parent = self.parent; 7005 7006 while (child) { 7007 prev = child._prev; 7008 child._dirty && child.totalDuration(); 7009 start = child._start; 7010 7011 if (start > prevStart && self._sort && child._ts && !self._lock) { 7012 self._lock = 1; 7013 _addToTimeline(self, child, start - child._delay, 1)._lock = 0; 7014 } else { 7015 prevStart = start; 7016 } 7017 7018 if (start < 0 && child._ts) { 7019 max -= start; 7020 7021 if (!parent && !self._dp || parent && parent.smoothChildTiming) { 7022 self._start += start / self._ts; 7023 self._time -= start; 7024 self._tTime -= start; 7025 } 7026 7027 self.shiftChildren(-start, false, -1e999); 7028 prevStart = 0; 7029 } 7030 7031 child._end > max && child._ts && (max = child._end); 7032 child = prev; 7033 } 7034 7035 _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1); 7036 7037 self._dirty = 0; 7038 } 7039 7040 return self._tDur; 7041 }; 7042 7043 Timeline.updateRoot = function updateRoot(time) { 7044 if (_globalTimeline._ts) { 7045 _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline)); 7046 7047 _lastRenderedFrame = _ticker.frame; 7048 } 7049 7050 if (_ticker.frame >= _nextGCFrame) { 7051 _nextGCFrame += _config.autoSleep || 120; 7052 var child = _globalTimeline._first; 7053 if (!child || !child._ts) if (_config.autoSleep && _ticker._listeners.length < 2) { 7054 while (child && !child._ts) { 7055 child = child._next; 7056 } 7057 7058 child || _ticker.sleep(); 7059 } 7060 } 7061 }; 7062 7063 return Timeline; 7064 }(Animation); 7065 7066 _setDefaults(Timeline.prototype, { 7067 _lock: 0, 7068 _hasPause: 0, 7069 _forcing: 0 7070 }); 7071 7072 var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) { 7073 var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter), 7074 index = 0, 7075 matchIndex = 0, 7076 result, 7077 startNums, 7078 color, 7079 endNum, 7080 chunk, 7081 startNum, 7082 hasRandom, 7083 a; 7084 pt.b = start; 7085 pt.e = end; 7086 start += ""; 7087 end += ""; 7088 7089 if (hasRandom = ~end.indexOf("random(")) { 7090 end = _replaceRandom(end); 7091 } 7092 7093 if (stringFilter) { 7094 a = [start, end]; 7095 stringFilter(a, target, prop); 7096 start = a[0]; 7097 end = a[1]; 7098 } 7099 7100 startNums = start.match(_complexStringNumExp) || []; 7101 7102 while (result = _complexStringNumExp.exec(end)) { 7103 endNum = result[0]; 7104 chunk = end.substring(index, result.index); 7105 7106 if (color) { 7107 color = (color + 1) % 5; 7108 } else if (chunk.substr(-5) === "rgba(") { 7109 color = 1; 7110 } 7111 7112 if (endNum !== startNums[matchIndex++]) { 7113 startNum = parseFloat(startNums[matchIndex - 1]) || 0; 7114 pt._pt = { 7115 _next: pt._pt, 7116 p: chunk || matchIndex === 1 ? chunk : ",", 7117 s: startNum, 7118 c: endNum.charAt(1) === "=" ? parseFloat(endNum.substr(2)) * (endNum.charAt(0) === "-" ? -1 : 1) : parseFloat(endNum) - startNum, 7119 m: color && color < 4 ? Math.round : 0 7120 }; 7121 index = _complexStringNumExp.lastIndex; 7122 } 7123 } 7124 7125 pt.c = index < end.length ? end.substring(index, end.length) : ""; 7126 pt.fp = funcParam; 7127 7128 if (_relExp.test(end) || hasRandom) { 7129 pt.e = 0; 7130 } 7131 7132 this._pt = pt; 7133 return pt; 7134 }, 7135 _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam) { 7136 _isFunction(end) && (end = end(index || 0, target, targets)); 7137 var currentValue = target[prop], 7138 parsedStart = start !== "get" ? start : !_isFunction(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](), 7139 setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc, 7140 pt; 7141 7142 if (_isString(end)) { 7143 if (~end.indexOf("random(")) { 7144 end = _replaceRandom(end); 7145 } 7146 7147 if (end.charAt(1) === "=") { 7148 pt = parseFloat(parsedStart) + parseFloat(end.substr(2)) * (end.charAt(0) === "-" ? -1 : 1) + (getUnit(parsedStart) || 0); 7149 7150 if (pt || pt === 0) { 7151 end = pt; 7152 } 7153 } 7154 } 7155 7156 if (parsedStart !== end) { 7157 if (!isNaN(parsedStart * end) && end !== "") { 7158 pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter); 7159 funcParam && (pt.fp = funcParam); 7160 modifier && pt.modifier(modifier, this, target); 7161 return this._pt = pt; 7162 } 7163 7164 !currentValue && !(prop in target) && _missingPlugin(prop, end); 7165 return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam); 7166 } 7167 }, 7168 _processVars = function _processVars(vars, index, target, targets, tween) { 7169 _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets)); 7170 7171 if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) { 7172 return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars; 7173 } 7174 7175 var copy = {}, 7176 p; 7177 7178 for (p in vars) { 7179 copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets); 7180 } 7181 7182 return copy; 7183 }, 7184 _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) { 7185 var plugin, pt, ptLookup, i; 7186 7187 if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) { 7188 tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority); 7189 7190 if (tween !== _quickTween) { 7191 ptLookup = tween._ptLookup[tween._targets.indexOf(target)]; 7192 i = plugin._props.length; 7193 7194 while (i--) { 7195 ptLookup[plugin._props[i]] = pt; 7196 } 7197 } 7198 } 7199 7200 return plugin; 7201 }, 7202 _overwritingTween, 7203 _initTween = function _initTween(tween, time) { 7204 var vars = tween.vars, 7205 ease = vars.ease, 7206 startAt = vars.startAt, 7207 immediateRender = vars.immediateRender, 7208 lazy = vars.lazy,
vendor: 8,118 bytes, lines 7209-7370
7209 onUpdate = vars.onUpdate, 7210 onUpdateParams = vars.onUpdateParams, 7211 callbackScope = vars.callbackScope, 7212 runBackwards = vars.runBackwards, 7213 yoyoEase = vars.yoyoEase, 7214 keyframes = vars.keyframes, 7215 autoRevert = vars.autoRevert, 7216 dur = tween._dur, 7217 prevStartAt = tween._startAt, 7218 targets = tween._targets, 7219 parent = tween.parent, 7220 fullTargets = parent && parent.data === "nested" ? parent.parent._targets : targets, 7221 autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites, 7222 tl = tween.timeline, 7223 cleanVars, 7224 i, 7225 p, 7226 pt, 7227 target, 7228 hasPriority, 7229 gsData, 7230 harness, 7231 plugin, 7232 ptLookup, 7233 index, 7234 harnessVars, 7235 overwritten; 7236 tl && (!keyframes || !ease) && (ease = "none"); 7237 tween._ease = _parseEase(ease, _defaults.ease); 7238 tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0; 7239 7240 if (yoyoEase && tween._yoyo && !tween._repeat) { 7241 yoyoEase = tween._yEase; 7242 tween._yEase = tween._ease; 7243 tween._ease = yoyoEase; 7244 } 7245 7246 tween._from = !tl && !!vars.runBackwards; 7247 7248 if (!tl) { 7249 harness = targets[0] ? _getCache(targets[0]).harness : 0; 7250 harnessVars = harness && vars[harness.prop]; 7251 cleanVars = _copyExcluding(vars, _reservedProps); 7252 prevStartAt && prevStartAt.render(-1, true).kill(); 7253 7254 if (startAt) { 7255 _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({ 7256 data: "isStart", 7257 overwrite: false, 7258 parent: parent, 7259 immediateRender: true, 7260 lazy: _isNotFalse(lazy), 7261 startAt: null, 7262 delay: 0, 7263 onUpdate: onUpdate, 7264 onUpdateParams: onUpdateParams, 7265 callbackScope: callbackScope, 7266 stagger: 0 7267 }, startAt))); 7268 7269 time < 0 && !immediateRender && !autoRevert && tween._startAt.render(-1, true); 7270 7271 if (immediateRender) { 7272 time > 0 && !autoRevert && (tween._startAt = 0); 7273 7274 if (dur && time <= 0) { 7275 time && (tween._zTime = time); 7276 return; 7277 } 7278 } else if (autoRevert === false) { 7279 tween._startAt = 0; 7280 } 7281 } else if (runBackwards && dur) { 7282 if (prevStartAt) { 7283 !autoRevert && (tween._startAt = 0); 7284 } else { 7285 time && (immediateRender = false); 7286 p = _setDefaults({ 7287 overwrite: false, 7288 data: "isFromStart", 7289 lazy: immediateRender && _isNotFalse(lazy), 7290 immediateRender: immediateRender, 7291 stagger: 0, 7292 parent: parent 7293 }, cleanVars); 7294 harnessVars && (p[harness.prop] = harnessVars); 7295 7296 _removeFromParent(tween._startAt = Tween.set(targets, p)); 7297 7298 time < 0 && tween._startAt.render(-1, true); 7299 7300 if (!immediateRender) { 7301 _initTween(tween._startAt, _tinyNum); 7302 } else if (!time) { 7303 return; 7304 } 7305 } 7306 } 7307 7308 tween._pt = 0; 7309 lazy = dur && _isNotFalse(lazy) || lazy && !dur; 7310 7311 for (i = 0; i < targets.length; i++) { 7312 target = targets[i]; 7313 gsData = target._gsap || _harness(targets)[i]._gsap; 7314 tween._ptLookup[i] = ptLookup = {}; 7315 _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender(); 7316 index = fullTargets === targets ? i : fullTargets.indexOf(target); 7317 7318 if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) { 7319 tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority); 7320 7321 plugin._props.forEach(function (name) { 7322 ptLookup[name] = pt; 7323 }); 7324 7325 plugin.priority && (hasPriority = 1); 7326 } 7327 7328 if (!harness || harnessVars) { 7329 for (p in cleanVars) { 7330 if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) { 7331 plugin.priority && (hasPriority = 1); 7332 } else { 7333 ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter); 7334 } 7335 } 7336 } 7337 7338 tween._op && tween._op[i] && tween.kill(target, tween._op[i]); 7339 7340 if (autoOverwrite && tween._pt) { 7341 _overwritingTween = tween; 7342 7343 _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(0)); 7344 7345 overwritten = !tween.parent; 7346 _overwritingTween = 0; 7347 } 7348 7349 tween._pt && lazy && (_lazyLookup[gsData.id] = 1); 7350 } 7351 7352 hasPriority && _sortPropTweensByPriority(tween); 7353 tween._onInit && tween._onInit(tween); 7354 } 7355 7356 tween._onUpdate = onUpdate; 7357 tween._initted = (!tween._op || tween._pt) && !overwritten; 7358 }, 7359 _addAliasesToVars = function _addAliasesToVars(targets, vars) { 7360 var harness = targets[0] ? _getCache(targets[0]).harness : 0, 7361 propertyAliases = harness && harness.aliases, 7362 copy, 7363 p, 7364 i, 7365 aliases; 7366 7367 if (!propertyAliases) { 7368 return vars; 7369 } 7370
7371 copy = _merge({}, vars); 7372 7373 for (p in propertyAliases) { 7374 if (p in copy) { 7375 aliases = propertyAliases[p].split(","); 7376 i = aliases.length; 7377 7378 while (i--) { 7379 copy[aliases[i]] = copy[p]; 7380 } 7381 } 7382 } 7383 7384 return copy; 7385 }, 7386 _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) { 7387 return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value; 7388 }, 7389 _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase", 7390 _staggerPropsToSkip = (_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger").split(","); 7391 7392 var Tween = function (_Animation2) { 7393 _inheritsLoose(Tween, _Animation2); 7394 7395 function Tween(targets, vars, position, skipInherit) { 7396 var _this3; 7397 7398 if (typeof vars === "number") { 7399 position.duration = vars; 7400 vars = position; 7401 position = null; 7402 } 7403 7404 _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this; 7405 var _this3$vars = _this3.vars, 7406 duration = _this3$vars.duration, 7407 delay = _this3$vars.delay, 7408 immediateRender = _this3$vars.immediateRender, 7409 stagger = _this3$vars.stagger, 7410 overwrite = _this3$vars.overwrite, 7411 keyframes = _this3$vars.keyframes, 7412 defaults = _this3$vars.defaults, 7413 scrollTrigger = _this3$vars.scrollTrigger, 7414 yoyoEase = _this3$vars.yoyoEase, 7415 parent = vars.parent || _globalTimeline, 7416 parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [targets] : toArray(targets), 7417 tl, 7418 i, 7419 copy, 7420 l, 7421 p, 7422 curTarget, 7423 staggerFunc, 7424 staggerVarsToMerge; 7425 _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://greensock.com", !_config.nullTargetWarn) || []; 7426 _this3._ptLookup = []; 7427 _this3._overwrite = overwrite; 7428 7429 if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 7430 vars = _this3.vars; 7431 tl = _this3.timeline = new Timeline({ 7432 data: "nested", 7433 defaults: defaults || {} 7434 }); 7435 tl.kill(); 7436 tl.parent = tl._dp = _assertThisInitialized(_this3); 7437 tl._start = 0; 7438 7439 if (keyframes) { 7440 _setDefaults(tl.vars.defaults, { 7441 ease: "none" 7442 }); 7443 7444 stagger ? parsedTargets.forEach(function (t, i) { 7445 return keyframes.forEach(function (frame, j) { 7446 return tl.to(t, frame, j ? ">" : i * stagger); 7447 }); 7448 }) : keyframes.forEach(function (frame) { 7449 return tl.to(parsedTargets, frame, ">"); 7450 }); 7451 } else { 7452 l = parsedTargets.length;
vendor: 9,439 bytes, lines 7453-7657
7453 staggerFunc = stagger ? distribute(stagger) : _emptyFunc; 7454 7455 if (_isObject(stagger)) { 7456 for (p in stagger) { 7457 if (~_staggerTweenProps.indexOf(p)) { 7458 staggerVarsToMerge || (staggerVarsToMerge = {}); 7459 staggerVarsToMerge[p] = stagger[p]; 7460 } 7461 } 7462 } 7463 7464 for (i = 0; i < l; i++) { 7465 copy = {}; 7466 7467 for (p in vars) { 7468 if (_staggerPropsToSkip.indexOf(p) < 0) { 7469 copy[p] = vars[p]; 7470 } 7471 } 7472 7473 copy.stagger = 0; 7474 yoyoEase && (copy.yoyoEase = yoyoEase); 7475 staggerVarsToMerge && _merge(copy, staggerVarsToMerge); 7476 curTarget = parsedTargets[i]; 7477 copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets); 7478 copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay; 7479 7480 if (!stagger && l === 1 && copy.delay) { 7481 _this3._delay = delay = copy.delay; 7482 _this3._start += delay; 7483 copy.delay = 0; 7484 } 7485 7486 tl.to(curTarget, copy, staggerFunc(i, curTarget, parsedTargets)); 7487 } 7488 7489 tl.duration() ? duration = delay = 0 : _this3.timeline = 0; 7490 } 7491 7492 duration || _this3.duration(duration = tl.duration()); 7493 } else { 7494 _this3.timeline = 0; 7495 } 7496 7497 if (overwrite === true && !_suppressOverwrites) { 7498 _overwritingTween = _assertThisInitialized(_this3); 7499 7500 _globalTimeline.killTweensOf(parsedTargets); 7501 7502 _overwritingTween = 0; 7503 } 7504 7505 _addToTimeline(parent, _assertThisInitialized(_this3), position); 7506 7507 vars.reversed && _this3.reverse(); 7508 vars.paused && _this3.paused(true); 7509 7510 if (immediateRender || !duration && !keyframes && _this3._start === _round(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") { 7511 _this3._tTime = -_tinyNum; 7512 7513 _this3.render(Math.max(0, -delay)); 7514 } 7515 7516 scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger); 7517 return _this3; 7518 } 7519 7520 var _proto3 = Tween.prototype; 7521 7522 _proto3.render = function render(totalTime, suppressEvents, force) { 7523 var prevTime = this._time, 7524 tDur = this._tDur, 7525 dur = this._dur, 7526 tTime = totalTime > tDur - _tinyNum && totalTime >= 0 ? tDur : totalTime < _tinyNum ? 0 : totalTime, 7527 time, 7528 pt, 7529 iteration, 7530 cycleDuration, 7531 prevIteration, 7532 isYoyo, 7533 ratio, 7534 timeline, 7535 yoyoEase; 7536 7537 if (!dur) { 7538 _renderZeroDurationTween(this, totalTime, suppressEvents, force); 7539 } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== totalTime < 0) { 7540 time = tTime; 7541 timeline = this.timeline; 7542 7543 if (this._repeat) { 7544 cycleDuration = dur + this._rDelay; 7545 7546 if (this._repeat < -1 && totalTime < 0) { 7547 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 7548 } 7549 7550 time = _round(tTime % cycleDuration); 7551 7552 if (tTime === tDur) { 7553 iteration = this._repeat; 7554 time = dur; 7555 } else { 7556 iteration = ~~(tTime / cycleDuration); 7557 7558 if (iteration && iteration === tTime / cycleDuration) { 7559 time = dur; 7560 iteration--; 7561 } 7562 7563 time > dur && (time = dur); 7564 } 7565 7566 isYoyo = this._yoyo && iteration & 1; 7567 7568 if (isYoyo) { 7569 yoyoEase = this._yEase; 7570 time = dur - time; 7571 } 7572 7573 prevIteration = _animationCycle(this._tTime, cycleDuration); 7574 7575 if (time === prevTime && !force && this._initted) { 7576 return this; 7577 } 7578 7579 if (iteration !== prevIteration) { 7580 timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo); 7581 7582 if (this.vars.repeatRefresh && !isYoyo && !this._lock) { 7583 this._lock = force = 1; 7584 this.render(_round(cycleDuration * iteration), true).invalidate()._lock = 0; 7585 } 7586 } 7587 } 7588 7589 if (!this._initted) { 7590 if (_attemptInitTween(this, totalTime < 0 ? totalTime : time, force, suppressEvents)) { 7591 this._tTime = 0; 7592 return this; 7593 } 7594 7595 if (dur !== this._dur) { 7596 return this.render(totalTime, suppressEvents, force); 7597 } 7598 } 7599 7600 this._tTime = tTime; 7601 this._time = time; 7602 7603 if (!this._act && this._ts) { 7604 this._act = 1; 7605 this._lazy = 0; 7606 } 7607 7608 this.ratio = ratio = (yoyoEase || this._ease)(time / dur); 7609 7610 if (this._from) { 7611 this.ratio = ratio = 1 - ratio; 7612 } 7613 7614 if (time && !prevTime && !suppressEvents) { 7615 _callback(this, "onStart"); 7616 7617 if (this._tTime !== tTime) { 7618 return this; 7619 } 7620 } 7621 7622 pt = this._pt; 7623 7624 while (pt) { 7625 pt.r(ratio, pt.d); 7626 pt = pt._next; 7627 } 7628 7629 timeline && timeline.render(totalTime < 0 ? totalTime : !time && isYoyo ? -_tinyNum : timeline._dur * ratio, suppressEvents, force) || this._startAt && (this._zTime = totalTime); 7630 7631 if (this._onUpdate && !suppressEvents) { 7632 totalTime < 0 && this._startAt && this._startAt.render(totalTime, true, force); 7633 7634 _callback(this, "onUpdate"); 7635 } 7636 7637 this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat"); 7638 7639 if ((tTime === this._tDur || !tTime) && this._tTime === tTime) { 7640 totalTime < 0 && this._startAt && !this._onUpdate && this._startAt.render(totalTime, true, true); 7641 (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); 7642 7643 if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime)) { 7644 _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true); 7645 7646 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 7647 } 7648 } 7649 } 7650 7651 return this; 7652 }; 7653 7654 _proto3.targets = function targets() { 7655 return this._targets; 7656 }; 7657
vendor: 17,726 bytes, lines 7658-8085
7658 _proto3.invalidate = function invalidate() { 7659 this._pt = this._op = this._startAt = this._onUpdate = this._lazy = this.ratio = 0; 7660 this._ptLookup = []; 7661 this.timeline && this.timeline.invalidate(); 7662 return _Animation2.prototype.invalidate.call(this); 7663 }; 7664 7665 _proto3.kill = function kill(targets, vars) { 7666 if (vars === void 0) { 7667 vars = "all"; 7668 } 7669 7670 if (!targets && (!vars || vars === "all")) { 7671 this._lazy = this._pt = 0; 7672 return this.parent ? _interrupt(this) : this; 7673 } 7674 7675 if (this.timeline) { 7676 var tDur = this.timeline.totalDuration(); 7677 this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this); 7678 this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1); 7679 return this; 7680 } 7681 7682 var parsedTargets = this._targets, 7683 killingTargets = targets ? toArray(targets) : parsedTargets, 7684 propTweenLookup = this._ptLookup, 7685 firstPT = this._pt, 7686 overwrittenProps, 7687 curLookup, 7688 curOverwriteProps, 7689 props, 7690 p, 7691 pt, 7692 i; 7693 7694 if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) { 7695 vars === "all" && (this._pt = 0); 7696 return _interrupt(this); 7697 } 7698 7699 overwrittenProps = this._op = this._op || []; 7700 7701 if (vars !== "all") { 7702 if (_isString(vars)) { 7703 p = {}; 7704 7705 _forEachName(vars, function (name) { 7706 return p[name] = 1; 7707 }); 7708 7709 vars = p; 7710 } 7711 7712 vars = _addAliasesToVars(parsedTargets, vars); 7713 } 7714 7715 i = parsedTargets.length; 7716 7717 while (i--) { 7718 if (~killingTargets.indexOf(parsedTargets[i])) { 7719 curLookup = propTweenLookup[i]; 7720 7721 if (vars === "all") { 7722 overwrittenProps[i] = vars; 7723 props = curLookup; 7724 curOverwriteProps = {}; 7725 } else { 7726 curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {}; 7727 props = vars; 7728 } 7729 7730 for (p in props) { 7731 pt = curLookup && curLookup[p]; 7732 7733 if (pt) { 7734 if (!("kill" in pt.d) || pt.d.kill(p) === true) { 7735 _removeLinkedListItem(this, pt, "_pt"); 7736 } 7737 7738 delete curLookup[p]; 7739 } 7740 7741 if (curOverwriteProps !== "all") { 7742 curOverwriteProps[p] = 1; 7743 } 7744 } 7745 } 7746 } 7747 7748 this._initted && !this._pt && firstPT && _interrupt(this); 7749 return this; 7750 }; 7751 7752 Tween.to = function to(targets, vars) { 7753 return new Tween(targets, vars, arguments[2]); 7754 }; 7755 7756 Tween.from = function from(targets, vars) { 7757 return _createTweenType(1, arguments); 7758 }; 7759 7760 Tween.delayedCall = function delayedCall(delay, callback, params, scope) { 7761 return new Tween(callback, 0, { 7762 immediateRender: false, 7763 lazy: false, 7764 overwrite: false, 7765 delay: delay, 7766 onComplete: callback, 7767 onReverseComplete: callback, 7768 onCompleteParams: params, 7769 onReverseCompleteParams: params, 7770 callbackScope: scope 7771 }); 7772 }; 7773 7774 Tween.fromTo = function fromTo(targets, fromVars, toVars) { 7775 return _createTweenType(2, arguments); 7776 }; 7777 7778 Tween.set = function set(targets, vars) { 7779 vars.duration = 0; 7780 vars.repeatDelay || (vars.repeat = 0); 7781 return new Tween(targets, vars); 7782 }; 7783 7784 Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) { 7785 return _globalTimeline.killTweensOf(targets, props, onlyActive); 7786 }; 7787 7788 return Tween; 7789 }(Animation); 7790 7791 _setDefaults(Tween.prototype, { 7792 _targets: [], 7793 _lazy: 0, 7794 _startAt: 0, 7795 _op: 0, 7796 _onInit: 0 7797 }); 7798 7799 _forEachName("staggerTo,staggerFrom,staggerFromTo", function (name) { 7800 Tween[name] = function () { 7801 var tl = new Timeline(), 7802 params = _slice.call(arguments, 0); 7803 7804 params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0); 7805 return tl[name].apply(tl, params); 7806 }; 7807 }); 7808 7809 var _setterPlain = function _setterPlain(target, property, value) { 7810 return target[property] = value; 7811 }, 7812 _setterFunc = function _setterFunc(target, property, value) { 7813 return target[property](value); 7814 }, 7815 _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) { 7816 return target[property](data.fp, value); 7817 }, 7818 _setterAttribute = function _setterAttribute(target, property, value) { 7819 return target.setAttribute(property, value); 7820 }, 7821 _getSetter = function _getSetter(target, property) { 7822 return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain; 7823 }, 7824 _renderPlain = function _renderPlain(ratio, data) { 7825 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1000000) / 1000000, data); 7826 }, 7827 _renderBoolean = function _renderBoolean(ratio, data) { 7828 return data.set(data.t, data.p, !!(data.s + data.c * ratio), data); 7829 }, 7830 _renderComplexString = function _renderComplexString(ratio, data) { 7831 var pt = data._pt, 7832 s = ""; 7833 7834 if (!ratio && data.b) { 7835 s = data.b; 7836 } else if (ratio === 1 && data.e) { 7837 s = data.e; 7838 } else { 7839 while (pt) { 7840 s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s; 7841 pt = pt._next; 7842 } 7843 7844 s += data.c; 7845 } 7846 7847 data.set(data.t, data.p, s, data); 7848 }, 7849 _renderPropTweens = function _renderPropTweens(ratio, data) { 7850 var pt = data._pt; 7851 7852 while (pt) { 7853 pt.r(ratio, pt.d); 7854 pt = pt._next; 7855 } 7856 }, 7857 _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) { 7858 var pt = this._pt, 7859 next; 7860 7861 while (pt) { 7862 next = pt._next; 7863 pt.p === property && pt.modifier(modifier, tween, target); 7864 pt = next; 7865 } 7866 }, 7867 _killPropTweensOf = function _killPropTweensOf(property) { 7868 var pt = this._pt, 7869 hasNonDependentRemaining, 7870 next; 7871 7872 while (pt) { 7873 next = pt._next; 7874 7875 if (pt.p === property && !pt.op || pt.op === property) { 7876 _removeLinkedListItem(this, pt, "_pt"); 7877 } else if (!pt.dep) { 7878 hasNonDependentRemaining = 1; 7879 } 7880 7881 pt = next; 7882 } 7883 7884 return !hasNonDependentRemaining; 7885 }, 7886 _setterWithModifier = function _setterWithModifier(target, property, value, data) { 7887 data.mSet(target, property, data.m.call(data.tween, value, data.mt), data); 7888 }, 7889 _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) { 7890 var pt = parent._pt, 7891 next, 7892 pt2, 7893 first, 7894 last; 7895 7896 while (pt) { 7897 next = pt._next; 7898 pt2 = first; 7899 7900 while (pt2 && pt2.pr > pt.pr) { 7901 pt2 = pt2._next; 7902 } 7903 7904 if (pt._prev = pt2 ? pt2._prev : last) { 7905 pt._prev._next = pt; 7906 } else { 7907 first = pt; 7908 } 7909 7910 if (pt._next = pt2) { 7911 pt2._prev = pt; 7912 } else { 7913 last = pt; 7914 } 7915 7916 pt = next; 7917 } 7918 7919 parent._pt = first; 7920 }; 7921 7922 var PropTween = function () { 7923 function PropTween(next, target, prop, start, change, renderer, data, setter, priority) { 7924 this.t = target; 7925 this.s = start; 7926 this.c = change; 7927 this.p = prop; 7928 this.r = renderer || _renderPlain; 7929 this.d = data || this; 7930 this.set = setter || _setterPlain; 7931 this.pr = priority || 0; 7932 this._next = next; 7933 7934 if (next) { 7935 next._prev = this; 7936 } 7937 } 7938 7939 var _proto4 = PropTween.prototype; 7940 7941 _proto4.modifier = function modifier(func, tween, target) { 7942 this.mSet = this.mSet || this.set; 7943 this.set = _setterWithModifier; 7944 this.m = func; 7945 this.mt = target; 7946 this.tween = tween; 7947 }; 7948 7949 return PropTween; 7950 }(); 7951 7952 _forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", function (name) { 7953 return _reservedProps[name] = 1; 7954 }); 7955 7956 _globals.TweenMax = _globals.TweenLite = Tween; 7957 _globals.TimelineLite = _globals.TimelineMax = Timeline; 7958 _globalTimeline = new Timeline({ 7959 sortChildren: false, 7960 defaults: _defaults, 7961 autoRemoveChildren: true, 7962 id: "root", 7963 smoothChildTiming: true 7964 }); 7965 _config.stringFilter = _colorStringFilter; 7966 var _gsap = { 7967 registerPlugin: function registerPlugin() { 7968 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 7969 args[_key2] = arguments[_key2]; 7970 } 7971 7972 args.forEach(function (config) { 7973 return _createPlugin(config); 7974 }); 7975 }, 7976 timeline: function timeline(vars) { 7977 return new Timeline(vars); 7978 }, 7979 getTweensOf: function getTweensOf(targets, onlyActive) { 7980 return _globalTimeline.getTweensOf(targets, onlyActive); 7981 }, 7982 getProperty: function getProperty(target, property, unit, uncache) { 7983 _isString(target) && (target = toArray(target)[0]); 7984 7985 var getter = _getCache(target || {}).get, 7986 format = unit ? _passThrough : _numericIfPossible; 7987 7988 unit === "native" && (unit = ""); 7989 return !target ? target : !property ? function (property, unit, uncache) { 7990 return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 7991 } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 7992 }, 7993 quickSetter: function quickSetter(target, property, unit) { 7994 target = toArray(target); 7995 7996 if (target.length > 1) { 7997 var setters = target.map(function (t) { 7998 return gsap.quickSetter(t, property, unit); 7999 }), 8000 l = setters.length; 8001 return function (value) { 8002 var i = l; 8003 8004 while (i--) { 8005 setters[i](value); 8006 } 8007 }; 8008 } 8009 8010 target = target[0] || {}; 8011 8012 var Plugin = _plugins[property], 8013 cache = _getCache(target), 8014 p = cache.harness && (cache.harness.aliases || {})[property] || property, 8015 setter = Plugin ? function (value) { 8016 var p = new Plugin(); 8017 _quickTween._pt = 0; 8018 p.init(target, unit ? value + unit : value, _quickTween, 0, [target]); 8019 p.render(1, p); 8020 _quickTween._pt && _renderPropTweens(1, _quickTween); 8021 } : cache.set(target, p); 8022 8023 return Plugin ? setter : function (value) { 8024 return setter(target, p, unit ? value + unit : value, cache, 1); 8025 }; 8026 }, 8027 isTweening: function isTweening(targets) { 8028 return _globalTimeline.getTweensOf(targets, true).length > 0; 8029 }, 8030 defaults: function defaults(value) { 8031 value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease)); 8032 return _mergeDeep(_defaults, value || {}); 8033 }, 8034 config: function config(value) { 8035 return _mergeDeep(_config, value || {}); 8036 }, 8037 registerEffect: function registerEffect(_ref3) { 8038 var name = _ref3.name, 8039 effect = _ref3.effect, 8040 plugins = _ref3.plugins, 8041 defaults = _ref3.defaults, 8042 extendTimeline = _ref3.extendTimeline; 8043 (plugins || "").split(",").forEach(function (pluginName) { 8044 return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin."); 8045 }); 8046 8047 _effects[name] = function (targets, vars, tl) { 8048 return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl); 8049 }; 8050 8051 if (extendTimeline) { 8052 Timeline.prototype[name] = function (targets, vars, position) { 8053 return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position); 8054 }; 8055 } 8056 }, 8057 registerEase: function registerEase(name, ease) { 8058 _easeMap[name] = _parseEase(ease); 8059 }, 8060 parseEase: function parseEase(ease, defaultEase) { 8061 return arguments.length ? _parseEase(ease, defaultEase) : _easeMap; 8062 }, 8063 getById: function getById(id) { 8064 return _globalTimeline.getById(id); 8065 }, 8066 exportRoot: function exportRoot(vars, includeDelayedCalls) { 8067 if (vars === void 0) { 8068 vars = {}; 8069 } 8070 8071 var tl = new Timeline(vars), 8072 child, 8073 next; 8074 tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming); 8075 8076 _globalTimeline.remove(tl); 8077 8078 tl._dp = 0; 8079 tl._time = tl._tTime = _globalTimeline._time; 8080 child = _globalTimeline._first; 8081 8082 while (child) { 8083 next = child._next; 8084 8085 if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) {
8086 _addToTimeline(tl, child, child._start - child._delay); 8087 } 8088 8089 child = next; 8090 } 8091 8092 _addToTimeline(_globalTimeline, tl, 0); 8093 8094 return tl; 8095 }, 8096 utils: { 8097 wrap: wrap, 8098 wrapYoyo: wrapYoyo, 8099 distribute: distribute, 8100 random: random, 8101 snap: snap, 8102 normalize: normalize, 8103 getUnit: getUnit, 8104 clamp: clamp, 8105 splitColor: splitColor, 8106 toArray: toArray, 8107 selector: selector, 8108 mapRange: mapRange, 8109 pipe: pipe, 8110 unitize: unitize, 8111 interpolate: interpolate, 8112 shuffle: shuffle 8113 }, 8114 install: _install, 8115 effects: _effects, 8116 ticker: _ticker, 8117 updateRoot: Timeline.updateRoot, 8118 plugins: _plugins, 8119 globalTimeline: _globalTimeline, 8120 core: { 8121 PropTween: PropTween, 8122 globals: _addGlobal, 8123 Tween: Tween, 8124 Timeline: Timeline, 8125 Animation: Animation, 8126 getCache: _getCache, 8127 _removeLinkedListItem: _removeLinkedListItem, 8128 suppressOverwrites: function suppressOverwrites(value) { 8129 return _suppressOverwrites = value; 8130 } 8131 } 8132 }; 8133 8134 _forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function (name) { 8135 return _gsap[name] = Tween[name]; 8136 }); 8137 8138 _ticker.add(Timeline.updateRoot); 8139 8140 _quickTween = _gsap.to({}, { 8141 duration: 0 8142 }); 8143 8144 var _getPluginPropTween = function _getPluginPropTween(plugin, prop
vendor: 25,731 bytes, lines 8144-8712
8144) { 8145 var pt = plugin._pt; 8146 8147 while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) { 8148 pt = pt._next; 8149 } 8150 8151 return pt; 8152 }, 8153 _addModifiers = function _addModifiers(tween, modifiers) { 8154 var targets = tween._targets, 8155 p, 8156 i, 8157 pt; 8158 8159 for (p in modifiers) { 8160 i = targets.length; 8161 8162 while (i--) { 8163 pt = tween._ptLookup[i][p]; 8164 8165 if (pt && (pt = pt.d)) { 8166 if (pt._pt) { 8167 pt = _getPluginPropTween(pt, p); 8168 } 8169 8170 pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p); 8171 } 8172 } 8173 } 8174 }, 8175 _buildModifierPlugin = function _buildModifierPlugin(name, modifier) { 8176 return { 8177 name: name, 8178 rawVars: 1, 8179 init: function init(target, vars, tween) { 8180 tween._onInit = function (tween) { 8181 var temp, p; 8182 8183 if (_isString(vars)) { 8184 temp = {}; 8185 8186 _forEachName(vars, function (name) { 8187 return temp[name] = 1; 8188 }); 8189 8190 vars = temp; 8191 } 8192 8193 if (modifier) { 8194 temp = {}; 8195 8196 for (p in vars) { 8197 temp[p] = modifier(vars[p]); 8198 } 8199 8200 vars = temp; 8201 } 8202 8203 _addModifiers(tween, vars); 8204 }; 8205 } 8206 }; 8207 }; 8208 8209 var gsap = _gsap.registerPlugin({ 8210 name: "attr", 8211 init: function init(target, vars, tween, index, targets) { 8212 var p, pt; 8213 8214 for (p in vars) { 8215 pt = this.add(target, "setAttribute", (target.getAttribute(p) || 0) + "", vars[p], index, targets, 0, 0, p); 8216 pt && (pt.op = p); 8217 8218 this._props.push(p); 8219 } 8220 } 8221 }, { 8222 name: "endArray", 8223 init: function init(target, value) { 8224 var i = value.length; 8225 8226 while (i--) { 8227 this.add(target, i, target[i] || 0, value[i]); 8228 } 8229 } 8230 }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap; 8231 Tween.version = Timeline.version = gsap.version = "3.7.1"; 8232 _coreReady = 1; 8233 _windowExists() && _wake(); 8234 var Power0 = _easeMap.Power0, 8235 Power1 = _easeMap.Power1, 8236 Power2 = _easeMap.Power2, 8237 Power3 = _easeMap.Power3, 8238 Power4 = _easeMap.Power4, 8239 Linear = _easeMap.Linear, 8240 Quad = _easeMap.Quad, 8241 Cubic = _easeMap.Cubic, 8242 Quart = _easeMap.Quart, 8243 Quint = _easeMap.Quint, 8244 Strong = _easeMap.Strong, 8245 Elastic = _easeMap.Elastic, 8246 Back = _easeMap.Back, 8247 SteppedEase = _easeMap.SteppedEase, 8248 Bounce = _easeMap.Bounce, 8249 Sine = _easeMap.Sine, 8250 Expo = _easeMap.Expo, 8251 Circ = _easeMap.Circ; 8252 8253 var _win$1, 8254 _doc$1, 8255 _docElement, 8256 _pluginInitted, 8257 _tempDiv, 8258 _tempDivStyler, 8259 _recentSetterPlugin, 8260 _windowExists$1 = function _windowExists() { 8261 return typeof window !== "undefined"; 8262 }, 8263 _transformProps = {}, 8264 _RAD2DEG = 180 / Math.PI, 8265 _DEG2RAD = Math.PI / 180, 8266 _atan2 = Math.atan2, 8267 _bigNum$1 = 1e8, 8268 _capsExp = /([A-Z])/g, 8269 _horizontalExp = /(?:left|right|width|margin|padding|x)/i, 8270 _complexExp = /[\s,\(]\S/, 8271 _propertyAliases = { 8272 autoAlpha: "opacity,visibility", 8273 scale: "scaleX,scaleY", 8274 alpha: "opacity" 8275 }, 8276 _renderCSSProp = function _renderCSSProp(ratio, data) { 8277 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 8278 }, 8279 _renderPropWithEnd = function _renderPropWithEnd(ratio, data) { 8280 return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 8281 }, 8282 _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) { 8283 return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data); 8284 }, 8285 _renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) { 8286 var value = data.s + data.c * ratio; 8287 data.set(data.t, data.p, ~~(value + (value < 0 ? -.5 : .5)) + data.u, data); 8288 }, 8289 _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) { 8290 return data.set(data.t, data.p, ratio ? data.e : data.b, data); 8291 }, 8292 _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) { 8293 return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data); 8294 }, 8295 _setterCSSStyle = function _setterCSSStyle(target, property, value) { 8296 return target.style[property] = value; 8297 }, 8298 _setterCSSProp = function _setterCSSProp(target, property, value) { 8299 return target.style.setProperty(property, value); 8300 }, 8301 _setterTransform = function _setterTransform(target, property, value) { 8302 return target._gsap[property] = value; 8303 }, 8304 _setterScale = function _setterScale(target, property, value) { 8305 return target._gsap.scaleX = target._gsap.scaleY = value; 8306 }, 8307 _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) { 8308 var cache = target._gsap; 8309 cache.scaleX = cache.scaleY = value; 8310 cache.renderTransform(ratio, cache); 8311 }, 8312 _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) { 8313 var cache = target._gsap; 8314 cache[property] = value; 8315 cache.renderTransform(ratio, cache); 8316 }, 8317 _transformProp = "transform", 8318 _transformOriginProp = _transformProp + "Origin", 8319 _supports3D, 8320 _createElement = function _createElement(type, ns) { 8321 var e = _doc$1.createElementNS ? _doc$1.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$1.createElement(type); 8322 return e.style ? e : _doc$1.createElement(type); 8323 }, 8324 _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) { 8325 var cs = getComputedStyle(target); 8326 return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || ""; 8327 }, 8328 _prefixes = "O,Moz,ms,Ms,Webkit".split(","), 8329 _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) { 8330 var e = element || _tempDiv, 8331 s = e.style, 8332 i = 5; 8333 8334 if (property in s && !preferPrefix) { 8335 return property; 8336 } 8337 8338 property = property.charAt(0).toUpperCase() + property.substr(1); 8339 8340 while (i-- && !(_prefixes[i] + property in s)) { } 8341 8342 return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property; 8343 }, 8344 _initCore = function _initCore() { 8345 if (_windowExists$1() && window.document) { 8346 _win$1 = window; 8347 _doc$1 = _win$1.document; 8348 _docElement = _doc$1.documentElement; 8349 _tempDiv = _createElement("div") || { 8350 style: {} 8351 }; 8352 _tempDivStyler = _createElement("div"); 8353 _transformProp = _checkPropPrefix(_transformProp); 8354 _transformOriginProp = _transformProp + "Origin"; 8355 _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0"; 8356 _supports3D = !!_checkPropPrefix("perspective"); 8357 _pluginInitted = 1; 8358 } 8359 }, 8360 _getBBoxHack = function _getBBoxHack(swapIfPossible) { 8361 var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), 8362 oldParent = this.parentNode, 8363 oldSibling = this.nextSibling, 8364 oldCSS = this.style.cssText, 8365 bbox; 8366 8367 _docElement.appendChild(svg); 8368 8369 svg.appendChild(this); 8370 this.style.display = "block"; 8371 8372 if (swapIfPossible) { 8373 try { 8374 bbox = this.getBBox(); 8375 this._gsapBBox = this.getBBox; 8376 this.getBBox = _getBBoxHack; 8377 } catch (e) { } 8378 } else if (this._gsapBBox) { 8379 bbox = this._gsapBBox(); 8380 } 8381 8382 if (oldParent) { 8383 if (oldSibling) { 8384 oldParent.insertBefore(this, oldSibling); 8385 } else { 8386 oldParent.appendChild(this); 8387 } 8388 } 8389 8390 _docElement.removeChild(svg); 8391 8392 this.style.cssText = oldCSS; 8393 return bbox; 8394 }, 8395 _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) { 8396 var i = attributesArray.length; 8397 8398 while (i--) { 8399 if (target.hasAttribute(attributesArray[i])) { 8400 return target.getAttribute(attributesArray[i]); 8401 } 8402 } 8403 }, 8404 _getBBox = function _getBBox(target) { 8405 var bounds; 8406 8407 try { 8408 bounds = target.getBBox(); 8409 } catch (error) { 8410 bounds = _getBBoxHack.call(target, true); 8411 } 8412 8413 bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true)); 8414 return bounds && !bounds.width && !bounds.x && !bounds.y ? { 8415 x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0, 8416 y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0, 8417 width: 0, 8418 height: 0 8419 } : bounds; 8420 }, 8421 _isSVG = function _isSVG(e) { 8422 return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); 8423 }, 8424 _removeProperty = function _removeProperty(target, property) { 8425 if (property) { 8426 var style = target.style; 8427 8428 if (property in _transformProps && property !== _transformOriginProp) { 8429 property = _transformProp; 8430 } 8431 8432 if (style.removeProperty) { 8433 if (property.substr(0, 2) === "ms" || property.substr(0, 6) === "webkit") { 8434 property = "-" + property; 8435 } 8436 8437 style.removeProperty(property.replace(_capsExp, "-$1").toLowerCase()); 8438 } else { 8439 style.removeAttribute(property); 8440 } 8441 } 8442 }, 8443 _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) { 8444 var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue); 8445 plugin._pt = pt; 8446 pt.b = beginning; 8447 pt.e = end; 8448 8449 plugin._props.push(property); 8450 8451 return pt; 8452 }, 8453 _nonConvertibleUnits = { 8454 deg: 1, 8455 rad: 1, 8456 turn: 1 8457 }, 8458 _convertToUnit = function _convertToUnit(target, property, value, unit) { 8459 var curValue = parseFloat(value) || 0, 8460 curUnit = (value + "").trim().substr((curValue + "").length) || "px", 8461 style = _tempDiv.style, 8462 horizontal = _horizontalExp.test(property), 8463 isRootSVG = target.tagName.toLowerCase() === "svg", 8464 measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"), 8465 amount = 100, 8466 toPixels = unit === "px", 8467 toPercent = unit === "%", 8468 px, 8469 parent, 8470 cache, 8471 isSVG; 8472 8473 if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) { 8474 return curValue; 8475 } 8476 8477 curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px")); 8478 isSVG = target.getCTM && _isSVG(target); 8479 8480 if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) { 8481 px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty]; 8482 return _round(toPercent ? curValue / px * amount : curValue / 100 * px); 8483 } 8484 8485 style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit); 8486 parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode; 8487 8488 if (isSVG) { 8489 parent = (target.ownerSVGElement || {}).parentNode; 8490 } 8491 8492 if (!parent || parent === _doc$1 || !parent.appendChild) { 8493 parent = _doc$1.body; 8494 } 8495 8496 cache = parent._gsap; 8497 8498 if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time) { 8499 return _round(curValue / cache.width * amount); 8500 } else { 8501 (toPercent || curUnit === "%") && (style.position = _getComputedProperty(target, "position")); 8502 parent === target && (style.position = "static"); 8503 parent.appendChild(_tempDiv); 8504 px = _tempDiv[measureProperty]; 8505 parent.removeChild(_tempDiv); 8506 style.position = "absolute"; 8507 8508 if (horizontal && toPercent) { 8509 cache = _getCache(parent); 8510 cache.time = _ticker.time; 8511 cache.width = parent[measureProperty]; 8512 } 8513 } 8514 8515 return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0); 8516 }, 8517 _get = function _get(target, property, unit, uncache) { 8518 var value; 8519 _pluginInitted || _initCore(); 8520 8521 if (property in _propertyAliases && property !== "transform") { 8522 property = _propertyAliases[property]; 8523 8524 if (~property.indexOf(",")) { 8525 property = property.split(",")[0]; 8526 } 8527 } 8528 8529 if (_transformProps[property] && property !== "transform") { 8530 value = _parseTransform(target, uncache); 8531 value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px"; 8532 } else { 8533 value = target.style[property]; 8534 8535 if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) { 8536 value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0); 8537 } 8538 } 8539 8540 return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value; 8541 }, 8542 _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) { 8543 if (!start || start === "none") { 8544 var p = _checkPropPrefix(prop, target, 1), 8545 s = p && _getComputedProperty(target, p, 1); 8546 8547 if (s && s !== start) { 8548 prop = p; 8549 start = s; 8550 } else if (prop === "borderColor") { 8551 start = _getComputedProperty(target, "borderTopColor"); 8552 } 8553 } 8554 8555 var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString), 8556 index = 0, 8557 matchIndex = 0, 8558 a, 8559 result, 8560 startValues, 8561 startNum, 8562 color, 8563 startValue, 8564 endValue, 8565 endNum, 8566 chunk, 8567 endUnit, 8568 startUnit, 8569 relative, 8570 endValues; 8571 pt.b = start; 8572 pt.e = end; 8573 start += ""; 8574 end += ""; 8575 8576 if (end === "auto") { 8577 target.style[prop] = end; 8578 end = _getComputedProperty(target, prop) || end; 8579 target.style[prop] = start; 8580 } 8581 8582 a = [start, end]; 8583 8584 _colorStringFilter(a); 8585 8586 start = a[0]; 8587 end = a[1]; 8588 startValues = start.match(_numWithUnitExp) || []; 8589 endValues = end.match(_numWithUnitExp) || []; 8590 8591 if (endValues.length) { 8592 while (result = _numWithUnitExp.exec(end)) { 8593 endValue = result[0]; 8594 chunk = end.substring(index, result.index); 8595 8596 if (color) { 8597 color = (color + 1) % 5; 8598 } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") { 8599 color = 1; 8600 } 8601 8602 if (endValue !== (startValue = startValues[matchIndex++] || "")) { 8603 startNum = parseFloat(startValue) || 0; 8604 startUnit = startValue.substr((startNum + "").length); 8605 relative = endValue.charAt(1) === "=" ? +(endValue.charAt(0) + "1") : 0; 8606 8607 if (relative) { 8608 endValue = endValue.substr(2); 8609 } 8610 8611 endNum = parseFloat(endValue); 8612 endUnit = endValue.substr((endNum + "").length); 8613 index = _numWithUnitExp.lastIndex - endUnit.length; 8614 8615 if (!endUnit) { 8616 endUnit = endUnit || _config.units[prop] || startUnit; 8617 8618 if (index === end.length) { 8619 end += endUnit; 8620 pt.e += endUnit; 8621 } 8622 } 8623 8624 if (startUnit !== endUnit) { 8625 startNum = _convertToUnit(target, prop, startValue, endUnit) || 0; 8626 } 8627 8628 pt._pt = { 8629 _next: pt._pt, 8630 p: chunk || matchIndex === 1 ? chunk : ",", 8631 s: startNum, 8632 c: relative ? relative * endNum : endNum - startNum, 8633 m: color && color < 4 || prop === "zIndex" ? Math.round : 0 8634 }; 8635 } 8636 } 8637 8638 pt.c = index < end.length ? end.substring(index, end.length) : ""; 8639 } else { 8640 pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue; 8641 } 8642 8643 _relExp.test(end) && (pt.e = 0); 8644 this._pt = pt; 8645 return pt; 8646 }, 8647 _keywordToPercent = { 8648 top: "0%", 8649 bottom: "100%", 8650 left: "0%", 8651 right: "100%", 8652 center: "50%" 8653 }, 8654 _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) { 8655 var split = value.split(" "), 8656 x = split[0], 8657 y = split[1] || "50%"; 8658 8659 if (x === "top" || x === "bottom" || y === "left" || y === "right") { 8660 value = x; 8661 x = y; 8662 y = value; 8663 } 8664 8665 split[0] = _keywordToPercent[x] || x; 8666 split[1] = _keywordToPercent[y] || y; 8667 return split.join(" "); 8668 }, 8669 _renderClearProps = function _renderClearProps(ratio, data) { 8670 if (data.tween && data.tween._time === data.tween._dur) { 8671 var target = data.t, 8672 style = target.style, 8673 props = data.u, 8674 cache = target._gsap, 8675 prop, 8676 clearTransforms, 8677 i; 8678 8679 if (props === "all" || props === true) { 8680 style.cssText = ""; 8681 clearTransforms = 1; 8682 } else { 8683 props = props.split(","); 8684 i = props.length; 8685 8686 while (--i > -1) { 8687 prop = props[i]; 8688 8689 if (_transformProps[prop]) { 8690 clearTransforms = 1; 8691 prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp; 8692 } 8693 8694 _removeProperty(target, prop); 8695 } 8696 } 8697 8698 if (clearTransforms) { 8699 _removeProperty(target, _transformProp); 8700 8701 if (cache) { 8702 cache.svg && target.removeAttribute("transform"); 8703 8704 _parseTransform(target, 1); 8705 8706 cache.uncache = 1; 8707 } 8708 } 8709 } 8710 }, 8711 _specialProps = { 8712 clearProps: function clearProps(plugin, target, property, endValue, tween) {
vendor: 4,123 bytes, lines 8713-8793
8713 if (tween.data !== "isFromStart") { 8714 var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps); 8715 pt.u = endValue; 8716 pt.pr = -10; 8717 pt.tween = tween; 8718 8719 plugin._props.push(property); 8720 8721 return 1; 8722 } 8723 } 8724 }, 8725 _identity2DMatrix = [1, 0, 0, 1, 0, 0], 8726 _rotationalProperties = {}, 8727 _isNullTransform = function _isNullTransform(value) { 8728 return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value; 8729 }, 8730 _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) { 8731 var matrixString = _getComputedProperty(target, _transformProp); 8732 8733 return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round); 8734 }, 8735 _getMatrix = function _getMatrix(target, force2D) { 8736 var cache = target._gsap || _getCache(target), 8737 style = target.style, 8738 matrix = _getComputedTransformMatrixAsArray(target), 8739 parent, 8740 nextSibling, 8741 temp, 8742 addedToDOM; 8743 8744 if (cache.svg && target.getAttribute("transform")) { 8745 temp = target.transform.baseVal.consolidate().matrix; 8746 matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f]; 8747 return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix; 8748 } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) { 8749 temp = style.display; 8750 style.display = "block"; 8751 parent = target.parentNode; 8752 8753 if (!parent || !target.offsetParent) { 8754 addedToDOM = 1; 8755 nextSibling = target.nextSibling; 8756 8757 _docElement.appendChild(target); 8758 } 8759 8760 matrix = _getComputedTransformMatrixAsArray(target); 8761 temp ? style.display = temp : _removeProperty(target, "display"); 8762 8763 if (addedToDOM) { 8764 nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target); 8765 } 8766 } 8767 8768 return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix; 8769 }, 8770 _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) { 8771 var cache = target._gsap, 8772 matrix = matrixArray || _getMatrix(target, true), 8773 xOriginOld = cache.xOrigin || 0, 8774 yOriginOld = cache.yOrigin || 0, 8775 xOffsetOld = cache.xOffset || 0, 8776 yOffsetOld = cache.yOffset || 0, 8777 a = matrix[0], 8778 b = matrix[1], 8779 c = matrix[2], 8780 d = matrix[3], 8781 tx = matrix[4], 8782 ty = matrix[5], 8783 originSplit = origin.split(" "), 8784 xOrigin = parseFloat(originSplit[0]) || 0, 8785 yOrigin = parseFloat(originSplit[1]) || 0, 8786 bounds, 8787 determinant, 8788 x, 8789 y; 8790 8791 if (!originIsAbsolute) { 8792 bounds = _getBBox(target); 8793 xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * boun
vendor: 10,030 bytes, lines 8793-9001
8793ds.width : xOrigin); 8794 yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin); 8795 } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) { 8796 x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant; 8797 y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant; 8798 xOrigin = x; 8799 yOrigin = y; 8800 } 8801 8802 if (smooth || smooth !== false && cache.smooth) { 8803 tx = xOrigin - xOriginOld; 8804 ty = yOrigin - yOriginOld; 8805 cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx; 8806 cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty; 8807 } else { 8808 cache.xOffset = cache.yOffset = 0; 8809 } 8810 8811 cache.xOrigin = xOrigin; 8812 cache.yOrigin = yOrigin; 8813 cache.smooth = !!smooth; 8814 cache.origin = origin; 8815 cache.originIsAbsolute = !!originIsAbsolute; 8816 target.style[_transformOriginProp] = "0px 0px"; 8817 8818 if (pluginToAddPropTweensTo) { 8819 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin); 8820 8821 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin); 8822 8823 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset); 8824 8825 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset); 8826 } 8827 8828 target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin); 8829 }, 8830 _parseTransform = function _parseTransform(target, uncache) { 8831 var cache = target._gsap || new GSCache(target); 8832 8833 if ("x" in cache && !uncache && !cache.uncache) { 8834 return cache; 8835 } 8836 8837 var style = target.style, 8838 invertedScaleX = cache.scaleX < 0, 8839 px = "px", 8840 deg = "deg", 8841 origin = _getComputedProperty(target, _transformOriginProp) || "0", 8842 x, 8843 y, 8844 z, 8845 scaleX, 8846 scaleY, 8847 rotation, 8848 rotationX, 8849 rotationY, 8850 skewX, 8851 skewY, 8852 perspective, 8853 xOrigin, 8854 yOrigin, 8855 matrix, 8856 angle, 8857 cos, 8858 sin, 8859 a, 8860 b, 8861 c, 8862 d, 8863 a12, 8864 a22, 8865 t1, 8866 t2, 8867 t3, 8868 a13, 8869 a23, 8870 a33, 8871 a42, 8872 a43, 8873 a32; 8874 x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0; 8875 scaleX = scaleY = 1; 8876 cache.svg = !!(target.getCTM && _isSVG(target)); 8877 matrix = _getMatrix(target, cache.svg); 8878 8879 if (cache.svg) { 8880 t1 = (!cache.uncache || origin === "0px 0px") && !uncache && target.getAttribute("data-svg-origin"); 8881 8882 _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix); 8883 } 8884 8885 xOrigin = cache.xOrigin || 0; 8886 yOrigin = cache.yOrigin || 0; 8887 8888 if (matrix !== _identity2DMatrix) { 8889 a = matrix[0]; 8890 b = matrix[1]; 8891 c = matrix[2]; 8892 d = matrix[3]; 8893 x = a12 = matrix[4]; 8894 y = a22 = matrix[5]; 8895 8896 if (matrix.length === 6) { 8897 scaleX = Math.sqrt(a * a + b * b); 8898 scaleY = Math.sqrt(d * d + c * c); 8899 rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0; 8900 skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0; 8901 skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD))); 8902 8903 if (cache.svg) { 8904 x -= xOrigin - (xOrigin * a + yOrigin * c); 8905 y -= yOrigin - (xOrigin * b + yOrigin * d); 8906 } 8907 } else { 8908 a32 = matrix[6]; 8909 a42 = matrix[7]; 8910 a13 = matrix[8]; 8911 a23 = matrix[9]; 8912 a33 = matrix[10]; 8913 a43 = matrix[11]; 8914 x = matrix[12]; 8915 y = matrix[13]; 8916 z = matrix[14]; 8917 angle = _atan2(a32, a33); 8918 rotationX = angle * _RAD2DEG; 8919 8920 if (angle) { 8921 cos = Math.cos(-angle); 8922 sin = Math.sin(-angle); 8923 t1 = a12 * cos + a13 * sin; 8924 t2 = a22 * cos + a23 * sin; 8925 t3 = a32 * cos + a33 * sin; 8926 a13 = a12 * -sin + a13 * cos; 8927 a23 = a22 * -sin + a23 * cos; 8928 a33 = a32 * -sin + a33 * cos; 8929 a43 = a42 * -sin + a43 * cos; 8930 a12 = t1; 8931 a22 = t2; 8932 a32 = t3; 8933 } 8934 8935 angle = _atan2(-c, a33); 8936 rotationY = angle * _RAD2DEG; 8937 8938 if (angle) { 8939 cos = Math.cos(-angle); 8940 sin = Math.sin(-angle); 8941 t1 = a * cos - a13 * sin; 8942 t2 = b * cos - a23 * sin; 8943 t3 = c * cos - a33 * sin; 8944 a43 = d * sin + a43 * cos; 8945 a = t1; 8946 b = t2; 8947 c = t3; 8948 } 8949 8950 angle = _atan2(b, a); 8951 rotation = angle * _RAD2DEG; 8952 8953 if (angle) { 8954 cos = Math.cos(angle); 8955 sin = Math.sin(angle); 8956 t1 = a * cos + b * sin; 8957 t2 = a12 * cos + a22 * sin; 8958 b = b * cos - a * sin; 8959 a22 = a22 * cos - a12 * sin; 8960 a = t1; 8961 a12 = t2; 8962 } 8963 8964 if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) { 8965 rotationX = rotation = 0; 8966 rotationY = 180 - rotationY; 8967 } 8968 8969 scaleX = _round(Math.sqrt(a * a + b * b + c * c)); 8970 scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32)); 8971 angle = _atan2(a12, a22); 8972 skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0; 8973 perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0; 8974 } 8975 8976 if (cache.svg) { 8977 t1 = target.getAttribute("transform"); 8978 cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp)); 8979 t1 && target.setAttribute("transform", t1); 8980 } 8981 } 8982 8983 if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) { 8984 if (invertedScaleX) { 8985 scaleX *= -1; 8986 skewX += rotation <= 0 ? 180 : -180; 8987 rotation += rotation <= 0 ? 180 : -180; 8988 } else { 8989 scaleY *= -1; 8990 skewX += skewX <= 0 ? 180 : -180; 8991 } 8992 } 8993 8994 cache.x = x - ((cache.xPercent = x && (cache.xPercent || (Math.round(target.offsetWidth / 2) === Math.round(-x) ? -50 : 0))) ? target.offsetWidth * cache.xPercent / 100 : 0) + px; 8995 cache.y = y - ((cache.yPercent = y && (cache.yPercent || (Math.round(target.offsetHeight / 2) === Math.round(-y) ? -50 : 0))) ? target.offsetHeight * cache.yPercent / 100 : 0) + px; 8996 cache.z = z + px; 8997 cache.scaleX = _round(scaleX); 8998 cache.scaleY = _round(scaleY); 8999 cache.rotation = _round(rotation) + deg; 9000 cache.rotationX = _round(rotationX) + deg; 9001 cache.rotationY = _round(rotationY) + deg;
vendor: 4,195 bytes, lines 9002-9090
9002 cache.skewX = skewX + deg; 9003 cache.skewY = skewY + deg; 9004 cache.transformPerspective = perspective + px; 9005 9006 if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || 0) { 9007 style[_transformOriginProp] = _firstTwoOnly(origin); 9008 } 9009 9010 cache.xOffset = cache.yOffset = 0; 9011 cache.force3D = _config.force3D; 9012 cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms; 9013 cache.uncache = 0; 9014 return cache; 9015 }, 9016 _firstTwoOnly = function _firstTwoOnly(value) { 9017 return (value = value.split(" "))[0] + " " + value[1]; 9018 }, 9019 _addPxTranslate = function _addPxTranslate(target, start, value) { 9020 var unit = getUnit(start); 9021 return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit; 9022 }, 9023 _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) { 9024 cache.z = "0px"; 9025 cache.rotationY = cache.rotationX = "0deg"; 9026 cache.force3D = 0; 9027 9028 _renderCSSTransforms(ratio, cache); 9029 }, 9030 _zeroDeg = "0deg", 9031 _zeroPx = "0px", 9032 _endParenthesis = ") ", 9033 _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) { 9034 var _ref = cache || this, 9035 xPercent = _ref.xPercent, 9036 yPercent = _ref.yPercent, 9037 x = _ref.x, 9038 y = _ref.y, 9039 z = _ref.z, 9040 rotation = _ref.rotation, 9041 rotationY = _ref.rotationY, 9042 rotationX = _ref.rotationX, 9043 skewX = _ref.skewX, 9044 skewY = _ref.skewY, 9045 scaleX = _ref.scaleX, 9046 scaleY = _ref.scaleY, 9047 transformPerspective = _ref.transformPerspective, 9048 force3D = _ref.force3D, 9049 target = _ref.target, 9050 zOrigin = _ref.zOrigin, 9051 transforms = "", 9052 use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true; 9053 9054 if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) { 9055 var angle = parseFloat(rotationY) * _DEG2RAD, 9056 a13 = Math.sin(angle), 9057 a33 = Math.cos(angle), 9058 cos; 9059 9060 angle = parseFloat(rotationX) * _DEG2RAD; 9061 cos = Math.cos(angle); 9062 x = _addPxTranslate(target, x, a13 * cos * -zOrigin); 9063 y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin); 9064 z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin); 9065 } 9066 9067 if (transformPerspective !== _zeroPx) { 9068 transforms += "perspective(" + transformPerspective + _endParenthesis; 9069 } 9070 9071 if (xPercent || yPercent) { 9072 transforms += "translate(" + xPercent + "%, " + yPercent + "%) "; 9073 } 9074 9075 if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) { 9076 transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis; 9077 } 9078 9079 if (rotation !== _zeroDeg) { 9080 transforms += "rotate(" + rotation + _endParenthesis; 9081 } 9082 9083 if (rotationY !== _zeroDeg) { 9084 transforms += "rotateY(" + rotationY + _endParenthesis; 9085 } 9086 9087 if (rotationX !== _zeroDeg) { 9088 transforms += "rotateX(" + rotationX + _endParenthesis; 9089 } 9090
vendor: 8,216 bytes, lines 9091-9278
9091 if (skewX !== _zeroDeg || skewY !== _zeroDeg) { 9092 transforms += "skew(" + skewX + ", " + skewY + _endParenthesis; 9093 } 9094 9095 if (scaleX !== 1 || scaleY !== 1) { 9096 transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis; 9097 } 9098 9099 target.style[_transformProp] = transforms || "translate(0, 0)"; 9100 }, 9101 _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) { 9102 var _ref2 = cache || this, 9103 xPercent = _ref2.xPercent, 9104 yPercent = _ref2.yPercent, 9105 x = _ref2.x, 9106 y = _ref2.y, 9107 rotation = _ref2.rotation, 9108 skewX = _ref2.skewX, 9109 skewY = _ref2.skewY, 9110 scaleX = _ref2.scaleX, 9111 scaleY = _ref2.scaleY, 9112 target = _ref2.target, 9113 xOrigin = _ref2.xOrigin, 9114 yOrigin = _ref2.yOrigin, 9115 xOffset = _ref2.xOffset, 9116 yOffset = _ref2.yOffset, 9117 forceCSS = _ref2.forceCSS, 9118 tx = parseFloat(x), 9119 ty = parseFloat(y), 9120 a11, 9121 a21, 9122 a12, 9123 a22, 9124 temp; 9125 9126 rotation = parseFloat(rotation); 9127 skewX = parseFloat(skewX); 9128 skewY = parseFloat(skewY); 9129 9130 if (skewY) { 9131 skewY = parseFloat(skewY); 9132 skewX += skewY; 9133 rotation += skewY; 9134 } 9135 9136 if (rotation || skewX) { 9137 rotation *= _DEG2RAD; 9138 skewX *= _DEG2RAD; 9139 a11 = Math.cos(rotation) * scaleX; 9140 a21 = Math.sin(rotation) * scaleX; 9141 a12 = Math.sin(rotation - skewX) * -scaleY; 9142 a22 = Math.cos(rotation - skewX) * scaleY; 9143 9144 if (skewX) { 9145 skewY *= _DEG2RAD; 9146 temp = Math.tan(skewX - skewY); 9147 temp = Math.sqrt(1 + temp * temp); 9148 a12 *= temp; 9149 a22 *= temp; 9150 9151 if (skewY) { 9152 temp = Math.tan(skewY); 9153 temp = Math.sqrt(1 + temp * temp); 9154 a11 *= temp; 9155 a21 *= temp; 9156 } 9157 } 9158 9159 a11 = _round(a11); 9160 a21 = _round(a21); 9161 a12 = _round(a12); 9162 a22 = _round(a22); 9163 } else { 9164 a11 = scaleX; 9165 a22 = scaleY; 9166 a21 = a12 = 0; 9167 } 9168 9169 if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) { 9170 tx = _convertToUnit(target, "x", x, "px"); 9171 ty = _convertToUnit(target, "y", y, "px"); 9172 } 9173 9174 if (xOrigin || yOrigin || xOffset || yOffset) { 9175 tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset); 9176 ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset); 9177 } 9178 9179 if (xPercent || yPercent) { 9180 temp = target.getBBox(); 9181 tx = _round(tx + xPercent / 100 * temp.width); 9182 ty = _round(ty + yPercent / 100 * temp.height); 9183 } 9184 9185 temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")"; 9186 target.setAttribute("transform", temp); 9187 forceCSS && (target.style[_transformProp] = temp); 9188 }, 9189 _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue, relative) { 9190 var cap = 360, 9191 isString = _isString(endValue), 9192 endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1), 9193 change = relative ? endNum * relative : endNum - startNum, 9194 finalValue = startNum + change + "deg", 9195 direction, 9196 pt; 9197 9198 if (isString) { 9199 direction = endValue.split("_")[1]; 9200 9201 if (direction === "short") { 9202 change %= cap; 9203 9204 if (change !== change % (cap / 2)) { 9205 change += change < 0 ? cap : -cap; 9206 } 9207 } 9208 9209 if (direction === "cw" && change < 0) { 9210 change = (change + cap * _bigNum$1) % cap - ~~(change / cap) * cap; 9211 } else if (direction === "ccw" && change > 0) { 9212 change = (change - cap * _bigNum$1) % cap - ~~(change / cap) * cap; 9213 } 9214 } 9215 9216 plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd); 9217 pt.e = finalValue; 9218 pt.u = "deg"; 9219 9220 plugin._props.push(property); 9221 9222 return pt; 9223 }, 9224 _assign = function _assign(target, source) { 9225 for (var p in source) { 9226 target[p] = source[p]; 9227 } 9228 9229 return target; 9230 }, 9231 _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) { 9232 var startCache = _assign({}, target._gsap), 9233 exclude = "perspective,force3D,transformOrigin,svgOrigin", 9234 style = target.style, 9235 endCache, 9236 p, 9237 startValue, 9238 endValue, 9239 startNum, 9240 endNum, 9241 startUnit, 9242 endUnit; 9243 9244 if (startCache.svg) { 9245 startValue = target.getAttribute("transform"); 9246 target.setAttribute("transform", ""); 9247 style[_transformProp] = transforms; 9248 endCache = _parseTransform(target, 1); 9249 9250 _removeProperty(target, _transformProp); 9251 9252 target.setAttribute("transform", startValue); 9253 } else { 9254 startValue = getComputedStyle(target)[_transformProp]; 9255 style[_transformProp] = transforms; 9256 endCache = _parseTransform(target, 1); 9257 style[_transformProp] = startValue; 9258 } 9259 9260 for (p in _transformProps) { 9261 startValue = startCache[p]; 9262 endValue = endCache[p]; 9263 9264 if (startValue !== endValue && exclude.indexOf(p) < 0) { 9265 startUnit = getUnit(startValue); 9266 endUnit = getUnit(endValue); 9267 startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue); 9268 endNum = parseFloat(endValue); 9269 plugin._pt = new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp); 9270 plugin._pt.u = endUnit || 0; 9271 9272 plugin._props.push(p); 9273 } 9274 } 9275 9276 _assign(endCache, startCache); 9277 }; 9278
vendor: 5,827 bytes, lines 9279-9401
9279 _forEachName("padding,margin,Width,Radius", function (name, index) { 9280 var t = "Top", 9281 r = "Right", 9282 b = "Bottom", 9283 l = "Left", 9284 props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function (side) { 9285 return index < 2 ? name + side : "border" + side + name; 9286 }); 9287 9288 _specialProps[index > 1 ? "border" + name : name] = function (plugin, target, property, endValue, tween) { 9289 var a, vars; 9290 9291 if (arguments.length < 4) { 9292 a = props.map(function (prop) { 9293 return _get(plugin, prop, property); 9294 }); 9295 vars = a.join(" "); 9296 return vars.split(a[0]).length === 5 ? a[0] : vars; 9297 } 9298 9299 a = (endValue + "").split(" "); 9300 vars = {}; 9301 props.forEach(function (prop, i) { 9302 return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0]; 9303 }); 9304 plugin.init(target, vars, tween); 9305 }; 9306 }); 9307 9308 var CSSPlugin = { 9309 name: "css", 9310 register: _initCore, 9311 targetTest: function targetTest(target) { 9312 return target.style && target.nodeType; 9313 }, 9314 init: function init(target, vars, tween, index, targets) { 9315 var props = this._props, 9316 style = target.style, 9317 startAt = tween.vars.startAt, 9318 startValue, 9319 endValue, 9320 endNum, 9321 startNum, 9322 type, 9323 specialProp, 9324 p, 9325 startUnit, 9326 endUnit, 9327 relative, 9328 isTransformRelated, 9329 transformPropTween, 9330 cache, 9331 smooth, 9332 hasPriority; 9333 _pluginInitted || _initCore(); 9334 9335 for (p in vars) { 9336 if (p === "autoRound") { 9337 continue; 9338 } 9339 9340 endValue = vars[p]; 9341 9342 if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) { 9343 continue; 9344 } 9345 9346 type = typeof endValue; 9347 specialProp = _specialProps[p]; 9348 9349 if (type === "function") { 9350 endValue = endValue.call(tween, index, target, targets); 9351 type = typeof endValue; 9352 } 9353 9354 if (type === "string" && ~endValue.indexOf("random(")) { 9355 endValue = _replaceRandom(endValue); 9356 } 9357 9358 if (specialProp) { 9359 specialProp(this, target, p, endValue, tween) && (hasPriority = 1); 9360 } else if (p.substr(0, 2) === "--") { 9361 startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim(); 9362 endValue += ""; 9363 _colorExp.lastIndex = 0; 9364 9365 if (!_colorExp.test(startValue)) { 9366 startUnit = getUnit(startValue); 9367 endUnit = getUnit(endValue); 9368 } 9369 9370 endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit); 9371 this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p); 9372 props.push(p); 9373 } else if (type !== "undefined") { 9374 if (startAt && p in startAt) { 9375 startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p]; 9376 p in _config.units && !getUnit(startValue) && (startValue += _config.units[p]); 9377 (startValue + "").charAt(1) === "=" && (startValue = _get(target, p)); 9378 } else { 9379 startValue = _get(target, p); 9380 } 9381 9382 startNum = parseFloat(startValue); 9383 relative = type === "string" && endValue.charAt(1) === "=" ? +(endValue.charAt(0) + "1") : 0; 9384 relative && (endValue = endValue.substr(2)); 9385 endNum = parseFloat(endValue); 9386 9387 if (p in _propertyAliases) { 9388 if (p === "autoAlpha") { 9389 if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) { 9390 startNum = 0; 9391 } 9392 9393 _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum); 9394 } 9395 9396 if (p !== "scale" && p !== "transform") { 9397 p = _propertyAliases[p]; 9398 ~p.indexOf(",") && (p = p.split(",")[0]); 9399 } 9400 } 9401
vendor: 6,104 bytes, lines 9402-9495
9402 isTransformRelated = p in _transformProps; 9403 9404 if (isTransformRelated) { 9405 if (!transformPropTween) { 9406 cache = target._gsap; 9407 cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform); 9408 smooth = vars.smoothOrigin !== false && cache.smooth; 9409 transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1); 9410 transformPropTween.dep = 1; 9411 } 9412 9413 if (p === "scale") { 9414 this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, (relative ? relative * endNum : endNum - cache.scaleY) || 0); 9415 props.push("scaleY", p); 9416 p += "X"; 9417 } else if (p === "transformOrigin") { 9418 endValue = _convertKeywordsToPercentages(endValue); 9419 9420 if (cache.svg) { 9421 _applySVGOrigin(target, endValue, 0, smooth, 0, this); 9422 } else { 9423 endUnit = parseFloat(endValue.split(" ")[2]) || 0; 9424 endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit); 9425 9426 _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue)); 9427 } 9428 9429 continue; 9430 } else if (p === "svgOrigin") { 9431 _applySVGOrigin(target, endValue, 1, smooth, 0, this); 9432 9433 continue; 9434 } else if (p in _rotationalProperties) { 9435 _addRotationalPropTween(this, cache, p, startNum, endValue, relative); 9436 9437 continue; 9438 } else if (p === "smoothOrigin") { 9439 _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue); 9440 9441 continue; 9442 } else if (p === "force3D") { 9443 cache[p] = endValue; 9444 continue; 9445 } else if (p === "transform") { 9446 _addRawTransformPTs(this, endValue, target); 9447 9448 continue; 9449 } 9450 } else if (!(p in style)) { 9451 p = _checkPropPrefix(p) || p; 9452 } 9453 9454 if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) { 9455 startUnit = (startValue + "").substr((startNum + "").length); 9456 endNum || (endNum = 0); 9457 endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit); 9458 startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit)); 9459 this._pt = new PropTween(this._pt, isTransformRelated ? cache : style, p, startNum, relative ? relative * endNum : endNum - startNum, !isTransformRelated && (endUnit === "px" || p === "zIndex") && vars.autoRound !== false ? _renderRoundedCSSProp : _renderCSSProp); 9460 this._pt.u = endUnit || 0; 9461 9462 if (startUnit !== endUnit) { 9463 this._pt.b = startValue; 9464 this._pt.r = _renderCSSPropWithBeginning; 9465 } 9466 } else if (!(p in style)) { 9467 if (p in target) { 9468 this.add(target, p, startValue || target[p], endValue, index, targets); 9469 } else { 9470 _missingPlugin(p, endValue); 9471 9472 continue; 9473 } 9474 } else { 9475 _tweenComplexCSSString.call(this, target, p, startValue, endValue); 9476 } 9477 9478 props.push(p); 9479 } 9480 } 9481 9482 hasPriority && _sortPropTweensByPriority(this); 9483 }, 9484 get: _get, 9485 aliases: _propertyAliases, 9486 getSetter: function getSetter(target, property, plugin) { 9487 var p = _propertyAliases[property]; 9488 p && p.indexOf(",") < 0 && (property = p); 9489 return property in _transformProps && property !== _transformOriginProp && (target._gsap.x || _get(target, "x")) ? plugin && _recentSetterPlugin === plugin ? property === "scale" ? _setterScale : _setterTransform : (_recentSetterPlugin = plugin || {}) && (property === "scale" ? _setterScaleWithRender : _setterTransformWithRender) : target.style && !_isUndefined(target.style[property]) ? _setterCSSStyle : ~property.indexOf("-") ? _setterCSSProp : _getSetter(target, property); 9490 }, 9491 core: { 9492 _removeProperty: _removeProperty, 9493 _getMatrix: _getMatrix 9494 } 9495 };
vendor: 61,451 bytes, lines 9496-11319
9496 gsap.utils.checkPrefix = _checkPropPrefix; 9497 9498 (function (positionAndScale, rotation, others, aliases) { 9499 var all = _forEachName(positionAndScale + "," + rotation + "," + others, function (name) { 9500 _transformProps[name] = 1; 9501 }); 9502 9503 _forEachName(rotation, function (name) { 9504 _config.units[name] = "deg"; 9505 _rotationalProperties[name] = 1; 9506 }); 9507 9508 _propertyAliases[all[13]] = positionAndScale + "," + rotation; 9509 9510 _forEachName(aliases, function (name) { 9511 var split = name.split(":"); 9512 _propertyAliases[split[1]] = all[split[0]]; 9513 }); 9514 })("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"); 9515 9516 _forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function (name) { 9517 _config.units[name] = "px"; 9518 }); 9519 9520 gsap.registerPlugin(CSSPlugin); 9521 9522 var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap, 9523 TweenMaxWithCSS = gsapWithCSS.core.Tween; 9524 9525 exports.Back = Back; 9526 exports.Bounce = Bounce; 9527 exports.CSSPlugin = CSSPlugin; 9528 exports.Circ = Circ; 9529 exports.Cubic = Cubic; 9530 exports.Elastic = Elastic; 9531 exports.Expo = Expo; 9532 exports.Linear = Linear; 9533 exports.Power0 = Power0; 9534 exports.Power1 = Power1; 9535 exports.Power2 = Power2; 9536 exports.Power3 = Power3; 9537 exports.Power4 = Power4; 9538 exports.Quad = Quad; 9539 exports.Quart = Quart; 9540 exports.Quint = Quint; 9541 exports.Sine = Sine; 9542 exports.SteppedEase = SteppedEase; 9543 exports.Strong = Strong; 9544 exports.TimelineLite = Timeline; 9545 exports.TimelineMax = Timeline; 9546 exports.TweenLite = Tween; 9547 exports.TweenMax = TweenMaxWithCSS; 9548 exports.default = gsapWithCSS; 9549 exports.gsap = gsapWithCSS; 9550 9551 if (typeof (window) === 'undefined' || window !== exports) { Object.defineProperty(exports, '__esModule', { value: true }); } else { delete window.default; } 9552 9553}))); 9554/*! Magnific Popup - v1.1.0 - 2016-02-20 9555* http://dimsemenov.com/plugins/magnific-popup/ 9556* Copyright (c) 2016 Dmitry Semenov; */ 9557;(function (factory) { 9558 if (typeof define === 'function' && define.amd) { 9559 // AMD. Register as an anonymous module. 9560 define(['jquery'], factory); 9561 } else if (typeof exports === 'object') { 9562 // Node/CommonJS 9563 factory(require('jquery')); 9564 } else { 9565 // Browser globals 9566 factory(window.jQuery || window.Zepto); 9567 } 9568 }(function($) { 9569 9570 /*>>core*/ 9571 /** 9572 * 9573 * Magnific Popup Core JS file 9574 * 9575 */ 9576 9577 9578 /** 9579 * Private static constants 9580 */ 9581 var CLOSE_EVENT = 'Close', 9582 BEFORE_CLOSE_EVENT = 'BeforeClose', 9583 AFTER_CLOSE_EVENT = 'AfterClose', 9584 BEFORE_APPEND_EVENT = 'BeforeAppend', 9585 MARKUP_PARSE_EVENT = 'MarkupParse', 9586 OPEN_EVENT = 'Open', 9587 CHANGE_EVENT = 'Change', 9588 NS = 'mfp', 9589 EVENT_NS = '.' + NS, 9590 READY_CLASS = 'mfp-ready', 9591 REMOVING_CLASS = 'mfp-removing', 9592 PREVENT_CLOSE_CLASS = 'mfp-prevent-close'; 9593 9594 9595 /** 9596 * Private vars 9597 */ 9598 /*jshint -W079 */ 9599 var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this' 9600 MagnificPopup = function(){}, 9601 _isJQ = !!(window.jQuery), 9602 _prevStatus, 9603 _window = $(window), 9604 _document, 9605 _prevContentType, 9606 _wrapClasses, 9607 _currPopupType; 9608 9609 9610 /** 9611 * Private functions 9612 */ 9613 var _mfpOn = function(name, f) { 9614 mfp.ev.on(NS + name + EVENT_NS, f); 9615 }, 9616 _getEl = function(className, appendTo, html, raw) { 9617 var el = document.createElement('div'); 9618 el.className = 'mfp-'+className; 9619 if(html) { 9620 el.innerHTML = html; 9621 } 9622 if(!raw) { 9623 el = $(el); 9624 if(appendTo) { 9625 el.appendTo(appendTo); 9626 } 9627 } else if(appendTo) { 9628 appendTo.appendChild(el); 9629 } 9630 return el; 9631 }, 9632 _mfpTrigger = function(e, data) { 9633 mfp.ev.triggerHandler(NS + e, data); 9634 9635 if(mfp.st.callbacks) { 9636 // converts "mfpEventName" to "eventName" callback and triggers it if it's present 9637 e = e.charAt(0).toLowerCase() + e.slice(1); 9638 if(mfp.st.callbacks[e]) { 9639 mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]); 9640 } 9641 } 9642 }, 9643 _getCloseBtn = function(type) { 9644 if(type !== _currPopupType || !mfp.currTemplate.closeBtn) { 9645 mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) ); 9646 _currPopupType = type; 9647 } 9648 return mfp.currTemplate.closeBtn; 9649 }, 9650 // Initialize Magnific Popup only when called at least once 9651 _checkInstance = function() { 9652 if(!$.magnificPopup.instance) { 9653 /*jshint -W020 */ 9654 mfp = new MagnificPopup(); 9655 mfp.init(); 9656 $.magnificPopup.instance = mfp; 9657 } 9658 }, 9659 // CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr 9660 supportsTransitions = function() { 9661 var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist 9662 v = ['ms','O','Moz','Webkit']; // 'v' for vendor 9663 9664 if( s['transition'] !== undefined ) { 9665 return true; 9666 } 9667 9668 while( v.length ) { 9669 if( v.pop() + 'Transition' in s ) { 9670 return true; 9671 } 9672 } 9673 9674 return false; 9675 }; 9676 9677 9678 9679 /** 9680 * Public functions 9681 */ 9682 MagnificPopup.prototype = { 9683 9684 constructor: MagnificPopup, 9685 9686 /** 9687 * Initializes Magnific Popup plugin. 9688 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed 9689 */ 9690 init: function() { 9691 var appVersion = navigator.appVersion; 9692 mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener; 9693 mfp.isAndroid = (/android/gi).test(appVersion); 9694 mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion); 9695 mfp.supportsTransition = supportsTransitions(); 9696 9697 // We disable fixed positioned lightbox on devices that don't handle it nicely. 9698 // If you know a better way of detecting this - let me know. 9699 mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) ); 9700 _document = $(document); 9701 9702 mfp.popupsCache = {}; 9703 }, 9704 9705 /** 9706 * Opens popup 9707 * @param data [description] 9708 */ 9709 open: function(data) { 9710 9711 var i; 9712 9713 if(data.isObj === false) { 9714 // convert jQuery collection to array to avoid conflicts later 9715 mfp.items = data.items.toArray(); 9716 9717 mfp.index = 0; 9718 var items = data.items, 9719 item; 9720 for(i = 0; i < items.length; i++) { 9721 item = items[i]; 9722 if(item.parsed) { 9723 item = item.el[0]; 9724 } 9725 if(item === data.el[0]) { 9726 mfp.index = i; 9727 break; 9728 } 9729 } 9730 } else { 9731 mfp.items = $.isArray(data.items) ? data.items : [data.items]; 9732 mfp.index = data.index || 0; 9733 } 9734 9735 // if popup is already opened - we just update the content 9736 if(mfp.isOpen) { 9737 mfp.updateItemHTML(); 9738 return; 9739 } 9740 9741 mfp.types = []; 9742 _wrapClasses = ''; 9743 if(data.mainEl && data.mainEl.length) { 9744 mfp.ev = data.mainEl.eq(0); 9745 } else { 9746 mfp.ev = _document; 9747 } 9748 9749 if(data.key) { 9750 if(!mfp.popupsCache[data.key]) { 9751 mfp.popupsCache[data.key] = {}; 9752 } 9753 mfp.currTemplate = mfp.popupsCache[data.key]; 9754 } else { 9755 mfp.currTemplate = {}; 9756 } 9757 9758 9759 9760 mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data ); 9761 mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos; 9762 9763 if(mfp.st.modal) { 9764 mfp.st.closeOnContentClick = false; 9765 mfp.st.closeOnBgClick = false; 9766 mfp.st.showCloseBtn = false; 9767 mfp.st.enableEscapeKey = false; 9768 } 9769 9770 9771 // Building markup 9772 // main containers are created only once 9773 if(!mfp.bgOverlay) { 9774 9775 // Dark overlay 9776 mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() { 9777 mfp.close(); 9778 }); 9779 9780 mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) { 9781 if(mfp._checkIfClose(e.target)) { 9782 mfp.close(); 9783 } 9784 }); 9785 9786 mfp.container = _getEl('container', mfp.wrap); 9787 } 9788 9789 mfp.contentContainer = _getEl('content'); 9790 if(mfp.st.preloader) { 9791 mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading); 9792 } 9793 9794 9795 // Initializing modules 9796 var modules = $.magnificPopup.modules; 9797 for(i = 0; i < modules.length; i++) { 9798 var n = modules[i]; 9799 n = n.charAt(0).toUpperCase() + n.slice(1); 9800 mfp['init'+n].call(mfp); 9801 } 9802 _mfpTrigger('BeforeOpen'); 9803 9804 9805 if(mfp.st.showCloseBtn) { 9806 // Close button 9807 if(!mfp.st.closeBtnInside) { 9808 mfp.wrap.append( _getCloseBtn() ); 9809 } else { 9810 _mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) { 9811 values.close_replaceWith = _getCloseBtn(item.type); 9812 }); 9813 _wrapClasses += ' mfp-close-btn-in'; 9814 } 9815 } 9816 9817 if(mfp.st.alignTop) { 9818 _wrapClasses += ' mfp-align-top'; 9819 } 9820 9821 9822 9823 if(mfp.fixedContentPos) { 9824 mfp.wrap.css({ 9825 overflow: mfp.st.overflowY, 9826 overflowX: 'hidden', 9827 overflowY: mfp.st.overflowY 9828 }); 9829 } else { 9830 mfp.wrap.css({ 9831 top: _window.scrollTop(), 9832 position: 'absolute' 9833 }); 9834 } 9835 if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) { 9836 mfp.bgOverlay.css({ 9837 height: _document.height(), 9838 position: 'absolute' 9839 }); 9840 } 9841 9842 9843 9844 if(mfp.st.enableEscapeKey) { 9845 // Close on ESC key 9846 _document.on('keyup' + EVENT_NS, function(e) { 9847 if(e.keyCode === 27) { 9848 mfp.close(); 9849 } 9850 }); 9851 } 9852 9853 _window.on('resize' + EVENT_NS, function() { 9854 mfp.updateSize(); 9855 }); 9856 9857 9858 if(!mfp.st.closeOnContentClick) { 9859 _wrapClasses += ' mfp-auto-cursor'; 9860 } 9861 9862 if(_wrapClasses) 9863 mfp.wrap.addClass(_wrapClasses); 9864 9865 9866 // this triggers recalculation of layout, so we get it once to not to trigger twice 9867 var windowHeight = mfp.wH = _window.height(); 9868 9869 9870 var windowStyles = {}; 9871 9872 if( mfp.fixedContentPos ) { 9873 if(mfp._hasScrollBar(windowHeight)){ 9874 var s = mfp._getScrollbarSize(); 9875 if(s) { 9876 windowStyles.marginRight = s; 9877 } 9878 } 9879 } 9880 9881 if(mfp.fixedContentPos) { 9882 if(!mfp.isIE7) { 9883 windowStyles.overflow = 'hidden'; 9884 } else { 9885 // ie7 double-scroll bug 9886 $('body, html').css('overflow', 'hidden'); 9887 } 9888 } 9889 9890 9891 9892 var classesToadd = mfp.st.mainClass; 9893 if(mfp.isIE7) { 9894 classesToadd += ' mfp-ie7'; 9895 } 9896 if(classesToadd) { 9897 mfp._addClassToMFP( classesToadd ); 9898 } 9899 9900 // add content 9901 mfp.updateItemHTML(); 9902 9903 _mfpTrigger('BuildControls'); 9904 9905 // remove scrollbar, add margin e.t.c 9906 $('html').css(windowStyles); 9907 9908 // add everything to DOM 9909 mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) ); 9910 9911 // Save last focused element 9912 mfp._lastFocusedEl = document.activeElement; 9913 9914 // Wait for next cycle to allow CSS transition 9915 setTimeout(function() { 9916 9917 if(mfp.content) { 9918 mfp._addClassToMFP(READY_CLASS); 9919 mfp._setFocus(); 9920 } else { 9921 // if content is not defined (not loaded e.t.c) we add class only for BG 9922 mfp.bgOverlay.addClass(READY_CLASS); 9923 } 9924 9925 // Trap the focus in popup 9926 _document.on('focusin' + EVENT_NS, mfp._onFocusIn); 9927 9928 }, 16); 9929 9930 mfp.isOpen = true; 9931 mfp.updateSize(windowHeight); 9932 _mfpTrigger(OPEN_EVENT); 9933 9934 return data; 9935 }, 9936 9937 /** 9938 * Closes the popup 9939 */ 9940 close: function() { 9941 if(!mfp.isOpen) return; 9942 _mfpTrigger(BEFORE_CLOSE_EVENT); 9943 9944 mfp.isOpen = false; 9945 // for CSS3 animation 9946 if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition ) { 9947 mfp._addClassToMFP(REMOVING_CLASS); 9948 setTimeout(function() { 9949 mfp._close(); 9950 }, mfp.st.removalDelay); 9951 } else { 9952 mfp._close(); 9953 } 9954 }, 9955 9956 /** 9957 * Helper for close() function 9958 */ 9959 _close: function() { 9960 _mfpTrigger(CLOSE_EVENT); 9961 9962 var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' '; 9963 9964 mfp.bgOverlay.detach(); 9965 mfp.wrap.detach(); 9966 mfp.container.empty(); 9967 9968 if(mfp.st.mainClass) { 9969 classesToRemove += mfp.st.mainClass + ' '; 9970 } 9971 9972 mfp._removeClassFromMFP(classesToRemove); 9973 9974 if(mfp.fixedContentPos) { 9975 var windowStyles = {marginRight: ''}; 9976 if(mfp.isIE7) { 9977 $('body, html').css('overflow', ''); 9978 } else { 9979 windowStyles.overflow = ''; 9980 } 9981 $('html').css(windowStyles); 9982 } 9983 9984 _document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS); 9985 mfp.ev.off(EVENT_NS); 9986 9987 // clean up DOM elements that aren't removed 9988 mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style'); 9989 mfp.bgOverlay.attr('class', 'mfp-bg'); 9990 mfp.container.attr('class', 'mfp-container'); 9991 9992 // remove close button from target element 9993 if(mfp.st.showCloseBtn && 9994 (!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) { 9995 if(mfp.currTemplate.closeBtn) 9996 mfp.currTemplate.closeBtn.detach(); 9997 } 9998 9999 10000 if(mfp.st.autoFocusLast && mfp._lastFocusedEl) { 10001 $(mfp._lastFocusedEl).focus(); // put tab focus back 10002 } 10003 mfp.currItem = null; 10004 mfp.content = null; 10005 mfp.currTemplate = null; 10006 mfp.prevHeight = 0; 10007 10008 _mfpTrigger(AFTER_CLOSE_EVENT); 10009 }, 10010 10011 updateSize: function(winHeight) { 10012 10013 if(mfp.isIOS) { 10014 // fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2 10015 var zoomLevel = document.documentElement.clientWidth / window.innerWidth; 10016 var height = window.innerHeight * zoomLevel; 10017 mfp.wrap.css('height', height); 10018 mfp.wH = height; 10019 } else { 10020 mfp.wH = winHeight || _window.height(); 10021 } 10022 // Fixes #84: popup incorrectly positioned with position:relative on body 10023 if(!mfp.fixedContentPos) { 10024 mfp.wrap.css('height', mfp.wH); 10025 } 10026 10027 _mfpTrigger('Resize'); 10028 10029 }, 10030 10031 /** 10032 * Set content of popup based on current index 10033 */ 10034 updateItemHTML: function() { 10035 var item = mfp.items[mfp.index]; 10036 10037 // Detach and perform modifications 10038 mfp.contentContainer.detach(); 10039 10040 if(mfp.content) 10041 mfp.content.detach(); 10042 10043 if(!item.parsed) { 10044 item = mfp.parseEl( mfp.index ); 10045 } 10046 10047 var type = item.type; 10048 10049 _mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]); 10050 // BeforeChange event works like so: 10051 // _mfpOn('BeforeChange', function(e, prevType, newType) { }); 10052 10053 mfp.currItem = item; 10054 10055 if(!mfp.currTemplate[type]) { 10056 var markup = mfp.st[type] ? mfp.st[type].markup : false; 10057 10058 // allows to modify markup 10059 _mfpTrigger('FirstMarkupParse', markup); 10060 10061 if(markup) { 10062 mfp.currTemplate[type] = $(markup); 10063 } else { 10064 // if there is no markup found we just define that template is parsed 10065 mfp.currTemplate[type] = true; 10066 } 10067 } 10068 10069 if(_prevContentType && _prevContentType !== item.type) { 10070 mfp.container.removeClass('mfp-'+_prevContentType+'-holder'); 10071 } 10072 10073 var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]); 10074 mfp.appendContent(newContent, type); 10075 10076 item.preloaded = true; 10077 10078 _mfpTrigger(CHANGE_EVENT, item); 10079 _prevContentType = item.type; 10080 10081 // Append container back after its content changed 10082 mfp.container.prepend(mfp.contentContainer); 10083 10084 _mfpTrigger('AfterChange'); 10085 }, 10086 10087 10088 /** 10089 * Set HTML content of popup 10090 */ 10091 appendContent: function(newContent, type) { 10092 mfp.content = newContent; 10093 10094 if(newContent) { 10095 if(mfp.st.showCloseBtn && mfp.st.closeBtnInside && 10096 mfp.currTemplate[type] === true) { 10097 // if there is no markup, we just append close button element inside 10098 if(!mfp.content.find('.mfp-close').length) { 10099 mfp.content.append(_getCloseBtn()); 10100 } 10101 } else { 10102 mfp.content = newContent; 10103 } 10104 } else { 10105 mfp.content = ''; 10106 } 10107 10108 _mfpTrigger(BEFORE_APPEND_EVENT); 10109 mfp.container.addClass('mfp-'+type+'-holder'); 10110 10111 mfp.contentContainer.append(mfp.content); 10112 }, 10113 10114 10115 /** 10116 * Creates Magnific Popup data object based on given data 10117 * @param {int} index Index of item to parse 10118 */ 10119 parseEl: function(index) { 10120 var item = mfp.items[index], 10121 type; 10122 10123 if(item.tagName) { 10124 item = { el: $(item) }; 10125 } else { 10126 type = item.type; 10127 item = { data: item, src: item.src }; 10128 } 10129 10130 if(item.el) { 10131 var types = mfp.types; 10132 10133 // check for 'mfp-TYPE' class 10134 for(var i = 0; i < types.length; i++) { 10135 if( item.el.hasClass('mfp-'+types[i]) ) { 10136 type = types[i]; 10137 break; 10138 } 10139 } 10140 10141 item.src = item.el.attr('data-mfp-src'); 10142 if(!item.src) { 10143 item.src = item.el.attr('href'); 10144 } 10145 } 10146 10147 item.type = type || mfp.st.type || 'inline'; 10148 item.index = index; 10149 item.parsed = true; 10150 mfp.items[index] = item; 10151 _mfpTrigger('ElementParse', item); 10152 10153 return mfp.items[index]; 10154 }, 10155 10156 10157 /** 10158 * Initializes single popup or a group of popups 10159 */ 10160 addGroup: function(el, options) { 10161 var eHandler = function(e) { 10162 e.mfpEl = this; 10163 mfp._openClick(e, el, options); 10164 }; 10165 10166 if(!options) { 10167 options = {}; 10168 } 10169 10170 var eName = 'click.magnificPopup'; 10171 options.mainEl = el; 10172 10173 if(options.items) { 10174 options.isObj = true; 10175 el.off(eName).on(eName, eHandler); 10176 } else { 10177 options.isObj = false; 10178 if(options.delegate) { 10179 el.off(eName).on(eName, options.delegate , eHandler); 10180 } else { 10181 options.items = el; 10182 el.off(eName).on(eName, eHandler); 10183 } 10184 } 10185 }, 10186 _openClick: function(e, el, options) { 10187 var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick; 10188 10189 10190 if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey ) ) { 10191 return; 10192 } 10193 10194 var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn; 10195 10196 if(disableOn) { 10197 if($.isFunction(disableOn)) { 10198 if( !disableOn.call(mfp) ) { 10199 return true; 10200 } 10201 } else { // else it's number 10202 if( _window.width() < disableOn ) { 10203 return true; 10204 } 10205 } 10206 } 10207 10208 if(e.type) { 10209 e.preventDefault(); 10210 10211 // This will prevent popup from closing if element is inside and popup is already opened 10212 if(mfp.isOpen) { 10213 e.stopPropagation(); 10214 } 10215 } 10216 10217 options.el = $(e.mfpEl); 10218 if(options.delegate) { 10219 options.items = el.find(options.delegate); 10220 } 10221 mfp.open(options); 10222 }, 10223 10224 10225 /** 10226 * Updates text on preloader 10227 */ 10228 updateStatus: function(status, text) { 10229 10230 if(mfp.preloader) { 10231 if(_prevStatus !== status) { 10232 mfp.container.removeClass('mfp-s-'+_prevStatus); 10233 } 10234 10235 if(!text && status === 'loading') { 10236 text = mfp.st.tLoading; 10237 } 10238 10239 var data = { 10240 status: status, 10241 text: text 10242 }; 10243 // allows to modify status 10244 _mfpTrigger('UpdateStatus', data); 10245 10246 status = data.status; 10247 text = data.text; 10248 10249 mfp.preloader.html(text); 10250 10251 mfp.preloader.find('a').on('click', function(e) { 10252 e.stopImmediatePropagation(); 10253 }); 10254 10255 mfp.container.addClass('mfp-s-'+status); 10256 _prevStatus = status; 10257 } 10258 }, 10259 10260 10261 /* 10262 "Private" helpers that aren't private at all 10263 */ 10264 // Check to close popup or not 10265 // "target" is an element that was clicked 10266 _checkIfClose: function(target) { 10267 10268 if($(target).hasClass(PREVENT_CLOSE_CLASS)) { 10269 return; 10270 } 10271 10272 var closeOnContent = mfp.st.closeOnContentClick; 10273 var closeOnBg = mfp.st.closeOnBgClick; 10274 10275 if(closeOnContent && closeOnBg) { 10276 return true; 10277 } else { 10278 10279 // We close the popup if click is on close button or on preloader. Or if there is no content. 10280 if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) { 10281 return true; 10282 } 10283 10284 // if click is outside the content 10285 if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) { 10286 if(closeOnBg) { 10287 // last check, if the clicked element is in DOM, (in case it's removed onclick) 10288 if( $.contains(document, target) ) { 10289 return true; 10290 } 10291 } 10292 } else if(closeOnContent) { 10293 return true; 10294 } 10295 10296 } 10297 return false; 10298 }, 10299 _addClassToMFP: function(cName) { 10300 mfp.bgOverlay.addClass(cName); 10301 mfp.wrap.addClass(cName); 10302 }, 10303 _removeClassFromMFP: function(cName) { 10304 this.bgOverlay.removeClass(cName); 10305 mfp.wrap.removeClass(cName); 10306 }, 10307 _hasScrollBar: function(winHeight) { 10308 return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) ); 10309 }, 10310 _setFocus: function() { 10311 (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus(); 10312 }, 10313 _onFocusIn: function(e) { 10314 if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) { 10315 mfp._setFocus(); 10316 return false; 10317 } 10318 }, 10319 _parseMarkup: function(template, values, item) { 10320 var arr; 10321 if(item.data) { 10322 values = $.extend(item.data, values); 10323 } 10324 _mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] ); 10325 10326 $.each(values, function(key, value) { 10327 if(value === undefined || value === false) { 10328 return true; 10329 } 10330 arr = key.split('_'); 10331 if(arr.length > 1) { 10332 var el = template.find(EVENT_NS + '-'+arr[0]); 10333 10334 if(el.length > 0) { 10335 var attr = arr[1]; 10336 if(attr === 'replaceWith') { 10337 if(el[0] !== value[0]) { 10338 el.replaceWith(value); 10339 } 10340 } else if(attr === 'img') { 10341 if(el.is('img')) { 10342 el.attr('src', value); 10343 } else { 10344 el.replaceWith( $('<img>').attr('src', value).attr('class', el.attr('class')) ); 10345 } 10346 } else { 10347 el.attr(arr[1], value); 10348 } 10349 } 10350 10351 } else { 10352 template.find(EVENT_NS + '-'+key).html(value); 10353 } 10354 }); 10355 }, 10356 10357 _getScrollbarSize: function() { 10358 // thx David 10359 if(mfp.scrollbarSize === undefined) { 10360 var scrollDiv = document.createElement("div"); 10361 scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;'; 10362 document.body.appendChild(scrollDiv); 10363 mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth; 10364 document.body.removeChild(scrollDiv); 10365 } 10366 return mfp.scrollbarSize; 10367 } 10368 10369 }; /* MagnificPopup core prototype end */ 10370 10371 10372 10373 10374 /** 10375 * Public static functions 10376 */ 10377 $.magnificPopup = { 10378 instance: null, 10379 proto: MagnificPopup.prototype, 10380 modules: [], 10381 10382 open: function(options, index) { 10383 _checkInstance(); 10384 10385 if(!options) { 10386 options = {}; 10387 } else { 10388 options = $.extend(true, {}, options); 10389 } 10390 10391 options.isObj = true; 10392 options.index = index || 0; 10393 return this.instance.open(options); 10394 }, 10395 10396 close: function() { 10397 return $.magnificPopup.instance && $.magnificPopup.instance.close(); 10398 }, 10399 10400 registerModule: function(name, module) { 10401 if(module.options) { 10402 $.magnificPopup.defaults[name] = module.options; 10403 } 10404 $.extend(this.proto, module.proto); 10405 this.modules.push(name); 10406 }, 10407 10408 defaults: { 10409 10410 // Info about options is in docs: 10411 // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options 10412 10413 disableOn: 0, 10414 10415 key: null, 10416 10417 midClick: false, 10418 10419 mainClass: '', 10420 10421 preloader: true, 10422 10423 focus: '', // CSS selector of input to focus after popup is opened 10424 10425 closeOnContentClick: false, 10426 10427 closeOnBgClick: true, 10428 10429 closeBtnInside: true, 10430 10431 showCloseBtn: true, 10432 10433 enableEscapeKey: true, 10434 10435 modal: false, 10436 10437 alignTop: false, 10438 10439 removalDelay: 0, 10440 10441 prependTo: null, 10442 10443 fixedContentPos: 'auto', 10444 10445 fixedBgPos: 'auto', 10446 10447 overflowY: 'auto', 10448 10449 closeMarkup: '<button title="%title%" type="button" class="mfp-close">×</button>', 10450 10451 tClose: 'Close (Esc)', 10452 10453 tLoading: 'Loading...', 10454 10455 autoFocusLast: true 10456 10457 } 10458 }; 10459 10460 10461 10462 $.fn.magnificPopup = function(options) { 10463 _checkInstance(); 10464 10465 var jqEl = $(this); 10466 10467 // We call some API method of first param is a string 10468 if (typeof options === "string" ) { 10469 10470 if(options === 'open') { 10471 var items, 10472 itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup, 10473 index = parseInt(arguments[1], 10) || 0; 10474 10475 if(itemOpts.items) { 10476 items = itemOpts.items[index]; 10477 } else { 10478 items = jqEl; 10479 if(itemOpts.delegate) { 10480 items = items.find(itemOpts.delegate); 10481 } 10482 items = items.eq( index ); 10483 } 10484 mfp._openClick({mfpEl:items}, jqEl, itemOpts); 10485 } else { 10486 if(mfp.isOpen) 10487 mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1)); 10488 } 10489 10490 } else { 10491 // clone options obj 10492 options = $.extend(true, {}, options); 10493 10494 /* 10495 * As Zepto doesn't support .data() method for objects 10496 * and it works only in normal browsers 10497 * we assign "options" object directly to the DOM element. FTW! 10498 */ 10499 if(_isJQ) { 10500 jqEl.data('magnificPopup', options); 10501 } else { 10502 jqEl[0].magnificPopup = options; 10503 } 10504 10505 mfp.addGroup(jqEl, options); 10506 10507 } 10508 return jqEl; 10509 }; 10510 10511 /*>>core*/ 10512 10513 /*>>inline*/ 10514 10515 var INLINE_NS = 'inline', 10516 _hiddenClass, 10517 _inlinePlaceholder, 10518 _lastInlineElement, 10519 _putInlineElementsBack = function() { 10520 if(_lastInlineElement) { 10521 _inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach(); 10522 _lastInlineElement = null; 10523 } 10524 }; 10525 10526 $.magnificPopup.registerModule(INLINE_NS, { 10527 options: { 10528 hiddenClass: 'hide', // will be appended with `mfp-` prefix 10529 markup: '', 10530 tNotFound: 'Content not found' 10531 }, 10532 proto: { 10533 10534 initInline: function() { 10535 mfp.types.push(INLINE_NS); 10536 10537 _mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() { 10538 _putInlineElementsBack(); 10539 }); 10540 }, 10541 10542 getInline: function(item, template) { 10543 10544 _putInlineElementsBack(); 10545 10546 if(item.src) { 10547 var inlineSt = mfp.st.inline, 10548 el = $(item.src); 10549 10550 if(el.length) { 10551 10552 // If target element has parent - we replace it with placeholder and put it back after popup is closed 10553 var parent = el[0].parentNode; 10554 if(parent && parent.tagName) { 10555 if(!_inlinePlaceholder) { 10556 _hiddenClass = inlineSt.hiddenClass; 10557 _inlinePlaceholder = _getEl(_hiddenClass); 10558 _hiddenClass = 'mfp-'+_hiddenClass; 10559 } 10560 // replace target inline element with placeholder 10561 _lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass); 10562 } 10563 10564 mfp.updateStatus('ready'); 10565 } else { 10566 mfp.updateStatus('error', inlineSt.tNotFound); 10567 el = $('<div>'); 10568 } 10569 10570 item.inlineElement = el; 10571 return el; 10572 } 10573 10574 mfp.updateStatus('ready'); 10575 mfp._parseMarkup(template, {}, item); 10576 return template; 10577 } 10578 } 10579 }); 10580 10581 /*>>inline*/ 10582 10583 /*>>ajax*/ 10584 var AJAX_NS = 'ajax', 10585 _ajaxCur, 10586 _removeAjaxCursor = function() { 10587 if(_ajaxCur) { 10588 $(document.body).removeClass(_ajaxCur); 10589 } 10590 }, 10591 _destroyAjaxRequest = function() { 10592 _removeAjaxCursor(); 10593 if(mfp.req) { 10594 mfp.req.abort(); 10595 } 10596 }; 10597 10598 $.magnificPopup.registerModule(AJAX_NS, { 10599 10600 options: { 10601 settings: null, 10602 cursor: 'mfp-ajax-cur', 10603 tError: '<a href="%url%">The content</a> could not be loaded.' 10604 }, 10605 10606 proto: { 10607 initAjax: function() { 10608 mfp.types.push(AJAX_NS); 10609 _ajaxCur = mfp.st.ajax.cursor; 10610 10611 _mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest); 10612 _mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest); 10613 }, 10614 getAjax: function(item) { 10615 10616 if(_ajaxCur) { 10617 $(document.body).addClass(_ajaxCur); 10618 } 10619 10620 mfp.updateStatus('loading'); 10621 10622 var opts = $.extend({ 10623 url: item.src, 10624 success: function(data, textStatus, jqXHR) { 10625 var temp = { 10626 data:data, 10627 xhr:jqXHR 10628 }; 10629 10630 _mfpTrigger('ParseAjax', temp); 10631 10632 mfp.appendContent( $(temp.data), AJAX_NS ); 10633 10634 item.finished = true; 10635 10636 _removeAjaxCursor(); 10637 10638 mfp._setFocus(); 10639 10640 setTimeout(function() { 10641 mfp.wrap.addClass(READY_CLASS); 10642 }, 16); 10643 10644 mfp.updateStatus('ready'); 10645 10646 _mfpTrigger('AjaxContentAdded'); 10647 }, 10648 error: function() { 10649 _removeAjaxCursor(); 10650 item.finished = item.loadError = true; 10651 mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src)); 10652 } 10653 }, mfp.st.ajax.settings); 10654 10655 mfp.req = $.ajax(opts); 10656 10657 return ''; 10658 } 10659 } 10660 }); 10661 10662 /*>>ajax*/ 10663 10664 /*>>image*/ 10665 var _imgInterval, 10666 _getTitle = function(item) { 10667 if(item.data && item.data.title !== undefined) 10668 return item.data.title; 10669 10670 var src = mfp.st.image.titleSrc; 10671 10672 if(src) { 10673 if($.isFunction(src)) { 10674 return src.call(mfp, item); 10675 } else if(item.el) { 10676 return item.el.attr(src) || ''; 10677 } 10678 } 10679 return ''; 10680 }; 10681 10682 $.magnificPopup.registerModule('image', { 10683 10684 options: { 10685 markup: '<div class="mfp-figure">'+ 10686 '<div class="mfp-close"></div>'+ 10687 '<figure>'+ 10688 '<div class="mfp-img"></div>'+ 10689 '<figcaption>'+ 10690 '<div class="mfp-bottom-bar">'+ 10691 '<div class="mfp-title"></div>'+ 10692 '<div class="mfp-counter"></div>'+ 10693 '</div>'+ 10694 '</figcaption>'+ 10695 '</figure>'+ 10696 '</div>', 10697 cursor: 'mfp-zoom-out-cur', 10698 titleSrc: 'title', 10699 verticalFit: true, 10700 tError: '<a href="%url%">The image</a> could not be loaded.' 10701 }, 10702 10703 proto: { 10704 initImage: function() { 10705 var imgSt = mfp.st.image, 10706 ns = '.image'; 10707 10708 mfp.types.push('image'); 10709 10710 _mfpOn(OPEN_EVENT+ns, function() { 10711 if(mfp.currItem.type === 'image' && imgSt.cursor) { 10712 $(document.body).addClass(imgSt.cursor); 10713 } 10714 }); 10715 10716 _mfpOn(CLOSE_EVENT+ns, function() { 10717 if(imgSt.cursor) { 10718 $(document.body).removeClass(imgSt.cursor); 10719 } 10720 _window.off('resize' + EVENT_NS); 10721 }); 10722 10723 _mfpOn('Resize'+ns, mfp.resizeImage); 10724 if(mfp.isLowIE) { 10725 _mfpOn('AfterChange', mfp.resizeImage); 10726 } 10727 }, 10728 resizeImage: function() { 10729 var item = mfp.currItem; 10730 if(!item || !item.img) return; 10731 10732 if(mfp.st.image.verticalFit) { 10733 var decr = 0; 10734 // fix box-sizing in ie7/8 10735 if(mfp.isLowIE) { 10736 decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10); 10737 } 10738 item.img.css('max-height', mfp.wH-decr); 10739 } 10740 }, 10741 _onImageHasSize: function(item) { 10742 if(item.img) { 10743 10744 item.hasSize = true; 10745 10746 if(_imgInterval) { 10747 clearInterval(_imgInterval); 10748 } 10749 10750 item.isCheckingImgSize = false; 10751 10752 _mfpTrigger('ImageHasSize', item); 10753 10754 if(item.imgHidden) { 10755 if(mfp.content) 10756 mfp.content.removeClass('mfp-loading'); 10757 10758 item.imgHidden = false; 10759 } 10760 10761 } 10762 }, 10763 10764 /** 10765 * Function that loops until the image has size to display elements that rely on it asap 10766 */ 10767 findImageSize: function(item) { 10768 10769 var counter = 0, 10770 img = item.img[0], 10771 mfpSetInterval = function(delay) { 10772 10773 if(_imgInterval) { 10774 clearInterval(_imgInterval); 10775 } 10776 // decelerating interval that checks for size of an image 10777 _imgInterval = setInterval(function() { 10778 if(img.naturalWidth > 0) { 10779 mfp._onImageHasSize(item); 10780 return; 10781 } 10782 10783 if(counter > 200) { 10784 clearInterval(_imgInterval); 10785 } 10786 10787 counter++; 10788 if(counter === 3) { 10789 mfpSetInterval(10); 10790 } else if(counter === 40) { 10791 mfpSetInterval(50); 10792 } else if(counter === 100) { 10793 mfpSetInterval(500); 10794 } 10795 }, delay); 10796 }; 10797 10798 mfpSetInterval(1); 10799 }, 10800 10801 getImage: function(item, template) { 10802 10803 var guard = 0, 10804 10805 // image load complete handler 10806 onLoadComplete = function() { 10807 if(item) { 10808 if (item.img[0].complete) { 10809 item.img.off('.mfploader'); 10810 10811 if(item === mfp.currItem){ 10812 mfp._onImageHasSize(item); 10813 10814 mfp.updateStatus('ready'); 10815 } 10816 10817 item.hasSize = true; 10818 item.loaded = true; 10819 10820 _mfpTrigger('ImageLoadComplete'); 10821 10822 } 10823 else { 10824 // if image complete check fails 200 times (20 sec), we assume that there was an error. 10825 guard++; 10826 if(guard < 200) { 10827 setTimeout(onLoadComplete,100); 10828 } else { 10829 onLoadError(); 10830 } 10831 } 10832 } 10833 }, 10834 10835 // image error handler 10836 onLoadError = function() { 10837 if(item) { 10838 item.img.off('.mfploader'); 10839 if(item === mfp.currItem){ 10840 mfp._onImageHasSize(item); 10841 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); 10842 } 10843 10844 item.hasSize = true; 10845 item.loaded = true; 10846 item.loadError = true; 10847 } 10848 }, 10849 imgSt = mfp.st.image; 10850 10851 10852 var el = template.find('.mfp-img'); 10853 if(el.length) { 10854 var img = document.createElement('img'); 10855 img.className = 'mfp-img'; 10856 if(item.el && item.el.find('img').length) { 10857 img.alt = item.el.find('img').attr('alt'); 10858 } 10859 item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError); 10860 img.src = item.src; 10861 10862 // without clone() "error" event is not firing when IMG is replaced by new IMG 10863 // TODO: find a way to avoid such cloning 10864 if(el.is('img')) { 10865 item.img = item.img.clone(); 10866 } 10867 10868 img = item.img[0]; 10869 if(img.naturalWidth > 0) { 10870 item.hasSize = true; 10871 } else if(!img.width) { 10872 item.hasSize = false; 10873 } 10874 } 10875 10876 mfp._parseMarkup(template, { 10877 title: _getTitle(item), 10878 img_replaceWith: item.img 10879 }, item); 10880 10881 mfp.resizeImage(); 10882 10883 if(item.hasSize) { 10884 if(_imgInterval) clearInterval(_imgInterval); 10885 10886 if(item.loadError) { 10887 template.addClass('mfp-loading'); 10888 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); 10889 } else { 10890 template.removeClass('mfp-loading'); 10891 mfp.updateStatus('ready'); 10892 } 10893 return template; 10894 } 10895 10896 mfp.updateStatus('loading'); 10897 item.loading = true; 10898 10899 if(!item.hasSize) { 10900 item.imgHidden = true; 10901 template.addClass('mfp-loading'); 10902 mfp.findImageSize(item); 10903 } 10904 10905 return template; 10906 } 10907 } 10908 }); 10909 10910 /*>>image*/ 10911 10912 /*>>zoom*/ 10913 var hasMozTransform, 10914 getHasMozTransform = function() { 10915 if(hasMozTransform === undefined) { 10916 hasMozTransform = document.createElement('p').style.MozTransform !== undefined; 10917 } 10918 return hasMozTransform; 10919 }; 10920 10921 $.magnificPopup.registerModule('zoom', { 10922 10923 options: { 10924 enabled: false, 10925 easing: 'ease-in-out', 10926 duration: 300, 10927 opener: function(element) { 10928 return element.is('img') ? element : element.find('img'); 10929 } 10930 }, 10931 10932 proto: { 10933 10934 initZoom: function() { 10935 var zoomSt = mfp.st.zoom, 10936 ns = '.zoom', 10937 image; 10938 10939 if(!zoomSt.enabled || !mfp.supportsTransition) { 10940 return; 10941 } 10942 10943 var duration = zoomSt.duration, 10944 getElToAnimate = function(image) { 10945 var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'), 10946 transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing, 10947 cssObj = { 10948 position: 'fixed', 10949 zIndex: 9999, 10950 left: 0, 10951 top: 0, 10952 '-webkit-backface-visibility': 'hidden' 10953 }, 10954 t = 'transition'; 10955 10956 cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition; 10957 10958 newImg.css(cssObj); 10959 return newImg; 10960 }, 10961 showMainContent = function() { 10962 mfp.content.css('visibility', 'visible'); 10963 }, 10964 openTimeout, 10965 animatedImg; 10966 10967 _mfpOn('BuildControls'+ns, function() { 10968 if(mfp._allowZoom()) { 10969 10970 clearTimeout(openTimeout); 10971 mfp.content.css('visibility', 'hidden'); 10972 10973 // Basically, all code below does is clones existing image, puts in on top of the current one and animated it 10974 10975 image = mfp._getItemToZoom(); 10976 10977 if(!image) { 10978 showMainContent(); 10979 return; 10980 } 10981 10982 animatedImg = getElToAnimate(image); 10983 10984 animatedImg.css( mfp._getOffset() ); 10985 10986 mfp.wrap.append(animatedImg); 10987 10988 openTimeout = setTimeout(function() { 10989 animatedImg.css( mfp._getOffset( true ) ); 10990 openTimeout = setTimeout(function() { 10991 10992 showMainContent(); 10993 10994 setTimeout(function() { 10995 animatedImg.remove(); 10996 image = animatedImg = null; 10997 _mfpTrigger('ZoomAnimationEnded'); 10998 }, 16); // avoid blink when switching images 10999 11000 }, duration); // this timeout equals animation duration 11001 11002 }, 16); // by adding this timeout we avoid short glitch at the beginning of animation 11003 11004 11005 // Lots of timeouts... 11006 } 11007 }); 11008 _mfpOn(BEFORE_CLOSE_EVENT+ns, function() { 11009 if(mfp._allowZoom()) { 11010 11011 clearTimeout(openTimeout); 11012 11013 mfp.st.removalDelay = duration; 11014 11015 if(!image) { 11016 image = mfp._getItemToZoom(); 11017 if(!image) { 11018 return; 11019 } 11020 animatedImg = getElToAnimate(image); 11021 } 11022 11023 animatedImg.css( mfp._getOffset(true) ); 11024 mfp.wrap.append(animatedImg); 11025 mfp.content.css('visibility', 'hidden'); 11026 11027 setTimeout(function() { 11028 animatedImg.css( mfp._getOffset() ); 11029 }, 16); 11030 } 11031 11032 }); 11033 11034 _mfpOn(CLOSE_EVENT+ns, function() { 11035 if(mfp._allowZoom()) { 11036 showMainContent(); 11037 if(animatedImg) { 11038 animatedImg.remove(); 11039 } 11040 image = null; 11041 } 11042 }); 11043 }, 11044 11045 _allowZoom: function() { 11046 return mfp.currItem.type === 'image'; 11047 }, 11048 11049 _getItemToZoom: function() { 11050 if(mfp.currItem.hasSize) { 11051 return mfp.currItem.img; 11052 } else { 11053 return false; 11054 } 11055 }, 11056 11057 // Get element postion relative to viewport 11058 _getOffset: function(isLarge) { 11059 var el; 11060 if(isLarge) { 11061 el = mfp.currItem.img; 11062 } else { 11063 el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem); 11064 } 11065 11066 var offset = el.offset(); 11067 var paddingTop = parseInt(el.css('padding-top'),10); 11068 var paddingBottom = parseInt(el.css('padding-bottom'),10); 11069 offset.top -= ( $(window).scrollTop() - paddingTop ); 11070 11071 11072 /* 11073 Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa. 11074 */ 11075 var obj = { 11076 width: el.width(), 11077 // fix Zepto height+padding issue 11078 height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop 11079 }; 11080 11081 // I hate to do this, but there is no another option 11082 if( getHasMozTransform() ) { 11083 obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)'; 11084 } else { 11085 obj.left = offset.left; 11086 obj.top = offset.top; 11087 } 11088 return obj; 11089 } 11090 11091 } 11092 }); 11093 11094 11095 11096 /*>>zoom*/ 11097 11098 /*>>iframe*/ 11099 11100 var IFRAME_NS = 'iframe', 11101 _emptyPage = '//about:blank', 11102 11103 _fixIframeBugs = function(isShowing) { 11104 if(mfp.currTemplate[IFRAME_NS]) { 11105 var el = mfp.currTemplate[IFRAME_NS].find('iframe'); 11106 if(el.length) { 11107 // reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug 11108 if(!isShowing) { 11109 el[0].src = _emptyPage; 11110 } 11111 11112 // IE8 black screen bug fix 11113 if(mfp.isIE8) { 11114 el.css('display', isShowing ? 'block' : 'none'); 11115 } 11116 } 11117 } 11118 }; 11119 11120 $.magnificPopup.registerModule(IFRAME_NS, { 11121 11122 options: { 11123 markup: '<div class="mfp-iframe-scaler">'+ 11124 '<div class="mfp-close"></div>'+ 11125 '<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+ 11126 '</div>', 11127 11128 srcAction: 'iframe_src', 11129 11130 // we don't care and support only one default type of URL by default 11131 patterns: { 11132 youtube: { 11133 index: 'youtube.com', 11134 id: 'v=', 11135 src: '//www.youtube.com/embed/%id%?autoplay=1' 11136 }, 11137 vimeo: { 11138 index: 'vimeo.com/', 11139 id: '/', 11140 src: '//player.vimeo.com/video/%id%?autoplay=1' 11141 }, 11142 gmaps: { 11143 index: '//maps.google.', 11144 src: '%id%&output=embed' 11145 } 11146 } 11147 }, 11148 11149 proto: { 11150 initIframe: function() { 11151 mfp.types.push(IFRAME_NS); 11152 11153 _mfpOn('BeforeChange', function(e, prevType, newType) { 11154 if(prevType !== newType) { 11155 if(prevType === IFRAME_NS) { 11156 _fixIframeBugs(); // iframe if removed 11157 } else if(newType === IFRAME_NS) { 11158 _fixIframeBugs(true); // iframe is showing 11159 } 11160 }// else { 11161 // iframe source is switched, don't do anything 11162 //} 11163 }); 11164 11165 _mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() { 11166 _fixIframeBugs(); 11167 }); 11168 }, 11169 11170 getIframe: function(item, template) { 11171 var embedSrc = item.src; 11172 var iframeSt = mfp.st.iframe; 11173 11174 $.each(iframeSt.patterns, function() { 11175 if(embedSrc.indexOf( this.index ) > -1) { 11176 if(this.id) { 11177 if(typeof this.id === 'string') { 11178 embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length); 11179 } else { 11180 embedSrc = this.id.call( this, embedSrc ); 11181 } 11182 } 11183 embedSrc = this.src.replace('%id%', embedSrc ); 11184 return false; // break; 11185 } 11186 }); 11187 11188 var dataObj = {}; 11189 if(iframeSt.srcAction) { 11190 dataObj[iframeSt.srcAction] = embedSrc; 11191 } 11192 mfp._parseMarkup(template, dataObj, item); 11193 11194 mfp.updateStatus('ready'); 11195 11196 return template; 11197 } 11198 } 11199 }); 11200 11201 11202 11203 /*>>iframe*/ 11204 11205 /*>>gallery*/ 11206 /** 11207 * Get looped index depending on number of slides 11208 */ 11209 var _getLoopedId = function(index) { 11210 var numSlides = mfp.items.length; 11211 if(index > numSlides - 1) { 11212 return index - numSlides; 11213 } else if(index < 0) { 11214 return numSlides + index; 11215 } 11216 return index; 11217 }, 11218 _replaceCurrTotal = function(text, curr, total) { 11219 return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total); 11220 }; 11221 11222 $.magnificPopup.registerModule('gallery', { 11223 11224 options: { 11225 enabled: false, 11226 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', 11227 preload: [0,2], 11228 navigateByImgClick: true, 11229 arrows: true, 11230 11231 tPrev: 'Previous (Left arrow key)', 11232 tNext: 'Next (Right arrow key)', 11233 tCounter: '%curr% of %total%' 11234 }, 11235 11236 proto: { 11237 initGallery: function() { 11238 11239 var gSt = mfp.st.gallery, 11240 ns = '.mfp-gallery'; 11241 11242 mfp.direction = true; // true - next, false - prev 11243 11244 if(!gSt || !gSt.enabled ) return false; 11245 11246 _wrapClasses += ' mfp-gallery'; 11247 11248 _mfpOn(OPEN_EVENT+ns, function() { 11249 11250 if(gSt.navigateByImgClick) { 11251 mfp.wrap.on('click'+ns, '.mfp-img', function() { 11252 if(mfp.items.length > 1) { 11253 mfp.next(); 11254 return false; 11255 } 11256 }); 11257 } 11258 11259 _document.on('keydown'+ns, function(e) { 11260 if (e.keyCode === 37) { 11261 mfp.prev(); 11262 } else if (e.keyCode === 39) { 11263 mfp.next(); 11264 } 11265 }); 11266 }); 11267 11268 _mfpOn('UpdateStatus'+ns, function(e, data) { 11269 if(data.text) { 11270 data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length); 11271 } 11272 }); 11273 11274 _mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) { 11275 var l = mfp.items.length; 11276 values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : ''; 11277 }); 11278 11279 _mfpOn('BuildControls' + ns, function() { 11280 if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) { 11281 var markup = gSt.arrowMarkup, 11282 arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS), 11283 arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS); 11284 11285 arrowLeft.click(function() { 11286 mfp.prev(); 11287 }); 11288 arrowRight.click(function() { 11289 mfp.next(); 11290 }); 11291 11292 mfp.container.append(arrowLeft.add(arrowRight)); 11293 } 11294 }); 11295 11296 _mfpOn(CHANGE_EVENT+ns, function() { 11297 if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout); 11298 11299 mfp._preloadTimeout = setTimeout(function() { 11300 mfp.preloadNearbyImages(); 11301 mfp._preloadTimeout = null; 11302 }, 16); 11303 }); 11304 11305 11306 _mfpOn(CLOSE_EVENT+ns, function() { 11307 _document.off(ns); 11308 mfp.wrap.off('click'+ns); 11309 mfp.arrowRight = mfp.arrowLeft = null; 11310 }); 11311 11312 }, 11313 next: function() { 11314 mfp.direction = true; 11315 mfp.index = _getLoopedId(mfp.index + 1); 11316 mfp.updateItemHTML(); 11317 }, 11318 prev: function() { 11319 mfp.direction = false;
vendor: 34,950 bytes, lines 11320-11569
11320 mfp.index = _getLoopedId(mfp.index - 1); 11321 mfp.updateItemHTML(); 11322 }, 11323 goTo: function(newIndex) { 11324 mfp.direction = (newIndex >= mfp.index); 11325 mfp.index = newIndex; 11326 mfp.updateItemHTML(); 11327 }, 11328 preloadNearbyImages: function() { 11329 var p = mfp.st.gallery.preload, 11330 preloadBefore = Math.min(p[0], mfp.items.length), 11331 preloadAfter = Math.min(p[1], mfp.items.length), 11332 i; 11333 11334 for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) { 11335 mfp._preloadItem(mfp.index+i); 11336 } 11337 for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) { 11338 mfp._preloadItem(mfp.index-i); 11339 } 11340 }, 11341 _preloadItem: function(index) { 11342 index = _getLoopedId(index); 11343 11344 if(mfp.items[index].preloaded) { 11345 return; 11346 } 11347 11348 var item = mfp.items[index]; 11349 if(!item.parsed) { 11350 item = mfp.parseEl( index ); 11351 } 11352 11353 _mfpTrigger('LazyLoad', item); 11354 11355 if(item.type === 'image') { 11356 item.img = $('<img class="mfp-img" />').on('load.mfploader', function() { 11357 item.hasSize = true; 11358 }).on('error.mfploader', function() { 11359 item.hasSize = true; 11360 item.loadError = true; 11361 _mfpTrigger('LazyLoadError', item); 11362 }).attr('src', item.src); 11363 } 11364 11365 11366 item.preloaded = true; 11367 } 11368 } 11369 }); 11370 11371 /*>>gallery*/ 11372 11373 /*>>retina*/ 11374 11375 var RETINA_NS = 'retina'; 11376 11377 $.magnificPopup.registerModule(RETINA_NS, { 11378 options: { 11379 replaceSrc: function(item) { 11380 return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; }); 11381 }, 11382 ratio: 1 // Function or number. Set to 1 to disable. 11383 }, 11384 proto: { 11385 initRetina: function() { 11386 if(window.devicePixelRatio > 1) { 11387 11388 var st = mfp.st.retina, 11389 ratio = st.ratio; 11390 11391 ratio = !isNaN(ratio) ? ratio : ratio(); 11392 11393 if(ratio > 1) { 11394 _mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) { 11395 item.img.css({ 11396 'max-width': item.img[0].naturalWidth / ratio, 11397 'width': '100%' 11398 }); 11399 }); 11400 _mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) { 11401 item.src = st.replaceSrc(item, ratio); 11402 }); 11403 } 11404 } 11405 11406 } 11407 } 11408 }); 11409 11410 /*>>retina*/ 11411 _checkInstance(); })); 11412/*! 11413 * Masonry PACKAGED v4.2.2 11414 * Cascading grid layout library 11415 * https://masonry.desandro.com 11416 * MIT License 11417 * by David DeSandro 11418 */ 11419 11420!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, r, a) { function h(t, e, n) { var o, r = "$()." + i + '("' + e + '")'; return t.each(function (t, h) { var u = a.data(h, i); if (!u) return void s(i + " not initialized. Cannot call methods, i.e. " + r); var d = u[e]; if (!d || "_" == e.charAt(0)) return void s(r + " is not a valid method"); var l = d.apply(u, n); o = void 0 === o ? l : o }), void 0 !== o ? o : t } function u(t, e) { t.each(function (t, n) { var o = a.data(n, i); o ? (o.option(e), o._init()) : (o = new r(n, e), a.data(n, i, o)) }) } a = a || e || t.jQuery, a && (r.prototype.option || (r.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 = o.call(arguments, 1); return h(this, t, e) } return u(this, t), this }, n(a)) } function n(t) { !t || t && t.bridget || (t.bridget = i) } var o = Array.prototype.slice, r = t.console, s = "undefined" == typeof r ? function () { } : function (t) { r.error(t) }; return n(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 || {}, n = i[t] = i[t] || []; return -1 == n.indexOf(e) && n.push(e), this } }, e.once = function (t, e) { if (t && e) { this.on(t, e); var i = this._onceEvents = this._onceEvents || {}, n = i[t] = i[t] || {}; return n[e] = !0, this } }, e.off = function (t, e) { var i = this._events && this._events[t]; if (i && i.length) { var n = i.indexOf(e); return -1 != n && i.splice(n, 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 n = this._onceEvents && this._onceEvents[t], o = 0; o < i.length; o++) { var r = i[o], s = n && n[r]; s && (this.off(t, r), delete n[r]), r.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 = -1 == t.indexOf("%") && !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; u > e; e++) { var i = h[e]; t[i] = 0 } return t } function n(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 o() { 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 o = n(e); s = 200 == Math.round(t(o.width)), r.isBoxSizeOuter = s, i.removeChild(e) } } function r(e) { if (o(), "string" == typeof e && (e = document.querySelector(e)), e && "object" == typeof e && e.nodeType) { var r = n(e); if ("none" == r.display) return i(); var a = {}; a.width = e.offsetWidth, a.height = e.offsetHeight; for (var d = a.isBorderBox = "border-box" == r.boxSizing, l = 0; u > l; l++) { var c = h[l], f = r[c], m = parseFloat(f); a[c] = isNaN(m) ? 0 : m } var p = a.paddingLeft + a.paddingRight, g = a.paddingTop + a.paddingBottom, y = a.marginLeft + a.marginRight, v = a.marginTop + a.marginBottom, _ = a.borderLeftWidth + a.borderRightWidth, z = a.borderTopWidth + a.borderBottomWidth, E = d && s, b = t(r.width); b !== !1 && (a.width = b + (E ? 0 : p + _)); var x = t(r.height); return x !== !1 && (a.height = x + (E ? 0 : g + z)), a.innerWidth = a.width - (p + _), a.innerHeight = a.height - (g + z), a.outerWidth = a.width + y, a.outerHeight = a.height + v, a } } var s, a = "undefined" == typeof console ? e : function (t) { console.error(t) }, h = ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "marginLeft", "marginRight", "marginTop", "marginBottom", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth"], u = h.length, d = !1; return r }), 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 n = e[i], o = n + "MatchesSelector"; if (t[o]) return o } }(); 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 n = 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 ? n.call(t) : [t] }, i.removeFrom = function (t, e) { var i = t.indexOf(e); -1 != i && 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, n) { t = i.makeArray(t); var o = []; return t.forEach(function (t) { if (t instanceof HTMLElement) { if (!n) return void o.push(t); e(t, n) && o.push(t); for (var i = t.querySelectorAll(n), r = 0; r < i.length; r++)o.push(i[r]) } }), o }, i.debounceMethod = function (t, e, i) { i = i || 100; var n = t.prototype[e], o = e + "Timeout"; t.prototype[e] = function () { var t = this[o]; clearTimeout(t); var e = arguments, r = this; this[o] = setTimeout(function () { n.apply(r, e), delete r[o] }, 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 o = t.console; return i.htmlInit = function (e, n) { i.docReady(function () { var r = i.toDashed(n), s = "data-" + r, a = document.querySelectorAll("[" + s + "]"), h = document.querySelectorAll(".js-" + r), u = i.makeArray(a).concat(i.makeArray(h)), d = s + "-options", l = t.jQuery; u.forEach(function (t) { var i, r = t.getAttribute(s) || t.getAttribute(d); try { i = r && JSON.parse(r) } catch (a) { return void (o && o.error("Error parsing " + s + " on " + t.className + ": " + a)) } var h = new e(t, i); l && l.data(t, n, h) }) }) }, 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 n(t, e) { t && (this.element = t, this.layout = e, this.position = { x: 0, y: 0 }, this._create()) } function o(t) { return t.replace(/([A-Z])/g, function (t) { return "-" + t.toLowerCase() }) } var r = document.documentElement.style, s = "string" == typeof r.transition ? "transition" : "WebkitTransition", a = "string" == typeof r.transform ? "transform" : "WebkitTransform", h = { WebkitTransition: "webkitTransitionEnd", transition: "transitionend" }[s], u = { transform: a, transition: s, transitionDuration: s + "Duration", transitionProperty: s + "Property", transitionDelay: s + "Delay" }, d = n.prototype = Object.create(t.prototype); d.constructor = n, 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 n = u[i] || i; e[n] = t[i] } }, d.getPosition = function () { var t = getComputedStyle(this.element), e = this.layout._getOption("originLeft"), i = this.layout._getOption("originTop"), n = t[e ? "left" : "right"], o = t[i ? "top" : "bottom"], r = parseFloat(n), s = parseFloat(o), a = this.layout.size; -1 != n.indexOf("%") && (r = r / 100 * a.width), -1 != o.indexOf("%") && (s = s / 100 * a.height), r = isNaN(r) ? 0 : r, s = isNaN(s) ? 0 : s, r -= e ? a.paddingLeft : a.paddingRight, s -= i ? a.paddingTop : a.paddingBottom, this.position.x = r, this.position.y = s }, d.layoutPosition = function () { var t = this.layout.size, e = {}, i = this.layout._getOption("originLeft"), n = this.layout._getOption("originTop"), o = i ? "paddingLeft" : "paddingRight", r = i ? "left" : "right", s = i ? "right" : "left", a = this.position.x + t[o]; e[r] = this.getXValue(a), e[s] = ""; var h = n ? "paddingTop" : "paddingBottom", u = n ? "top" : "bottom", d = n ? "bottom" : "top", l = this.position.y + t[h]; e[u] = 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, n = this.position.y, o = t == this.position.x && e == this.position.y; if (this.setPosition(t, e), o && !this.isTransitioning) return void this.layoutPosition(); var r = t - i, s = e - n, a = {}; a.transform = this.getTranslate(r, s), this.transition({ to: a, onTransitionEnd: { transform: this.layoutPosition }, isCleaning: !0 }) }, d.getTranslate = function (t, e) { var i = this.layout._getOption("originLeft"), n = this.layout._getOption("originTop"); return t = i ? t : -t, e = n ? 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 n = this.element.offsetHeight; n = null } this.enableTransition(t.to), this.css(t.to), this.isTransitioning = !0 }; var l = "opacity," + o(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(h, this, !1) } }, d.onwebkitTransitionEnd = function (t) { this.ontransitionend(t) }, d.onotransitionend = function (t) { this.ontransitionend(t) }; var c = { "-webkit-transform": "transform" }; d.ontransitionend = function (t) { if (t.target === this.element) { var e = this._transn, n = c[t.propertyName] || t.propertyName; if (delete e.ingProperties[n], i(e.ingProperties) && this.disableTransition(), n in e.clean && (this.element.style[t.propertyName] = "", delete e.clean[n]), n in e.onEnd) { var o = e.onEnd[n]; o.call(this), delete e.onEnd[n] } this.emitEvent("transitionEnd", [this]) } }, d.disableTransition = function () { this.removeTransitionStyles(), this.element.removeEventListener(h, this, !1), this.isTransitioning = !1 }, d._removeStyles = function (t) { var e = {}; for (var i in t) e[i] = ""; this.css(e) }; var f = { transitionProperty: "", transitionDuration: "", transitionDelay: "" }; return d.removeTransitionStyles = function () { this.css(f) }, 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 s && 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: "" }) }, n }), 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, n, o, r) { return e(t, i, n, o, r) }) : "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, n, o) { "use strict"; function r(t, e) { var i = n.getQueryElement(t); if (!i) return void (h && h.error("Bad element for " + this.constructor.namespace + ": " + (i || t))); this.element = i, u && (this.$element = u(this.element)), this.options = n.extend({}, this.constructor.defaults), this.option(e); var o = ++l; this.element.outlayerGUID = o, c[o] = this, this._create(); var r = this._getOption("initLayout"); r && this.layout() } function s(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], n = e && e[2]; if (!i.length) return 0; i = parseFloat(i); var o = m[n] || 1; return i * o } var h = t.console, u = t.jQuery, d = function () { }, l = 0, c = {}; r.namespace = "outlayer", r.Item = o, r.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 f = r.prototype; n.extend(f, e.prototype), f.option = function (t) { n.extend(this.options, t) }, f._getOption = function (t) { var e = this.constructor.compatOptions[t]; return e && void 0 !== this.options[e] ? this.options[e] : this.options[t] }, r.compatOptions = { initLayout: "isInitLayout", horizontal: "isHorizontal", layoutInstant: "isLayoutInstant", originLeft: "isOriginLeft", originTop: "isOriginTop", resize: "isResizeBound", resizeContainer: "isResizingContainer" }, f._create = function () { this.reloadItems(), this.stamps = [], this.stamp(this.options.stamp), n.extend(this.element.style, this.options.containerStyle); var t = this._getOption("resize"); t && this.bindResize() }, f.reloadItems = function () { this.items = this._itemize(this.element.children) }, f._itemize = function (t) { for (var e = this._filterFindItemElements(t), i = this.constructor.Item, n = [], o = 0; o < e.length; o++) { var r = e[o], s = new i(r, this); n.push(s) } return n }, f._filterFindItemElements = function (t) { return n.filterFindElements(t, this.options.itemSelector) }, f.getItemElements = function () { return this.items.map(function (t) { return t.element }) }, f.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 }, f._init = f.layout, f._resetLayout = function () { this.getSize() }, f.getSize = function () { this.size = i(this.element) }, f._getMeasurement = function (t, e) { var n, o = this.options[t]; o ? ("string" == typeof o ? n = this.element.querySelector(o) : o instanceof HTMLElement && (n = o), this[t] = n ? i(n)[e] : o) : this[t] = 0 }, f.layoutItems = function (t, e) { t = this._getItemsForLayout(t), this._layoutItems(t, e), this._postLayout() }, f._getItemsForLayout = function (t) { return t.filter(function (t) { return !t.isIgnored }) }, f._layoutItems = function (t, e) { if (this._emitCompleteOnItems("layout", t), t && t.length) { var i = []; t.forEach(function (t) { var n = this._getItemLayoutPosition(t); n.item = t, n.isInstant = e || t.isLayoutInstant, i.push(n) }, this), this._processLayoutQueue(i) } }, f._getItemLayoutPosition = function () { return { x: 0, y: 0 } }, f._processLayoutQueue = function (t) { this.updateStagger(), t.forEach(function (t, e) { this._positionItem(t.item, t.x, t.y, t.isInstant, e) }, this) }, f.updateStagger = function () { var t = this.options.stagger; return null === t || void 0 === t ? void (this.stagger = 0) : (this.stagger = a(t), this.stagger) }, f._positionItem = function (t, e, i, n, o) { n ? t.goTo(e, i) : (t.stagger(o * this.stagger), t.moveTo(e, i)) }, f._postLayout = function () { this.resizeContainer() }, f.resizeContainer = function () { var t = this._getOption("resizeContainer"); if (t) { var e = this._getContainerSize(); e && (this._setContainerMeasure(e.width, !0), this._setContainerMeasure(e.height, !1)) } }, f._getContainerSize = d, f._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" } }, f._emitCompleteOnItems = function (t, e) { function i() { o.dispatchEvent(t + "Complete", null, [e]) } function n() { s++, s == r && i() } var o = this, r = e.length; if (!e || !r) return void i(); var s = 0; e.forEach(function (e) { e.once(t, n) }) }, f.dispatchEvent = function (t, e, i) { var n = e ? [e].concat(i) : i; if (this.emitEvent(t, n), u) if (this.$element = this.$element || u(this.element), e) { var o = u.Event(e); o.type = t, this.$element.trigger(o, i) } else this.$element.trigger(t, i) }, f.ignore = function (t) { var e = this.getItem(t); e && (e.isIgnored = !0) }, f.unignore = function (t) { var e = this.getItem(t); e && delete e.isIgnored }, f.stamp = function (t) { t = this._find(t), t && (this.stamps = this.stamps.concat(t), t.forEach(this.ignore, this)) }, f.unstamp = function (t) { t = this._find(t), t && t.forEach(function (t) { n.removeFrom(this.stamps, t), this.unignore(t) }, this) }, f._find = function (t) { return t ? ("string" == typeof t && (t = this.element.querySelectorAll(t)), t = n.makeArray(t)) : void 0 }, f._manageStamps = function () { this.stamps && this.stamps.length && (this._getBoundingRect(), this.stamps.forEach(this._manageStamp, this)) }, f._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) } }, f._manageStamp = d, f._getElementOffset = function (t) { var e = t.getBoundingClientRect(), n = this._boundingRect, o = i(t), r = { left: e.left - n.left - o.marginLeft, top: e.top - n.top - o.marginTop, right: n.right - e.right - o.marginRight, bottom: n.bottom - e.bottom - o.marginBottom }; return r }, f.handleEvent = n.handleEvent, f.bindResize = function () { t.addEventListener("resize", this), this.isResizeBound = !0 }, f.unbindResize = function () { t.removeEventListener("resize", this), this.isResizeBound = !1 }, f.onresize = function () { this.resize() }, n.debounceMethod(r, "onresize", 100), f.resize = function () { this.isResizeBound && this.needsResizeLayout() && this.layout() }, f.needsResizeLayout = function () { var t = i(this.element), e = this.size && t; return e && t.innerWidth !== this.size.innerWidth }, f.addItems = function (t) { var e = this._itemize(t); return e.length && (this.items = this.items.concat(e)), e }, f.appended = function (t) { var e = this.addItems(t); e.length && (this.layoutItems(e, !0), this.reveal(e)) }, f.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) } }, f.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() }) } }, f.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() }) } }, f.revealItemElements = function (t) { var e = this.getItems(t); this.reveal(e) }, f.hideItemElements = function (t) { var e = this.getItems(t); this.hide(e) }, f.getItem = function (t) { for (var e = 0; e < this.items.length; e++) { var i = this.items[e]; if (i.element == t) return i } }, f.getItems = function (t) { t = n.makeArray(t); var e = []; return t.forEach(function (t) { var i = this.getItem(t); i && e.push(i) }, this), e }, f.remove = function (t) { var e = this.getItems(t); this._emitCompleteOnItems("remove", e), e && e.length && e.forEach(function (t) { t.remove(), n.removeFrom(this.items, t) }, this) }, f.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 c[e], delete this.element.outlayerGUID, u && u.removeData(this.element, this.constructor.namespace) }, r.data = function (t) { t = n.getQueryElement(t); var e = t && t.outlayerGUID; return e && c[e] }, r.create = function (t, e) { var i = s(r); return i.defaults = n.extend({}, r.defaults), n.extend(i.defaults, e), i.compatOptions = n.extend({}, r.compatOptions), i.namespace = t, i.data = r.data, i.Item = s(o), n.htmlInit(i, t), u && u.bridget && u.bridget(t, i), i }; var m = { ms: 1, s: 1e3 }; return r.Item = o, r }), function (t, e) { "function" == typeof define && define.amd ? define(["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 n = i.prototype; return n._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 }, n.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 n = this.columnWidth += this.gutter, o = this.containerWidth + this.gutter, r = o / n, s = n - o % n, a = s && 1 > s ? "round" : "floor"; r = Math[a](r), this.cols = Math.max(r, 1) }, n.getContainerWidth = function () { var t = this._getOption("fitWidth"), i = t ? this.element.parentNode : this.element, n = e(i); this.containerWidth = n && n.innerWidth }, n._getItemLayoutPosition = function (t) { t.getSize(); var e = t.size.outerWidth % this.columnWidth, i = e && 1 > e ? "round" : "ceil", n = Math[i](t.size.outerWidth / this.columnWidth); n = Math.min(n, this.cols); for (var o = this.options.horizontalOrder ? "_getHorizontalColPosition" : "_getTopColPosition", r = this[o](n, t), s = { x: this.columnWidth * r.col, y: r.y }, a = r.y + t.size.outerHeight, h = n + r.col, u = r.col; h > u; u++)this.colYs[u] = a; return s }, n._getTopColPosition = function (t) { var e = this._getTopColGroup(t), i = Math.min.apply(Math, e); return { col: e.indexOf(i), y: i } }, n._getTopColGroup = function (t) { if (2 > t) return this.colYs; for (var e = [], i = this.cols + 1 - t, n = 0; i > n; n++)e[n] = this._getColGroupY(n, t); return e }, n._getColGroupY = function (t, e) { if (2 > e) return this.colYs[t]; var i = this.colYs.slice(t, t + e); return Math.max.apply(Math, i) }, n._getHorizontalColPosition = function (t, e) { var i = this.horizontalColIndex % this.cols, n = t > 1 && i + t > this.cols; i = n ? 0 : i; var o = e.size.outerWidth && e.size.outerHeight; return this.horizontalColIndex = o ? i + t : this.horizontalColIndex, { col: i, y: this._getColGroupY(i, t) } }, n._manageStamp = function (t) { var i = e(t), n = this._getElementOffset(t), o = this._getOption("originLeft"), r = o ? n.left : n.right, s = r + i.outerWidth, a = Math.floor(r / this.columnWidth); a = Math.max(0, a); var h = Math.floor(s / this.columnWidth); h -= s % this.columnWidth ? 0 : 1, h = Math.min(this.cols - 1, h); for (var u = this._getOption("originTop"), d = (u ? n.top : n.bottom) + i.outerHeight, l = a; h >= l; l++)this.colYs[l] = Math.max(d, this.colYs[l]) }, n._getContainerSize = function () { this.maxY = Math.max.apply(Math, this.colYs); var t = { height: this.maxY }; return this._getOption("fitWidth") && (t.width = this._getContainerFitWidth()), t }, n._getContainerFitWidth = function () { for (var t = 0, e = this.cols; --e && 0 === this.colYs[e];)t++; return (this.cols - t) * this.columnWidth - this.gutter }, n.needsResizeLayout = function () { var t = this.containerWidth; return this.getContainerWidth(), t != this.containerWidth }, i }); 11421/** 11422 * jquery-match-height master by @liabru 11423 * http://brm.io/jquery-match-height/ 11424 * License: MIT 11425 */ 11426 11427;(function(factory) { // eslint-disable-line no-extra-semi 11428 'use strict'; 11429 if (typeof define === 'function' && define.amd) { 11430 // AMD 11431 define(['jquery'], factory); 11432 } else if (typeof module !== 'undefined' && module.exports) { 11433 // CommonJS 11434 module.exports = factory(require('jquery')); 11435 } else { 11436 // Global 11437 factory(jQuery); 11438 } 11439})(function($) { 11440 /* 11441 * internal 11442 */ 11443 11444 var _previousResizeWidth = -1, 11445 _updateTimeout = -1; 11446 11447 /* 11448 * _parse 11449 * value parse utility function 11450 */ 11451 11452 var _parse = function(value) { 11453 // parse value and convert NaN to 0 11454 return parseFloat(value) || 0; 11455 }; 11456 11457 /* 11458 * _rows 11459 * utility function returns array of jQuery selections representing each row 11460 * (as displayed after float wrapping applied by browser) 11461 */ 11462 11463 var _rows = function(elements) { 11464 var tolerance = 1, 11465 $elements = $(elements), 11466 lastTop = null, 11467 rows = []; 11468 11469 // group elements by their top position 11470 $elements.each(function(){ 11471 var $that = $(this), 11472 top = $that.offset().top - _parse($that.css('margin-top')), 11473 lastRow = rows.length > 0 ? rows[rows.length - 1] : null; 11474 11475 if (lastRow === null) { 11476 // first item on the row, so just push it 11477 rows.push($that); 11478 } else { 11479 // if the row top is the same, add to the row group 11480 if (Math.floor(Math.abs(lastTop - top)) <= tolerance) { 11481 rows[rows.length - 1] = lastRow.add($that); 11482 } else { 11483 // otherwise start a new row group 11484 rows.push($that); 11485 } 11486 } 11487 11488 // keep track of the last row top 11489 lastTop = top; 11490 }); 11491 11492 return rows; 11493 }; 11494 11495 /* 11496 * _parseOptions 11497 * handle plugin options 11498 */ 11499 11500 var _parseOptions = function(options) { 11501 var opts = { 11502 byRow: true, 11503 property: 'height', 11504 target: null, 11505 remove: false 11506 }; 11507 11508 if (typeof options === 'object') { 11509 return $.extend(opts, options); 11510 } 11511 11512 if (typeof options === 'boolean') { 11513 opts.byRow = options; 11514 } else if (options === 'remove') { 11515 opts.remove = true; 11516 } 11517 11518 return opts; 11519 }; 11520 11521 /* 11522 * matchHeight 11523 * plugin definition 11524 */ 11525 11526 var matchHeight = $.fn.matchHeight = function(options) { 11527 var opts = _parseOptions(options); 11528 11529 // handle remove 11530 if (opts.remove) { 11531 var that = this; 11532 11533 // remove fixed height from all selected elements 11534 this.css(opts.property, ''); 11535 11536 // remove selected elements from all groups 11537 $.each(matchHeight._groups, function(key, group) { 11538 group.elements = group.elements.not(that); 11539 }); 11540 11541 // TODO: cleanup empty groups 11542 11543 return this; 11544 } 11545 11546 if (this.length <= 1 && !opts.target) { 11547 return this; 11548 } 11549 11550 // keep track of this group so we can re-apply later on load and resize events 11551 matchHeight._groups.push({ 11552 elements: this, 11553 options: opts 11554 }); 11555 11556 // match each element's height to the tallest element in the selection 11557 matchHeight._apply(this, opts); 11558 11559 return this; 11560 }; 11561 11562 /* 11563 * plugin global options 11564 */ 11565 11566 matchHeight.version = 'master'; 11567 matchHeight._groups = []; 11568 matchHeight._throttle = 80; 11569 matchHeight._maintainScroll = false;
11570 matchHeight._beforeUpdate = null; 11571 matchHeight._afterUpdate = null; 11572 matchHeight._rows = _rows; 11573 matchHeight._parse = _parse; 11574 matchHeight._parseOptions = _parseOptions; 11575 11576 /* 11577 * matchHeight._apply 11578 * apply matchHeight to given elements 11579 */ 11580 11581 matchHeight._apply = function(elements, options) { 11582 var opts = _parseOptions(options), 11583 $elements = $(elements), 11584 rows = [$elements]; 11585 11586 // take note of scroll position 11587 var scrollTop = $(window).scrollTop(), 11588 htmlHeight = $('html').outerHeight(true); 11589 11590 // get hidden parents 11591 var $hiddenParents = $elements.parents().filter(':hidden'); 11592 11593 // cache the original inline style 11594 $hiddenParents.each(function() { 11595 var $that = $(this); 11596 $that.data('style-cache', $that.attr('style')); 11597 }); 11598 11599 // temporarily must force hidden parents visible 11600 $hiddenParents.css('display', 'block'); 11601 11602 // get rows if using byRow, otherwise assume one row 11603 if (opts.byRow && !opts.target) { 11604 11605 // must first force an arbitrary equal height so floating elements break evenly 11606 $elements.each(function() { 11607 var $that = $(this), 11608 display = $that.css('display'); 11609 11610 // temporarily force a usable display value 11611 if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { 11612 display = 'block'; 11613 } 11614 11615 // cache the original inline style 11616 $that.data('style-cache', $that.attr('style')); 11617 11618 $that.css({ 11619 'display': display, 11620 'padding-top': '0', 11621 'padding-bottom': '0', 11622 'margin-top': '0', 11623 'margin-bottom': '0', 11624 'border-top-width': '0', 11625 'border-bottom-width': '0', 11626 'height': '100px', 11627 'overflow': 'hidden' 11628 }); 11629 }); 11630 11631 // get the array of rows (based on element top position) 11632 rows = _rows($elements); 11633 11634 // revert original inline styles 11635 $elements.each(function() { 11636 var $that = $(this); 11637 $that.attr('style', $that.data('style-cache') || ''); 11638 }); 11639 } 11640 11641 $.each(rows, function(key, row) { 11642 var $row = $(row), 11643 targetHeight = 0; 11644 11645 if (!opts.target) { 11646 // skip apply to rows with only one item 11647 if (opts.byRow && $row.length <= 1) { 11648 $row.css(opts.property, ''); 11649 return; 11650 } 11651 11652 // iterate the row and find the max height 11653 $row.each(function(){ 11654 var $that = $(this), 11655 style = $that.attr('style'), 11656 display = $that.css('display'); 11657 11658 // temporarily force a usable display value 11659 if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { 11660 display = 'block'; 11661 } 11662 11663 // ensure we get the correct actual height (and not a previously set height value) 11664 var css = { 'display': display }; 11665 css[opts.property] = ''; 11666 $that.css(css); 11667 11668 // find the max height (including padding, but not margin) 11669 if ($that.outerHeight(false) > targetHeight) { 11670 targetHeight = $that.outerHeight(false); 11671 } 11672 11673 // revert styles 11674 if (style) { 11675 $that.attr('style', style); 11676 } else { 11677 $that.css('display', ''); 11678 } 11679 }); 11680 } else { 11681 // if target set, use the height of the target element 11682 targetHeight = opts.target.outerHeight(false); 11683 } 11684 11685 // iterate the row and apply the height to all elements 11686 $row.each(function(){ 11687 var $that = $(this), 11688 verticalPadding = 0; 11689 11690 // don't apply to a target 11691 if (opts.target && $that.is(opts.target)) { 11692 return; 11693 } 11694 11695 // handle padding and border correctly (required when not using border-box) 11696 if ($that.css('box-sizing') !== 'border-box') { 11697 verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width')); 11698 verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom')); 11699 } 11700 11701 // set the height (accounting for padding and border) 11702 $that.css(opts.property, (targetHeight - verticalPadding) + 'px'); 11703 }); 11704 }); 11705 11706 // revert hidden parents 11707 $hiddenParents.each(function() { 11708 var $that = $(this); 11709 $that.attr('style', $that.data('style-cache') || null); 11710 }); 11711 11712 // restore scroll position if enabled 11713 if (matchHeight._maintainScroll) { 11714 $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true)); 11715 } 11716 11717 return this; 11718 }; 11719 11720 /* 11721 * matchHeight._applyDataApi 11722 * applies matchHeight to all elements with a data-match-height attribute 11723 */ 11724 11725 matchHeight._applyDataApi = function() { 11726 var groups = {}; 11727 11728 // generate groups by their groupId set by elements using data-match-height 11729 $('[data-match-height], [data-mh]').each(function() { 11730 var $this = $(this), 11731 groupId = $this.attr('data-mh') || $this.attr('data-match-height'); 11732 11733 if (groupId in groups) { 11734 groups[groupId] = groups[groupId].add($this); 11735 } else { 11736 groups[groupId] = $this; 11737 } 11738 }); 11739 11740 // apply matchHeight to each group 11741 $.each(groups, function() { 11742 this.matchHeight(true); 11743 }); 11744 }; 11745 11746 /* 11747 * matchHeight._update 11748 * updates matchHeight on all current groups with their correct options 11749 */ 11750 11751 var _update = function(event) { 11752 if (matchHeight._beforeUpdate) { 11753 matchHeight._beforeUpdate(event, matchHeight._groups); 11754 } 11755 11756 $.each(matchHeight._groups, function() { 11757 matchHeight._apply(this.elements, this.options); 11758 }); 11759 11760 if (matchHeight._afterUpdate) { 11761 matchHeight._afterUpdate(event, matchHeight._groups); 11762 } 11763 }; 11764 11765 matchHeight._update = function(throttle, event) { 11766 // prevent update if fired from a resize event 11767 // where the viewport width hasn't actually changed 11768 // fixes an event looping bug in IE8 11769 if (event && event.type === 'resize') { 11770 var windowWidth = $(window).width(); 11771 if (windowWidth === _previousResizeWidth) { 11772 return; 11773 } 11774 _previousResizeWidth = windowWidth; 11775 } 11776 11777 // throttle updates 11778 if (!throttle) { 11779 _update(event); 11780 } else if (_updateTimeout === -1) { 11781 _updateTimeout = setTimeout(function() { 11782 _update(event); 11783 _updateTimeout = -1; 11784 }, matchHeight._throttle); 11785 } 11786 }; 11787 11788 /* 11789 * bind events 11790 */ 11791 11792 // apply on DOM ready event 11793 $(matchHeight._applyDataApi); 11794 11795 // use on or bind where supported 11796 var on = $.fn.on ? 'on' : 'bind'; 11797 11798 // update heights on load and resize events 11799 $(window)[on]('load', function(event) { 11800 matchHeight._update(false, event); 11801 }); 11802 11803 // throttled update heights on resize events 11804 $(window)[on]('resize orientationchange', function(event) { 11805 matchHeight._update(true, event); 11806 }); 11807 11808}); 11809(function (global, factory) { 11810 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : 11811 typeof define === 'function' && define.amd ? define(['exports'], factory) : 11812 (global = global || self, factory(global.window = global.window || {})); 11813}(this, (function (exports) { 11814 'use strict'; 11815 11816 /*! 11817 * ScrollTrigger 3.7.1 11818 * https://greensock.com 11819 * 11820 * @license Copyright 2008-2021, GreenSock. All rights reserved. 11821 * Subject to the terms at https://greensock.com/standard-license or for 11822 * Club GreenSock members, the agreement issued with that membership. 11823 * @author: Jack Doyle, [email protected] 11824 */ 11825 var gsap, 11826 _coreInitted, 11827 _win, 11828 _doc, 11829 _docEl, 11830 _body, 11831 _root, 11832 _resizeDelay, 11833 _raf, 11834 _request, 11835 _toArray, 11836 _clamp, 11837 _time2, 11838 _syncInterval, 11839 _refreshing, 11840 _pointerIsDown, 11841 _transformProp, 11842 _i, 11843 _prevWidth, 11844 _prevHeight, 11845 _autoRefresh, 11846 _sort, 11847 _suppressOverwrites, 11848 _ignoreResize, 11849 _limitCallbacks, 11850 _startup = 1, 11851 _proxies = [], 11852 _scrollers = [], 11853 _getTime = Date.now, 11854 _time1 = _getTime(), 11855 _lastScrollTime = 0, 11856 _enabled = 1, 11857 _passThrough = function _passThrough(v) { 11858 return v; 11859 }, 11860 _round = function _round(value) { 11861 return Math.round(value * 100000) / 100000 || 0; 11862 }, 11863 _windowExists = function _windowExists() { 11864 return typeof window !== "undefined"; 11865 }, 11866 _getGSAP = function _getGSAP() { 11867 return gsap || _windowExists() && (gsap = window.gsap) && gsap.registerPlugin && gsap; 11868 }, 11869 _isViewport = function _isViewport(e) { 11870 return !!~_root.indexOf(e); 11871 }, 11872 _getProxyProp = function _getProxyProp(element, property) { 11873 return ~_proxies.indexOf(element) && _proxies[_proxies.indexOf(element) + 1][property]; 11874 }, 11875 _getScrollFunc = function _getScrollFunc(element, _ref) { 11876 var s = _ref.s, 11877 sc = _ref.sc; 11878 11879 var i = _scrollers.indexOf(element), 11880 offset = sc === _vertical.sc ? 1 : 2; 11881 11882 !~i && (i = _scrollers.push(element) - 1); 11883 return _scrollers[i + offset] || (_scrollers[i + offset] = _getProxyProp(element, s) || (_isViewport(element) ? sc : function (value) { 11884 return arguments.length ? element[s] = value : element[s]; 11885 })); 11886 }, 11887 _getBoundsFunc = function _getBoundsFunc(element) { 11888 return _getProxyProp(element, "getBoundingClientRect") || (_isViewport(element) ? function () { 11889 _winOffsets.width = _win.innerWidth; 11890 _winOffsets.height = _win.innerHeight; 11891 return _winOffsets; 11892 } : function () { 11893 return _getBounds(element); 11894 }); 11895 }, 11896 _getSizeFunc = function _getSizeFunc(scroller, isViewport, _ref2) { 11897 var d = _ref2.d, 11898 d2 = _ref2.d2, 11899 a = _ref2.a; 11900 return (a = _getProxyProp(scroller, "getBoundingClientRect")) ? function () { 11901 return a()[d]; 11902 } : function () { 11903 return (isViewport ? _win["inner" + d2] : scroller["client" + d2]) || 0; 11904 }; 11905 }, 11906 _getOffsetsFunc = function _getOffsetsFunc(element, isViewport) { 11907 return !isViewport || ~_proxies.indexOf(element) ? _getBoundsFunc(element) : function () { 11908 return _winOffsets; 11909 }; 11910 }, 11911 _maxScroll = function _maxScroll(element, _ref3) { 11912 var s = _ref3.s, 11913 d2 = _ref3.d2, 11914 d = _ref3.d, 11915 a = _ref3.a; 11916 return (s = "scroll" + d2) && (a = _getProxyProp(element, s)) ? a() - _getBoundsFunc(element)()[d] : _isViewport(element) ? Math.max(_docEl[s], _body[s]) - (_win["inner" + d2] || _docEl["client" + d2] || _body["client" + d2]) : element[s] - element["offset" + d2]; 11917 }, 11918 _iterateAutoRefresh = function _iterateAutoRefresh(func, events) { 11919 for (var i = 0; i < _autoRefresh.length; i += 3) { 11920 (!events || ~events.indexOf(_autoRefresh[i + 1])
vendor: 9,512 bytes, lines 11920-12144
11920) && func(_autoRefresh[i], _autoRefresh[i + 1], _autoRefresh[i + 2]); 11921 } 11922 }, 11923 _isString = function _isString(value) { 11924 return typeof value === "string"; 11925 }, 11926 _isFunction = function _isFunction(value) { 11927 return typeof value === "function"; 11928 }, 11929 _isNumber = function _isNumber(value) { 11930 return typeof value === "number"; 11931 }, 11932 _isObject = function _isObject(value) { 11933 return typeof value === "object"; 11934 }, 11935 _callIfFunc = function _callIfFunc(value) { 11936 return _isFunction(value) && value(); 11937 }, 11938 _combineFunc = function _combineFunc(f1, f2) { 11939 return function () { 11940 var result1 = _callIfFunc(f1), 11941 result2 = _callIfFunc(f2); 11942 11943 return function () { 11944 _callIfFunc(result1); 11945 11946 _callIfFunc(result2); 11947 }; 11948 }; 11949 }, 11950 _abs = Math.abs, 11951 _scrollLeft = "scrollLeft", 11952 _scrollTop = "scrollTop", 11953 _left = "left", 11954 _top = "top", 11955 _right = "right", 11956 _bottom = "bottom", 11957 _width = "width", 11958 _height = "height", 11959 _Right = "Right", 11960 _Left = "Left", 11961 _Top = "Top", 11962 _Bottom = "Bottom", 11963 _padding = "padding", 11964 _margin = "margin", 11965 _Width = "Width", 11966 _Height = "Height", 11967 _px = "px", 11968 _horizontal = { 11969 s: _scrollLeft, 11970 p: _left, 11971 p2: _Left, 11972 os: _right, 11973 os2: _Right, 11974 d: _width, 11975 d2: _Width, 11976 a: "x", 11977 sc: function sc(value) { 11978 return arguments.length ? _win.scrollTo(value, _vertical.sc()) : _win.pageXOffset || _doc[_scrollLeft] || _docEl[_scrollLeft] || _body[_scrollLeft] || 0; 11979 } 11980 }, 11981 _vertical = { 11982 s: _scrollTop, 11983 p: _top, 11984 p2: _Top, 11985 os: _bottom, 11986 os2: _Bottom, 11987 d: _height, 11988 d2: _Height, 11989 a: "y", 11990 op: _horizontal, 11991 sc: function sc(value) { 11992 return arguments.length ? _win.scrollTo(_horizontal.sc(), value) : _win.pageYOffset || _doc[_scrollTop] || _docEl[_scrollTop] || _body[_scrollTop] || 0; 11993 } 11994 }, 11995 _getComputedStyle = function _getComputedStyle(element) { 11996 return _win.getComputedStyle(element); 11997 }, 11998 _makePositionable = function _makePositionable(element) { 11999 var position = _getComputedStyle(element).position; 12000 12001 element.style.position = position === "absolute" || position === "fixed" ? position : "relative"; 12002 }, 12003 _setDefaults = function _setDefaults(obj, defaults) { 12004 for (var p in defaults) { 12005 p in obj || (obj[p] = defaults[p]); 12006 } 12007 12008 return obj; 12009 }, 12010 _getBounds = function _getBounds(element, withoutTransforms) { 12011 var tween = withoutTransforms && _getComputedStyle(element)[_transformProp] !== "matrix(1, 0, 0, 1, 0, 0)" && gsap.to(element, { 12012 x: 0, 12013 y: 0, 12014 xPercent: 0, 12015 yPercent: 0, 12016 rotation: 0, 12017 rotationX: 0, 12018 rotationY: 0, 12019 scale: 1, 12020 skewX: 0, 12021 skewY: 0 12022 }).progress(1), 12023 bounds = element.getBoundingClientRect(); 12024 tween && tween.progress(0).kill(); 12025 return bounds; 12026 }, 12027 _getSize = function _getSize(element, _ref4) { 12028 var d2 = _ref4.d2; 12029 return element["offset" + d2] || element["client" + d2] || 0; 12030 }, 12031 _getLabelRatioArray = function _getLabelRatioArray(timeline) { 12032 var a = [], 12033 labels = timeline.labels, 12034 duration = timeline.duration(), 12035 p; 12036 12037 for (p in labels) { 12038 a.push(labels[p] / duration); 12039 } 12040 12041 return a; 12042 }, 12043 _getClosestLabel = function _getClosestLabel(animation) { 12044 return function (value) { 12045 return gsap.utils.snap(_getLabelRatioArray(animation), value); 12046 }; 12047 }, 12048 _getLabelAtDirection = function _getLabelAtDirection(timeline) { 12049 return function (value, st) { 12050 var a = _getLabelRatioArray(timeline), 12051 i; 12052 12053 a.sort(function (a, b) { 12054 return a - b; 12055 }); 12056 12057 if (st.direction > 0) { 12058 value -= 1e-4; 12059 12060 for (i = 0; i < a.length; i++) { 12061 if (a[i] >= value) { 12062 return a[i]; 12063 } 12064 } 12065 12066 return a.pop(); 12067 } else { 12068 i = a.length; 12069 value += 1e-4; 12070 12071 while (i--) { 12072 if (a[i] <= value) { 12073 return a[i]; 12074 } 12075 } 12076 } 12077 12078 return a[0]; 12079 }; 12080 }, 12081 _multiListener = function _multiListener(func, element, types, callback) { 12082 return types.split(",").forEach(function (type) { 12083 return func(element, type, callback); 12084 }); 12085 }, 12086 _addListener = function _addListener(element, type, func) { 12087 return element.addEventListener(type, func, { 12088 passive: true 12089 }); 12090 }, 12091 _removeListener = function _removeListener(element, type, func) { 12092 return element.removeEventListener(type, func); 12093 }, 12094 _markerDefaults = { 12095 startColor: "green", 12096 endColor: "red", 12097 indent: 0, 12098 fontSize: "16px", 12099 fontWeight: "normal" 12100 }, 12101 _defaults = { 12102 toggleActions: "play", 12103 anticipatePin: 0 12104 }, 12105 _keywords = { 12106 top: 0, 12107 left: 0, 12108 center: 0.5, 12109 bottom: 1, 12110 right: 1 12111 }, 12112 _offsetToPx = function _offsetToPx(value, size) { 12113 if (_isString(value)) { 12114 var eqIndex = value.indexOf("="), 12115 relative = ~eqIndex ? +(value.charAt(eqIndex - 1) + 1) * parseFloat(value.substr(eqIndex + 1)) : 0; 12116 12117 if (~eqIndex) { 12118 value.indexOf("%") > eqIndex && (relative *= size / 100); 12119 value = value.substr(0, eqIndex - 1); 12120 } 12121 12122 value = relative + (value in _keywords ? _keywords[value] * size : ~value.indexOf("%") ? parseFloat(value) * size / 100 : parseFloat(value) || 0); 12123 } 12124 12125 return value; 12126 }, 12127 _createMarker = function _createMarker(type, name, container, direction, _ref5, offset, matchWidthEl) { 12128 var startColor = _ref5.startColor, 12129 endColor = _ref5.endColor, 12130 fontSize = _ref5.fontSize, 12131 indent = _ref5.indent, 12132 fontWeight = _ref5.fontWeight; 12133 12134 var e = _doc.createElement("div"), 12135 useFixedPosition = _isViewport(container) || _getProxyProp(container, "pinType") === "fixed", 12136 isScroller = type.indexOf("scroller") !== -1, 12137 parent = useFixedPosition ? _body : container, 12138 isStart = type.indexOf("start") !== -1, 12139 color = isStart ? startColor : endColor, 12140 css = "border-color:" + color + ";font-size:" + fontSize + ";color:" + color + ";font-weight:" + fontWeight + ";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;"; 12141 12142 css += "position:" + (isScroller && useFixedPosition ? "fixed;" : "absolute;"); 12143 (isScroller || !useFixedPosition) && (css += (direction === _vertical ? _right : _bottom) + ":" + (offset + parseFloat(indent)) + "px;"); 12144 matchWidthEl && (css += "box-sizing:border-box;text-align:left;
12144width:" + matchWidthEl.offsetWidth + "px;"); 12145 e._isStart = isStart; 12146 e.setAttribute("class", "gsap-marker-" + type); 12147 e.style.cssText = css; 12148 e.innerText = name || name === 0 ? type + "-" + name : type; 12149 parent.children[0] ? parent.insertBefore(e, parent.children[0]) : parent.appendChild(e); 12150 e._offset = e["offset" + direction.op.d2]; 12151 12152 _positionMarker(e, 0, direction, isStart); 12153 12154 return e; 12155 }, 12156 _positionMarker = function _positionMarker(marker, start, direction, flipped) { 12157 var vars = { 12158 display: "block" 12159 }, 12160 side = direction[flipped ? "os2" : "p2"], 12161 oppositeSide = direction[flipped ? "p2" : "os2"]; 12162 marker._isFlipped = flipped; 12163 vars[direction.a + "Percent"] = flipped ? -100 : 0; 12164 vars[direction.a] = flipped ? "1px" : 0; 12165 vars["border" + side + _Width] = 1; 12166 vars["border" + oppositeSide + _Width] = 0; 12167 vars[direction.p] = start + "px"; 12168 gsap.set(marker, vars); 12169 }, 12170 _triggers = [], 12171 _ids = {}, 12172 _sync = function _sync() { 12173 return _request || (_request = _raf(_updateAll)); 12174 }, 12175 _onScroll = function _onScroll() { 12176 if (!_request) { 12177 _request = _raf(_updateAll); 12178 _lastScrollTime || _dispatch("scrollStart"); 12179 _lastScrollTime = _getTime(); 12180 } 12181 }, 12182 _onResize = function _onResize() { 12183 return !_refreshing && !_ignoreResize && !_doc.fullscreenElement && _resizeDelay.restart(true); 12184 }, 12185 _listeners = {}, 12186 _emptyArray = [], 12187 _media = [], 12188 _creatingMedia, 12189 _lastMediaTick, 12190 _onMediaChange = function _onMediaChange(e) { 12191 var tick = gsap.ticker.frame, 12192 matches = [], 12193 i = 0, 12194 index; 12195 12196 if (_lastMediaTick !== tick || _startup) { 12197 _revertAll(); 12198 12199 for (; i < _media.length; i += 4) { 12200 index = _win.matchMedia(_media[i]).matches; 12201 12202 if (index !== _media[i + 3]) { 12203 _media[i + 3] = index; 12204 index ? matches.push(i) : _revertAll(1, _media[i]) || _isFunction(_media[i + 2]) && _media[i + 2](); 12205 } 12206 } 12207 12208 _revertRecorded(); 12209 12210 for (i = 0; i < matches.length; i++) { 12211 index = matches[i]; 12212 _creatingMedia = _media[index]; 12213 _media[index + 2] = _media[index + 1](e); 12214 } 12215 12216 _creatingMedia = 0; 12217 _coreInitted && _refreshAll(0, 1); 12218 _lastMediaTick = tick; 12219 12220 _dispatch("matchMedia"); 12221 } 12222 }, 12223 _softRefresh = function _softRefresh() { 12224 return _removeListener(ScrollTrigger, "scrollEnd", _softRefresh) || _refreshAll(true); 12225 }, 12226 _dispatch = function _dispatch(type) { 12227 return _listeners[type] && _listeners[type].map(function (f) { 12228 return f(); 12229 }) || _emptyArray; 12230 }, 12231 _savedStyles = [], 12232 _revertRecorded = function _revertRecorded(media) { 12233 for (var i = 0; i < _savedStyles.length; i += 5) { 12234 if (!media || _savedStyles[i + 4] === media) { 12235 _savedStyles[i].style.cssText = _savedStyles[i + 1]; 12236 _savedStyles[i].getBBox && _savedStyles[i].setAttribute("transform", _savedStyles[i + 2] || ""); 12237 _savedStyles[i + 3].uncache = 1; 12238 } 12239 } 12240 }, 12241 _revertAll = function _revertAll(kill, media) { 12242 var trigger; 12243 12244 for (_i = 0; _i < _triggers.length; _i++) { 12245 trigger = _triggers[_i]; 12246 12247 if (!media || trigger.media === media) { 12248 if (kill) { 12249 trigger.kill(1); 12250 } else { 12251 trigger.revert(); 12252 } 12253 } 12254 } 12255 12256 media && _revertRecorded(media); 12257 media || _dispatch("revert"); 12258 }, 12259 _refreshingAll, 12260 _refreshAll = function _refreshAll(force, skipRevert) { 12261 if (_lastScrollTime && !force) { 12262 _addListener(ScrollTrigger, "scrollEnd", _softRefresh); 12263 12264 return; 12265 } 12266 12267 _refreshingAll = true; 12268 12269 var refreshInits = _dispatch("refreshInit"); 12270 12271 _sort && ScrollTrigger.sort(); 12272 skipRevert || _revertAll(); 12273
vendor: 6,053 bytes, lines 12274-12411
12274 _triggers.forEach(function (t) { 12275 return t.refresh(); 12276 }); 12277 12278 refreshInits.forEach(function (result) { 12279 return result && result.render && result.render(-1); 12280 }); 12281 12282 _scrollers.forEach(function (obj) { 12283 return typeof obj === "function" && (obj.rec = 0); 12284 }); 12285 12286 _resizeDelay.pause(); 12287 12288 _refreshingAll = false; 12289 12290 _dispatch("refresh"); 12291 }, 12292 _lastScroll = 0, 12293 _direction = 1, 12294 _updateAll = function _updateAll() { 12295 if (!_refreshingAll) { 12296 var l = _triggers.length, 12297 time = _getTime(), 12298 recordVelocity = time - _time1 >= 50, 12299 scroll = l && _triggers[0].scroll(); 12300 12301 _direction = _lastScroll > scroll ? -1 : 1; 12302 _lastScroll = scroll; 12303 12304 if (recordVelocity) { 12305 if (_lastScrollTime && !_pointerIsDown && time - _lastScrollTime > 200) { 12306 _lastScrollTime = 0; 12307 12308 _dispatch("scrollEnd"); 12309 } 12310 12311 _time2 = _time1; 12312 _time1 = time; 12313 } 12314 12315 if (_direction < 0) { 12316 _i = l; 12317 12318 while (_i-- > 0) { 12319 _triggers[_i] && _triggers[_i].update(0, recordVelocity); 12320 } 12321 12322 _direction = 1; 12323 } else { 12324 for (_i = 0; _i < l; _i++) { 12325 _triggers[_i] && _triggers[_i].update(0, recordVelocity); 12326 } 12327 } 12328 12329 _request = 0; 12330 } 12331 }, 12332 _propNamesToCopy = [_left, _top, _bottom, _right, _margin + _Bottom, _margin + _Right, _margin + _Top, _margin + _Left, "display", "flexShrink", "float", "zIndex", "grid-column-start", "grid-column-end", "grid-row-start", "grid-row-end", "grid-area", "justify-self", "align-self", "place-self"], 12333 _stateProps = _propNamesToCopy.concat([_width, _height, "boxSizing", "max" + _Width, "max" + _Height, "position", _margin, _padding, _padding + _Top, _padding + _Right, _padding + _Bottom, _padding + _Left]), 12334 _swapPinOut = function _swapPinOut(pin, spacer, state) { 12335 _setState(state); 12336 12337 if (pin.parentNode === spacer) { 12338 var parent = spacer.parentNode; 12339 12340 if (parent) { 12341 parent.insertBefore(pin, spacer); 12342 parent.removeChild(spacer); 12343 } 12344 } 12345 }, 12346 _swapPinIn = function _swapPinIn(pin, spacer, cs, spacerState) { 12347 if (pin.parentNode !== spacer) { 12348 var i = _propNamesToCopy.length, 12349 spacerStyle = spacer.style, 12350 pinStyle = pin.style, 12351 p; 12352 12353 while (i--) { 12354 p = _propNamesToCopy[i]; 12355 spacerStyle[p] = cs[p]; 12356 } 12357 12358 spacerStyle.position = cs.position === "absolute" ? "absolute" : "relative"; 12359 cs.display === "inline" && (spacerStyle.display = "inline-block"); 12360 pinStyle[_bottom] = pinStyle[_right] = "auto"; 12361 spacerStyle.overflow = "visible"; 12362 spacerStyle.boxSizing = "border-box"; 12363 spacerStyle[_width] = _getSize(pin, _horizontal) + _px; 12364 spacerStyle[_height] = _getSize(pin, _vertical) + _px; 12365 spacerStyle[_padding] = pinStyle[_margin] = pinStyle[_top] = pinStyle[_left] = "0"; 12366 12367 _setState(spacerState); 12368 12369 pinStyle[_width] = pinStyle["max" + _Width] = cs[_width]; 12370 pinStyle[_height] = pinStyle["max" + _Height] = cs[_height]; 12371 pinStyle[_padding] = cs[_padding]; 12372 pin.parentNode.insertBefore(spacer, pin); 12373 spacer.appendChild(pin); 12374 } 12375 }, 12376 _capsExp = /([A-Z])/g, 12377 _setState = function _setState(state) { 12378 if (state) { 12379 var style = state.t.style, 12380 l = state.length, 12381 i = 0, 12382 p, 12383 value; 12384 (state.t._gsap || gsap.core.getCache(state.t)).uncache = 1; 12385 12386 for (; i < l; i += 2) { 12387 value = state[i + 1]; 12388 p = state[i]; 12389 12390 if (value) { 12391 style[p] = value; 12392 } else if (style[p]) { 12393 style.removeProperty(p.replace(_capsExp, "-$1").toLowerCase()); 12394 } 12395 } 12396 } 12397 }, 12398 _getState = function _getState(element) { 12399 var l = _stateProps.length, 12400 style = element.style, 12401 state = [], 12402 i = 0; 12403 12404 for (; i < l; i++) { 12405 state.push(_stateProps[i], style[_stateProps[i]]); 12406 } 12407 12408 state.t = element; 12409 return state; 12410 }, 12411 _copyState = function _copyState(state, override, omitOff
vendor: 4,678 bytes, lines 12411-12504
12411sets) { 12412 var result = [], 12413 l = state.length, 12414 i = omitOffsets ? 8 : 0, 12415 p; 12416 12417 for (; i < l; i += 2) { 12418 p = state[i]; 12419 result.push(p, p in override ? override[p] : state[i + 1]); 12420 } 12421 12422 result.t = state.t; 12423 return result; 12424 }, 12425 _winOffsets = { 12426 left: 0, 12427 top: 0 12428 }, 12429 _parsePosition = function _parsePosition(value, trigger, scrollerSize, direction, scroll, marker, markerScroller, self, scrollerBounds, borderWidth, useFixedPosition, scrollerMax) { 12430 _isFunction(value) && (value = value(self)); 12431 12432 if (_isString(value) && value.substr(0, 3) === "max") { 12433 value = scrollerMax + (value.charAt(4) === "=" ? _offsetToPx("0" + value.substr(3), scrollerSize) : 0); 12434 } 12435 12436 if (!_isNumber(value)) { 12437 _isFunction(trigger) && (trigger = trigger(self)); 12438 12439 var element = _toArray(trigger)[0] || _body, 12440 bounds = _getBounds(element) || {}, 12441 offsets = value.split(" "), 12442 localOffset, 12443 globalOffset, 12444 display; 12445 12446 if ((!bounds || !bounds.left && !bounds.top) && _getComputedStyle(element).display === "none") { 12447 display = element.style.display; 12448 element.style.display = "block"; 12449 bounds = _getBounds(element); 12450 display ? element.style.display = display : element.style.removeProperty("display"); 12451 } 12452 12453 localOffset = _offsetToPx(offsets[0], bounds[direction.d]); 12454 globalOffset = _offsetToPx(offsets[1] || "0", scrollerSize); 12455 value = bounds[direction.p] - scrollerBounds[direction.p] - borderWidth + localOffset + scroll - globalOffset; 12456 markerScroller && _positionMarker(markerScroller, globalOffset, direction, scrollerSize - globalOffset < 20 || markerScroller._isStart && globalOffset > 20); 12457 scrollerSize -= scrollerSize - globalOffset; 12458 } else if (markerScroller) { 12459 _positionMarker(markerScroller, scrollerSize, direction, true); 12460 } 12461 12462 if (marker) { 12463 var position = value + scrollerSize, 12464 isStart = marker._isStart; 12465 scrollerMax = "scroll" + direction.d2; 12466 12467 _positionMarker(marker, position, direction, isStart && position > 20 || !isStart && (useFixedPosition ? Math.max(_body[scrollerMax], _docEl[scrollerMax]) : marker.parentNode[scrollerMax]) <= position + 1); 12468 12469 if (useFixedPosition) { 12470 scrollerBounds = _getBounds(markerScroller); 12471 useFixedPosition && (marker.style[direction.op.p] = scrollerBounds[direction.op.p] - direction.op.m - marker._offset + _px); 12472 } 12473 } 12474 12475 return Math.round(value); 12476 }, 12477 _prefixExp = /(?:webkit|moz|length|cssText|inset)/i, 12478 _reparent = function _reparent(element, parent, top, left) { 12479 if (element.parentNode !== parent) { 12480 var style = element.style, 12481 p, 12482 cs; 12483 12484 if (parent === _body) { 12485 element._stOrig = style.cssText; 12486 cs = _getComputedStyle(element); 12487 12488 for (p in cs) { 12489 if (!+p && !_prefixExp.test(p) && cs[p] && typeof style[p] === "string" && p !== "0") { 12490 style[p] = cs[p]; 12491 } 12492 } 12493 12494 style.top = top; 12495 style.left = left; 12496 } else { 12497 style.cssText = element._stOrig; 12498 } 12499 12500 gsap.core.getCache(element).uncache = 1; 12501 parent.appendChild(element); 12502 } 12503 }, 12504 _getTweenCreator = function _getTweenCreator(scroller, direction) {
12505 var getScroll = _getScrollFunc(scroller, direction), 12506 prop = "_scroll" + direction.p2, 12507 lastScroll1, 12508 lastScroll2, 12509 getTween = function getTween(scrollTo, vars, initialValue, change1, change2) { 12510 var tween = getTween.tween, 12511 onComplete = vars.onComplete, 12512 modifiers = {}; 12513 tween && tween.kill(); 12514 lastScroll1 = Math.round(initialValue); 12515 vars[prop] = scrollTo; 12516 vars.modifiers = modifiers; 12517 12518 modifiers[prop] = function (value) { 12519 value = _round(getScroll()); 12520 12521 if (value !== lastScroll1 && value !== lastScroll2 && Math.abs(value - lastScroll1) > 2) { 12522 tween.kill(); 12523 getTween.tween = 0; 12524 } else { 12525 value = initialValue + change1 * tween.ratio + change2 * tween.ratio * tween.ratio; 12526 } 12527 12528 lastScroll2 = lastScroll1; 12529 return lastScroll1 = _round(value); 12530 }; 12531 12532 vars.onComplete = function () { 12533 getTween.tween = 0; 12534 onComplete && onComplete.call(tween); 12535 }; 12536 12537 tween = getTween.tween = gsap.to(scroller, vars); 12538 return tween; 12539 }; 12540 12541 scroller[prop] = getScroll; 12542 scroller.addEventListener("wheel", function () { 12543 return getTween.tween && getTween.tween.kill() && (getTween.tween = 0); 12544 }, { 12545 passive: true 12546 }); 12547 return getTween; 12548 }; 12549 12550 _horizontal.op = _vertical; 12551 var ScrollTrigger = function () { 12552 function ScrollTrigger(vars, animation) { 12553 _coreInitted || ScrollTrigger.register(gsap) || console.warn("Please gsap.registerPlugin(ScrollTrigger)"); 12554 this.init(vars, animation); 12555 } 12556 12557 var _proto = ScrollTrigger.prototype; 12558 12559 _proto.init = function init(vars, animation) { 12560 this.progress = this.start = 0; 12561 this.vars && this.kill(1); 12562 12563 if (!_enabled) { 12564 this.update = this.refresh = this.kill = _passThrough; 12565 return; 12566 } 12567 12568 vars = _setDefaults(_isString(vars) || _isNumber(vars) || vars.nodeType ? { 12569 trigger: vars 12570 } : vars, _defaults); 12571 12572 var direction = vars.horizontal ? _horizontal : _vertical, 12573 _vars = vars, 12574 onUpdate = _vars.onUpdate, 12575 toggleClass = _vars.toggleClass, 12576 id = _vars.id, 12577 onToggle = _vars.onToggle, 12578 onRefresh = _vars.onRefresh, 12579 scrub = _vars.scrub, 12580 trigger = _vars.trigger, 12581 pin = _vars.pin, 12582 pinSpacing = _vars.pinSpacing, 12583 invalidateOnRefresh = _vars.invalidateOnRefresh, 12584 anticipatePin = _vars.anticipatePin, 12585 onScrubComplete = _vars.onScrubComplete, 12586 onSnapComplete = _vars.onSnapComplete, 12587 once = _vars.once, 12588 snap = _vars.snap, 12589 pinReparent = _vars.pinReparent, 12590 isToggle = !scrub && scrub !== 0, 12591 scroller = _toArray(vars.scroller || _win)[0], 12592 scrollerCache = gsap.core.getCache(scroller), 12593 isViewport = _isViewport(scroller), 12594 useFixedPosition = "pinType" in vars ? vars.pinType === "fixed" : isViewport || _getProxyProp(scroller, "pinType") === "fixed", 12595 callbacks = [vars.onEnter, vars.onLeave, vars.onEnterBack, vars.onLeaveBack], 12596 toggleActions = isToggle && vars.toggleActions.split(" "), 12597 markers = "markers" in vars ? vars.markers : _defaults.markers, 12598 borderWidth = isViewport ? 0 : parseFloat(_getComputedStyle(scroller)["border" + direction.p2 + _Width]) || 0, 12599 self = this, 12600 onRefreshInit = vars.onRefreshInit && function () { 12601 return vars.onRefreshInit(self); 12602 },
12603 getScrollerSize = _getSizeFunc(scroller, isViewport, direction), 12604 getScrollerOffsets = _getOffsetsFunc(scroller, isViewport), 12605 lastSnap = 0, 12606 tweenTo, 12607 pinCache, 12608 snapFunc, 12609 scroll1, 12610 scroll2, 12611 start, 12612 end, 12613 markerStart, 12614 markerEnd, 12615 markerStartTrigger, 12616 markerEndTrigger, 12617 markerVars, 12618 change, 12619 pinOriginalState, 12620 pinActiveState, 12621 pinState, 12622 spacer, 12623 offset, 12624 pinGetter, 12625 pinSetter, 12626 pinStart, 12627 pinChange, 12628 spacingStart, 12629 spacerState, 12630 markerStartSetter, 12631 markerEndSetter, 12632 cs, 12633 snap1, 12634 snap2, 12635 scrubTween, 12636 scrubSmooth, 12637 snapDurClamp, 12638 snapDelayedCall, 12639 prevProgress, 12640 prevScroll, 12641 prevAnimProgress; 12642 12643 self.media = _creatingMedia; 12644 anticipatePin *= 45; 12645 self.scroller = scroller; 12646 self.scroll = _getScrollFunc(scroller, direction); 12647 scroll1 = self.scroll(); 12648 self.vars = vars; 12649 animation = animation || vars.animation; 12650 "refreshPriority" in vars && (_sort = 1); 12651 scrollerCache.tweenScroll = scrollerCache.tweenScroll || { 12652 top: _getTweenCreator(scroller, _vertical), 12653 left: _getTweenCreator(scroller, _horizontal) 12654 }; 12655 self.tweenTo = tweenTo = scrollerCache.tweenScroll[direction.p]; 12656 12657 if (animation) { 12658 animation.vars.lazy = false; 12659 animation._initted || animation.vars.immediateRender !== false && vars.immediateRender !== false && animation.render(0, true, true); 12660 self.animation = animation.pause(); 12661 animation.scrollTrigger = self; 12662 scrubSmooth = _isNumber(scrub) && scrub; 12663 scrubSmooth && (scrubTween = gsap.to(animation, { 12664 ease: "power3", 12665 duration: scrubSmooth, 12666 onComplete: function onComplete() { 12667 return onScrubComplete && onScrubComplete(self); 12668 } 12669 })); 12670 snap1 = 0; 12671 id || (id = animation.vars.id); 12672 } 12673 12674 _triggers.push(self); 12675 12676 if (snap) { 12677 if (!_isObject(snap) || snap.push) { 12678 snap = { 12679 snapTo: snap 12680 }; 12681 } 12682 12683 "scrollBehavior" in _body.style && gsap.set(isViewport ? [_body, _docEl] : scroller, { 12684 scrollBehavior: "auto" 12685 }); 12686 snapFunc = _isFunction(snap.snapTo) ? snap.snapTo : snap.snapTo === "labels" ? _getClosestLabel(animation) : snap.snapTo === "labelsDirectional" ? _getLabelAtDirection(animation) : gsap.utils.snap(snap.snapTo); 12687 snapDurClamp = snap.duration || { 12688 min: 0.1, 12689 max: 2 12690 }; 12691 snapDurClamp = _isObject(snapDurClamp) ? _clamp(snapDurClamp.min, snapDurClamp.max) : _clamp(snapDurClamp, snapDurClamp); 12692 snapDelayedCall = gsap.delayedCall(snap.delay || scrubSmooth / 2 || 0.1, function () { 12693 if (Math.abs(self.getVelocity()) < 10 && !_pointerIsDown && lastSnap !== self.scroll()) { 12694 var totalProgress = animation && !isToggle ? animation.totalProgress() : self.progress, 12695 velocity = (totalProgress - snap2) / (_getTime() - _time2) * 1000 || 0, 12696 change1 = gsap.utils.clamp(-self.progress, 1 - self.progress, _abs(velocity / 2) * velocity / 0.185), 12697 naturalEnd = self.progress + (snap.inertia === false ? 0 : change1), 12698 endValue = _clamp(0, 1, snapFunc(naturalEnd, self)), 12699 scroll = self.scroll(), 12700 endScroll = Math.round(start + endValue * change), 12701 _snap = snap, 12702 onStart = _snap.onStart, 12703 _onInterrupt = _snap.onInterrupt, 12704 _onComplete = _snap.onComplete, 12705 tween = tweenTo.tween; 12706 12707 if (scroll <= end && scroll >= start && endScroll !== scroll) { 12708 if (tween && !tween._initted && tween.data <= Math.abs(endScroll - scroll)) { 12709 return; 12710 } 12711 12712 if (snap.inertia === false) { 12713 change1 = endValue - self.progress; 12714 } 12715 12716 tweenTo(endScroll, { 12717 duration: snapDurClamp(_abs(Math.max(_abs(naturalEnd - totalProgress), _abs(endValue - totalProgress)) * 0.185 / velocity / 0.05 || 0)), 12718 ease: snap.ease || "power3", 12719 data: Math.abs(endScroll - scroll), 12720 onInterrupt: function onInterrupt() { 12721 return snapDelayedCall.restart(true) && _onInterrupt && _onInterrupt(self); 12722 }, 12723 onComplete: function onComplete() { 12724 lastSnap = self.scroll(); 12725 snap1 = snap2 = animation && !isToggle ? animation.totalProgress() : self.progress; 12726 onSnapComplete && onSnapComplete(self); 12727 _onComplete && _onComplete(self); 12728 } 12729 }, scroll, change1 * change, endScroll - scroll - change1 * change); 12730 onStart && onStart(self, tweenTo.tween); 12731 } 12732 } else if (self.isActive) { 12733 snapDelayedCall.restart(true); 12734 } 12735 }).pause(); 12736 } 12737 12738 id && (_ids[id] = self); 12739 trigger = self.trigger = _toArray(trigger || pin)[0]; 12740 pin = pin === true ? trigger : _toArray(pin)[0]; 12741 _isString(toggleClass) && (toggleClass = { 12742 targets: trigger, 12743 className: toggleClass 12744 }); 12745 12746 if (pin) { 12747 pinSpacing === false || pinSpacing === _margin || (pinSpacing = !pinSpacing && _getComputedStyle(pin.parentNode).display === "flex" ? false : _padding); 12748 self.pin = pin; 12749 vars.force3D !== false && gsap.set(pin, {
12750 force3D: true 12751 }); 12752 pinCache = gsap.core.getCache(pin); 12753 12754 if (!pinCache.spacer) { 12755 pinCache.spacer = spacer = _doc.createElement("div"); 12756 spacer.setAttribute("class", "pin-spacer" + (id ? " pin-spacer-" + id : "")); 12757 pinCache.pinState = pinOriginalState = _getState(pin); 12758 } else { 12759 pinOriginalState = pinCache.pinState; 12760 } 12761 12762 self.spacer = spacer = pinCache.spacer; 12763 cs = _getComputedStyle(pin); 12764 spacingStart = cs[pinSpacing + direction.os2]; 12765 pinGetter = gsap.getProperty(pin); 12766 pinSetter = gsap.quickSetter(pin, direction.a, _px); 12767 12768 _swapPinIn(pin, spacer, cs); 12769 12770 pinState = _getState(pin); 12771 } 12772 12773 if (markers) { 12774 markerVars = _isObject(markers) ? _setDefaults(markers, _markerDefaults) : _markerDefaults; 12775 markerStartTrigger = _createMarker("scroller-start", id, scroller, direction, markerVars, 0); 12776 markerEndTrigger = _createMarker("scroller-end", id, scroller, direction, markerVars, 0, markerStartTrigger); 12777 offset = markerStartTrigger["offset" + direction.op.d2]; 12778 markerStart = _createMarker("start", id, scroller, direction, markerVars, offset); 12779 markerEnd = _createMarker("end", id, scroller, direction, markerVars, offset); 12780 12781 if (!useFixedPosition && !(_proxies.length && _getProxyProp(scroller, "fixedMarkers") === true)) { 12782 _makePositionable(isViewport ? _body : scroller); 12783 12784 gsap.set([markerStartTrigger, markerEndTrigger], { 12785 force3D: true 12786 }); 12787 markerStartSetter = gsap.quickSetter(markerStartTrigger, direction.a, _px); 12788 markerEndSetter = gsap.quickSetter(markerEndTrigger, direction.a, _px); 12789 } 12790 } 12791 12792 self.revert = function (revert) { 12793 var r = revert !== false || !self.enabled, 12794 prevRefreshing = _refreshing; 12795 12796 if (r !== self.isReverted) { 12797 if (r) { 12798 self.scroll.rec || (self.scroll.rec = self.scroll()); 12799 prevScroll = Math.max(self.scroll(), self.scroll.rec || 0); 12800 prevProgress = self.progress; 12801 prevAnimProgress = animation && animation.progress(); 12802 } 12803 12804 markerStart && [markerStart, markerEnd, markerStartTrigger, markerEndTrigger].forEach(function (m) { 12805 return m.style.display = r ? "none" : "block"; 12806 }); 12807 r && (_refreshing = 1); 12808 self.update(r); 12809 _refreshing = prevRefreshing; 12810 pin && (r ? _swapPinOut(pin, spacer, pinOriginalState) : (!pinReparent || !self.isActive) && _swapPinIn(pin, spacer, _getComputedStyle(pin), spacerState)); 12811 self.isReverted = r; 12812 } 12813 }; 12814 12815 self.refresh = function (soft, force) { 12816 if ((_refreshing || !self.enabled) && !force) { 12817 return; 12818 } 12819 12820 if (pin && soft && _lastScrollTime) { 12821 _addListener(ScrollTrigger, "scrollEnd", _softRefresh); 12822 12823 return; 12824 } 12825 12826 _refreshing = 1; 12827 scrubTween && scrubTween.pause(); 12828 invalidateOnRefresh && animation && animation.progress(0).invalidate(); 12829 self.isReverted || self.revert(); 12830 12831 var size = getScrollerSize(), 12832 scrollerBounds = getScrollerOffsets(), 12833 max = _maxScroll(scroller, direction), 12834 offset = 0, 12835 otherPinOffset = 0, 12836 parsedEnd = vars.end, 12837 parsedEndTrigger = vars.endTrigger || trigger, 12838 parsedStart = vars.start || (vars.start === 0 || !trigger ? 0 : pin ? "0 0" : "0 100%"), 12839 pinnedContainer = vars.pinnedContainer && _toArray(vars.pinnedContainer)[0], 12840 triggerIndex = trigger && Math.max(0, _triggers.indexOf(self)) || 0, 12841 i = triggerIndex, 12842 cs, 12843 bounds, 12844 scroll, 12845 isVertical, 12846 override, 12847 curTrigger, 12848 curPin, 12849 oppositeScroll, 12850 initted, 12851 revertedPins; 12852 12853 while (i--) { 12854 curTrigger = _triggers[i]; 12855 curTrigger.end || curTrigger.refresh(0, 1) || (_refreshing = 1); 12856 curPin = curTrigger.pin; 12857 12858 if (curPin && (curPin === trigger || curPin === pin) && !curTrigger.isReverted) { 12859 revertedPins || (revertedPins = []); 12860 revertedPins.unshift(curTrigger); 12861 curTrigger.revert(); 12862 } 12863 } 12864 12865 start = _parsePosition(parsedStart, trigger, size, direction, self.scroll(), markerStart, markerStartTrigger, self, scrollerBounds, borderWidth, useFixedPosition, max) || (pin ? -0.001 : 0); 12866 _isFunction(parsedEnd) && (parsedEnd = parsedEnd(self)); 12867 12868 if (_isString(parsedEnd) && !parsedEnd.indexOf("+=")) { 12869 if (~parsedEnd.indexOf(" ")) { 12870 parsedEnd = (_isString(parsedStart) ? parsedStart.split(" ")[0] : "") + parsedEnd; 12871 } else { 12872 offset = _offsetToPx(parsedEnd.substr(2), size); 12873 parsedEnd = _isString(parsedStart) ? parsedStart : start + offset; 12874 parsedEndTrigger = trigger; 12875 } 12876 } 12877 12878 end = Math.max(start, _parsePosition(parsedEnd || (parsedEndTrigger ? "100% 0" : max), parsedEndTrigger, size, direction, self.scroll() + offset, markerEnd, markerEndTrigger, self, scrollerBounds, borderWidth, useFixedPosition, max)) || -0.001; 12879 change = end - start || (start -= 0.01) && 0.001; 12880 offset = 0; 12881 i = triggerIndex; 12882 12883 while (i--) { 12884 curTrigger = _triggers[i]; 12885 curPin = curTrigger.pin; 12886 12887 if (curPin && curTrigger.start - curTrigger._pinPush < start) { 12888 cs = curTrigger.end - curTrigger.start; 12889 (curPin === trigger || curPin === pinnedContainer) && (offset += cs); 12890 curPin === pin && (otherPinOffset += cs); 12891 } 12892 } 12893 12894 start += offset; 12895 end += offset; 12896 self._pinPush = otherPinOffset; 12897 12898 if (markerStart && offset) { 12899 cs = {}; 12900 cs[direction.a] = "+=" + offset; 12901 pinnedContainer && (cs[direction.p] = "-=" + self.scroll()); 12902 gsap.set([markerStart, markerEnd], cs); 12903 } 12904 12905 if (pin) { 12906 cs = _getComputedStyle(pin); 12907 isVertical = direction === _vertical; 12908 scroll = self.scroll(); 12909 pinStart = parseFloat(pinGetter(direction.a)) + otherPinOffset; 12910 !max && end > 1 && ((isViewport ? _body : scroller).style["overflow-" + direction.a] = "scroll"); 12911 12912 _swapPinIn(pin, spacer, cs); 12913
12914 pinState = _getState(pin); 12915 bounds = _getBounds(pin, true); 12916 oppositeScroll = useFixedPosition && _getScrollFunc(scroller, isVertical ? _horizontal : _vertical)(); 12917 12918 if (pinSpacing) { 12919 spacerState = [pinSpacing + direction.os2, change + otherPinOffset + _px]; 12920 spacerState.t = spacer; 12921 i = pinSpacing === _padding ? _getSize(pin, direction) + change + otherPinOffset : 0; 12922 i && spacerState.push(direction.d, i + _px); 12923 12924 _setState(spacerState); 12925 12926 useFixedPosition && self.scroll(prevScroll); 12927 } 12928 12929 if (useFixedPosition) { 12930 override = { 12931 top: bounds.top + (isVertical ? scroll - start : oppositeScroll) + _px, 12932 left: bounds.left + (isVertical ? oppositeScroll : scroll - start) + _px, 12933 boxSizing: "border-box", 12934 position: "fixed" 12935 }; 12936 override[_width] = override["max" + _Width] = Math.ceil(bounds.width) + _px; 12937 override[_height] = override["max" + _Height] = Math.ceil(bounds.height) + _px; 12938 override[_margin] = override[_margin + _Top] = override[_margin + _Right] = override[_margin + _Bottom] = override[_margin + _Left] = "0"; 12939 override[_padding] = cs[_padding]; 12940 override[_padding + _Top] = cs[_padding + _Top]; 12941 override[_padding + _Right] = cs[_padding + _Right]; 12942 override[_padding + _Bottom] = cs[_padding + _Bottom]; 12943 override[_padding + _Left] = cs[_padding + _Left]; 12944 pinActiveState = _copyState(pinOriginalState, override, pinReparent); 12945 } 12946 12947 if (animation) { 12948 initted = animation._initted; 12949 12950 _suppressOverwrites(1); 12951 12952 animation.render(animation.duration(), true, true); 12953 pinChange = pinGetter(direction.a) - pinStart + change + otherPinOffset; 12954 change !== pinChange && pinActiveState.splice(pinActiveState.length - 2, 2); 12955 animation.render(0, true, true); 12956 initted || animation.invalidate(); 12957 12958 _suppressOverwrites(0); 12959 } else { 12960 pinChange = change; 12961 } 12962 } else if (trigger && self.scroll()) { 12963 bounds = trigger.parentNode; 12964 12965 while (bounds && bounds !== _body) { 12966 if (bounds._pinOffset) { 12967 start -= bounds._pinOffset; 12968 end -= bounds._pinOffset; 12969 } 12970 12971 bounds = bounds.parentNode; 12972 } 12973 } 12974 12975 revertedPins && revertedPins.forEach(function (t) { 12976 return t.revert(false); 12977 }); 12978 self.start = start; 12979 self.end = end; 12980 scroll1 = scroll2 = self.scroll(); 12981 scroll1 < prevScroll && self.scroll(prevScroll); 12982 self.revert(false); 12983 _refreshing = 0; 12984 animation && isToggle && animation._initted && animation.progress() !== prevAnimProgress && animation.progress(prevAnimProgress, true).render(animation.time(), true, true); 12985 12986 if (prevProgress !== self.progress) { 12987 scrubTween && animation.totalProgress(prevProgress, true); 12988 self.progress = prevProgress;
vendor: 10,026 bytes, lines 12989-13177
12989 self.update(); 12990 } 12991 12992 pin && pinSpacing && (spacer._pinOffset = Math.round(self.progress * pinChange)); 12993 onRefresh && onRefresh(self); 12994 }; 12995 12996 self.getVelocity = function () { 12997 return (self.scroll() - scroll2) / (_getTime() - _time2) * 1000 || 0; 12998 }; 12999 13000 self.update = function (reset, recordVelocity) { 13001 var scroll = self.scroll(), 13002 p = reset ? 0 : (scroll - start) / change, 13003 clipped = p < 0 ? 0 : p > 1 ? 1 : p || 0, 13004 prevProgress = self.progress, 13005 isActive, 13006 wasActive, 13007 toggleState, 13008 action, 13009 stateChanged, 13010 toggled; 13011 13012 if (recordVelocity) { 13013 scroll2 = scroll1; 13014 scroll1 = scroll; 13015 13016 if (snap) { 13017 snap2 = snap1; 13018 snap1 = animation && !isToggle ? animation.totalProgress() : clipped; 13019 } 13020 } 13021 13022 anticipatePin && !clipped && pin && !_refreshing && !_startup && _lastScrollTime && start < scroll + (scroll - scroll2) / (_getTime() - _time2) * anticipatePin && (clipped = 0.0001); 13023 13024 if (clipped !== prevProgress && self.enabled) { 13025 isActive = self.isActive = !!clipped && clipped < 1; 13026 wasActive = !!prevProgress && prevProgress < 1; 13027 toggled = isActive !== wasActive; 13028 stateChanged = toggled || !!clipped !== !!prevProgress; 13029 self.direction = clipped > prevProgress ? 1 : -1; 13030 self.progress = clipped; 13031 13032 if (!isToggle) { 13033 if (scrubTween && !_refreshing && !_startup) { 13034 scrubTween.vars.totalProgress = clipped; 13035 scrubTween.invalidate().restart(); 13036 } else if (animation) { 13037 animation.totalProgress(clipped, !!_refreshing); 13038 } 13039 } 13040 13041 if (pin) { 13042 reset && pinSpacing && (spacer.style[pinSpacing + direction.os2] = spacingStart); 13043 13044 if (!useFixedPosition) { 13045 pinSetter(pinStart + pinChange * clipped); 13046 } else if (stateChanged) { 13047 action = !reset && clipped > prevProgress && end + 1 > scroll && scroll + 1 >= _maxScroll(scroller, direction); 13048 13049 if (pinReparent) { 13050 if (!reset && (isActive || action)) { 13051 var bounds = _getBounds(pin, true), 13052 _offset = scroll - start; 13053 13054 _reparent(pin, _body, bounds.top + (direction === _vertical ? _offset : 0) + _px, bounds.left + (direction === _vertical ? 0 : _offset) + _px); 13055 } else { 13056 _reparent(pin, spacer); 13057 } 13058 } 13059 13060 _setState(isActive || action ? pinActiveState : pinState); 13061 13062 pinChange !== change && clipped < 1 && isActive || pinSetter(pinStart + (clipped === 1 && !action ? pinChange : 0)); 13063 } 13064 } 13065 13066 snap && !tweenTo.tween && !_refreshing && !_startup && snapDelayedCall.restart(true); 13067 toggleClass && (toggled || once && clipped && (clipped < 1 || !_limitCallbacks)) && _toArray(toggleClass.targets).forEach(function (el) { 13068 return el.classList[isActive || once ? "add" : "remove"](toggleClass.className); 13069 }); 13070 onUpdate && !isToggle && !reset && onUpdate(self); 13071 13072 if (stateChanged && !_refreshing) { 13073 toggleState = clipped && !prevProgress ? 0 : clipped === 1 ? 1 : prevProgress === 1 ? 2 : 3; 13074 13075 if (isToggle) { 13076 action = !toggled && toggleActions[toggleState + 1] !== "none" && toggleActions[toggleState + 1] || toggleActions[toggleState]; 13077 13078 if (animation && (action === "complete" || action === "reset" || action in animation)) { 13079 if (action === "complete") { 13080 animation.pause().totalProgress(1); 13081 } else if (action === "reset") { 13082 animation.restart(true).pause(); 13083 } else if (action === "restart") { 13084 animation.restart(true); 13085 } else { 13086 animation[action](); 13087 } 13088 } 13089 13090 onUpdate && onUpdate(self); 13091 } 13092 13093 if (toggled || !_limitCallbacks) { 13094 onToggle && toggled && onToggle(self); 13095 callbacks[toggleState] && callbacks[toggleState](self); 13096 once && (clipped === 1 ? self.kill(false, 1) : callbacks[toggleState] = 0); 13097 13098 if (!toggled) { 13099 toggleState = clipped === 1 ? 1 : 3; 13100 callbacks[toggleState] && callbacks[toggleState](self); 13101 } 13102 } 13103 } else if (isToggle && onUpdate && !_refreshing) { 13104 onUpdate(self); 13105 } 13106 } 13107 13108 if (markerEndSetter) { 13109 markerStartSetter(scroll + (markerStartTrigger._isFlipped ? 1 : 0)); 13110 markerEndSetter(scroll); 13111 } 13112 }; 13113 13114 self.enable = function (reset, refresh) { 13115 if (!self.enabled) { 13116 self.enabled = true; 13117 13118 _addListener(scroller, "resize", _onResize); 13119 13120 _addListener(scroller, "scroll", _onScroll); 13121 13122 onRefreshInit && _addListener(ScrollTrigger, "refreshInit", onRefreshInit); 13123 13124 if (reset !== false) { 13125 self.progress = prevProgress = 0; 13126 scroll1 = scroll2 = lastSnap = self.scroll(); 13127 } 13128 13129 refresh !== false && self.refresh(); 13130 } 13131 }; 13132 13133 self.getTween = function (snap) { 13134 return snap && tweenTo ? tweenTo.tween : scrubTween; 13135 }; 13136 13137 self.disable = function (reset, allowAnimation) { 13138 if (self.enabled) { 13139 reset !== false && self.revert(); 13140 self.enabled = self.isActive = false; 13141 allowAnimation || scrubTween && scrubTween.pause(); 13142 prevScroll = 0; 13143 pinCache && (pinCache.uncache = 1); 13144 onRefreshInit && _removeListener(ScrollTrigger, "refreshInit", onRefreshInit); 13145 13146 if (snapDelayedCall) { 13147 snapDelayedCall.pause(); 13148 tweenTo.tween && tweenTo.tween.kill() && (tweenTo.tween = 0); 13149 } 13150 13151 if (!isViewport) { 13152 var i = _triggers.length; 13153 13154 while (i--) { 13155 if (_triggers[i].scroller === scroller && _triggers[i] !== self) { 13156 return; 13157 } 13158 } 13159 13160 _removeListener(scroller, "resize", _onResize); 13161 13162 _removeListener(scroller, "scroll", _onScroll); 13163 } 13164 } 13165 }; 13166 13167 self.kill = function (revert, allowAnimation) { 13168 self.disable(revert, allowAnimation); 13169 id && delete _ids[id]; 13170 13171 var i = _triggers.indexOf(self); 13172 13173 _triggers.splice(i, 1); 13174 13175 i === _i && _direction > 0 && _i--; 13176 i = 0; 13177
13178 _triggers.forEach(function (t) { 13179 return t.scroller === self.scroller && (i = 1); 13180 }); 13181 13182 i || (self.scroll.rec = 0); 13183 13184 if (animation) { 13185 animation.scrollTrigger = null; 13186 revert && animation.render(-1); 13187 allowAnimation || animation.kill(); 13188 } 13189 13190 markerStart && [markerStart, markerEnd, markerStartTrigger, markerEndTrigger].forEach(function (m) { 13191 return m.parentNode && m.parentNode.removeChild(m); 13192 }); 13193 13194 if (pin) { 13195 pinCache && (pinCache.uncache = 1); 13196 i = 0; 13197 13198 _triggers.forEach(function (t) { 13199 return t.pin === pin && i++; 13200 }); 13201 13202 i || (pinCache.spacer = 0); 13203 } 13204 }; 13205 13206 self.enable(false, false); 13207 !animation || !animation.add || change ? self.refresh() : gsap.delayedCall(0.01, function () { 13208 return start || end || self.refresh(); 13209 }) && (change = 0.01) && (start = end = 0); 13210 }; 13211 13212 ScrollTrigger.register = function register(core) { 13213 if (!_coreInitted) { 13214 gsap = core || _getGSAP(); 13215 13216 if (_windowExists() && window.document) { 13217 _win = window; 13218 _doc = document; 13219 _docEl = _doc.documentElement; 13220 _body = _doc.body; 13221 } 13222 13223 if (gsap) { 13224 _toArray = gsap.utils.toArray; 13225 _clamp = gsap.utils.clamp; 13226 _suppressOverwrites = gsap.core.suppressOverwrites || _passThrough; 13227 gsap.core.globals("ScrollTrigger", ScrollTrigger); 13228 13229 if (_body) { 13230 _raf = _win.requestAnimationFrame || function (f) { 13231 return setTimeout(f, 16); 13232 }; 13233 13234 _addListener(_win, "wheel", _onScroll); 13235 13236 _root = [_win, _doc, _docEl, _body]; 13237 13238 _addListener(_doc, "scroll", _onScroll); 13239 13240 var bodyStyle = _body.style, 13241 border = bodyStyle.borderTop, 13242 bounds; 13243 bodyStyle.borderTop = "1px solid #000"; 13244 bounds = _getBounds(_body); 13245 _vertical.m = Math.round(bounds.top + _vertical.sc()) || 0; 13246 _horizontal.m = Math.round(bounds.left + _horizontal.sc()) || 0; 13247 border ? bodyStyle.borderTop = border : bodyStyle.removeProperty("border-top"); 13248 _syncInterval = setInterval(_sync, 200); 13249 gsap.delayedCall(0.5, function () { 13250 return _startup = 0; 13251 }); 13252 13253 _addListener(_doc, "touchcancel", _passThrough); 13254 13255 _addListener(_body, "touchstart", _passThrough); 13256 13257 _multiListener(_addListener, _doc, "pointerdown,touchstart,mousedown", function () { 13258 return _pointerIsDown = 1; 13259 }); 13260 13261 _multiListener(_addListener, _doc, "pointerup,touchend,mouseup", function () { 13262 return _pointerIsDown = 0; 13263 }); 13264 13265 _transformProp = gsap.utils.checkPrefix("transform"); 13266 13267 _stateProps.push(_transformProp); 13268 13269 _coreInitted = _getTime(); 13270 _resizeDelay = gsap.delayedCall(0.2, _refreshAll).pause(); 13271 _autoRefresh = [_doc, "visibilitychange", function () { 13272 var w = _win.innerWidth, 13273 h = _win.innerHeight; 13274 13275 if (_doc.hidden) { 13276 _prevWidth = w; 13277 _prevHeight = h; 13278 } else if (_prevWidth !== w || _prevHeight !== h) { 13279 _onResize(); 13280 } 13281 }, _doc, "DOMContentLoaded", _refreshAll, _win, "load", function () { 13282 return _lastScrollTime || _refreshAll(); 13283 }, _win, "resize", _onResize]; 13284 13285 _iterateAutoRefresh(_addListener); 13286 } 13287 } 13288 } 13289 13290 return _coreInitted; 13291 }; 13292 13293 ScrollTrigger.defaults = function defaults(config) { 13294 for (var p in config) { 13295 _defaults[p] = config[p]; 13296 } 13297 }; 13298 13299 ScrollTrigger.kill = function kill() { 13300 _enabled = 0; 13301
13302 _triggers.slice(0).forEach(function (trigger) { 13303 return trigger.kill(1); 13304 }); 13305 }; 13306 13307 ScrollTrigger.config = function config(vars) { 13308 "limitCallbacks" in vars && (_limitCallbacks = !!vars.limitCallbacks); 13309 var ms = vars.syncInterval; 13310 ms && clearInterval(_syncInterval) || (_syncInterval = ms) && setInterval(_sync, ms); 13311 13312 if ("autoRefreshEvents" in vars) { 13313 _iterateAutoRefresh(_removeListener) || _iterateAutoRefresh(_addListener, vars.autoRefreshEvents || "none"); 13314 _ignoreResize = (vars.autoRefreshEvents + "").indexOf("resize") === -1; 13315 } 13316 }; 13317 13318 ScrollTrigger.scrollerProxy = function scrollerProxy(target, vars) { 13319 var t = _toArray(target)[0], 13320 i = _scrollers.indexOf(t), 13321 isViewport = _isViewport(t); 13322 13323 if (~i) { 13324 _scrollers.splice(i, isViewport ? 6 : 2); 13325 } 13326 13327 isViewport ? _proxies.unshift(_win, vars, _body, vars, _docEl, vars) : _proxies.unshift(t, vars); 13328 }; 13329 13330 ScrollTrigger.matchMedia = function matchMedia(vars) { 13331 var mq, p, i, func, result; 13332 13333 for (p in vars) { 13334 i = _media.indexOf(p); 13335 func = vars[p]; 13336 _creatingMedia = p; 13337 13338 if (p === "all") { 13339 func(); 13340 } else { 13341 mq = _win.matchMedia(p); 13342 13343 if (mq) { 13344 mq.matches && (result = func()); 13345 13346 if (~i) { 13347 _media[i + 1] = _combineFunc(_media[i + 1], func); 13348 _media[i + 2] = _combineFunc(_media[i + 2], result); 13349 } else { 13350 i = _media.length; 13351 13352 _media.push(p, func, result); 13353 13354 mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange); 13355 } 13356 13357 _media[i + 3] = mq.matches; 13358 } 13359 } 13360 13361 _creatingMedia = 0; 13362 } 13363 13364 return _media; 13365 }; 13366 13367 ScrollTrigger.clearMatchMedia = function clearMatchMedia(query) { 13368 query || (_media.length = 0); 13369 query = _media.indexOf(query); 13370 query >= 0 && _media.splice(query, 4); 13371 }; 13372 13373 return ScrollTrigger; 13374 }(); 13375 ScrollTrigger.version = "3.7.1"; 13376 13377 ScrollTrigger.saveStyles = function (targets) { 13378 return targets ? _toArray(targets).forEach(function (target) { 13379 if (target && target.style) { 13380 var i = _savedStyles.indexOf(target); 13381 13382 i >= 0 && _savedStyles.splice(i, 5); 13383 13384 _savedStyles.push(target, target.style.cssText, target.getBBox && target.getAttribute("transform"), gsap.core.getCache(target), _creatingMedia); 13385 } 13386 }) : _savedStyles; 13387 }; 13388 13389 ScrollTrigger.revert = function (soft, media) { 13390 return _revertAll(!soft, media); 13391 }; 13392 13393 ScrollTrigger.create = function (vars, animation) { 13394 return new ScrollTrigger(vars, animation); 13395 }; 13396 13397 ScrollTrigger.refresh = function (safe) { 13398 return safe ? _onResize() : _refreshAll(true); 13399 }; 13400 13401 ScrollTrigger.update = _updateAll; 13402 13403 ScrollTrigger.maxScroll = function (element, horizontal) { 13404 return _maxScroll(element, horizontal ? _horizontal : _vertical); 13405 }; 13406 13407 ScrollTrigger.getScrollFunc = function (element, horizontal) { 13408 return _getScrollFunc(_toArray(element)[0], horizontal ? _horizontal : _vertical); 13409 }; 13410 13411 ScrollTrigger.getById = function (id) { 13412 return _ids[id]; 13413 }; 13414 13415 ScrollTrigger.getAll = function () { 13416 return _triggers.slice(0); 13417 }; 13418 13419 ScrollTrigger.isScrolling = function () { 13420 return !!_lastScrollTime; 13421 }; 13422 13423 ScrollTrigger.addEventListener = function (type, callback) { 13424 var a = _listeners[type] || (_listeners[type] = []); 13425 ~a.indexOf(callback) || a.push(callback); 13426 }; 13427 13428 ScrollTrigger.removeEventListener = function (type, callback) { 13429 var a = _listeners[type], 13430 i = a && a.indexOf(callback); 13431 i >= 0 && a.splice(i, 1); 13432 }; 13433 13434 ScrollTrigger.batch = function (targets, vars) { 13435 var result = [], 13436 varsCopy = {}, 13437 interval = vars.interval || 0.016,
13438 batchMax = vars.batchMax || 1e9, 13439 proxyCallback = function proxyCallback(type, callback) { 13440 var elements = [], 13441 triggers = [], 13442 delay = gsap.delayedCall(interval, function () { 13443 callback(elements, triggers); 13444 elements = []; 13445 triggers = []; 13446 }).pause(); 13447 return function (self) { 13448 elements.length || delay.restart(true); 13449 elements.push(self.trigger); 13450 triggers.push(self); 13451 batchMax <= elements.length && delay.progress(1); 13452 }; 13453 }, 13454 p; 13455 13456 for (p in vars) { 13457 varsCopy[p] = p.substr(0, 2) === "on" && _isFunction(vars[p]) && p !== "onRefreshInit" ? proxyCallback(p, vars[p]) : vars[p]; 13458 } 13459 13460 if (_isFunction(batchMax)) { 13461 batchMax = batchMax(); 13462 13463 _addListener(ScrollTrigger, "refresh", function () { 13464 return batchMax = vars.batchMax(); 13465 }); 13466 } 13467 13468 _toArray(targets).forEach(function (target) { 13469 var config = {}; 13470 13471 for (p in varsCopy) { 13472 config[p] = varsCopy[p]; 13473 } 13474 13475 config.trigger = target; 13476 result.push(ScrollTrigger.create(config)); 13477 }); 13478 13479 return result; 13480 }; 13481 13482 ScrollTrigger.sort = function (func) { 13483 return _triggers.sort(func || function (a, b) { 13484 return (a.vars.refreshPriority || 0) * -1e6 + a.start - (b.start + (b.vars.refreshPriority || 0) * -1e6); 13485 }); 13486 }; 13487 13488 _getGSAP() && gsap.registerPlugin(ScrollTrigger); 13489 13490 exports.ScrollTrigger = ScrollTrigger; 13491 exports.default = ScrollTrigger; 13492 13493 Object.defineProperty(exports, '__esModule', { value: true }); 13494 13495}))); 13496/* 13497 _ _ _ _ 13498 ___| (_) ___| | __ (_)___ 13499/ __| | |/ __| |/ / | / __| 13500\__ \ | | (__| < _ | \__ \ 13501|___/_|_|\___|_|\_(_)/ |___/ 13502 |__/ 13503 13504 Version: 1.9.0 13505 Author: Ken Wheeler 13506 Website: http://kenwheeler.github.io 13507 Docs: http://kenwheeler.github.io/slick 13508 Repo: http://github.com/kenwheeler/slick 13509 Issues: http://github.com/kenwheeler/slick/issues 13510 13511 */ 13512/* global window, document, define, jQuery, setInterval, clearInterval */ 13513;(function(factory) { 13514 'use strict'; 13515 if (typeof define === 'function' && define.amd) { 13516 define(['jquery'], factory); 13517 } else if (typeof exports !== 'undefined') { 13518 module.exports = factory(require('jquery')); 13519 } else { 13520 factory(jQuery); 13521 } 13522 13523}(function($) { 13524 'use strict';
vendor: 29,656 bytes, lines 13524-14512
13524 13525 var Slick = window.Slick || {}; 13526 13527 Slick = (function() { 13528 13529 var instanceUid = 0; 13530 13531 function Slick(element, settings) { 13532 13533 var _ = this, dataSettings; 13534 13535 _.defaults = { 13536 accessibility: true, 13537 adaptiveHeight: false, 13538 appendArrows: $(element), 13539 appendDots: $(element), 13540 arrows: true, 13541 asNavFor: null, 13542 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 13543 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 13544 autoplay: false, 13545 autoplaySpeed: 3000, 13546 centerMode: false, 13547 centerPadding: '50px', 13548 cssEase: 'ease', 13549 customPaging: function(slider, i) { 13550 return $('<button type="button" />').text(i + 1); 13551 }, 13552 dots: false, 13553 dotsClass: 'slick-dots', 13554 draggable: true, 13555 easing: 'linear', 13556 edgeFriction: 0.35, 13557 fade: false, 13558 focusOnSelect: false, 13559 focusOnChange: false, 13560 infinite: true, 13561 initialSlide: 0, 13562 lazyLoad: 'ondemand', 13563 mobileFirst: false, 13564 pauseOnHover: true, 13565 pauseOnFocus: true, 13566 pauseOnDotsHover: false, 13567 respondTo: 'window', 13568 responsive: null, 13569 rows: 1, 13570 rtl: false, 13571 slide: '', 13572 slidesPerRow: 1, 13573 slidesToShow: 1, 13574 slidesToScroll: 1, 13575 speed: 500, 13576 swipe: true, 13577 swipeToSlide: false, 13578 touchMove: true, 13579 touchThreshold: 5, 13580 useCSS: true, 13581 useTransform: true, 13582 variableWidth: false, 13583 vertical: false, 13584 verticalSwiping: false, 13585 waitForAnimate: true, 13586 zIndex: 1000 13587 }; 13588 13589 _.initials = { 13590 animating: false, 13591 dragging: false, 13592 autoPlayTimer: null, 13593 currentDirection: 0, 13594 currentLeft: null, 13595 currentSlide: 0, 13596 direction: 1, 13597 $dots: null, 13598 listWidth: null, 13599 listHeight: null, 13600 loadIndex: 0, 13601 $nextArrow: null, 13602 $prevArrow: null, 13603 scrolling: false, 13604 slideCount: null, 13605 slideWidth: null, 13606 $slideTrack: null, 13607 $slides: null, 13608 sliding: false, 13609 slideOffset: 0, 13610 swipeLeft: null, 13611 swiping: false, 13612 $list: null, 13613 touchObject: {}, 13614 transformsEnabled: false, 13615 unslicked: false 13616 }; 13617 13618 $.extend(_, _.initials); 13619 13620 _.activeBreakpoint = null; 13621 _.animType = null; 13622 _.animProp = null; 13623 _.breakpoints = []; 13624 _.breakpointSettings = []; 13625 _.cssTransitions = false; 13626 _.focussed = false; 13627 _.interrupted = false; 13628 _.hidden = 'hidden'; 13629 _.paused = true; 13630 _.positionProp = null; 13631 _.respondTo = null; 13632 _.rowCount = 1; 13633 _.shouldClick = true; 13634 _.$slider = $(element); 13635 _.$slidesCache = null; 13636 _.transformType = null; 13637 _.transitionType = null; 13638 _.visibilityChange = 'visibilitychange'; 13639 _.windowWidth = 0; 13640 _.windowTimer = null; 13641 13642 dataSettings = $(element).data('slick') || {}; 13643 13644 _.options = $.extend({}, _.defaults, settings, dataSettings); 13645 13646 _.currentSlide = _.options.initialSlide; 13647 13648 _.originalSettings = _.options; 13649 13650 if (typeof document.mozHidden !== 'undefined') { 13651 _.hidden = 'mozHidden'; 13652 _.visibilityChange = 'mozvisibilitychange'; 13653 } else if (typeof document.webkitHidden !== 'undefined') { 13654 _.hidden = 'webkitHidden'; 13655 _.visibilityChange = 'webkitvisibilitychange'; 13656 } 13657 13658 _.autoPlay = $.proxy(_.autoPlay, _); 13659 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 13660 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 13661 _.changeSlide = $.proxy(_.changeSlide, _); 13662 _.clickHandler = $.proxy(_.clickHandler, _); 13663 _.selectHandler = $.proxy(_.selectHandler, _); 13664 _.setPosition = $.proxy(_.setPosition, _); 13665 _.swipeHandler = $.proxy(_.swipeHandler, _); 13666 _.dragHandler = $.proxy(_.dragHandler, _); 13667 _.keyHandler = $.proxy(_.keyHandler, _); 13668 13669 _.instanceUid = instanceUid++; 13670 13671 // A simple way to check for HTML strings 13672 // Strict HTML recognition (must start with <) 13673 // Extracted from jQuery v1.11 source 13674 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 13675 13676 13677 _.registerBreakpoints(); 13678 _.init(true); 13679 13680 } 13681 13682 return Slick; 13683 13684 }()); 13685 13686 Slick.prototype.activateADA = function() { 13687 var _ = this; 13688 13689 _.$slideTrack.find('.slick-active').attr({ 13690 'aria-hidden': 'false' 13691 }).find('a, input, button, select').attr({ 13692 'tabindex': '0' 13693 }); 13694 13695 }; 13696 13697 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 13698 13699 var _ = this; 13700 13701 if (typeof(index) === 'boolean') { 13702 addBefore = index; 13703 index = null; 13704 } else if (index < 0 || (index >= _.slideCount)) { 13705 return false; 13706 } 13707 13708 _.unload(); 13709 13710 if (typeof(index) === 'number') { 13711 if (index === 0 && _.$slides.length === 0) { 13712 $(markup).appendTo(_.$slideTrack); 13713 } else if (addBefore) { 13714 $(markup).insertBefore(_.$slides.eq(index)); 13715 } else { 13716 $(markup).insertAfter(_.$slides.eq(index)); 13717 } 13718 } else { 13719 if (addBefore === true) { 13720 $(markup).prependTo(_.$slideTrack); 13721 } else { 13722 $(markup).appendTo(_.$slideTrack); 13723 } 13724 } 13725 13726 _.$slides = _.$slideTrack.children(this.options.slide); 13727 13728 _.$slideTrack.children(this.options.slide).detach(); 13729 13730 _.$slideTrack.append(_.$slides); 13731 13732 _.$slides.each(function(index, element) { 13733 $(element).attr('data-slick-index', index); 13734 }); 13735 13736 _.$slidesCache = _.$slides; 13737 13738 _.reinit(); 13739 13740 }; 13741 13742 Slick.prototype.animateHeight = function() { 13743 var _ = this; 13744 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 13745 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 13746 _.$list.animate({ 13747 height: targetHeight 13748 }, _.options.speed); 13749 } 13750 }; 13751 13752 Slick.prototype.animateSlide = function(targetLeft, callback) { 13753 13754 var animProps = {}, 13755 _ = this; 13756 13757 _.animateHeight(); 13758 13759 if (_.options.rtl === true && _.options.vertical === false) { 13760 targetLeft = -targetLeft; 13761 } 13762 if (_.transformsEnabled === false) { 13763 if (_.options.vertical === false) { 13764 _.$slideTrack.animate({ 13765 left: targetLeft 13766 }, _.options.speed, _.options.easing, callback); 13767 } else { 13768 _.$slideTrack.animate({ 13769 top: targetLeft 13770 }, _.options.speed, _.options.easing, callback); 13771 } 13772 13773 } else { 13774 13775 if (_.cssTransitions === false) { 13776 if (_.options.rtl === true) { 13777 _.currentLeft = -(_.currentLeft); 13778 } 13779 $({ 13780 animStart: _.currentLeft 13781 }).animate({ 13782 animStart: targetLeft 13783 }, { 13784 duration: _.options.speed, 13785 easing: _.options.easing, 13786 step: function(now) { 13787 now = Math.ceil(now); 13788 if (_.options.vertical === false) { 13789 animProps[_.animType] = 'translate(' + 13790 now + 'px, 0px)'; 13791 _.$slideTrack.css(animProps); 13792 } else { 13793 animProps[_.animType] = 'translate(0px,' + 13794 now + 'px)'; 13795 _.$slideTrack.css(animProps); 13796 } 13797 }, 13798 complete: function() { 13799 if (callback) { 13800 callback.call(); 13801 } 13802 } 13803 }); 13804 13805 } else { 13806 13807 _.applyTransition(); 13808 targetLeft = Math.ceil(targetLeft); 13809 13810 if (_.options.vertical === false) { 13811 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 13812 } else { 13813 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 13814 } 13815 _.$slideTrack.css(animProps); 13816 13817 if (callback) { 13818 setTimeout(function() { 13819 13820 _.disableTransition(); 13821 13822 callback.call(); 13823 }, _.options.speed); 13824 } 13825 13826 } 13827 13828 } 13829 13830 }; 13831 13832 Slick.prototype.getNavTarget = function() { 13833 13834 var _ = this, 13835 asNavFor = _.options.asNavFor; 13836 13837 if ( asNavFor && asNavFor !== null ) { 13838 asNavFor = $(asNavFor).not(_.$slider); 13839 } 13840 13841 return asNavFor; 13842 13843 }; 13844 13845 Slick.prototype.asNavFor = function(index) { 13846 13847 var _ = this, 13848 asNavFor = _.getNavTarget(); 13849 13850 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 13851 asNavFor.each(function() { 13852 var target = $(this).slick('getSlick'); 13853 if(!target.unslicked) { 13854 target.slideHandler(index, true); 13855 } 13856 }); 13857 } 13858 13859 }; 13860 13861 Slick.prototype.applyTransition = function(slide) { 13862 13863 var _ = this, 13864 transition = {}; 13865 13866 if (_.options.fade === false) { 13867 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 13868 } else { 13869 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 13870 } 13871 13872 if (_.options.fade === false) { 13873 _.$slideTrack.css(transition); 13874 } else { 13875 _.$slides.eq(slide).css(transition); 13876 } 13877 13878 }; 13879 13880 Slick.prototype.autoPlay = function() { 13881 13882 var _ = this; 13883 13884 _.autoPlayClear(); 13885 13886 if ( _.slideCount > _.options.slidesToShow ) { 13887 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 13888 } 13889 13890 }; 13891 13892 Slick.prototype.autoPlayClear = function() { 13893 13894 var _ = this; 13895 13896 if (_.autoPlayTimer) { 13897 clearInterval(_.autoPlayTimer); 13898 } 13899 13900 }; 13901 13902 Slick.prototype.autoPlayIterator = function() { 13903 13904 var _ = this, 13905 slideTo = _.currentSlide + _.options.slidesToScroll; 13906 13907 if ( !_.paused && !_.interrupted && !_.focussed ) { 13908 13909 if ( _.options.infinite === false ) { 13910 13911 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 13912 _.direction = 0; 13913 } 13914 13915 else if ( _.direction === 0 ) { 13916 13917 slideTo = _.currentSlide - _.options.slidesToScroll; 13918 13919 if ( _.currentSlide - 1 === 0 ) { 13920 _.direction = 1; 13921 } 13922 13923 } 13924 13925 } 13926 13927 _.slideHandler( slideTo ); 13928 13929 } 13930 13931 }; 13932 13933 Slick.prototype.buildArrows = function() { 13934 13935 var _ = this; 13936 13937 if (_.options.arrows === true ) { 13938 13939 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 13940 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 13941 13942 if( _.slideCount > _.options.slidesToShow ) { 13943 13944 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 13945 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 13946 13947 if (_.htmlExpr.test(_.options.prevArrow)) { 13948 _.$prevArrow.prependTo(_.options.appendArrows); 13949 } 13950 13951 if (_.htmlExpr.test(_.options.nextArrow)) { 13952 _.$nextArrow.appendTo(_.options.appendArrows); 13953 } 13954 13955 if (_.options.infinite !== true) { 13956 _.$prevArrow 13957 .addClass('slick-disabled') 13958 .attr('aria-disabled', 'true'); 13959 } 13960 13961 } else { 13962 13963 _.$prevArrow.add( _.$nextArrow ) 13964 13965 .addClass('slick-hidden') 13966 .attr({ 13967 'aria-disabled': 'true', 13968 'tabindex': '-1' 13969 }); 13970 13971 } 13972 13973 } 13974 13975 }; 13976 13977 Slick.prototype.buildDots = function() { 13978 13979 var _ = this, 13980 i, dot; 13981 13982 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 13983 13984 _.$slider.addClass('slick-dotted'); 13985 13986 dot = $('<ul />').addClass(_.options.dotsClass); 13987 13988 for (i = 0; i <= _.getDotCount(); i += 1) { 13989 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 13990 } 13991 13992 _.$dots = dot.appendTo(_.options.appendDots); 13993 13994 _.$dots.find('li').first().addClass('slick-active'); 13995 13996 } 13997 13998 }; 13999 14000 Slick.prototype.buildOut = function() { 14001 14002 var _ = this; 14003 14004 _.$slides = 14005 _.$slider 14006 .children( _.options.slide + ':not(.slick-cloned)') 14007 .addClass('slick-slide'); 14008 14009 _.slideCount = _.$slides.length; 14010 14011 _.$slides.each(function(index, element) { 14012 $(element) 14013 .attr('data-slick-index', index) 14014 .data('originalStyling', $(element).attr('style') || ''); 14015 }); 14016 14017 _.$slider.addClass('slick-slider'); 14018 14019 _.$slideTrack = (_.slideCount === 0) ? 14020 $('<div class="slick-track"/>').appendTo(_.$slider) : 14021 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 14022 14023 _.$list = _.$slideTrack.wrap( 14024 '<div class="slick-list"/>').parent(); 14025 _.$slideTrack.css('opacity', 0); 14026 14027 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 14028 _.options.slidesToScroll = 1; 14029 } 14030 14031 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 14032 14033 _.setupInfinite(); 14034 14035 _.buildArrows(); 14036 14037 _.buildDots(); 14038 14039 _.updateDots(); 14040 14041 14042 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 14043 14044 if (_.options.draggable === true) { 14045 _.$list.addClass('draggable'); 14046 } 14047 14048 }; 14049 14050 Slick.prototype.buildRows = function() { 14051 14052 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 14053 14054 newSlides = document.createDocumentFragment(); 14055 originalSlides = _.$slider.children(); 14056 14057 if(_.options.rows > 0) { 14058 14059 slidesPerSection = _.options.slidesPerRow * _.options.rows; 14060 numOfSlides = Math.ceil( 14061 originalSlides.length / slidesPerSection 14062 ); 14063 14064 for(a = 0; a < numOfSlides; a++){ 14065 var slide = document.createElement('div'); 14066 for(b = 0; b < _.options.rows; b++) { 14067 var row = document.createElement('div'); 14068 for(c = 0; c < _.options.slidesPerRow; c++) { 14069 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 14070 if (originalSlides.get(target)) { 14071 row.appendChild(originalSlides.get(target)); 14072 } 14073 } 14074 slide.appendChild(row); 14075 } 14076 newSlides.appendChild(slide); 14077 } 14078 14079 _.$slider.empty().append(newSlides); 14080 _.$slider.children().children().children() 14081 .css({ 14082 'width':(100 / _.options.slidesPerRow) + '%', 14083 'display': 'inline-block' 14084 }); 14085 14086 } 14087 14088 }; 14089 14090 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 14091 14092 var _ = this, 14093 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 14094 var sliderWidth = _.$slider.width(); 14095 var windowWidth = window.innerWidth || $(window).width(); 14096 14097 if (_.respondTo === 'window') { 14098 respondToWidth = windowWidth; 14099 } else if (_.respondTo === 'slider') { 14100 respondToWidth = sliderWidth; 14101 } else if (_.respondTo === 'min') { 14102 respondToWidth = Math.min(windowWidth, sliderWidth); 14103 } 14104 14105 if ( _.options.responsive && 14106 _.options.responsive.length && 14107 _.options.responsive !== null) { 14108 14109 targetBreakpoint = null; 14110 14111 for (breakpoint in _.breakpoints) { 14112 if (_.breakpoints.hasOwnProperty(breakpoint)) { 14113 if (_.originalSettings.mobileFirst === false) { 14114 if (respondToWidth < _.breakpoints[breakpoint]) { 14115 targetBreakpoint = _.breakpoints[breakpoint]; 14116 } 14117 } else { 14118 if (respondToWidth > _.breakpoints[breakpoint]) { 14119 targetBreakpoint = _.breakpoints[breakpoint]; 14120 } 14121 } 14122 } 14123 } 14124 14125 if (targetBreakpoint !== null) { 14126 if (_.activeBreakpoint !== null) { 14127 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 14128 _.activeBreakpoint = 14129 targetBreakpoint; 14130 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 14131 _.unslick(targetBreakpoint); 14132 } else { 14133 _.options = $.extend({}, _.originalSettings, 14134 _.breakpointSettings[ 14135 targetBreakpoint]); 14136 if (initial === true) { 14137 _.currentSlide = _.options.initialSlide; 14138 } 14139 _.refresh(initial); 14140 } 14141 triggerBreakpoint = targetBreakpoint; 14142 } 14143 } else { 14144 _.activeBreakpoint = targetBreakpoint; 14145 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 14146 _.unslick(targetBreakpoint); 14147 } else { 14148 _.options = $.extend({}, _.originalSettings, 14149 _.breakpointSettings[ 14150 targetBreakpoint]); 14151 if (initial === true) { 14152 _.currentSlide = _.options.initialSlide; 14153 } 14154 _.refresh(initial); 14155 } 14156 triggerBreakpoint = targetBreakpoint; 14157 } 14158 } else { 14159 if (_.activeBreakpoint !== null) { 14160 _.activeBreakpoint = null; 14161 _.options = _.originalSettings; 14162 if (initial === true) { 14163 _.currentSlide = _.options.initialSlide; 14164 } 14165 _.refresh(initial); 14166 triggerBreakpoint = targetBreakpoint; 14167 } 14168 } 14169 14170 // only trigger breakpoints during an actual break. not on initialize. 14171 if( !initial && triggerBreakpoint !== false ) { 14172 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 14173 } 14174 } 14175 14176 }; 14177 14178 Slick.prototype.changeSlide = function(event, dontAnimate) { 14179 14180 var _ = this, 14181 $target = $(event.currentTarget), 14182 indexOffset, slideOffset, unevenOffset; 14183 14184 // If target is a link, prevent default action. 14185 if($target.is('a')) { 14186 event.preventDefault(); 14187 } 14188 14189 // If target is not the <li> element (ie: a child), find the <li>. 14190 if(!$target.is('li')) { 14191 $target = $target.closest('li'); 14192 } 14193 14194 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 14195 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 14196 14197 switch (event.data.message) { 14198 14199 case 'previous': 14200 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 14201 if (_.slideCount > _.options.slidesToShow) { 14202 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 14203 } 14204 break; 14205 14206 case 'next': 14207 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 14208 if (_.slideCount > _.options.slidesToShow) { 14209 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 14210 } 14211 break; 14212 14213 case 'index': 14214 var index = event.data.index === 0 ? 0 : 14215 event.data.index || $target.index() * _.options.slidesToScroll; 14216 14217 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 14218 $target.children().trigger('focus'); 14219 break; 14220 14221 default: 14222 return; 14223 } 14224 14225 }; 14226 14227 Slick.prototype.checkNavigable = function(index) { 14228 14229 var _ = this, 14230 navigables, prevNavigable; 14231 14232 navigables = _.getNavigableIndexes(); 14233 prevNavigable = 0; 14234 if (index > navigables[navigables.length - 1]) { 14235 index = navigables[navigables.length - 1]; 14236 } else { 14237 for (var n in navigables) { 14238 if (index < navigables[n]) { 14239 index = prevNavigable; 14240 break; 14241 } 14242 prevNavigable = navigables[n]; 14243 } 14244 } 14245 14246 return index; 14247 }; 14248 14249 Slick.prototype.cleanUpEvents = function() { 14250 14251 var _ = this; 14252 14253 if (_.options.dots && _.$dots !== null) { 14254 14255 $('li', _.$dots) 14256 .off('click.slick', _.changeSlide) 14257 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 14258 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 14259 14260 if (_.options.accessibility === true) { 14261 _.$dots.off('keydown.slick', _.keyHandler); 14262 } 14263 } 14264 14265 _.$slider.off('focus.slick blur.slick'); 14266 14267 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 14268 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 14269 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 14270 14271 if (_.options.accessibility === true) { 14272 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 14273 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 14274 } 14275 } 14276 14277 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 14278 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 14279 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 14280 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 14281 14282 _.$list.off('click.slick', _.clickHandler); 14283 14284 $(document).off(_.visibilityChange, _.visibility); 14285 14286 _.cleanUpSlideEvents(); 14287 14288 if (_.options.accessibility === true) { 14289 _.$list.off('keydown.slick', _.keyHandler); 14290 } 14291 14292 if (_.options.focusOnSelect === true) { 14293 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 14294 } 14295 14296 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 14297 14298 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 14299 14300 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 14301 14302 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 14303 14304 }; 14305 14306 Slick.prototype.cleanUpSlideEvents = function() { 14307 14308 var _ = this; 14309 14310 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 14311 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 14312 14313 }; 14314 14315 Slick.prototype.cleanUpRows = function() { 14316 14317 var _ = this, originalSlides; 14318 14319 if(_.options.rows > 0) { 14320 originalSlides = _.$slides.children().children(); 14321 originalSlides.removeAttr('style'); 14322 _.$slider.empty().append(originalSlides); 14323 } 14324 14325 }; 14326 14327 Slick.prototype.clickHandler = function(event) { 14328 14329 var _ = this; 14330 14331 if (_.shouldClick === false) { 14332 event.stopImmediatePropagation(); 14333 event.stopPropagation(); 14334 event.preventDefault(); 14335 } 14336 14337 }; 14338 14339 Slick.prototype.destroy = function(refresh) { 14340 14341 var _ = this; 14342 14343 _.autoPlayClear(); 14344 14345 _.touchObject = {}; 14346 14347 _.cleanUpEvents(); 14348 14349 $('.slick-cloned', _.$slider).detach(); 14350 14351 if (_.$dots) { 14352 _.$dots.remove(); 14353 } 14354 14355 if ( _.$prevArrow && _.$prevArrow.length ) { 14356 14357 _.$prevArrow 14358 .removeClass('slick-disabled slick-arrow slick-hidden') 14359 .removeAttr('aria-hidden aria-disabled tabindex') 14360 .css('display',''); 14361 14362 if ( _.htmlExpr.test( _.options.prevArrow )) { 14363 _.$prevArrow.remove(); 14364 } 14365 } 14366 14367 if ( _.$nextArrow && _.$nextArrow.length ) { 14368 14369 _.$nextArrow 14370 .removeClass('slick-disabled slick-arrow slick-hidden') 14371 .removeAttr('aria-hidden aria-disabled tabindex') 14372 .css('display',''); 14373 14374 if ( _.htmlExpr.test( _.options.nextArrow )) { 14375 _.$nextArrow.remove(); 14376 } 14377 } 14378 14379 14380 if (_.$slides) { 14381 14382 _.$slides 14383 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 14384 .removeAttr('aria-hidden') 14385 .removeAttr('data-slick-index') 14386 .each(function(){ 14387 $(this).attr('style', $(this).data('originalStyling')); 14388 }); 14389 14390 _.$slideTrack.children(this.options.slide).detach(); 14391 14392 _.$slideTrack.detach(); 14393 14394 _.$list.detach(); 14395 14396 _.$slider.append(_.$slides); 14397 } 14398 14399 _.cleanUpRows(); 14400 14401 _.$slider.removeClass('slick-slider'); 14402 _.$slider.removeClass('slick-initialized'); 14403 _.$slider.removeClass('slick-dotted'); 14404 14405 _.unslicked = true; 14406 14407 if(!refresh) { 14408 _.$slider.trigger('destroy', [_]); 14409 } 14410 14411 }; 14412 14413 Slick.prototype.disableTransition = function(slide) { 14414 14415 var _ = this, 14416 transition = {}; 14417 14418 transition[_.transitionType] = ''; 14419 14420 if (_.options.fade === false) { 14421 _.$slideTrack.css(transition); 14422 } else { 14423 _.$slides.eq(slide).css(transition); 14424 } 14425 14426 }; 14427 14428 Slick.prototype.fadeSlide = function(slideIndex, callback) { 14429 14430 var _ = this; 14431 14432 if (_.cssTransitions === false) { 14433 14434 _.$slides.eq(slideIndex).css({ 14435 zIndex: _.options.zIndex 14436 }); 14437 14438 _.$slides.eq(slideIndex).animate({ 14439 opacity: 1 14440 }, _.options.speed, _.options.easing, callback); 14441 14442 } else { 14443 14444 _.applyTransition(slideIndex); 14445 14446 _.$slides.eq(slideIndex).css({ 14447 opacity: 1, 14448 zIndex: _.options.zIndex 14449 }); 14450 14451 if (callback) { 14452 setTimeout(function() { 14453 14454 _.disableTransition(slideIndex); 14455 14456 callback.call(); 14457 }, _.options.speed); 14458 } 14459 14460 } 14461 14462 }; 14463 14464 Slick.prototype.fadeSlideOut = function(slideIndex) { 14465 14466 var _ = this; 14467 14468 if (_.cssTransitions === false) { 14469 14470 _.$slides.eq(slideIndex).animate({ 14471 opacity: 0, 14472 zIndex: _.options.zIndex - 2 14473 }, _.options.speed, _.options.easing); 14474 14475 } else { 14476 14477 _.applyTransition(slideIndex); 14478 14479 _.$slides.eq(slideIndex).css({ 14480 opacity: 0, 14481 zIndex: _.options.zIndex - 2 14482 }); 14483 14484 } 14485 14486 }; 14487 14488 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 14489 14490 var _ = this; 14491 14492 if (filter !== null) { 14493 14494 _.$slidesCache = _.$slides; 14495 14496 _.unload(); 14497 14498 _.$slideTrack.children(this.options.slide).detach(); 14499 14500 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 14501 14502 _.reinit(); 14503 14504 } 14505 14506 }; 14507 14508 Slick.prototype.focusHandler = function() { 14509 14510 var _ = this; 14511 14512
vendor: 3,201 bytes, lines 14512-14607
14512// If any child element receives focus within the slider we need to pause the autoplay 14513 _.$slider 14514 .off('focus.slick blur.slick') 14515 .on( 14516 'focus.slick', 14517 '*', 14518 function(event) { 14519 var $sf = $(this); 14520 14521 setTimeout(function() { 14522 if( _.options.pauseOnFocus ) { 14523 if ($sf.is(':focus')) { 14524 _.focussed = true; 14525 _.autoPlay(); 14526 } 14527 } 14528 }, 0); 14529 } 14530 ).on( 14531 'blur.slick', 14532 '*', 14533 function(event) { 14534 var $sf = $(this); 14535 14536 // When a blur occurs on any elements within the slider we become unfocused 14537 if( _.options.pauseOnFocus ) { 14538 _.focussed = false; 14539 _.autoPlay(); 14540 } 14541 } 14542 ); 14543 }; 14544 14545 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 14546 14547 var _ = this; 14548 return _.currentSlide; 14549 14550 }; 14551 14552 Slick.prototype.getDotCount = function() { 14553 14554 var _ = this; 14555 14556 var breakPoint = 0; 14557 var counter = 0; 14558 var pagerQty = 0; 14559 14560 if (_.options.infinite === true) { 14561 if (_.slideCount <= _.options.slidesToShow) { 14562 ++pagerQty; 14563 } else { 14564 while (breakPoint < _.slideCount) { 14565 ++pagerQty; 14566 breakPoint = counter + _.options.slidesToScroll; 14567 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 14568 } 14569 } 14570 } else if (_.options.centerMode === true) { 14571 pagerQty = _.slideCount; 14572 } else if(!_.options.asNavFor) { 14573 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 14574 }else { 14575 while (breakPoint < _.slideCount) { 14576 ++pagerQty; 14577 breakPoint = counter + _.options.slidesToScroll; 14578 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 14579 } 14580 } 14581 14582 return pagerQty - 1; 14583 14584 }; 14585 14586 Slick.prototype.getLeft = function(slideIndex) { 14587 14588 var _ = this, 14589 targetLeft, 14590 verticalHeight, 14591 verticalOffset = 0, 14592 targetSlide, 14593 coef; 14594 14595 _.slideOffset = 0; 14596 verticalHeight = _.$slides.first().outerHeight(true); 14597 14598 if (_.options.infinite === true) { 14599 if (_.slideCount > _.options.slidesToShow) { 14600 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 14601 coef = -1 14602 14603 if (_.options.vertical === true && _.options.centerMode === true) { 14604 if (_.options.slidesToShow === 2) { 14605 coef = -1.5; 14606 } else if (_.options.slidesToShow === 1) { 14607 coef = -2
vendor: 4,950 bytes, lines 14607-14736
14607 14608 } 14609 } 14610 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 14611 } 14612 if (_.slideCount % _.options.slidesToScroll !== 0) { 14613 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 14614 if (slideIndex > _.slideCount) { 14615 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1; 14616 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 14617 } else { 14618 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 14619 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 14620 } 14621 } 14622 } 14623 } else { 14624 if (slideIndex + _.options.slidesToShow > _.slideCount) { 14625 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 14626 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 14627 } 14628 } 14629 14630 if (_.slideCount <= _.options.slidesToShow) { 14631 _.slideOffset = 0; 14632 verticalOffset = 0; 14633 } 14634 14635 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 14636 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 14637 } else if (_.options.centerMode === true && _.options.infinite === true) { 14638 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 14639 } else if (_.options.centerMode === true) { 14640 _.slideOffset = 0; 14641 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 14642 } 14643 14644 if (_.options.vertical === false) { 14645 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 14646 } else { 14647 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 14648 } 14649 14650 if (_.options.variableWidth === true) { 14651 14652 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 14653 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 14654 } else { 14655 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 14656 } 14657 14658 if (_.options.rtl === true) { 14659 if (targetSlide[0]) { 14660 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 14661 } else { 14662 targetLeft = 0; 14663 } 14664 } else { 14665 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 14666 } 14667 14668 if (_.options.centerMode === true) { 14669 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 14670 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 14671 } else { 14672 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 14673 } 14674 14675 if (_.options.rtl === true) { 14676 if (targetSlide[0]) { 14677 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 14678 } else { 14679 targetLeft = 0; 14680 } 14681 } else { 14682 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 14683 } 14684 14685 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 14686 } 14687 } 14688 14689 return targetLeft; 14690 14691 }; 14692 14693 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 14694 14695 var _ = this; 14696 14697 return _.options[option]; 14698 14699 }; 14700 14701 Slick.prototype.getNavigableIndexes = function() { 14702 14703 var _ = this, 14704 breakPoint = 0, 14705 counter = 0, 14706 indexes = [], 14707 max; 14708 14709 if (_.options.infinite === false) { 14710 max = _.slideCount; 14711 } else { 14712 breakPoint = _.options.slidesToScroll * -1; 14713 counter = _.options.slidesToScroll * -1; 14714 max = _.slideCount * 2; 14715 } 14716 14717 while (breakPoint < max) { 14718 indexes.push(breakPoint); 14719 breakPoint = counter + _.options.slidesToScroll; 14720 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 14721 } 14722 14723 return indexes; 14724 14725 }; 14726 14727 Slick.prototype.getSlick = function() { 14728 14729 return this; 14730 14731 }; 14732 14733 Slick.prototype.getSlideCount = function() { 14734 14735 var _ = this, 14736 slidesTraversed, swipedSlide,
14736swipeTarget, centerOffset; 14737 14738 centerOffset = _.options.centerMode === true ? Math.floor(_.$list.width() / 2) : 0; 14739 swipeTarget = (_.swipeLeft * -1) + centerOffset; 14740 14741 if (_.options.swipeToSlide === true) { 14742 14743 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 14744 14745 var slideOuterWidth, slideOffset, slideRightBoundary; 14746 slideOuterWidth = $(slide).outerWidth(); 14747 slideOffset = slide.offsetLeft; 14748 if (_.options.centerMode !== true) { 14749 slideOffset += (slideOuterWidth / 2); 14750 } 14751 14752 slideRightBoundary = slideOffset + (slideOuterWidth); 14753 14754 if (swipeTarget < slideRightBoundary) { 14755 swipedSlide = slide; 14756 return false; 14757 } 14758 }); 14759 14760 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 14761 14762 return slidesTraversed; 14763 14764 } else { 14765 return _.options.slidesToScroll; 14766 } 14767 14768 }; 14769 14770 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 14771 14772 var _ = this; 14773 14774 _.changeSlide({ 14775 data: { 14776 message: 'index', 14777 index: parseInt(slide) 14778 } 14779 }, dontAnimate); 14780 14781 }; 14782 14783 Slick.prototype.init = function(creation) { 14784 14785 var _ = this; 14786 14787 if (!$(_.$slider).hasClass('slick-initialized')) { 14788 14789 $(_.$slider).addClass('slick-initialized'); 14790 14791 _.buildRows(); 14792 _.buildOut(); 14793 _.setProps(); 14794 _.startLoad(); 14795 _.loadSlider(); 14796 _.initializeEvents(); 14797 _.updateArrows(); 14798 _.updateDots(); 14799 _.checkResponsive(true); 14800 _.focusHandler(); 14801 14802 } 14803 14804 if (creation) { 14805 _.$slider.trigger('init', [_]); 14806 } 14807 14808 if (_.options.accessibility === true) { 14809 _.initADA(); 14810 } 14811 14812 if ( _.options.autoplay ) { 14813 14814 _.paused = false;
vendor: 1,103 bytes, lines 14815-14846
14815 _.autoPlay(); 14816 14817 } 14818 14819 }; 14820 14821 Slick.prototype.initADA = function() { 14822 var _ = this, 14823 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 14824 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 14825 return (val >= 0) && (val < _.slideCount); 14826 }); 14827 14828 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 14829 'aria-hidden': 'true', 14830 'tabindex': '-1' 14831 }).find('a, input, button, select').attr({ 14832 'tabindex': '-1' 14833 }); 14834 14835 if (_.$dots !== null) { 14836 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 14837 var slideControlIndex = tabControlIndexes.indexOf(i); 14838 14839 $(this).attr({ 14840 'role': 'tabpanel', 14841 'id': 'slick-slide' + _.instanceUid + i, 14842 'tabindex': -1 14843 }); 14844 14845 if (slideControlIndex !== -1) { 14846 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex
vendor: 39,773 bytes, lines 14846-16222
14846 14847 if ($('#' + ariaButtonControl).length) { 14848 $(this).attr({ 14849 'aria-describedby': ariaButtonControl 14850 }); 14851 } 14852 } 14853 }); 14854 14855 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 14856 var mappedSlideIndex = tabControlIndexes[i]; 14857 14858 $(this).attr({ 14859 'role': 'presentation' 14860 }); 14861 14862 $(this).find('button').first().attr({ 14863 'role': 'tab', 14864 'id': 'slick-slide-control' + _.instanceUid + i, 14865 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 14866 'aria-label': (i + 1) + ' of ' + numDotGroups, 14867 'aria-selected': null, 14868 'tabindex': '-1' 14869 }); 14870 14871 }).eq(_.currentSlide).find('button').attr({ 14872 'aria-selected': 'true', 14873 'tabindex': '0' 14874 }).end(); 14875 } 14876 14877 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 14878 if (_.options.focusOnChange) { 14879 _.$slides.eq(i).attr({'tabindex': '0'}); 14880 } else { 14881 _.$slides.eq(i).removeAttr('tabindex'); 14882 } 14883 } 14884 14885 _.activateADA(); 14886 14887 }; 14888 14889 Slick.prototype.initArrowEvents = function() { 14890 14891 var _ = this; 14892 14893 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 14894 _.$prevArrow 14895 .off('click.slick') 14896 .on('click.slick', { 14897 message: 'previous' 14898 }, _.changeSlide); 14899 _.$nextArrow 14900 .off('click.slick') 14901 .on('click.slick', { 14902 message: 'next' 14903 }, _.changeSlide); 14904 14905 if (_.options.accessibility === true) { 14906 _.$prevArrow.on('keydown.slick', _.keyHandler); 14907 _.$nextArrow.on('keydown.slick', _.keyHandler); 14908 } 14909 } 14910 14911 }; 14912 14913 Slick.prototype.initDotEvents = function() { 14914 14915 var _ = this; 14916 14917 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 14918 $('li', _.$dots).on('click.slick', { 14919 message: 'index' 14920 }, _.changeSlide); 14921 14922 if (_.options.accessibility === true) { 14923 _.$dots.on('keydown.slick', _.keyHandler); 14924 } 14925 } 14926 14927 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 14928 14929 $('li', _.$dots) 14930 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 14931 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 14932 14933 } 14934 14935 }; 14936 14937 Slick.prototype.initSlideEvents = function() { 14938 14939 var _ = this; 14940 14941 if ( _.options.pauseOnHover ) { 14942 14943 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 14944 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 14945 14946 } 14947 14948 }; 14949 14950 Slick.prototype.initializeEvents = function() { 14951 14952 var _ = this; 14953 14954 _.initArrowEvents(); 14955 14956 _.initDotEvents(); 14957 _.initSlideEvents(); 14958 14959 _.$list.on('touchstart.slick mousedown.slick', { 14960 action: 'start' 14961 }, _.swipeHandler); 14962 _.$list.on('touchmove.slick mousemove.slick', { 14963 action: 'move' 14964 }, _.swipeHandler); 14965 _.$list.on('touchend.slick mouseup.slick', { 14966 action: 'end' 14967 }, _.swipeHandler); 14968 _.$list.on('touchcancel.slick mouseleave.slick', { 14969 action: 'end' 14970 }, _.swipeHandler); 14971 14972 _.$list.on('click.slick', _.clickHandler); 14973 14974 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 14975 14976 if (_.options.accessibility === true) { 14977 _.$list.on('keydown.slick', _.keyHandler); 14978 } 14979 14980 if (_.options.focusOnSelect === true) { 14981 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 14982 } 14983 14984 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 14985 14986 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 14987 14988 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 14989 14990 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 14991 $(_.setPosition); 14992 14993 }; 14994 14995 Slick.prototype.initUI = function() { 14996 14997 var _ = this; 14998 14999 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 15000 15001 _.$prevArrow.show(); 15002 _.$nextArrow.show(); 15003 15004 } 15005 15006 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 15007 15008 _.$dots.show(); 15009 15010 } 15011 15012 }; 15013 15014 Slick.prototype.keyHandler = function(event) { 15015 15016 var _ = this; 15017 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 15018 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 15019 if (event.keyCode === 37 && _.options.accessibility === true) { 15020 _.changeSlide({ 15021 data: { 15022 message: _.options.rtl === true ? 'next' : 'previous' 15023 } 15024 }); 15025 } else if (event.keyCode === 39 && _.options.accessibility === true) { 15026 _.changeSlide({ 15027 data: { 15028 message: _.options.rtl === true ? 'previous' : 'next' 15029 } 15030 }); 15031 } 15032 } 15033 15034 }; 15035 15036 Slick.prototype.lazyLoad = function() { 15037 15038 var _ = this, 15039 loadRange, cloneRange, rangeStart, rangeEnd; 15040 15041 function loadImages(imagesScope) { 15042 15043 $('img[data-lazy]', imagesScope).each(function() { 15044 15045 var image = $(this), 15046 imageSource = $(this).attr('data-lazy'), 15047 imageSrcSet = $(this).attr('data-srcset'), 15048 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 15049 imageToLoad = document.createElement('img'); 15050 15051 imageToLoad.onload = function() { 15052 15053 image 15054 .animate({ opacity: 0 }, 100, function() { 15055 15056 if (imageSrcSet) { 15057 image 15058 .attr('srcset', imageSrcSet ); 15059 15060 if (imageSizes) { 15061 image 15062 .attr('sizes', imageSizes ); 15063 } 15064 } 15065 15066 image 15067 .attr('src', imageSource) 15068 .animate({ opacity: 1 }, 200, function() { 15069 image 15070 .removeAttr('data-lazy data-srcset data-sizes') 15071 .removeClass('slick-loading'); 15072 }); 15073 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 15074 }); 15075 15076 }; 15077 15078 imageToLoad.onerror = function() { 15079 15080 image 15081 .removeAttr( 'data-lazy' ) 15082 .removeClass( 'slick-loading' ) 15083 .addClass( 'slick-lazyload-error' ); 15084 15085 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 15086 15087 }; 15088 15089 imageToLoad.src = imageSource; 15090 15091 }); 15092 15093 } 15094 15095 if (_.options.centerMode === true) { 15096 if (_.options.infinite === true) { 15097 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 15098 rangeEnd = rangeStart + _.options.slidesToShow + 2; 15099 } else { 15100 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 15101 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 15102 } 15103 } else { 15104 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 15105 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 15106 if (_.options.fade === true) { 15107 if (rangeStart > 0) rangeStart--; 15108 if (rangeEnd <= _.slideCount) rangeEnd++; 15109 } 15110 } 15111 15112 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 15113 15114 if (_.options.lazyLoad === 'anticipated') { 15115 var prevSlide = rangeStart - 1, 15116 nextSlide = rangeEnd, 15117 $slides = _.$slider.find('.slick-slide'); 15118 15119 for (var i = 0; i < _.options.slidesToScroll; i++) { 15120 if (prevSlide < 0) prevSlide = _.slideCount - 1; 15121 loadRange = loadRange.add($slides.eq(prevSlide)); 15122 loadRange = loadRange.add($slides.eq(nextSlide)); 15123 prevSlide--; 15124 nextSlide++; 15125 } 15126 } 15127 15128 loadImages(loadRange); 15129 15130 if (_.slideCount <= _.options.slidesToShow) { 15131 cloneRange = _.$slider.find('.slick-slide'); 15132 loadImages(cloneRange); 15133 } else 15134 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 15135 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 15136 loadImages(cloneRange); 15137 } else if (_.currentSlide === 0) { 15138 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 15139 loadImages(cloneRange); 15140 } 15141 15142 }; 15143 15144 Slick.prototype.loadSlider = function() { 15145 15146 var _ = this; 15147 15148 _.setPosition(); 15149 15150 _.$slideTrack.css({ 15151 opacity: 1 15152 }); 15153 15154 _.$slider.removeClass('slick-loading'); 15155 15156 _.initUI(); 15157 15158 if (_.options.lazyLoad === 'progressive') { 15159 _.progressiveLazyLoad(); 15160 } 15161 15162 }; 15163 15164 Slick.prototype.next = Slick.prototype.slickNext = function() { 15165 15166 var _ = this; 15167 15168 _.changeSlide({ 15169 data: { 15170 message: 'next' 15171 } 15172 }); 15173 15174 }; 15175 15176 Slick.prototype.orientationChange = function() { 15177 15178 var _ = this; 15179 15180 _.checkResponsive(); 15181 _.setPosition(); 15182 15183 }; 15184 15185 Slick.prototype.pause = Slick.prototype.slickPause = function() { 15186 15187 var _ = this; 15188 15189 _.autoPlayClear(); 15190 _.paused = true; 15191 15192 }; 15193 15194 Slick.prototype.play = Slick.prototype.slickPlay = function() { 15195 15196 var _ = this; 15197 15198 _.autoPlay(); 15199 _.options.autoplay = true; 15200 _.paused = false; 15201 _.focussed = false; 15202 _.interrupted = false; 15203 15204 }; 15205 15206 Slick.prototype.postSlide = function(index) { 15207 15208 var _ = this; 15209 15210 if( !_.unslicked ) { 15211 15212 _.$slider.trigger('afterChange', [_, index]); 15213 15214 _.animating = false; 15215 15216 if (_.slideCount > _.options.slidesToShow) { 15217 _.setPosition(); 15218 } 15219 15220 _.swipeLeft = null; 15221 15222 if ( _.options.autoplay ) { 15223 _.autoPlay(); 15224 } 15225 15226 if (_.options.accessibility === true) { 15227 _.initADA(); 15228 15229 if (_.options.focusOnChange) { 15230 var $currentSlide = $(_.$slides.get(_.currentSlide)); 15231 $currentSlide.attr('tabindex', 0).focus(); 15232 } 15233 } 15234 15235 } 15236 15237 }; 15238 15239 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 15240 15241 var _ = this; 15242 15243 _.changeSlide({ 15244 data: { 15245 message: 'previous' 15246 } 15247 }); 15248 15249 }; 15250 15251 Slick.prototype.preventDefault = function(event) { 15252 15253 event.preventDefault(); 15254 15255 }; 15256 15257 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 15258 15259 tryCount = tryCount || 1; 15260 15261 var _ = this, 15262 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 15263 image, 15264 imageSource, 15265 imageSrcSet, 15266 imageSizes, 15267 imageToLoad; 15268 15269 if ( $imgsToLoad.length ) { 15270 15271 image = $imgsToLoad.first(); 15272 imageSource = image.attr('data-lazy'); 15273 imageSrcSet = image.attr('data-srcset'); 15274 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 15275 imageToLoad = document.createElement('img'); 15276 15277 imageToLoad.onload = function() { 15278 15279 if (imageSrcSet) { 15280 image 15281 .attr('srcset', imageSrcSet ); 15282 15283 if (imageSizes) { 15284 image 15285 .attr('sizes', imageSizes ); 15286 } 15287 } 15288 15289 image 15290 .attr( 'src', imageSource ) 15291 .removeAttr('data-lazy data-srcset data-sizes') 15292 .removeClass('slick-loading'); 15293 15294 if ( _.options.adaptiveHeight === true ) { 15295 _.setPosition(); 15296 } 15297 15298 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 15299 _.progressiveLazyLoad(); 15300 15301 }; 15302 15303 imageToLoad.onerror = function() { 15304 15305 if ( tryCount < 3 ) { 15306 15307 /** 15308 * try to load the image 3 times, 15309 * leave a slight delay so we don't get 15310 * servers blocking the request. 15311 */ 15312 setTimeout( function() { 15313 _.progressiveLazyLoad( tryCount + 1 ); 15314 }, 500 ); 15315 15316 } else { 15317 15318 image 15319 .removeAttr( 'data-lazy' ) 15320 .removeClass( 'slick-loading' ) 15321 .addClass( 'slick-lazyload-error' ); 15322 15323 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 15324 15325 _.progressiveLazyLoad(); 15326 15327 } 15328 15329 }; 15330 15331 imageToLoad.src = imageSource; 15332 15333 } else { 15334 15335 _.$slider.trigger('allImagesLoaded', [ _ ]); 15336 15337 } 15338 15339 }; 15340 15341 Slick.prototype.refresh = function( initializing ) { 15342 15343 var _ = this, currentSlide, lastVisibleIndex; 15344 15345 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 15346 15347 // in non-infinite sliders, we don't want to go past the 15348 // last visible index. 15349 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 15350 _.currentSlide = lastVisibleIndex; 15351 } 15352 15353 // if less slides than to show, go to start. 15354 if ( _.slideCount <= _.options.slidesToShow ) { 15355 _.currentSlide = 0; 15356 15357 } 15358 15359 currentSlide = _.currentSlide; 15360 15361 _.destroy(true); 15362 15363 $.extend(_, _.initials, { currentSlide: currentSlide }); 15364 15365 _.init(); 15366 15367 if( !initializing ) { 15368 15369 _.changeSlide({ 15370 data: { 15371 message: 'index', 15372 index: currentSlide 15373 } 15374 }, false); 15375 15376 } 15377 15378 }; 15379 15380 Slick.prototype.registerBreakpoints = function() { 15381 15382 var _ = this, breakpoint, currentBreakpoint, l, 15383 responsiveSettings = _.options.responsive || null; 15384 15385 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 15386 15387 _.respondTo = _.options.respondTo || 'window'; 15388 15389 for ( breakpoint in responsiveSettings ) { 15390 15391 l = _.breakpoints.length-1; 15392 15393 if (responsiveSettings.hasOwnProperty(breakpoint)) { 15394 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 15395 15396 // loop through the breakpoints and cut out any existing 15397 // ones with the same breakpoint number, we don't want dupes. 15398 while( l >= 0 ) { 15399 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 15400 _.breakpoints.splice(l,1); 15401 } 15402 l--; 15403 } 15404 15405 _.breakpoints.push(currentBreakpoint); 15406 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 15407 15408 } 15409 15410 } 15411 15412 _.breakpoints.sort(function(a, b) { 15413 return ( _.options.mobileFirst ) ? a-b : b-a; 15414 }); 15415 15416 } 15417 15418 }; 15419 15420 Slick.prototype.reinit = function() { 15421 15422 var _ = this; 15423 15424 _.$slides = 15425 _.$slideTrack 15426 .children(_.options.slide) 15427 .addClass('slick-slide'); 15428 15429 _.slideCount = _.$slides.length; 15430 15431 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 15432 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 15433 } 15434 15435 if (_.slideCount <= _.options.slidesToShow) { 15436 _.currentSlide = 0; 15437 } 15438 15439 _.registerBreakpoints(); 15440 15441 _.setProps(); 15442 _.setupInfinite(); 15443 _.buildArrows(); 15444 _.updateArrows(); 15445 _.initArrowEvents(); 15446 _.buildDots(); 15447 _.updateDots(); 15448 _.initDotEvents(); 15449 _.cleanUpSlideEvents(); 15450 _.initSlideEvents(); 15451 15452 _.checkResponsive(false, true); 15453 15454 if (_.options.focusOnSelect === true) { 15455 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 15456 } 15457 15458 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 15459 15460 _.setPosition(); 15461 _.focusHandler(); 15462 15463 _.paused = !_.options.autoplay; 15464 _.autoPlay(); 15465 15466 _.$slider.trigger('reInit', [_]); 15467 15468 }; 15469 15470 Slick.prototype.resize = function() { 15471 15472 var _ = this; 15473 15474 if ($(window).width() !== _.windowWidth) { 15475 clearTimeout(_.windowDelay); 15476 _.windowDelay = window.setTimeout(function() { 15477 _.windowWidth = $(window).width(); 15478 _.checkResponsive(); 15479 if( !_.unslicked ) { _.setPosition(); } 15480 }, 50); 15481 } 15482 }; 15483 15484 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 15485 15486 var _ = this; 15487 15488 if (typeof(index) === 'boolean') { 15489 removeBefore = index; 15490 index = removeBefore === true ? 0 : _.slideCount - 1; 15491 } else { 15492 index = removeBefore === true ? --index : index; 15493 } 15494 15495 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 15496 return false; 15497 } 15498 15499 _.unload(); 15500 15501 if (removeAll === true) { 15502 _.$slideTrack.children().remove(); 15503 } else { 15504 _.$slideTrack.children(this.options.slide).eq(index).remove(); 15505 } 15506 15507 _.$slides = _.$slideTrack.children(this.options.slide); 15508 15509 _.$slideTrack.children(this.options.slide).detach(); 15510 15511 _.$slideTrack.append(_.$slides); 15512 15513 _.$slidesCache = _.$slides; 15514 15515 _.reinit(); 15516 15517 }; 15518 15519 Slick.prototype.setCSS = function(position) { 15520 15521 var _ = this, 15522 positionProps = {}, 15523 x, y; 15524 15525 if (_.options.rtl === true) { 15526 position = -position; 15527 } 15528 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 15529 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 15530 15531 positionProps[_.positionProp] = position; 15532 15533 if (_.transformsEnabled === false) { 15534 _.$slideTrack.css(positionProps); 15535 } else { 15536 positionProps = {}; 15537 if (_.cssTransitions === false) { 15538 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 15539 _.$slideTrack.css(positionProps); 15540 } else { 15541 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 15542 _.$slideTrack.css(positionProps); 15543 } 15544 } 15545 15546 }; 15547 15548 Slick.prototype.setDimensions = function() { 15549 15550 var _ = this; 15551 15552 if (_.options.vertical === false) { 15553 if (_.options.centerMode === true) { 15554 _.$list.css({ 15555 padding: ('0px ' + _.options.centerPadding) 15556 }); 15557 } 15558 } else { 15559 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 15560 if (_.options.centerMode === true) { 15561 _.$list.css({ 15562 padding: (_.options.centerPadding + ' 0px') 15563 }); 15564 } 15565 } 15566 15567 _.listWidth = _.$list.width(); 15568 _.listHeight = _.$list.height(); 15569 15570 15571 if (_.options.vertical === false && _.options.variableWidth === false) { 15572 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 15573 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 15574 15575 } else if (_.options.variableWidth === true) { 15576 _.$slideTrack.width(5000 * _.slideCount); 15577 } else { 15578 _.slideWidth = Math.ceil(_.listWidth); 15579 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 15580 } 15581 15582 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 15583 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 15584 15585 }; 15586 15587 Slick.prototype.setFade = function() { 15588 15589 var _ = this, 15590 targetLeft; 15591 15592 _.$slides.each(function(index, element) { 15593 targetLeft = (_.slideWidth * index) * -1; 15594 if (_.options.rtl === true) { 15595 $(element).css({ 15596 position: 'relative', 15597 right: targetLeft, 15598 top: 0, 15599 zIndex: _.options.zIndex - 2, 15600 opacity: 0 15601 }); 15602 } else { 15603 $(element).css({ 15604 position: 'relative', 15605 left: targetLeft, 15606 top: 0, 15607 zIndex: _.options.zIndex - 2, 15608 opacity: 0 15609 }); 15610 } 15611 }); 15612 15613 _.$slides.eq(_.currentSlide).css({ 15614 zIndex: _.options.zIndex - 1, 15615 opacity: 1 15616 }); 15617 15618 }; 15619 15620 Slick.prototype.setHeight = function() { 15621 15622 var _ = this; 15623 15624 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 15625 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 15626 _.$list.css('height', targetHeight); 15627 } 15628 15629 }; 15630 15631 Slick.prototype.setOption = 15632 Slick.prototype.slickSetOption = function() { 15633 15634 /** 15635 * accepts arguments in format of: 15636 * 15637 * - for changing a single option's value: 15638 * .slick("setOption", option, value, refresh ) 15639 * 15640 * - for changing a set of responsive options: 15641 * .slick("setOption", 'responsive', [{}, ...], refresh ) 15642 * 15643 * - for updating multiple values at once (not responsive) 15644 * .slick("setOption", { 'option': value, ... }, refresh ) 15645 */ 15646 15647 var _ = this, l, item, option, value, refresh = false, type; 15648 15649 if( $.type( arguments[0] ) === 'object' ) { 15650 15651 option = arguments[0]; 15652 refresh = arguments[1]; 15653 type = 'multiple'; 15654 15655 } else if ( $.type( arguments[0] ) === 'string' ) { 15656 15657 option = arguments[0]; 15658 value = arguments[1]; 15659 refresh = arguments[2]; 15660 15661 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 15662 15663 type = 'responsive'; 15664 15665 } else if ( typeof arguments[1] !== 'undefined' ) { 15666 15667 type = 'single'; 15668 15669 } 15670 15671 } 15672 15673 if ( type === 'single' ) { 15674 15675 _.options[option] = value; 15676 15677 15678 } else if ( type === 'multiple' ) { 15679 15680 $.each( option , function( opt, val ) { 15681 15682 _.options[opt] = val; 15683 15684 }); 15685 15686 15687 } else if ( type === 'responsive' ) { 15688 15689 for ( item in value ) { 15690 15691 if( $.type( _.options.responsive ) !== 'array' ) { 15692 15693 _.options.responsive = [ value[item] ]; 15694 15695 } else { 15696 15697 l = _.options.responsive.length-1; 15698 15699 // loop through the responsive object and splice out duplicates. 15700 while( l >= 0 ) { 15701 15702 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 15703 15704 _.options.responsive.splice(l,1); 15705 15706 } 15707 15708 l--; 15709 15710 } 15711 15712 _.options.responsive.push( value[item] ); 15713 15714 } 15715 15716 } 15717 15718 } 15719 15720 if ( refresh ) { 15721 15722 _.unload(); 15723 _.reinit(); 15724 15725 } 15726 15727 }; 15728 15729 Slick.prototype.setPosition = function() { 15730 15731 var _ = this; 15732 15733 _.setDimensions(); 15734 15735 _.setHeight(); 15736 15737 if (_.options.fade === false) { 15738 _.setCSS(_.getLeft(_.currentSlide)); 15739 } else { 15740 _.setFade(); 15741 } 15742 15743 _.$slider.trigger('setPosition', [_]); 15744 15745 }; 15746 15747 Slick.prototype.setProps = function() { 15748 15749 var _ = this, 15750 bodyStyle = document.body.style; 15751 15752 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 15753 15754 if (_.positionProp === 'top') { 15755 _.$slider.addClass('slick-vertical'); 15756 } else { 15757 _.$slider.removeClass('slick-vertical'); 15758 } 15759 15760 if (bodyStyle.WebkitTransition !== undefined || 15761 bodyStyle.MozTransition !== undefined || 15762 bodyStyle.msTransition !== undefined) { 15763 if (_.options.useCSS === true) { 15764 _.cssTransitions = true; 15765 } 15766 } 15767 15768 if ( _.options.fade ) { 15769 if ( typeof _.options.zIndex === 'number' ) { 15770 if( _.options.zIndex < 3 ) { 15771 _.options.zIndex = 3; 15772 } 15773 } else { 15774 _.options.zIndex = _.defaults.zIndex; 15775 } 15776 } 15777 15778 if (bodyStyle.OTransform !== undefined) { 15779 _.animType = 'OTransform'; 15780 _.transformType = '-o-transform'; 15781 _.transitionType = 'OTransition'; 15782 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 15783 } 15784 if (bodyStyle.MozTransform !== undefined) { 15785 _.animType = 'MozTransform'; 15786 _.transformType = '-moz-transform'; 15787 _.transitionType = 'MozTransition'; 15788 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 15789 } 15790 if (bodyStyle.webkitTransform !== undefined) { 15791 _.animType = 'webkitTransform'; 15792 _.transformType = '-webkit-transform'; 15793 _.transitionType = 'webkitTransition'; 15794 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 15795 } 15796 if (bodyStyle.msTransform !== undefined) { 15797 _.animType = 'msTransform'; 15798 _.transformType = '-ms-transform'; 15799 _.transitionType = 'msTransition'; 15800 if (bodyStyle.msTransform === undefined) _.animType = false; 15801 } 15802 if (bodyStyle.transform !== undefined && _.animType !== false) { 15803 _.animType = 'transform'; 15804 _.transformType = 'transform'; 15805 _.transitionType = 'transition'; 15806 } 15807 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 15808 }; 15809 15810 15811 Slick.prototype.setSlideClasses = function(index) { 15812 15813 var _ = this, 15814 centerOffset, allSlides, indexOffset, remainder; 15815 15816 allSlides = _.$slider 15817 .find('.slick-slide') 15818 .removeClass('slick-active slick-center slick-current') 15819 .attr('aria-hidden', 'true'); 15820 15821 _.$slides 15822 .eq(index) 15823 .addClass('slick-current'); 15824 15825 if (_.options.centerMode === true) { 15826 15827 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 15828 15829 centerOffset = Math.floor(_.options.slidesToShow / 2); 15830 15831 if (_.options.infinite === true) { 15832 15833 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 15834 _.$slides 15835 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 15836 .addClass('slick-active') 15837 .attr('aria-hidden', 'false'); 15838 15839 } else { 15840 15841 indexOffset = _.options.slidesToShow + index; 15842 allSlides 15843 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 15844 .addClass('slick-active') 15845 .attr('aria-hidden', 'false'); 15846 15847 } 15848 15849 if (index === 0) { 15850 15851 allSlides 15852 .eq(allSlides.length - 1 - _.options.slidesToShow) 15853 .addClass('slick-center'); 15854 15855 } else if (index === _.slideCount - 1) { 15856 15857 allSlides 15858 .eq(_.options.slidesToShow) 15859 .addClass('slick-center'); 15860 15861 } 15862 15863 } 15864 15865 _.$slides 15866 .eq(index) 15867 .addClass('slick-center'); 15868 15869 } else { 15870 15871 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 15872 15873 _.$slides 15874 .slice(index, index + _.options.slidesToShow) 15875 .addClass('slick-active') 15876 .attr('aria-hidden', 'false'); 15877 15878 } else if (allSlides.length <= _.options.slidesToShow) { 15879 15880 allSlides 15881 .addClass('slick-active') 15882 .attr('aria-hidden', 'false'); 15883 15884 } else { 15885 15886 remainder = _.slideCount % _.options.slidesToShow; 15887 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 15888 15889 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 15890 15891 allSlides 15892 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 15893 .addClass('slick-active') 15894 .attr('aria-hidden', 'false'); 15895 15896 } else { 15897 15898 allSlides 15899 .slice(indexOffset, indexOffset + _.options.slidesToShow) 15900 .addClass('slick-active') 15901 .attr('aria-hidden', 'false'); 15902 15903 } 15904 15905 } 15906 15907 } 15908 15909 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 15910 _.lazyLoad(); 15911 } 15912 }; 15913 15914 Slick.prototype.setupInfinite = function() { 15915 15916 var _ = this, 15917 i, slideIndex, infiniteCount; 15918 15919 if (_.options.fade === true) { 15920 _.options.centerMode = false; 15921 } 15922 15923 if (_.options.infinite === true && _.options.fade === false) { 15924 15925 slideIndex = null; 15926 15927 if (_.slideCount > _.options.slidesToShow) { 15928 15929 if (_.options.centerMode === true) { 15930 infiniteCount = _.options.slidesToShow + 1; 15931 } else { 15932 infiniteCount = _.options.slidesToShow; 15933 } 15934 15935 for (i = _.slideCount; i > (_.slideCount - 15936 infiniteCount); i -= 1) { 15937 slideIndex = i - 1; 15938 $(_.$slides[slideIndex]).clone(true).attr('id', '') 15939 .attr('data-slick-index', slideIndex - _.slideCount) 15940 .prependTo(_.$slideTrack).addClass('slick-cloned'); 15941 } 15942 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 15943 slideIndex = i; 15944 $(_.$slides[slideIndex]).clone(true).attr('id', '') 15945 .attr('data-slick-index', slideIndex + _.slideCount) 15946 .appendTo(_.$slideTrack).addClass('slick-cloned'); 15947 } 15948 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 15949 $(this).attr('id', ''); 15950 }); 15951 15952 } 15953 15954 } 15955 15956 }; 15957 15958 Slick.prototype.interrupt = function( toggle ) { 15959 15960 var _ = this; 15961 15962 if( !toggle ) { 15963 _.autoPlay(); 15964 } 15965 _.interrupted = toggle; 15966 15967 }; 15968 15969 Slick.prototype.selectHandler = function(event) { 15970 15971 var _ = this; 15972 15973 var targetElement = 15974 $(event.target).is('.slick-slide') ? 15975 $(event.target) : 15976 $(event.target).parents('.slick-slide'); 15977 15978 var index = parseInt(targetElement.attr('data-slick-index')); 15979 15980 if (!index) index = 0; 15981 15982 if (_.slideCount <= _.options.slidesToShow) { 15983 15984 _.slideHandler(index, false, true); 15985 return; 15986 15987 } 15988 15989 _.slideHandler(index); 15990 15991 }; 15992 15993 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 15994 15995 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 15996 _ = this, navTarget; 15997 15998 sync = sync || false; 15999 16000 if (_.animating === true && _.options.waitForAnimate === true) { 16001 return; 16002 } 16003 16004 if (_.options.fade === true && _.currentSlide === index) { 16005 return; 16006 } 16007 16008 if (sync === false) { 16009 _.asNavFor(index); 16010 } 16011 16012 targetSlide = index; 16013 targetLeft = _.getLeft(targetSlide); 16014 slideLeft = _.getLeft(_.currentSlide); 16015 16016 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 16017 16018 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 16019 if (_.options.fade === false) { 16020 targetSlide = _.currentSlide; 16021 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 16022 _.animateSlide(slideLeft, function() { 16023 _.postSlide(targetSlide); 16024 }); 16025 } else { 16026 _.postSlide(targetSlide); 16027 } 16028 } 16029 return; 16030 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 16031 if (_.options.fade === false) { 16032 targetSlide = _.currentSlide; 16033 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 16034 _.animateSlide(slideLeft, function() { 16035 _.postSlide(targetSlide); 16036 }); 16037 } else { 16038 _.postSlide(targetSlide); 16039 } 16040 } 16041 return; 16042 } 16043 16044 if ( _.options.autoplay ) { 16045 clearInterval(_.autoPlayTimer); 16046 } 16047 16048 if (targetSlide < 0) { 16049 if (_.slideCount % _.options.slidesToScroll !== 0) { 16050 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 16051 } else { 16052 animSlide = _.slideCount + targetSlide; 16053 } 16054 } else if (targetSlide >= _.slideCount) { 16055 if (_.slideCount % _.options.slidesToScroll !== 0) { 16056 animSlide = 0; 16057 } else { 16058 animSlide = targetSlide - _.slideCount; 16059 } 16060 } else { 16061 animSlide = targetSlide; 16062 } 16063 16064 _.animating = true; 16065 16066 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 16067 16068 oldSlide = _.currentSlide; 16069 _.currentSlide = animSlide; 16070 16071 _.setSlideClasses(_.currentSlide); 16072 16073 if ( _.options.asNavFor ) { 16074 16075 navTarget = _.getNavTarget(); 16076 navTarget = navTarget.slick('getSlick'); 16077 16078 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 16079 navTarget.setSlideClasses(_.currentSlide); 16080 } 16081 16082 } 16083 16084 _.updateDots(); 16085 _.updateArrows(); 16086 16087 if (_.options.fade === true) { 16088 if (dontAnimate !== true) { 16089 16090 _.fadeSlideOut(oldSlide); 16091 16092 _.fadeSlide(animSlide, function() { 16093 _.postSlide(animSlide); 16094 }); 16095 16096 } else { 16097 _.postSlide(animSlide); 16098 } 16099 _.animateHeight(); 16100 return; 16101 } 16102 16103 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 16104 _.animateSlide(targetLeft, function() { 16105 _.postSlide(animSlide); 16106 }); 16107 } else { 16108 _.postSlide(animSlide); 16109 } 16110 16111 }; 16112 16113 Slick.prototype.startLoad = function() { 16114 16115 var _ = this; 16116 16117 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 16118 16119 _.$prevArrow.hide(); 16120 _.$nextArrow.hide(); 16121 16122 } 16123 16124 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 16125 16126 _.$dots.hide(); 16127 16128 } 16129 16130 _.$slider.addClass('slick-loading'); 16131 16132 }; 16133 16134 Slick.prototype.swipeDirection = function() { 16135 16136 var xDist, yDist, r, swipeAngle, _ = this; 16137 16138 xDist = _.touchObject.startX - _.touchObject.curX; 16139 yDist = _.touchObject.startY - _.touchObject.curY; 16140 r = Math.atan2(yDist, xDist); 16141 16142 swipeAngle = Math.round(r * 180 / Math.PI); 16143 if (swipeAngle < 0) { 16144 swipeAngle = 360 - Math.abs(swipeAngle); 16145 } 16146 16147 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 16148 return (_.options.rtl === false ? 'left' : 'right'); 16149 } 16150 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 16151 return (_.options.rtl === false ? 'left' : 'right'); 16152 } 16153 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 16154 return (_.options.rtl === false ? 'right' : 'left'); 16155 } 16156 if (_.options.verticalSwiping === true) { 16157 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 16158 return 'down'; 16159 } else { 16160 return 'up'; 16161 } 16162 } 16163 16164 return 'vertical'; 16165 16166 }; 16167 16168 Slick.prototype.swipeEnd = function(event) { 16169 16170 var _ = this, 16171 slideCount, 16172 direction; 16173 16174 _.dragging = false; 16175 _.swiping = false; 16176 16177 if (_.scrolling) { 16178 _.scrolling = false; 16179 return false; 16180 } 16181 16182 _.interrupted = false; 16183 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 16184 16185 if ( _.touchObject.curX === undefined ) { 16186 return false; 16187 } 16188 16189 if ( _.touchObject.edgeHit === true ) { 16190 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 16191 } 16192 16193 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 16194 16195 direction = _.swipeDirection(); 16196 16197 switch ( direction ) { 16198 16199 case 'left': 16200 case 'down': 16201 16202 slideCount = 16203 _.options.swipeToSlide ? 16204 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 16205 _.currentSlide + _.getSlideCount(); 16206 16207 _.currentDirection = 0; 16208 16209 break; 16210 16211 case 'right': 16212 case 'up': 16213 16214 slideCount = 16215 _.options.swipeToSlide ? 16216 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 16217 _.currentSlide - _.getSlideCount(); 16218 16219 _.currentDirection = 1; 16220 16221 break; 16222
vendor: 8,456 bytes, lines 16223-16532
16223 default: 16224 16225 16226 } 16227 16228 if( direction != 'vertical' ) { 16229 16230 _.slideHandler( slideCount ); 16231 _.touchObject = {}; 16232 _.$slider.trigger('swipe', [_, direction ]); 16233 16234 } 16235 16236 } else { 16237 16238 if ( _.touchObject.startX !== _.touchObject.curX ) { 16239 16240 _.slideHandler( _.currentSlide ); 16241 _.touchObject = {}; 16242 16243 } 16244 16245 } 16246 16247 }; 16248 16249 Slick.prototype.swipeHandler = function(event) { 16250 16251 var _ = this; 16252 16253 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 16254 return; 16255 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 16256 return; 16257 } 16258 16259 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 16260 event.originalEvent.touches.length : 1; 16261 16262 _.touchObject.minSwipe = _.listWidth / _.options 16263 .touchThreshold; 16264 16265 if (_.options.verticalSwiping === true) { 16266 _.touchObject.minSwipe = _.listHeight / _.options 16267 .touchThreshold; 16268 } 16269 16270 switch (event.data.action) { 16271 16272 case 'start': 16273 _.swipeStart(event); 16274 break; 16275 16276 case 'move': 16277 _.swipeMove(event); 16278 break; 16279 16280 case 'end': 16281 _.swipeEnd(event); 16282 break; 16283 16284 } 16285 16286 }; 16287 16288 Slick.prototype.swipeMove = function(event) { 16289 16290 var _ = this, 16291 edgeWasHit = false, 16292 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 16293 16294 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 16295 16296 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 16297 return false; 16298 } 16299 16300 curLeft = _.getLeft(_.currentSlide); 16301 16302 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 16303 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 16304 16305 _.touchObject.swipeLength = Math.round(Math.sqrt( 16306 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 16307 16308 verticalSwipeLength = Math.round(Math.sqrt( 16309 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 16310 16311 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 16312 _.scrolling = true; 16313 return false; 16314 } 16315 16316 if (_.options.verticalSwiping === true) { 16317 _.touchObject.swipeLength = verticalSwipeLength; 16318 } 16319 16320 swipeDirection = _.swipeDirection(); 16321 16322 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 16323 _.swiping = true; 16324 event.preventDefault(); 16325 } 16326 16327 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 16328 if (_.options.verticalSwiping === true) { 16329 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 16330 } 16331 16332 16333 swipeLength = _.touchObject.swipeLength; 16334 16335 _.touchObject.edgeHit = false; 16336 16337 if (_.options.infinite === false) { 16338 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 16339 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 16340 _.touchObject.edgeHit = true; 16341 } 16342 } 16343 16344 if (_.options.vertical === false) { 16345 _.swipeLeft = curLeft + swipeLength * positionOffset; 16346 } else { 16347 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 16348 } 16349 if (_.options.verticalSwiping === true) { 16350 _.swipeLeft = curLeft + swipeLength * positionOffset; 16351 } 16352 16353 if (_.options.fade === true || _.options.touchMove === false) { 16354 return false; 16355 } 16356 16357 if (_.animating === true) { 16358 _.swipeLeft = null; 16359 return false; 16360 } 16361 16362 _.setCSS(_.swipeLeft); 16363 16364 }; 16365 16366 Slick.prototype.swipeStart = function(event) { 16367 16368 var _ = this, 16369 touches; 16370 16371 _.interrupted = true; 16372 16373 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 16374 _.touchObject = {}; 16375 return false; 16376 } 16377 16378 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 16379 touches = event.originalEvent.touches[0]; 16380 } 16381 16382 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 16383 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 16384 16385 _.dragging = true; 16386 16387 }; 16388 16389 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 16390 16391 var _ = this; 16392 16393 if (_.$slidesCache !== null) { 16394 16395 _.unload(); 16396 16397 _.$slideTrack.children(this.options.slide).detach(); 16398 16399 _.$slidesCache.appendTo(_.$slideTrack); 16400 16401 _.reinit(); 16402 16403 } 16404 16405 }; 16406 16407 Slick.prototype.unload = function() { 16408 16409 var _ = this; 16410 16411 $('.slick-cloned', _.$slider).remove(); 16412 16413 if (_.$dots) { 16414 _.$dots.remove(); 16415 } 16416 16417 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 16418 _.$prevArrow.remove(); 16419 } 16420 16421 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 16422 _.$nextArrow.remove(); 16423 } 16424 16425 _.$slides 16426 .removeClass('slick-slide slick-active slick-visible slick-current') 16427 .attr('aria-hidden', 'true') 16428 .css('width', ''); 16429 16430 }; 16431 16432 Slick.prototype.unslick = function(fromBreakpoint) { 16433 16434 var _ = this; 16435 _.$slider.trigger('unslick', [_, fromBreakpoint]); 16436 _.destroy(); 16437 16438 }; 16439 16440 Slick.prototype.updateArrows = function() { 16441 16442 var _ = this, 16443 centerOffset; 16444 16445 centerOffset = Math.floor(_.options.slidesToShow / 2); 16446 16447 if ( _.options.arrows === true && 16448 _.slideCount > _.options.slidesToShow && 16449 !_.options.infinite ) { 16450 16451 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 16452 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 16453 16454 if (_.currentSlide === 0) { 16455 16456 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 16457 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 16458 16459 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 16460 16461 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 16462 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 16463 16464 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 16465 16466 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 16467 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 16468 16469 } 16470 16471 } 16472 16473 }; 16474 16475 Slick.prototype.updateDots = function() { 16476 16477 var _ = this; 16478 16479 if (_.$dots !== null) { 16480 16481 _.$dots 16482 .find('li') 16483 .removeClass('slick-active') 16484 .end(); 16485 16486 _.$dots 16487 .find('li') 16488 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 16489 .addClass('slick-active'); 16490 16491 } 16492 16493 }; 16494 16495 Slick.prototype.visibility = function() { 16496 16497 var _ = this; 16498 16499 if ( _.options.autoplay ) { 16500 16501 if ( document[_.hidden] ) { 16502 16503 _.interrupted = true; 16504 16505 } else { 16506 16507 _.interrupted = false; 16508 16509 } 16510 16511 } 16512 16513 }; 16514 16515 $.fn.slick = function() { 16516 var _ = this, 16517 opt = arguments[0], 16518 args = Array.prototype.slice.call(arguments, 1), 16519 l = _.length, 16520 i, 16521 ret; 16522 for (i = 0; i < l; i++) { 16523 if (typeof opt == 'object' || typeof opt == 'undefined') 16524 _[i].slick = new Slick(_[i], opt); 16525 else 16526 ret = _[i].slick[opt].apply(_[i].slick, args); 16527 if (typeof ret != 'undefined') return ret; 16528 } 16529 return _; 16530 }; 16531 16532}));
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.