vendor: 4,096 bytes, lines 1-3
1/*! lazysizes - v5.3.1 */ 2 3!function(e){var t=function(u,D,f){"use strict";var k,H;if(function(){var e;var t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:true,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:true,ricTimeout:0,throttleDelay:125};H=u.lazySizesConfig||u.lazysizesConfig||{};for(e in t){if(!(e in H)){H[e]=t[e]}}}(),!D||!D.getElementsByClassName){return{init:function(){},cfg:H,noSupport:true}}var O=D.documentElement,i=u.HTMLPictureElement,P="addEventListener",$="getAttribute",q=u[P].bind(u),I=u.setTimeout,U=u.requestAnimationFrame||I,o=u.requestIdleCallback,j=/^picture$/i,r=["load","error","lazyincluded","_lazyloaded"],a={},G=Array.prototype.forEach,J=function(e,t){if(!a[t]){a[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")}return a[t].test(e[$]("class")||"")&&a[t]},K=function(e,t){if(!J(e,t)){e.setAttribute("class",(e[$]("class")||"").trim()+" "+t)}},Q=function(e,t){var a;if(a=J(e,t)){e.setAttribute("class",(e[$]("class")||"").replace(a," "))}},V=function(t,a,e){var i=e?P:"removeEventListener";if(e){V(t,a)}r.forEach(function(e){t[i](e,a)})},X=function(e,t,a,i,r){var n=D.createEvent("Event");if(!a){a={}}a.instance=k;n.initEvent(t,!i,!r);n.detail=a;e.dispatchEvent(n);return n},Y=function(e,t){var a;if(!i&&(a=u.picturefill||H.pf)){if(t&&t.src&&!e[$]("srcset")){e.setAttribute("srcset",t.src)}a({reevaluate:true,elements:[e]})}else if(t&&t.src){e.src=t.src}},Z=function(e,t){return(getComputedStyle(e,null)||{})[t]},s=function(e,t,a){a=a||e.offsetWidth;while(a<H.minSize&&t&&!e._lazysizesWidth){a=t.offsetWidth;t=t.parentNode}return a},ee=function(){var a,i;var t=[];var r=[];var n=t;var s=function(){var e=n;n=t.length?r:t;a=true;i=false;while(e.length){e.shift()()}a=false};var e=function(e,t){if(a&&!t){e.apply(this,arguments)}else{n.push(e);if(!i){i=true;(D.hidden?I:U)(s)}}};e._lsFlush=s;return e}(),te=function(a,e){return e?function(){ee(a)}:function(){var e=this;var t=arguments;ee(function(){a.apply(e,t)})}},ae=function(e){var a;var i=0;var r=H.throttleDelay;var n=H.ricTimeout;var t=function(){a=false;i=f.now();e()};var s=o&&n>49?function(){o(t,{timeout:n});if(n!==H.ricTimeout){n=H.ricTimeout}}:te(function(){I(t)},true);return function(e){var t;if(e=e===true){n=33}if(a){return}a=true;t=r-(f.now()-i);if(t<0){t=0}if(e||t<9){s()}else{I(s,t)}}},ie=function(e){var t,a;var i=99;var r=function(){t=null;e()};var n=function(){var e=f.now()-a;if(e<i){I(n,i-e)}else{(o||r)(r)}};return function(){a=f.now();if(!t){t=I(n,i)}}},e=function(){var v,m,c,h,e;var y,z,g,p,C,b,A;var n=/^img$/i;var d=/^iframe$/i;var E="onscroll"in u&&!/(gle|ing)bot/.test(navigator.userAgent);var _=0;var w=0;var M=0;var N=-1;var L=function(e){M--;if(!e||M<0||!e.target){M=0}};var x=function(e){if(A==null){A=Z(D.body,"visibility")=="hidden"}return A||!(Z(e.parentNode,"visibility")=="hidden"&&Z(e,"visibility")=="hidden")};var W=function(e,t){var a;var i=e;var r=x(e);g-=t;b+=t;p-=t;C+=t;while(r&&(i=i.offsetParent)&&i!=D.body&&i!=O){r=(Z(i,"opacity")||1)>0;if(r&&Z(i,"overflow")!="visible"){a=i.getBoundingClientRect();r=C>a.left&&p<a.right&&b>a.top-1&&g<a.bottom+1}}return r};var t=function(){var e,t,a,i,r,n,s,o,l,u,f,c;var d=k.elements;if((h=H.loadMode)&&M<8&&(e=d.length)){t=0;N++;for(;t<e;t++){if(!d[t]||d[t]._lazyRace){continue}if(!E||k.prematureUnveil&&k.prematureUnveil(d[t])){R(d[t]);continue}if(!(o=d[t][$]("data-expand"))||!(n=o*1)){n=w}if(!u){u=!H.expand||H.expand<1?O.clientHeight>500&&O.clientWidth>500?500:370:H.expand;k._defEx=u;f=u*H.expFactor;c=H.hFac;A=null;if(w<f&&M<1&&N>2&&h>2&&!D.hidden){w=f;N=0}else if(h>1&&N>1&&M<6){w=u}else{w=_}}if(l!==n){y=innerWidth+n*c;z=innerHeight+n;s=n*-1;l=n}a=d[t].getBoundingClientRect();if((b=a.bottom)>=s&&(g=a.top)<=z&&(C=a.right)>=s*c&&(p=a.left)<=y&&(b||C||p||g)&&(H.loadHidden||x(d[t]))&&(m&&M<3&&!o&&(h<3||N<4)||W(d[t],n))){R(d[t]);r=true;if(M>9){break}}else if(!r&&m&&!i&&M<4&&N<4&&h>
vendor: 10,247 bytes, lines 3-296
32&&(v[0]||H.preloadAfterLoad)&&(v[0]||!o&&(b||C||p||g||d[t][$](H.sizesAttr)!="auto"))){i=v[0]||d[t]}}if(i&&!r){R(i)}}};var a=ae(t);var S=function(e){var t=e.target;if(t._lazyCache){delete t._lazyCache;return}L(e);K(t,H.loadedClass);Q(t,H.loadingClass);V(t,B);X(t,"lazyloaded")};var i=te(S);var B=function(e){i({target:e.target})};var T=function(e,t){var a=e.getAttribute("data-load-mode")||H.iframeLoadMode;if(a==0){e.contentWindow.location.replace(t)}else if(a==1){e.src=t}};var F=function(e){var t;var a=e[$](H.srcsetAttr);if(t=H.customMedia[e[$]("data-media")||e[$]("media")]){e.setAttribute("media",t)}if(a){e.setAttribute("srcset",a)}};var s=te(function(t,e,a,i,r){var n,s,o,l,u,f;if(!(u=X(t,"lazybeforeunveil",e)).defaultPrevented){if(i){if(a){K(t,H.autosizesClass)}else{t.setAttribute("sizes",i)}}s=t[$](H.srcsetAttr);n=t[$](H.srcAttr);if(r){o=t.parentNode;l=o&&j.test(o.nodeName||"")}f=e.firesLoad||"src"in t&&(s||n||l);u={target:t};K(t,H.loadingClass);if(f){clearTimeout(c);c=I(L,2500);V(t,B,true)}if(l){G.call(o.getElementsByTagName("source"),F)}if(s){t.setAttribute("srcset",s)}else if(n&&!l){if(d.test(t.nodeName)){T(t,n)}else{t.src=n}}if(r&&(s||l)){Y(t,{src:n})}}if(t._lazyRace){delete t._lazyRace}Q(t,H.lazyClass);ee(function(){var e=t.complete&&t.naturalWidth>1;if(!f||e){if(e){K(t,H.fastLoadedClass)}S(u);t._lazyCache=true;I(function(){if("_lazyCache"in t){delete t._lazyCache}},9)}if(t.loading=="lazy"){M--}},true)});var R=function(e){if(e._lazyRace){return}var t;var a=n.test(e.nodeName);var i=a&&(e[$](H.sizesAttr)||e[$]("sizes"));var r=i=="auto";if((r||!m)&&a&&(e[$]("src")||e.srcset)&&!e.complete&&!J(e,H.errorClass)&&J(e,H.lazyClass)){return}t=X(e,"lazyunveilread").detail;if(r){re.updateElem(e,true,e.offsetWidth)}e._lazyRace=true;M++;s(e,t,r,i,a)};var r=ie(function(){H.loadMode=3;a()});var o=function(){if(H.loadMode==3){H.loadMode=2}r()};var l=function(){if(m){return}if(f.now()-e<999){I(l,999);return}m=true;H.loadMode=3;a();q("scroll",o,true)};return{_:function(){e=f.now();k.elements=D.getElementsByClassName(H.lazyClass);v=D.getElementsByClassName(H.lazyClass+" "+H.preloadClass);q("scroll",a,true);q("resize",a,true);q("pageshow",function(e){if(e.persisted){var t=D.querySelectorAll("."+H.loadingClass);if(t.length&&t.forEach){U(function(){t.forEach(function(e){if(e.complete){R(e)}})})}}});if(u.MutationObserver){new MutationObserver(a).observe(O,{childList:true,subtree:true,attributes:true})}else{O[P]("DOMNodeInserted",a,true);O[P]("DOMAttrModified",a,true);setInterval(a,999)}q("hashchange",a,true);["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){D[P](e,a,true)});if(/d$|^c/.test(D.readyState)){l()}else{q("load",l);D[P]("DOMContentLoaded",a);I(l,2e4)}if(k.elements.length){t();ee._lsFlush()}else{a()}},checkElems:a,unveil:R,_aLSL:o}}(),re=function(){var a;var n=te(function(e,t,a,i){var r,n,s;e._lazysizesWidth=i;i+="px";e.setAttribute("sizes",i);if(j.test(t.nodeName||"")){r=t.getElementsByTagName("source");for(n=0,s=r.length;n<s;n++){r[n].setAttribute("sizes",i)}}if(!a.detail.dataAttr){Y(e,a.detail)}});var i=function(e,t,a){var i;var r=e.parentNode;if(r){a=s(e,r,a);i=X(e,"lazybeforesizes",{width:a,dataAttr:!!t});if(!i.defaultPrevented){a=i.detail.width;if(a&&a!==e._lazysizesWidth){n(e,r,i,a)}}}};var e=function(){var e;var t=a.length;if(t){e=0;for(;e<t;e++){i(a[e])}}};var t=ie(e);return{_:function(){a=D.getElementsByClassName(H.autosizesClass);q("resize",t)},checkElems:t,updateElem:i}}(),t=function(){if(!t.i&&D.getElementsByClassName){t.i=true;re._();e._()}};return I(function(){H.init&&t()}),k={cfg:H,autoSizer:re,loader:e,init:t,uP:Y,aC:K,rC:Q,hC:J,fire:X,gW:s,rAF:ee}}(e,e.document,Date);e.lazySizes=t,"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:{}); 4 5/*! 6 * Flickity PACKAGED v2.3.0 7 * Touch, responsive, flickable carousels 8 * 9 * Licensed GPLv3 for open source use 10 * or Flickity Commercial License for commercial use 11 * 12 * https://flickity.metafizzy.co 13 * Copyright 2015-2021 Metafizzy 14 */ 15 16 17 18( function( window, factory ) { 19 if ( typeof define == 'function' && define.amd ) { 20 define( 'jquery-bridget/jquery-bridget',[ 'jquery' ], function( jQuery ) { 21 return factory( window, jQuery ); 22 }); 23 } else if ( typeof module == 'object' && module.exports ) { 24 module.exports = factory( 25 window, 26 require('jquery') 27 ); 28 } else { 29 window.jQueryBridget = factory( 30 window, 31 window.jQuery 32 ); 33 } 34 35}( window, function factory( window, jQuery ) { 36'use strict'; 37 38 39var arraySlice = Array.prototype.slice; 40 41var console = window.console; 42var logError = typeof console == 'undefined' ? function() {} : 43 function( message ) { 44 console.error( message ); 45 }; 46 47 48function jQueryBridget( namespace, PluginClass, $ ) { 49 $ = $ || jQuery || window.jQuery; 50 if ( !$ ) { 51 return; 52 } 53 54 if ( !PluginClass.prototype.option ) { 55 PluginClass.prototype.option = function( opts ) { 56 if ( !$.isPlainObject( opts ) ){ 57 return; 58 } 59 this.options = $.extend( true, this.options, opts ); 60 }; 61 } 62 63 $.fn[ namespace ] = function( arg0 ) { 64 if ( typeof arg0 == 'string' ) { 65 var args = arraySlice.call( arguments, 1 ); 66 return methodCall( this, arg0, args ); 67 } 68 plainCall( this, arg0 ); 69 return this; 70 }; 71 72 function methodCall( $elems, methodName, args ) { 73 var returnValue; 74 var pluginMethodStr = '$().' + namespace + '("' + methodName + '")'; 75 76 $elems.each( function( i, elem ) { 77 var instance = $.data( elem, namespace ); 78 if ( !instance ) { 79 logError( namespace + ' not initialized. Cannot call methods, i.e. ' + 80 pluginMethodStr ); 81 return; 82 } 83 84 var method = instance[ methodName ]; 85 if ( !method || methodName.charAt(0) == '_' ) { 86 logError( pluginMethodStr + ' is not a valid method' ); 87 return; 88 } 89 90 var value = method.apply( instance, args ); 91 returnValue = returnValue === undefined ? value : returnValue; 92 }); 93 94 return returnValue !== undefined ? returnValue : $elems; 95 } 96 97 function plainCall( $elems, options ) { 98 $elems.each( function( i, elem ) { 99 var instance = $.data( elem, namespace ); 100 if ( instance ) { 101 instance.option( options ); 102 instance._init(); 103 } else { 104 instance = new PluginClass( elem, options ); 105 $.data( elem, namespace, instance ); 106 } 107 }); 108 } 109 110 updateJQuery( $ ); 111 112} 113 114 115function updateJQuery( $ ) { 116 if ( !$ || ( $ && $.bridget ) ) { 117 return; 118 } 119 $.bridget = jQueryBridget; 120} 121 122updateJQuery( jQuery || window.jQuery ); 123 124 125return jQueryBridget; 126 127})); 128 129 130 131( function( global, factory ) { 132 if ( typeof define == 'function' && define.amd ) { 133 define( 'ev-emitter/ev-emitter',factory ); 134 } else if ( typeof module == 'object' && module.exports ) { 135 module.exports = factory(); 136 } else { 137 global.EvEmitter = factory(); 138 } 139 140}( typeof window != 'undefined' ? window : this, function() { 141 142 143 144function EvEmitter() {} 145 146var proto = EvEmitter.prototype; 147 148proto.on = function( eventName, listener ) { 149 if ( !eventName || !listener ) { 150 return; 151 } 152 var events = this._events = this._events || {}; 153 var listeners = events[ eventName ] = events[ eventName ] || []; 154 if ( listeners.indexOf( listener ) == -1 ) { 155 listeners.push( listener ); 156 } 157 158 return this; 159}; 160 161proto.once = function( eventName, listener ) { 162 if ( !eventName || !listener ) { 163 return; 164 } 165 this.on( eventName, listener ); 166 var onceEvents = this._onceEvents = this._onceEvents || {}; 167 var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; 168 onceListeners[ listener ] = true; 169 170 return this; 171}; 172 173proto.off = function( eventName, listener ) { 174 var listeners = this._events && this._events[ eventName ]; 175 if ( !listeners || !listeners.length ) { 176 return; 177 } 178 var index = listeners.indexOf( listener ); 179 if ( index != -1 ) { 180 listeners.splice( index, 1 ); 181 } 182 183 return this; 184}; 185 186proto.emitEvent = function( eventName, args ) { 187 var listeners = this._events && this._events[ eventName ]; 188 if ( !listeners || !listeners.length ) { 189 return; 190 } 191 listeners = listeners.slice(0); 192 args = args || []; 193 var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; 194 195 for ( var i=0; i < listeners.length; i++ ) { 196 var listener = listeners[i] 197 var isOnce = onceListeners && onceListeners[ listener ]; 198 if ( isOnce ) { 199 this.off( eventName, listener ); 200 delete onceListeners[ listener ]; 201 } 202 listener.apply( this, args ); 203 } 204 205 return this; 206}; 207 208proto.allOff = function() { 209 delete this._events; 210 delete this._onceEvents; 211}; 212 213return EvEmitter; 214 215})); 216 217/*! 218 * getSize v2.0.3 219 * measure size of elements 220 * MIT license 221 */ 222 223 224( function( window, factory ) { 225 if ( typeof define == 'function' && define.amd ) { 226 define( 'get-size/get-size',factory ); 227 } else if ( typeof module == 'object' && module.exports ) { 228 module.exports = factory(); 229 } else { 230 window.getSize = factory(); 231 } 232 233})( window, function factory() { 234'use strict'; 235 236 237function getStyleSize( value ) { 238 var num = parseFloat( value ); 239 var isValid = value.indexOf('%') == -1 && !isNaN( num ); 240 return isValid && num; 241} 242 243function noop() {} 244 245var logError = typeof console == 'undefined' ? noop : 246 function( message ) { 247 console.error( message ); 248 }; 249 250 251var measurements = [ 252 'paddingLeft', 253 'paddingRight', 254 'paddingTop', 255 'paddingBottom', 256 'marginLeft', 257 'marginRight', 258 'marginTop', 259 'marginBottom', 260 'borderLeftWidth', 261 'borderRightWidth', 262 'borderTopWidth', 263 'borderBottomWidth' 264]; 265 266var measurementsLength = measurements.length; 267 268function getZeroSize() { 269 var size = { 270 width: 0, 271 height: 0, 272 innerWidth: 0, 273 innerHeight: 0, 274 outerWidth: 0, 275 outerHeight: 0 276 }; 277 for ( var i=0; i < measurementsLength; i++ ) { 278 var measurement = measurements[i]; 279 size[ measurement ] = 0; 280 } 281 return size; 282} 283 284 285function getStyle( elem ) { 286 var style = getComputedStyle( elem ); 287 if ( !style ) { 288 logError( 'Style returned ' + style + 289 '. Are you running this code in a hidden iframe on Firefox? ' + 290 'See https://bit.ly/getsizebug1' ); 291 } 292 return style; 293} 294 295 296var isSetup = false;
vendor: 5,187 bytes, lines 297-526
297 298var isBoxSizeOuter; 299 300function setup() { 301 if ( isSetup ) { 302 return; 303 } 304 isSetup = true; 305 306 307 var div = document.createElement('div'); 308 div.style.width = '200px'; 309 div.style.padding = '1px 2px 3px 4px'; 310 div.style.borderStyle = 'solid'; 311 div.style.borderWidth = '1px 2px 3px 4px'; 312 div.style.boxSizing = 'border-box'; 313 314 var body = document.body || document.documentElement; 315 body.appendChild( div ); 316 var style = getStyle( div ); 317 isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200; 318 getSize.isBoxSizeOuter = isBoxSizeOuter; 319 320 body.removeChild( div ); 321} 322 323 324function getSize( elem ) { 325 setup(); 326 327 if ( typeof elem == 'string' ) { 328 elem = document.querySelector( elem ); 329 } 330 331 if ( !elem || typeof elem != 'object' || !elem.nodeType ) { 332 return; 333 } 334 335 var style = getStyle( elem ); 336 337 if ( style.display == 'none' ) { 338 return getZeroSize(); 339 } 340 341 var size = {}; 342 size.width = elem.offsetWidth; 343 size.height = elem.offsetHeight; 344 345 var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box'; 346 347 for ( var i=0; i < measurementsLength; i++ ) { 348 var measurement = measurements[i]; 349 var value = style[ measurement ]; 350 var num = parseFloat( value ); 351 size[ measurement ] = !isNaN( num ) ? num : 0; 352 } 353 354 var paddingWidth = size.paddingLeft + size.paddingRight; 355 var paddingHeight = size.paddingTop + size.paddingBottom; 356 var marginWidth = size.marginLeft + size.marginRight; 357 var marginHeight = size.marginTop + size.marginBottom; 358 var borderWidth = size.borderLeftWidth + size.borderRightWidth; 359 var borderHeight = size.borderTopWidth + size.borderBottomWidth; 360 361 var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter; 362 363 var styleWidth = getStyleSize( style.width ); 364 if ( styleWidth !== false ) { 365 size.width = styleWidth + 366 ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth ); 367 } 368 369 var styleHeight = getStyleSize( style.height ); 370 if ( styleHeight !== false ) { 371 size.height = styleHeight + 372 ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight ); 373 } 374 375 size.innerWidth = size.width - ( paddingWidth + borderWidth ); 376 size.innerHeight = size.height - ( paddingHeight + borderHeight ); 377 378 size.outerWidth = size.width + marginWidth; 379 size.outerHeight = size.height + marginHeight; 380 381 return size; 382} 383 384return getSize; 385 386}); 387 388 389 390( function( window, factory ) { 391 'use strict'; 392 if ( typeof define == 'function' && define.amd ) { 393 define( 'desandro-matches-selector/matches-selector',factory ); 394 } else if ( typeof module == 'object' && module.exports ) { 395 module.exports = factory(); 396 } else { 397 window.matchesSelector = factory(); 398 } 399 400}( window, function factory() { 401 'use strict'; 402 403 var matchesMethod = ( function() { 404 var ElemProto = window.Element.prototype; 405 if ( ElemProto.matches ) { 406 return 'matches'; 407 } 408 if ( ElemProto.matchesSelector ) { 409 return 'matchesSelector'; 410 } 411 var prefixes = [ 'webkit', 'moz', 'ms', 'o' ]; 412 413 for ( var i=0; i < prefixes.length; i++ ) { 414 var prefix = prefixes[i]; 415 var method = prefix + 'MatchesSelector'; 416 if ( ElemProto[ method ] ) { 417 return method; 418 } 419 } 420 })(); 421 422 return function matchesSelector( elem, selector ) { 423 return elem[ matchesMethod ]( selector ); 424 }; 425 426})); 427 428 429 430( function( window, factory ) { 431 432 if ( typeof define == 'function' && define.amd ) { 433 define( 'fizzy-ui-utils/utils',[ 434 'desandro-matches-selector/matches-selector' 435 ], function( matchesSelector ) { 436 return factory( window, matchesSelector ); 437 }); 438 } else if ( typeof module == 'object' && module.exports ) { 439 module.exports = factory( 440 window, 441 require('desandro-matches-selector') 442 ); 443 } else { 444 window.fizzyUIUtils = factory( 445 window, 446 window.matchesSelector 447 ); 448 } 449 450}( window, function factory( window, matchesSelector ) { 451 452 453 454var utils = {}; 455 456 457utils.extend = function( a, b ) { 458 for ( var prop in b ) { 459 a[ prop ] = b[ prop ]; 460 } 461 return a; 462}; 463 464 465utils.modulo = function( num, div ) { 466 return ( ( num % div ) + div ) % div; 467}; 468 469 470var arraySlice = Array.prototype.slice; 471 472utils.makeArray = function( obj ) { 473 if ( Array.isArray( obj ) ) { 474 return obj; 475 } 476 if ( obj === null || obj === undefined ) { 477 return []; 478 } 479 480 var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number'; 481 if ( isArrayLike ) { 482 return arraySlice.call( obj ); 483 } 484 485 return [ obj ]; 486}; 487 488 489utils.removeFrom = function( ary, obj ) { 490 var index = ary.indexOf( obj ); 491 if ( index != -1 ) { 492 ary.splice( index, 1 ); 493 } 494}; 495 496 497utils.getParent = function( elem, selector ) { 498 while ( elem.parentNode && elem != document.body ) { 499 elem = elem.parentNode; 500 if ( matchesSelector( elem, selector ) ) { 501 return elem; 502 } 503 } 504}; 505 506 507utils.getQueryElement = function( elem ) { 508 if ( typeof elem == 'string' ) { 509 return document.querySelector( elem ); 510 } 511 return elem; 512}; 513 514 515utils.handleEvent = function( event ) { 516 var method = 'on' + event.type; 517 if ( this[ method ] ) { 518 this[ method ]( event ); 519 } 520}; 521 522 523utils.filterFindElements = function( elems, selector ) { 524 elems = utils.makeArray( elems ); 525 var ffElems = []; 526
527 elems.forEach( function( elem ) { 528 if ( !( elem instanceof HTMLElement ) ) { 529 return; 530 } 531 if ( !selector ) { 532 ffElems.push( elem ); 533 return; 534 } 535 if ( matchesSelector( elem, selector ) ) { 536 ffElems.push( elem ); 537 } 538 var childElems = elem.querySelectorAll( selector ); 539 for ( var i=0; i < childElems.length; i++ ) { 540 ffElems.push( childElems[i] ); 541 } 542 }); 543 544 return ffElems; 545}; 546 547 548utils.debounceMethod = function( _class, methodName, threshold ) { 549 threshold = threshold || 100; 550 var method = _class.prototype[ methodName ]; 551 var timeoutName = methodName + 'Timeout'; 552 553 _class.prototype[ methodName ] = function() { 554 var timeout = this[ timeoutName ]; 555 clearTimeout( timeout ); 556 557 var args = arguments; 558 var _this = this; 559 this[ timeoutName ] = setTimeout( function() { 560 method.apply( _this, args ); 561 delete _this[ timeoutName ]; 562 }, threshold ); 563 }; 564}; 565 566 567utils.docReady = function( callback ) { 568 var readyState = document.readyState; 569 if ( readyState == 'complete' || readyState == 'interactive' ) { 570 setTimeout( callback ); 571 } else { 572 document.addEventListener( 'DOMContentLoaded', callback ); 573 } 574}; 575 576 577utils.toDashed = function( str ) { 578 return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) { 579 return $1 + '-' + $2; 580 }).toLowerCase(); 581}; 582 583var console = window.console; 584utils.htmlInit = function( WidgetClass, namespace ) { 585 utils.docReady( function() { 586 var dashedNamespace = utils.toDashed( namespace ); 587 var dataAttr = 'data-' + dashedNamespace; 588 var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' ); 589 var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace ); 590 var elems = utils.makeArray( dataAttrElems ) 591 .concat( utils.makeArray( jsDashElems ) ); 592 var dataOptionsAttr = dataAttr + '-options'; 593 var jQuery = window.jQuery; 594 595 elems.forEach( function( elem ) { 596 var attr = elem.getAttribute( dataAttr ) || 597 elem.getAttribute( dataOptionsAttr ); 598 var options; 599 try { 600 options = attr && JSON.parse( attr ); 601 } catch ( error ) { 602 if ( console ) { 603 console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className + 604 ': ' + error ); 605 } 606 return; 607 } 608 var instance = new WidgetClass( elem, options ); 609 if ( jQuery ) { 610 jQuery.data( elem, namespace, instance ); 611 } 612 }); 613 614 }); 615}; 616 617 618return utils; 619 620})); 621 622( function( window, factory ) { 623 if ( typeof define == 'function' && define.amd ) { 624 define( 'flickity/js/cell',[ 625 'get-size/get-size', 626 ], function( getSize ) { 627 return factory( window, getSize ); 628 } ); 629 } else if ( typeof module == 'object' && module.exports ) { 630 module.exports = factory( 631 window, 632 require('get-size') 633 ); 634 } else { 635 window.Flickity = window.Flickity || {}; 636 window.Flickity.Cell = factory( 637 window, 638 window.getSize 639 ); 640 } 641 642}( window, function factory( window, getSize ) { 643 644 645 646function Cell( elem, parent ) { 647 this.element = elem; 648 this.parent = parent; 649 650 this.create(); 651} 652 653var proto = Cell.prototype; 654 655proto.create = function() { 656 this.element.style.position = 'absolute'; 657 this.element.setAttribute( 'aria-hidden', 'true' ); 658 this.x = 0; 659 this.shift = 0; 660 this.element.style[ this.parent.originSide ] = 0; 661}; 662 663proto.destroy = function() { 664 this.unselect(); 665 this.element.style.position = ''; 666 var side = this.parent.originSide; 667 this.element.style[ side ] = ''; 668 this.element.style.transform = ''; 669 this.element.removeAttribute('aria-hidden'); 670}; 671 672proto.getSize = function() { 673 this.size = getSize( this.element ); 674}; 675 676proto.setPosition = function( x ) { 677 this.x = x; 678 this.updateTarget(); 679 this.renderPosition( x ); 680}; 681 682proto.updateTarget = proto.setDefaultTarget = function() { 683 var marginProperty = this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight'; 684 this.target = this.x + this.size[ marginProperty ] + 685 this.size.width * this.parent.cellAlign; 686}; 687 688proto.renderPosition = function( x ) { 689 var sideOffset = this.parent.originSide === 'left' ? 1 : -1; 690 691 var adjustedX = this.parent.options.percentPosition ? 692 x * sideOffset * ( this.parent.size.innerWidth / this.size.width ) : 693 x * sideOffset; 694 695 this.element.style.transform = 'translateX(' + 696 this.parent.getPositionValue( adjustedX ) + ')'; 697}; 698 699proto.select = function() { 700 this.element.classList.add('is-selected'); 701 this.element.removeAttribute('aria-hidden'); 702}; 703 704proto.unselect = function() { 705 this.element.classList.remove('is-selected'); 706 this.element.setAttribute( 'aria-hidden', 'true' ); 707}; 708 709proto.wrapShift = function( shift ) { 710 this.shift = shift; 711 this.renderPosition( this.x + this.parent.slideableWidth * shift ); 712}; 713 714proto.remove = function() { 715 this.element.parentNode.removeChild( this.element ); 716}; 717 718return Cell; 719 720} ) ); 721 722( function( window, factory ) { 723 if ( typeof define == 'function' && define.amd ) { 724 define( 'flickity/js/slide',factory ); 725 } else if ( typeof module == 'object' && module.exports ) { 726 module.exports = factory(); 727 } else { 728 window.Flickity = window.Flickity || {}; 729 window.Flickity.Slide = factory(); 730 } 731 732}( window, function factory() { 733'use strict'; 734 735function Slide( parent ) { 736 this.parent = parent; 737 this.isOriginLeft = parent.originSide == 'left'; 738 this.cells = []; 739 this.outerWidth = 0; 740 this.height = 0; 741} 742 743var proto = Slide.prototype; 744 745proto.addCell = function( cell ) { 746 this.cells.push( cell ); 747 this.outerWidth += cell.size.outerWidth; 748 this.height = Math.max( cell.size.outerHeight, this.height ); 749 if ( this.cells.length == 1 ) { 750 this.x = cell.x; 751 var beginMargin = this.isOriginLeft ? 'marginLeft' : 'marginRight'; 752 this.firstMargin = cell.size[ beginMargin ]; 753 } 754}; 755 756proto.updateTarget = function() { 757 var endMargin = this.isOriginLeft ? 'marginRight' : 'marginLeft'; 758 var lastCell = this.getLastCell(); 759 var lastMargin = lastCell ? lastCell.size[ endMargin ] : 0; 760 var slideWidth = this.outerWidth - ( this.firstMargin + lastMargin ); 761 this.target = this.x + this.firstMargin + slideWidth * this.parent.cellAlign; 762}; 763 764proto.getLastCell = function() { 765 return this.cells[ this.cells.length - 1 ]; 766}; 767 768proto.select = function() {
769 this.cells.forEach( function( cell ) { 770 cell.select(); 771 } ); 772}; 773 774proto.unselect = function() { 775 this.cells.forEach( function( cell ) { 776 cell.unselect(); 777 } ); 778}; 779 780proto.getCellElements = function() { 781 return this.cells.map( function( cell ) { 782 return cell.element; 783 } ); 784}; 785 786return Slide; 787 788} ) ); 789 790( function( window, factory ) { 791 if ( typeof define == 'function' && define.amd ) { 792 define( 'flickity/js/animate',[ 793 'fizzy-ui-utils/utils', 794 ], function( utils ) { 795 return factory( window, utils ); 796 } ); 797 } else if ( typeof module == 'object' && module.exports ) { 798 module.exports = factory( 799 window, 800 require('fizzy-ui-utils') 801 ); 802 } else { 803 window.Flickity = window.Flickity || {}; 804 window.Flickity.animatePrototype = factory( 805 window, 806 window.fizzyUIUtils 807 ); 808 } 809 810}( window, function factory( window, utils ) { 811 812 813 814 815var proto = {}; 816 817proto.startAnimation = function() { 818 if ( this.isAnimating ) { 819 return; 820 } 821 822 this.isAnimating = true; 823 this.restingFrames = 0; 824 this.animate(); 825}; 826 827proto.animate = function() { 828 this.applyDragForce(); 829 this.applySelectedAttraction(); 830 831 var previousX = this.x; 832 833 this.integratePhysics(); 834 this.positionSlider(); 835 this.settle( previousX ); 836 if ( this.isAnimating ) { 837 var _this = this; 838 requestAnimationFrame( function animateFrame() { 839 _this.animate(); 840 } ); 841 } 842}; 843 844proto.positionSlider = function() { 845 var x = this.x; 846 if ( this.options.wrapAround && this.cells.length > 1 ) { 847 x = utils.modulo( x, this.slideableWidth ); 848 x -= this.slideableWidth; 849 this.shiftWrapCells( x ); 850 } 851 852 this.setTranslateX( x, this.isAnimating ); 853 this.dispatchScrollEvent(); 854}; 855 856proto.setTranslateX = function( x, is3d ) { 857 x += this.cursorPosition; 858 x = this.options.rightToLeft ? -x : x; 859 var translateX = this.getPositionValue( x ); 860 this.slider.style.transform = is3d ? 861 'translate3d(' + translateX + ',0,0)' : 'translateX(' + translateX + ')'; 862}; 863 864proto.dispatchScrollEvent = function() { 865 var firstSlide = this.slides[0]; 866 if ( !firstSlide ) { 867 return; 868 } 869 var positionX = -this.x - firstSlide.target; 870 var progress = positionX / this.slidesWidth; 871 this.dispatchEvent( 'scroll', null, [ progress, positionX ] ); 872}; 873 874proto.positionSliderAtSelected = function() { 875 if ( !this.cells.length ) { 876 return; 877 } 878 this.x = -this.selectedSlide.target; 879 this.velocity = 0; 880 this.positionSlider(); 881}; 882 883proto.getPositionValue = function( position ) { 884 if ( this.options.percentPosition ) { 885 return ( Math.round( ( position / this.size.innerWidth ) * 10000 ) * 0.01 ) + '%'; 886 } else { 887 return Math.round( position ) + 'px'; 888 } 889}; 890 891proto.settle = function( previousX ) { 892 var isResting = !this.isPointerDown && 893 Math.round( this.x * 100 ) == Math.round( previousX * 100 ); 894 if ( isResting ) { 895 this.restingFrames++; 896 } 897 if ( this.restingFrames > 2 ) { 898 this.isAnimating = false; 899 delete this.isFreeScrolling; 900 this.positionSlider(); 901 this.dispatchEvent( 'settle', null, [ this.selectedIndex ] ); 902 } 903}; 904 905proto.shiftWrapCells = function( x ) { 906 var beforeGap = this.cursorPosition + x; 907 this._shiftCells( this.beforeShiftCells, beforeGap, -1 ); 908 var afterGap = this.size.innerWidth - ( x + this.slideableWidth + this.cursorPosition ); 909 this._shiftCells( this.afterShiftCells, afterGap, 1 ); 910}; 911 912proto._shiftCells = function( cells, gap, shift ) { 913 for ( var i = 0; i < cells.length; i++ ) { 914 var cell = cells[i]; 915 var cellShift = gap > 0 ? shift : 0; 916 cell.wrapShift( cellShift ); 917 gap -= cell.size.outerWidth; 918 } 919}; 920 921proto._unshiftCells = function( cells ) { 922 if ( !cells || !cells.length ) { 923 return; 924 } 925 for ( var i = 0; i < cells.length; i++ ) { 926 cells[i].wrapShift( 0 ); 927 } 928}; 929 930 931proto.integratePhysics = function() { 932 this.x += this.velocity; 933 this.velocity *= this.getFrictionFactor(); 934}; 935 936proto.applyForce = function( force ) { 937 this.velocity += force; 938}; 939 940proto.getFrictionFactor = function() { 941 return 1 - this.options[ this.isFreeScrolling ? 'freeScrollFriction' : 'friction' ]; 942}; 943 944proto.getRestingPosition = function() { 945 return this.x + this.velocity / ( 1 - this.getFrictionFactor() ); 946}; 947 948proto.applyDragForce = function() { 949 if ( !this.isDraggable || !this.isPointerDown ) { 950 return; 951 } 952 var dragVelocity = this.dragX - this.x; 953 var dragForce = dragVelocity - this.velocity; 954 this.applyForce( dragForce ); 955}; 956 957proto.applySelectedAttraction = function() { 958 var dragDown = this.isDraggable && this.isPointerDown; 959 if ( dragDown || this.isFreeScrolling || !this.slides.length ) { 960 return; 961 } 962 var distance = this.selectedSlide.target * -1 - this.x; 963 var force = distance * this.options.selectedAttraction; 964 this.applyForce( force ); 965}; 966 967return proto; 968 969} ) ); 970 971( function( window, factory ) { 972 if ( typeof define == 'function' && define.amd ) { 973 define( 'flickity/js/flickity',[ 974 'ev-emitter/ev-emitter', 975 'get-size/get-size', 976 'fizzy-ui-utils/utils', 977 './cell', 978 './slide', 979 './animate', 980 ], function( EvEmitter, getSize, utils, Cell, Slide, animatePrototype ) { 981 return factory( window, EvEmitter, getSize, utils, Cell, Slide, animatePrototype ); 982 } ); 983 } else if ( typeof module == 'object' && module.exports ) { 984 module.exports = factory( 985 window, 986 require('ev-emitter'), 987 require('get-size'), 988 require('fizzy-ui-utils'), 989 require('./cell'), 990 require('./slide'), 991 require('./animate') 992 ); 993 } else { 994 var _Flickity = window.Flickity; 995 996 window.Flickity = factory( 997 window, 998 window.EvEmitter, 999 window.getSize, 1000 window.fizzyUIUtils, 1001 _Flickity.Cell, 1002 _Flickity.Slide, 1003 _Flickity.animatePrototype 1004 ); 1005 } 1006 1007}( window, function factory( window, EvEmitter, getSize, 1008 utils, Cell, Slide, animatePrototype ) { 1009 1010 1011 1012var jQuery = window.jQuery; 1013var getComputedStyle = window.getComputedStyle; 1014var console = window.console; 1015 1016function moveElements( elems, toElem ) { 1017 elems = utils.makeArray( elems ); 1018 while ( elems.length ) { 1019 toElem.appendChild( elems.shift() ); 1020 } 1021} 1022 1023 1024var GUID = 0; 1025var instances = {}; 1026 1027function Flickity( element, options ) { 1028 var queryElement = utils.getQueryElement( element ); 1029 if ( !queryElement ) { 1030 if ( console ) { 1031 console.error( 'Bad element for Flickity: ' + ( queryElement || element ) ); 1032 } 1033 return; 1034 } 1035 this.element = queryElement; 1036 if ( this.element.flickityGUID ) { 1037 var instance = instances[ this.element.flickityGUID ]; 1038 if ( instance ) instance.option( options ); 1039 return instance; 1040 } 1041 1042 if ( jQuery ) { 1043 this.$element = jQuery( this.element ); 1044 } 1045 this.options = utils.extend( {}, this.constructor.defaults ); 1046 this.option( options ); 1047 1048 this._create(); 1049} 1050 1051Flickity.defaults = { 1052 accessibility: true, 1053 cellAlign: 'center', 1054 freeScrollFriction: 0.075, 1055 friction: 0.28, 1056 namespaceJQueryEvents: true, 1057 percentPosition: true, 1058 resize: true, 1059 selectedAttraction: 0.025, 1060 setGallerySize: true, 1061}; 1062 1063Flickity.createMethods = []; 1064 1065var proto = Flickity.prototype; 1066utils.extend( proto, EvEmitter.prototype ); 1067 1068proto._create = function() { 1069 var id = this.guid = ++GUID; 1070 this.element.flickityGUID = id; 1071 instances[ id ] = this; 1072 this.selectedIndex = 0; 1073 this.restingFrames = 0; 1074 this.x = 0; 1075 this.velocity = 0; 1076 this.originSide = this.options.rightToLeft ? 'right' : 'left'; 1077 this.viewport = document.createElement('div'); 1078 this.viewport.className = 'flickity-viewport'; 1079 this._createSlider(); 1080 1081 if ( this.options.resize || this.options.watchCSS ) { 1082 window.addEventListener( 'resize', this ); 1083 } 1084 1085 for ( var eventName in this.options.on ) { 1086 var listener = this.options.on[ eventName ]; 1087 this.on( eventName, listener ); 1088 } 1089 1090 Flickity.createMethods.forEach( function( method ) { 1091 this[ method ](); 1092 }, this ); 1093 1094 if ( this.options.watchCSS ) { 1095 this.watchCSS(); 1096 } else { 1097 this.activate(); 1098 } 1099 1100}; 1101 1102proto.option = function( opts ) { 1103 utils.extend( this.options, opts ); 1104}; 1105 1106proto.activate = function() { 1107 if ( this.isActive ) { 1108 return; 1109 } 1110 this.isActive = true; 1111 this.element.classList.add('flickity-enabled'); 1112 if ( this.options.rightToLeft ) { 1113 this.element.classList.add('flickity-rtl'); 1114 } 1115
1116 this.getSize(); 1117 var cellElems = this._filterFindCellElements( this.element.children ); 1118 moveElements( cellElems, this.slider ); 1119 this.viewport.appendChild( this.slider ); 1120 this.element.appendChild( this.viewport ); 1121 this.reloadCells(); 1122 1123 if ( this.options.accessibility ) { 1124 this.element.tabIndex = 0; 1125 this.element.addEventListener( 'keydown', this ); 1126 } 1127 1128 this.emitEvent('activate'); 1129 this.selectInitialIndex(); 1130 this.isInitActivated = true; 1131 this.dispatchEvent('ready'); 1132}; 1133 1134proto._createSlider = function() { 1135 var slider = document.createElement('div'); 1136 slider.className = 'flickity-slider'; 1137 slider.style[ this.originSide ] = 0; 1138 this.slider = slider; 1139}; 1140 1141proto._filterFindCellElements = function( elems ) { 1142 return utils.filterFindElements( elems, this.options.cellSelector ); 1143}; 1144 1145proto.reloadCells = function() { 1146 this.cells = this._makeCells( this.slider.children ); 1147 this.positionCells(); 1148 this._getWrapShiftCells(); 1149 this.setGallerySize(); 1150}; 1151 1152proto._makeCells = function( elems ) { 1153 var cellElems = this._filterFindCellElements( elems ); 1154 1155 var cells = cellElems.map( function( cellElem ) { 1156 return new Cell( cellElem, this ); 1157 }, this ); 1158 1159 return cells; 1160}; 1161 1162proto.getLastCell = function() { 1163 return this.cells[ this.cells.length - 1 ]; 1164}; 1165 1166proto.getLastSlide = function() { 1167 return this.slides[ this.slides.length - 1 ]; 1168}; 1169 1170proto.positionCells = function() { 1171 this._sizeCells( this.cells ); 1172 this._positionCells( 0 ); 1173}; 1174 1175proto._positionCells = function( index ) { 1176 index = index || 0; 1177 this.maxCellHeight = index ? this.maxCellHeight || 0 : 0; 1178 var cellX = 0; 1179 if ( index > 0 ) { 1180 var startCell = this.cells[ index - 1 ]; 1181 cellX = startCell.x + startCell.size.outerWidth; 1182 } 1183 var len = this.cells.length; 1184 for ( var i = index; i < len; i++ ) { 1185 var cell = this.cells[i]; 1186 cell.setPosition( cellX ); 1187 cellX += cell.size.outerWidth; 1188 this.maxCellHeight = Math.max( cell.size.outerHeight, this.maxCellHeight ); 1189 } 1190 this.slideableWidth = cellX; 1191 this.updateSlides(); 1192 this._containSlides(); 1193 this.slidesWidth = len ? this.getLastSlide().target - this.slides[0].target : 0; 1194}; 1195 1196proto._sizeCells = function( cells ) { 1197 cells.forEach( function( cell ) { 1198 cell.getSize(); 1199 } ); 1200}; 1201 1202 1203proto.updateSlides = function() { 1204 this.slides = []; 1205 if ( !this.cells.length ) { 1206 return; 1207 } 1208 1209 var slide = new Slide( this ); 1210 this.slides.push( slide ); 1211 var isOriginLeft = this.originSide == 'left'; 1212 var nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft'; 1213 1214 var canCellFit = this._getCanCellFit(); 1215 1216 this.cells.forEach( function( cell, i ) { 1217 if ( !slide.cells.length ) { 1218 slide.addCell( cell ); 1219 return; 1220 } 1221 1222 var slideWidth = ( slide.outerWidth - slide.firstMargin ) + 1223 ( cell.size.outerWidth - cell.size[ nextMargin ] ); 1224 1225 if ( canCellFit.call( this, i, slideWidth ) ) { 1226 slide.addCell( cell ); 1227 } else { 1228 slide.updateTarget(); 1229 1230 slide = new Slide( this ); 1231 this.slides.push( slide ); 1232 slide.addCell( cell ); 1233 } 1234 }, this ); 1235 slide.updateTarget(); 1236 this.updateSelectedSlide(); 1237}; 1238 1239proto._getCanCellFit = function() { 1240 var groupCells = this.options.groupCells; 1241 if ( !groupCells ) { 1242 return function() { 1243 return false; 1244 }; 1245 } else if ( typeof groupCells == 'number' ) { 1246 var number = parseInt( groupCells, 10 ); 1247 return function( i ) { 1248 return ( i % number ) !== 0; 1249 }; 1250 } 1251 var percentMatch = typeof groupCells == 'string' && 1252 groupCells.match( /^(\d+)%$/ ); 1253 var percent = percentMatch ? parseInt( percentMatch[1], 10 ) / 100 : 1; 1254 return function( i, slideWidth ) { 1255 return slideWidth <= ( this.size.innerWidth + 1 ) * percent; 1256 }; 1257}; 1258 1259proto._init = 1260proto.reposition = function() { 1261 this.positionCells(); 1262 this.positionSliderAtSelected(); 1263}; 1264 1265proto.getSize = function() { 1266 this.size = getSize( this.element ); 1267 this.setCellAlign(); 1268 this.cursorPosition = this.size.innerWidth * this.cellAlign; 1269}; 1270 1271var cellAlignShorthands = { 1272 center: { 1273 left: 0.5, 1274 right: 0.5, 1275 }, 1276 left: { 1277 left: 0, 1278 right: 1, 1279 }, 1280 right: { 1281 right: 0, 1282 left: 1, 1283 }, 1284}; 1285 1286proto.setCellAlign = function() { 1287 var shorthand = cellAlignShorthands[ this.options.cellAlign ]; 1288 this.cellAlign = shorthand ? shorthand[ this.originSide ] : this.options.cellAlign; 1289}; 1290 1291proto.setGallerySize = function() { 1292 if ( this.options.setGallerySize ) { 1293 var height = this.options.adaptiveHeight && this.selectedSlide ? 1294 this.selectedSlide.height : this.maxCellHeight; 1295 this.viewport.style.height = height + 'px'; 1296 } 1297}; 1298 1299proto._getWrapShiftCells = function() { 1300 if ( !this.options.wrapAround ) { 1301 return; 1302 } 1303 this._unshiftCells( this.beforeShiftCells ); 1304 this._unshiftCells( this.afterShiftCells ); 1305 var gapX = this.cursorPosition; 1306 var cellIndex = this.cells.length - 1; 1307 this.beforeShiftCells = this._getGapCells( gapX, cellIndex, -1 );
1308 gapX = this.size.innerWidth - this.cursorPosition; 1309 this.afterShiftCells = this._getGapCells( gapX, 0, 1 ); 1310}; 1311 1312proto._getGapCells = function( gapX, cellIndex, increment ) { 1313 var cells = []; 1314 while ( gapX > 0 ) { 1315 var cell = this.cells[ cellIndex ]; 1316 if ( !cell ) { 1317 break; 1318 } 1319 cells.push( cell ); 1320 cellIndex += increment; 1321 gapX -= cell.size.outerWidth; 1322 } 1323 return cells; 1324}; 1325 1326 1327proto._containSlides = function() { 1328 if ( !this.options.contain || this.options.wrapAround || !this.cells.length ) { 1329 return; 1330 } 1331 var isRightToLeft = this.options.rightToLeft; 1332 var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft'; 1333 var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight'; 1334 var contentWidth = this.slideableWidth - this.getLastCell().size[ endMargin ]; 1335 var isContentSmaller = contentWidth < this.size.innerWidth; 1336 var beginBound = this.cursorPosition + this.cells[0].size[ beginMargin ]; 1337 var endBound = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign ); 1338 this.slides.forEach( function( slide ) { 1339 if ( isContentSmaller ) { 1340 slide.target = contentWidth * this.cellAlign; 1341 } else { 1342 slide.target = Math.max( slide.target, beginBound ); 1343 slide.target = Math.min( slide.target, endBound ); 1344 } 1345 }, this ); 1346}; 1347 1348 1349proto.dispatchEvent = function( type, event, args ) { 1350 var emitArgs = event ? [ event ].concat( args ) : args; 1351 this.emitEvent( type, emitArgs ); 1352 1353 if ( jQuery && this.$element ) { 1354 type += this.options.namespaceJQueryEvents ? '.flickity' : ''; 1355 var $event = type; 1356 if ( event ) { 1357 var jQEvent = new jQuery.Event( event ); 1358 jQEvent.type = type; 1359 $event = jQEvent; 1360 } 1361 this.$element.trigger( $event, args ); 1362 } 1363}; 1364 1365 1366proto.select = function( index, isWrap, isInstant ) { 1367 if ( !this.isActive ) { 1368 return; 1369 } 1370 index = parseInt( index, 10 ); 1371 this._wrapSelect( index ); 1372 1373 if ( this.options.wrapAround || isWrap ) { 1374 index = utils.modulo( index, this.slides.length ); 1375 } 1376 if ( !this.slides[ index ] ) { 1377 return; 1378 } 1379 var prevIndex = this.selectedIndex; 1380 this.selectedIndex = index; 1381 this.updateSelectedSlide(); 1382 if ( isInstant ) { 1383 this.positionSliderAtSelected(); 1384 } else { 1385 this.startAnimation(); 1386 } 1387 if ( this.options.adaptiveHeight ) { 1388 this.setGallerySize(); 1389 } 1390 this.dispatchEvent( 'select', null, [ index ] ); 1391 if ( index != prevIndex ) { 1392 this.dispatchEvent( 'change', null, [ index ] ); 1393 } 1394 this.dispatchEvent('cellSelect'); 1395}; 1396 1397proto._wrapSelect = function( index ) { 1398 var len = this.slides.length; 1399 var isWrapping = this.options.wrapAround && len > 1; 1400 if ( !isWrapping ) { 1401 return index; 1402 } 1403 var wrapIndex = utils.modulo( index, len ); 1404 var delta = Math.abs( wrapIndex - this.selectedIndex ); 1405 var backWrapDelta = Math.abs( ( wrapIndex + len ) - this.selectedIndex ); 1406 var forewardWrapDelta = Math.abs( ( wrapIndex - len ) - this.selectedIndex ); 1407 if ( !this.isDragSelect && backWrapDelta < delta ) { 1408 index += len; 1409 } else if ( !this.isDragSelect && forewardWrapDelta < delta ) { 1410 index -= len; 1411 } 1412 if ( index < 0 ) { 1413 this.x -= this.slideableWidth; 1414 } else if ( index >= len ) { 1415 this.x += this.slideableWidth; 1416 } 1417}; 1418 1419proto.previous = function( isWrap, isInstant ) { 1420 this.select( this.selectedIndex - 1, isWrap, isInstant ); 1421}; 1422 1423proto.next = function( isWrap, isInstant ) { 1424 this.select( this.selectedIndex + 1, isWrap, isInstant ); 1425}; 1426 1427proto.updateSelectedSlide = function() { 1428 var slide = this.slides[ this.selectedIndex ]; 1429 if ( !slide ) { 1430 return; 1431 } 1432 this.unselectSelectedSlide(); 1433 this.selectedSlide = slide; 1434 slide.select(); 1435 this.selectedCells = slide.cells; 1436 this.selectedElements = slide.getCellElements(); 1437 this.selectedCell = slide.cells[0]; 1438 this.selectedElement = this.selectedElements[0]; 1439}; 1440 1441proto.unselectSelectedSlide = function() { 1442 if ( this.selectedSlide ) { 1443 this.selectedSlide.unselect(); 1444 } 1445}; 1446 1447proto.selectInitialIndex = function() { 1448 var initialIndex = this.options.initialIndex; 1449 if ( this.isInitActivated ) { 1450 this.select( this.selectedIndex, false, true ); 1451 return; 1452 } 1453 if ( initialIndex && typeof initialIndex == 'string' ) { 1454 var cell = this.queryCell( initialIndex ); 1455 if ( cell ) { 1456 this.selectCell( initialIndex, false, true ); 1457 return; 1458 } 1459 } 1460 1461 var index = 0; 1462 if ( initialIndex && this.slides[ initialIndex ] ) { 1463 index = initialIndex; 1464 } 1465 this.select( index, false, true ); 1466}; 1467 1468proto.selectCell = function( value, isWrap, isInstant ) { 1469 var cell = this.queryCell( value ); 1470 if ( !cell ) { 1471 return; 1472 } 1473 1474 var index = this.getCellSlideIndex( cell ); 1475 this.select( index, isWrap, isInstant ); 1476}; 1477 1478proto.getCellSlideIndex = function( cell ) { 1479 for ( var i = 0; i < this.slides.length; i++ ) { 1480 var slide = this.slides[i]; 1481 var index = slide.cells.indexOf( cell ); 1482 if ( index != -1 ) { 1483 return i; 1484 } 1485 } 1486}; 1487 1488 1489proto.getCell = function( elem ) { 1490 for ( var i = 0; i < this.cells.length; i++ ) { 1491 var cell = this.cells[i]; 1492 if ( cell.element == elem ) { 1493 return cell; 1494 } 1495 } 1496}; 1497 1498proto.getCells = function( elems ) { 1499 elems = utils.makeArray( elems ); 1500 var cells = [];
1501 elems.forEach( function( elem ) { 1502 var cell = this.getCell( elem ); 1503 if ( cell ) { 1504 cells.push( cell ); 1505 } 1506 }, this ); 1507 return cells; 1508}; 1509 1510proto.getCellElements = function() { 1511 return this.cells.map( function( cell ) { 1512 return cell.element; 1513 } ); 1514}; 1515 1516proto.getParentCell = function( elem ) { 1517 var cell = this.getCell( elem ); 1518 if ( cell ) { 1519 return cell; 1520 } 1521 elem = utils.getParent( elem, '.flickity-slider > *' ); 1522 return this.getCell( elem ); 1523}; 1524 1525proto.getAdjacentCellElements = function( adjCount, index ) { 1526 if ( !adjCount ) { 1527 return this.selectedSlide.getCellElements(); 1528 } 1529 index = index === undefined ? this.selectedIndex : index; 1530 1531 var len = this.slides.length; 1532 if ( 1 + ( adjCount * 2 ) >= len ) { 1533 return this.getCellElements(); 1534 } 1535 1536 var cellElems = []; 1537 for ( var i = index - adjCount; i <= index + adjCount; i++ ) { 1538 var slideIndex = this.options.wrapAround ? utils.modulo( i, len ) : i; 1539 var slide = this.slides[ slideIndex ]; 1540 if ( slide ) { 1541 cellElems = cellElems.concat( slide.getCellElements() ); 1542 } 1543 } 1544 return cellElems; 1545}; 1546 1547proto.queryCell = function( selector ) { 1548 if ( typeof selector == 'number' ) { 1549 return this.cells[ selector ]; 1550 } 1551 if ( typeof selector == 'string' ) { 1552 if ( selector.match( /^[#.]?[\d/]/ ) ) { 1553 return; 1554 } 1555 selector = this.element.querySelector( selector ); 1556 } 1557 return this.getCell( selector ); 1558}; 1559 1560 1561proto.uiChange = function() { 1562 this.emitEvent('uiChange'); 1563}; 1564 1565proto.childUIPointerDown = function( event ) { 1566 if ( event.type != 'touchstart' ) { 1567 event.preventDefault(); 1568 } 1569 this.focus(); 1570}; 1571 1572 1573proto.onresize = function() { 1574 this.watchCSS(); 1575 this.resize(); 1576}; 1577 1578utils.debounceMethod( Flickity, 'onresize', 150 ); 1579 1580proto.resize = function() { 1581 if ( !this.isActive || this.isAnimating || this.isDragging ) { 1582 return; 1583 } 1584 this.getSize(); 1585 if ( this.options.wrapAround ) { 1586 this.x = utils.modulo( this.x, this.slideableWidth ); 1587 } 1588 this.positionCells(); 1589 this._getWrapShiftCells(); 1590 this.setGallerySize(); 1591 this.emitEvent('resize'); 1592 var selectedElement = this.selectedElements && this.selectedElements[0]; 1593 this.selectCell( selectedElement, false, true ); 1594}; 1595 1596proto.watchCSS = function() { 1597 var watchOption = this.options.watchCSS; 1598 if ( !watchOption ) { 1599 return; 1600 } 1601 1602 var afterContent = getComputedStyle( this.element, ':after' ).content; 1603 if ( afterContent.indexOf('flickity') != -1 ) { 1604 this.activate(); 1605 } else { 1606 this.deactivate(); 1607 } 1608}; 1609 1610 1611proto.onkeydown = function( event ) { 1612 var isNotFocused = document.activeElement && document.activeElement != this.element; 1613 if ( !this.options.accessibility || isNotFocused ) { 1614 return; 1615 } 1616 1617 var handler = Flickity.keyboardHandlers[ event.keyCode ]; 1618 if ( handler ) { 1619 handler.call( this ); 1620 } 1621}; 1622 1623Flickity.keyboardHandlers = { 1624 37: function() { 1625 var leftMethod = this.options.rightToLeft ? 'next' : 'previous'; 1626 this.uiChange(); 1627 this[ leftMethod ](); 1628 }, 1629 39: function() { 1630 var rightMethod = this.options.rightToLeft ? 'previous' : 'next'; 1631 this.uiChange(); 1632 this[ rightMethod ](); 1633 }, 1634}; 1635 1636 1637proto.focus = function() { 1638 var prevScrollY = window.pageYOffset; 1639 this.element.focus({ preventScroll: true }); 1640 if ( window.pageYOffset != prevScrollY ) { 1641 window.scrollTo( window.pageXOffset, prevScrollY ); 1642 } 1643}; 1644 1645 1646proto.deactivate = function() { 1647 if ( !this.isActive ) { 1648 return; 1649 } 1650 this.element.classList.remove('flickity-enabled'); 1651 this.element.classList.remove('flickity-rtl'); 1652 this.unselectSelectedSlide(); 1653 this.cells.forEach( function( cell ) { 1654 cell.destroy(); 1655 } ); 1656 this.element.removeChild( this.viewport ); 1657 moveElements( this.slider.children, this.element ); 1658 if ( this.options.accessibility ) { 1659 this.element.removeAttribute('tabIndex'); 1660 this.element.removeEventListener( 'keydown', this ); 1661 } 1662 this.isActive = false; 1663 this.emitEvent('deactivate'); 1664}; 1665 1666proto.destroy = function() { 1667 this.deactivate(); 1668 window.removeEventListener( 'resize', this ); 1669 this.allOff(); 1670 this.emitEvent('destroy'); 1671 if ( jQuery && this.$element ) { 1672 jQuery.removeData( this.element, 'flickity' ); 1673 } 1674 delete this.element.flickityGUID; 1675 delete instances[ this.guid ]; 1676}; 1677 1678 1679utils.extend( proto, animatePrototype ); 1680 1681 1682Flickity.data = function( elem ) { 1683 elem = utils.getQueryElement( elem ); 1684 var id = elem && elem.flickityGUID; 1685 return id && instances[ id ]; 1686}; 1687 1688utils.htmlInit( Flickity, 'flickity' ); 1689 1690if ( jQuery && jQuery.bridget ) { 1691 jQuery.bridget( 'flickity', Flickity ); 1692} 1693 1694Flickity.setJQuery = function( jq ) { 1695 jQuery = jq; 1696}; 1697 1698Flickity.Cell = Cell; 1699Flickity.Slide = Slide; 1700 1701return Flickity; 1702 1703} ) ); 1704 1705/*! 1706 * Unipointer v2.4.0 1707 * base class for doing one thing with pointer event 1708 * MIT license 1709 */ 1710 1711 1712( function( window, factory ) { 1713 if ( typeof define == 'function' && define.amd ) { 1714 define( 'unipointer/unipointer',[ 1715 'ev-emitter/ev-emitter' 1716 ], function( EvEmitter ) { 1717 return factory( window, EvEmitter ); 1718 }); 1719 } else if ( typeof module == 'object' && module.exports ) { 1720 module.exports = factory( 1721 window, 1722 require('ev-emitter') 1723 ); 1724 } else { 1725 window.Unipointer = factory( 1726 window, 1727 window.EvEmitter 1728 ); 1729 } 1730 1731}( window, function factory( window, EvEmitter ) { 1732 1733 1734 1735function noop() {} 1736 1737function Unipointer() {} 1738 1739var proto = Unipointer.prototype = Object.create( EvEmitter.prototype ); 1740 1741proto.bindStartEvent = function( elem ) { 1742 this._bindStartEvent( elem, true ); 1743}; 1744 1745proto.unbindStartEvent = function( elem ) { 1746 this._bindStartEvent( elem, false ); 1747}; 1748 1749proto._bindStartEvent = function( elem, isAdd ) { 1750 isAdd = isAdd === undefined ? true : isAdd; 1751 var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener'; 1752 1753 var startEvent = 'mousedown'; 1754 if ( 'ontouchstart' in window ) { 1755 startEvent = 'touchstart'; 1756 } else if ( window.PointerEvent ) { 1757 startEvent = 'pointerdown'; 1758 } 1759 elem[ bindMethod ]( startEvent, this ); 1760}; 1761 1762proto.handleEvent = function( event ) { 1763 var method = 'on' + event.type; 1764 if ( this[ method ] ) { 1765 this[ method ]( event ); 1766 } 1767}; 1768 1769proto.getTouch = function( touches ) { 1770 for ( var i=0; i < touches.length; i++ ) { 1771 var touch = touches[i]; 1772 if ( touch.identifier == this.pointerIdentifier ) { 1773 return touch; 1774 } 1775 } 1776}; 1777 1778 1779proto.onmousedown = function( event ) { 1780 var button = event.button; 1781 if ( button && ( button !== 0 && button !== 1 ) ) { 1782 return; 1783 } 1784 this._pointerDown( event, event ); 1785}; 1786 1787proto.ontouchstart = function( event ) { 1788 this._pointerDown( event, event.changedTouches[0] ); 1789}; 1790 1791proto.onpointerdown = function( event ) { 1792 this._pointerDown( event, event ); 1793}; 1794 1795proto._pointerDown = function( event, pointer ) { 1796 if ( event.button || this.isPointerDown ) { 1797 return; 1798 } 1799 1800 this.isPointerDown = true; 1801 this.pointerIdentifier = pointer.pointerId !== undefined ? 1802 pointer.pointerId : pointer.identifier; 1803 1804 this.pointerDown( event, pointer ); 1805}; 1806 1807proto.pointerDown = function( event, pointer ) { 1808 this._bindPostStartEvents( event ); 1809 this.emitEvent( 'pointerDown', [ event, pointer ] ); 1810}; 1811 1812var postStartEvents = {
vendor: 4,822 bytes, lines 1813-2039
1813 mousedown: [ 'mousemove', 'mouseup' ], 1814 touchstart: [ 'touchmove', 'touchend', 'touchcancel' ], 1815 pointerdown: [ 'pointermove', 'pointerup', 'pointercancel' ], 1816}; 1817 1818proto._bindPostStartEvents = function( event ) { 1819 if ( !event ) { 1820 return; 1821 } 1822 var events = postStartEvents[ event.type ]; 1823 events.forEach( function( eventName ) { 1824 window.addEventListener( eventName, this ); 1825 }, this ); 1826 this._boundPointerEvents = events; 1827}; 1828 1829proto._unbindPostStartEvents = function() { 1830 if ( !this._boundPointerEvents ) { 1831 return; 1832 } 1833 this._boundPointerEvents.forEach( function( eventName ) { 1834 window.removeEventListener( eventName, this ); 1835 }, this ); 1836 1837 delete this._boundPointerEvents; 1838}; 1839 1840 1841proto.onmousemove = function( event ) { 1842 this._pointerMove( event, event ); 1843}; 1844 1845proto.onpointermove = function( event ) { 1846 if ( event.pointerId == this.pointerIdentifier ) { 1847 this._pointerMove( event, event ); 1848 } 1849}; 1850 1851proto.ontouchmove = function( event ) { 1852 var touch = this.getTouch( event.changedTouches ); 1853 if ( touch ) { 1854 this._pointerMove( event, touch ); 1855 } 1856}; 1857 1858proto._pointerMove = function( event, pointer ) { 1859 this.pointerMove( event, pointer ); 1860}; 1861 1862proto.pointerMove = function( event, pointer ) { 1863 this.emitEvent( 'pointerMove', [ event, pointer ] ); 1864}; 1865 1866 1867 1868proto.onmouseup = function( event ) { 1869 this._pointerUp( event, event ); 1870}; 1871 1872proto.onpointerup = function( event ) { 1873 if ( event.pointerId == this.pointerIdentifier ) { 1874 this._pointerUp( event, event ); 1875 } 1876}; 1877 1878proto.ontouchend = function( event ) { 1879 var touch = this.getTouch( event.changedTouches ); 1880 if ( touch ) { 1881 this._pointerUp( event, touch ); 1882 } 1883}; 1884 1885proto._pointerUp = function( event, pointer ) { 1886 this._pointerDone(); 1887 this.pointerUp( event, pointer ); 1888}; 1889 1890proto.pointerUp = function( event, pointer ) { 1891 this.emitEvent( 'pointerUp', [ event, pointer ] ); 1892}; 1893 1894 1895proto._pointerDone = function() { 1896 this._pointerReset(); 1897 this._unbindPostStartEvents(); 1898 this.pointerDone(); 1899}; 1900 1901proto._pointerReset = function() { 1902 this.isPointerDown = false; 1903 delete this.pointerIdentifier; 1904}; 1905 1906proto.pointerDone = noop; 1907 1908 1909proto.onpointercancel = function( event ) { 1910 if ( event.pointerId == this.pointerIdentifier ) { 1911 this._pointerCancel( event, event ); 1912 } 1913}; 1914 1915proto.ontouchcancel = function( event ) { 1916 var touch = this.getTouch( event.changedTouches ); 1917 if ( touch ) { 1918 this._pointerCancel( event, touch ); 1919 } 1920}; 1921 1922proto._pointerCancel = function( event, pointer ) { 1923 this._pointerDone(); 1924 this.pointerCancel( event, pointer ); 1925}; 1926 1927proto.pointerCancel = function( event, pointer ) { 1928 this.emitEvent( 'pointerCancel', [ event, pointer ] ); 1929}; 1930 1931 1932Unipointer.getPointerPoint = function( pointer ) { 1933 return { 1934 x: pointer.pageX, 1935 y: pointer.pageY 1936 }; 1937}; 1938 1939 1940return Unipointer; 1941 1942})); 1943 1944/*! 1945 * Unidragger v2.4.0 1946 * Draggable base class 1947 * MIT license 1948 */ 1949 1950 1951( function( window, factory ) { 1952 1953 if ( typeof define == 'function' && define.amd ) { 1954 define( 'unidragger/unidragger',[ 1955 'unipointer/unipointer' 1956 ], function( Unipointer ) { 1957 return factory( window, Unipointer ); 1958 }); 1959 } else if ( typeof module == 'object' && module.exports ) { 1960 module.exports = factory( 1961 window, 1962 require('unipointer') 1963 ); 1964 } else { 1965 window.Unidragger = factory( 1966 window, 1967 window.Unipointer 1968 ); 1969 } 1970 1971}( window, function factory( window, Unipointer ) { 1972 1973 1974 1975 1976function Unidragger() {} 1977 1978var proto = Unidragger.prototype = Object.create( Unipointer.prototype ); 1979 1980 1981proto.bindHandles = function() { 1982 this._bindHandles( true ); 1983}; 1984 1985proto.unbindHandles = function() { 1986 this._bindHandles( false ); 1987}; 1988 1989proto._bindHandles = function( isAdd ) { 1990 isAdd = isAdd === undefined ? true : isAdd; 1991 var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener'; 1992 var touchAction = isAdd ? this._touchActionValue : ''; 1993 for ( var i=0; i < this.handles.length; i++ ) { 1994 var handle = this.handles[i]; 1995 this._bindStartEvent( handle, isAdd ); 1996 handle[ bindMethod ]( 'click', this ); 1997 if ( window.PointerEvent ) { 1998 handle.style.touchAction = touchAction; 1999 } 2000 } 2001}; 2002 2003proto._touchActionValue = 'none'; 2004 2005 2006proto.pointerDown = function( event, pointer ) { 2007 var isOkay = this.okayPointerDown( event ); 2008 if ( !isOkay ) { 2009 return; 2010 } 2011 this.pointerDownPointer = { 2012 pageX: pointer.pageX, 2013 pageY: pointer.pageY, 2014 }; 2015 2016 event.preventDefault(); 2017 this.pointerDownBlur(); 2018 this._bindPostStartEvents( event ); 2019 this.emitEvent( 'pointerDown', [ event, pointer ] ); 2020}; 2021 2022var cursorNodes = { 2023 TEXTAREA: true, 2024 INPUT: true, 2025 SELECT: true, 2026 OPTION: true, 2027}; 2028 2029var clickTypes = { 2030 radio: true, 2031 checkbox: true, 2032 button: true, 2033 submit: true, 2034 image: true, 2035 file: true, 2036}; 2037 2038proto.okayPointerDown = function( event ) { 2039 var isCursorNode = cursorNodes[ event.target.nodeName ];
vendor: 8,927 bytes, lines 2040-2394
2040 var isClickType = clickTypes[ event.target.type ]; 2041 var isOkay = !isCursorNode || isClickType; 2042 if ( !isOkay ) { 2043 this._pointerReset(); 2044 } 2045 return isOkay; 2046}; 2047 2048proto.pointerDownBlur = function() { 2049 var focused = document.activeElement; 2050 var canBlur = focused && focused.blur && focused != document.body; 2051 if ( canBlur ) { 2052 focused.blur(); 2053 } 2054}; 2055 2056 2057proto.pointerMove = function( event, pointer ) { 2058 var moveVector = this._dragPointerMove( event, pointer ); 2059 this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] ); 2060 this._dragMove( event, pointer, moveVector ); 2061}; 2062 2063proto._dragPointerMove = function( event, pointer ) { 2064 var moveVector = { 2065 x: pointer.pageX - this.pointerDownPointer.pageX, 2066 y: pointer.pageY - this.pointerDownPointer.pageY 2067 }; 2068 if ( !this.isDragging && this.hasDragStarted( moveVector ) ) { 2069 this._dragStart( event, pointer ); 2070 } 2071 return moveVector; 2072}; 2073 2074proto.hasDragStarted = function( moveVector ) { 2075 return Math.abs( moveVector.x ) > 3 || Math.abs( moveVector.y ) > 3; 2076}; 2077 2078 2079proto.pointerUp = function( event, pointer ) { 2080 this.emitEvent( 'pointerUp', [ event, pointer ] ); 2081 this._dragPointerUp( event, pointer ); 2082}; 2083 2084proto._dragPointerUp = function( event, pointer ) { 2085 if ( this.isDragging ) { 2086 this._dragEnd( event, pointer ); 2087 } else { 2088 this._staticClick( event, pointer ); 2089 } 2090}; 2091 2092 2093proto._dragStart = function( event, pointer ) { 2094 this.isDragging = true; 2095 this.isPreventingClicks = true; 2096 this.dragStart( event, pointer ); 2097}; 2098 2099proto.dragStart = function( event, pointer ) { 2100 this.emitEvent( 'dragStart', [ event, pointer ] ); 2101}; 2102 2103proto._dragMove = function( event, pointer, moveVector ) { 2104 if ( !this.isDragging ) { 2105 return; 2106 } 2107 2108 this.dragMove( event, pointer, moveVector ); 2109}; 2110 2111proto.dragMove = function( event, pointer, moveVector ) { 2112 event.preventDefault(); 2113 this.emitEvent( 'dragMove', [ event, pointer, moveVector ] ); 2114}; 2115 2116proto._dragEnd = function( event, pointer ) { 2117 this.isDragging = false; 2118 setTimeout( function() { 2119 delete this.isPreventingClicks; 2120 }.bind( this ) ); 2121 2122 this.dragEnd( event, pointer ); 2123}; 2124 2125proto.dragEnd = function( event, pointer ) { 2126 this.emitEvent( 'dragEnd', [ event, pointer ] ); 2127}; 2128 2129 2130proto.onclick = function( event ) { 2131 if ( this.isPreventingClicks ) { 2132 event.preventDefault(); 2133 } 2134}; 2135 2136 2137proto._staticClick = function( event, pointer ) { 2138 if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) { 2139 return; 2140 } 2141 2142 this.staticClick( event, pointer ); 2143 2144 if ( event.type != 'mouseup' ) { 2145 this.isIgnoringMouseUp = true; 2146 setTimeout( function() { 2147 delete this.isIgnoringMouseUp; 2148 }.bind( this ), 400 ); 2149 } 2150}; 2151 2152proto.staticClick = function( event, pointer ) { 2153 this.emitEvent( 'staticClick', [ event, pointer ] ); 2154}; 2155 2156 2157Unidragger.getPointerPoint = Unipointer.getPointerPoint; 2158 2159 2160return Unidragger; 2161 2162})); 2163 2164( function( window, factory ) { 2165 if ( typeof define == 'function' && define.amd ) { 2166 define( 'flickity/js/drag',[ 2167 './flickity', 2168 'unidragger/unidragger', 2169 'fizzy-ui-utils/utils', 2170 ], function( Flickity, Unidragger, utils ) { 2171 return factory( window, Flickity, Unidragger, utils ); 2172 } ); 2173 } else if ( typeof module == 'object' && module.exports ) { 2174 module.exports = factory( 2175 window, 2176 require('./flickity'), 2177 require('unidragger'), 2178 require('fizzy-ui-utils') 2179 ); 2180 } else { 2181 window.Flickity = factory( 2182 window, 2183 window.Flickity, 2184 window.Unidragger, 2185 window.fizzyUIUtils 2186 ); 2187 } 2188 2189}( window, function factory( window, Flickity, Unidragger, utils ) { 2190 2191 2192 2193 2194utils.extend( Flickity.defaults, { 2195 draggable: '>1', 2196 dragThreshold: 3, 2197} ); 2198 2199 2200Flickity.createMethods.push('_createDrag'); 2201 2202 2203var proto = Flickity.prototype; 2204utils.extend( proto, Unidragger.prototype ); 2205proto._touchActionValue = 'pan-y'; 2206 2207 2208proto._createDrag = function() { 2209 this.on( 'activate', this.onActivateDrag ); 2210 this.on( 'uiChange', this._uiChangeDrag ); 2211 this.on( 'deactivate', this.onDeactivateDrag ); 2212 this.on( 'cellChange', this.updateDraggable ); 2213}; 2214 2215proto.onActivateDrag = function() { 2216 this.handles = [ this.viewport ]; 2217 this.bindHandles(); 2218 this.updateDraggable(); 2219}; 2220 2221proto.onDeactivateDrag = function() { 2222 this.unbindHandles(); 2223 this.element.classList.remove('is-draggable'); 2224}; 2225 2226proto.updateDraggable = function() { 2227 if ( this.options.draggable == '>1' ) { 2228 this.isDraggable = this.slides.length > 1; 2229 } else { 2230 this.isDraggable = this.options.draggable; 2231 } 2232 if ( this.isDraggable ) { 2233 this.element.classList.add('is-draggable'); 2234 } else { 2235 this.element.classList.remove('is-draggable'); 2236 } 2237}; 2238 2239proto.bindDrag = function() { 2240 this.options.draggable = true; 2241 this.updateDraggable(); 2242}; 2243 2244proto.unbindDrag = function() { 2245 this.options.draggable = false; 2246 this.updateDraggable(); 2247}; 2248 2249proto._uiChangeDrag = function() { 2250 delete this.isFreeScrolling; 2251}; 2252 2253 2254proto.pointerDown = function( event, pointer ) { 2255 if ( !this.isDraggable ) { 2256 this._pointerDownDefault( event, pointer ); 2257 return; 2258 } 2259 var isOkay = this.okayPointerDown( event ); 2260 if ( !isOkay ) { 2261 return; 2262 } 2263 2264 this._pointerDownPreventDefault( event ); 2265 this.pointerDownFocus( event ); 2266 if ( document.activeElement != this.element ) { 2267 this.pointerDownBlur(); 2268 } 2269 2270 this.dragX = this.x; 2271 this.viewport.classList.add('is-pointer-down'); 2272 this.pointerDownScroll = getScrollPosition(); 2273 window.addEventListener( 'scroll', this ); 2274 2275 this._pointerDownDefault( event, pointer ); 2276}; 2277 2278proto._pointerDownDefault = function( event, pointer ) { 2279 this.pointerDownPointer = { 2280 pageX: pointer.pageX, 2281 pageY: pointer.pageY, 2282 }; 2283 this._bindPostStartEvents( event ); 2284 this.dispatchEvent( 'pointerDown', event, [ pointer ] ); 2285}; 2286 2287var focusNodes = { 2288 INPUT: true, 2289 TEXTAREA: true, 2290 SELECT: true, 2291}; 2292 2293proto.pointerDownFocus = function( event ) { 2294 var isFocusNode = focusNodes[ event.target.nodeName ]; 2295 if ( !isFocusNode ) { 2296 this.focus(); 2297 } 2298}; 2299 2300proto._pointerDownPreventDefault = function( event ) { 2301 var isTouchStart = event.type == 'touchstart'; 2302 var isTouchPointer = event.pointerType == 'touch'; 2303 var isFocusNode = focusNodes[ event.target.nodeName ]; 2304 if ( !isTouchStart && !isTouchPointer && !isFocusNode ) { 2305 event.preventDefault(); 2306 } 2307}; 2308 2309 2310proto.hasDragStarted = function( moveVector ) { 2311 return Math.abs( moveVector.x ) > this.options.dragThreshold; 2312}; 2313 2314 2315proto.pointerUp = function( event, pointer ) { 2316 delete this.isTouchScrolling; 2317 this.viewport.classList.remove('is-pointer-down'); 2318 this.dispatchEvent( 'pointerUp', event, [ pointer ] ); 2319 this._dragPointerUp( event, pointer ); 2320}; 2321 2322proto.pointerDone = function() { 2323 window.removeEventListener( 'scroll', this ); 2324 delete this.pointerDownScroll; 2325}; 2326 2327 2328proto.dragStart = function( event, pointer ) { 2329 if ( !this.isDraggable ) { 2330 return; 2331 } 2332 this.dragStartPosition = this.x; 2333 this.startAnimation(); 2334 window.removeEventListener( 'scroll', this ); 2335 this.dispatchEvent( 'dragStart', event, [ pointer ] ); 2336}; 2337 2338proto.pointerMove = function( event, pointer ) { 2339 var moveVector = this._dragPointerMove( event, pointer ); 2340 this.dispatchEvent( 'pointerMove', event, [ pointer, moveVector ] ); 2341 this._dragMove( event, pointer, moveVector ); 2342}; 2343 2344proto.dragMove = function( event, pointer, moveVector ) { 2345 if ( !this.isDraggable ) { 2346 return; 2347 } 2348 event.preventDefault(); 2349 2350 this.previousDragX = this.dragX; 2351 var direction = this.options.rightToLeft ? -1 : 1; 2352 if ( this.options.wrapAround ) { 2353 moveVector.x %= this.slideableWidth; 2354 } 2355 var dragX = this.dragStartPosition + moveVector.x * direction; 2356 2357 if ( !this.options.wrapAround && this.slides.length ) { 2358 var originBound = Math.max( -this.slides[0].target, this.dragStartPosition ); 2359 dragX = dragX > originBound ? ( dragX + originBound ) * 0.5 : dragX; 2360 var endBound = Math.min( -this.getLastSlide().target, this.dragStartPosition ); 2361 dragX = dragX < endBound ? ( dragX + endBound ) * 0.5 : dragX; 2362 } 2363 2364 this.dragX = dragX; 2365 2366 this.dragMoveTime = new Date(); 2367 this.dispatchEvent( 'dragMove', event, [ pointer, moveVector ] ); 2368}; 2369 2370proto.dragEnd = function( event, pointer ) { 2371 if ( !this.isDraggable ) { 2372 return; 2373 } 2374 if ( this.options.freeScroll ) { 2375 this.isFreeScrolling = true; 2376 } 2377 var index = this.dragEndRestingSelect(); 2378 2379 if ( this.options.freeScroll && !this.options.wrapAround ) { 2380 var restingX = this.getRestingPosition(); 2381 this.isFreeScrolling = -restingX > this.slides[0].target && 2382 -restingX < this.getLastSlide().target; 2383 } else if ( !this.options.freeScroll && index == this.selectedIndex ) { 2384 index += this.dragEndBoostSelect(); 2385 } 2386 delete this.previousDragX; 2387 this.isDragSelect = this.options.wrapAround; 2388 this.select( index ); 2389 delete this.isDragSelect; 2390 this.dispatchEvent( 'dragEnd', event, [ pointer ] ); 2391}; 2392 2393proto.dragEndRestingSelect = function() { 2394 var restingX = this.getRestingPosition();
2395 var distance = Math.abs( this.getSlideDistance( -restingX, this.selectedIndex ) ); 2396 var positiveResting = this._getClosestResting( restingX, distance, 1 ); 2397 var negativeResting = this._getClosestResting( restingX, distance, -1 ); 2398 var index = positiveResting.distance < negativeResting.distance ? 2399 positiveResting.index : negativeResting.index; 2400 return index; 2401}; 2402 2403proto._getClosestResting = function( restingX, distance, increment ) { 2404 var index = this.selectedIndex; 2405 var minDistance = Infinity; 2406 var condition = this.options.contain && !this.options.wrapAround ? 2407 function( dist, minDist ) { 2408 return dist <= minDist; 2409 } : function( dist, minDist ) { 2410 return dist < minDist; 2411 }; 2412 while ( condition( distance, minDistance ) ) { 2413 index += increment; 2414 minDistance = distance; 2415 distance = this.getSlideDistance( -restingX, index ); 2416 if ( distance === null ) { 2417 break; 2418 } 2419 distance = Math.abs( distance ); 2420 } 2421 return { 2422 distance: minDistance, 2423 index: index - increment, 2424 }; 2425}; 2426 2427proto.getSlideDistance = function( x, index ) { 2428 var len = this.slides.length; 2429 var isWrapAround = this.options.wrapAround && len > 1; 2430 var slideIndex = isWrapAround ? utils.modulo( index, len ) : index; 2431 var slide = this.slides[ slideIndex ]; 2432 if ( !slide ) { 2433 return null; 2434 } 2435 var wrap = isWrapAround ? this.slideableWidth * Math.floor( index/len ) : 0; 2436 return x - ( slide.target + wrap ); 2437}; 2438 2439proto.dragEndBoostSelect = function() { 2440 if ( this.previousDragX === undefined || !this.dragMoveTime || 2441 new Date() - this.dragMoveTime > 100 ) { 2442 return 0; 2443 } 2444 2445 var distance = this.getSlideDistance( -this.dragX, this.selectedIndex ); 2446 var delta = this.previousDragX - this.dragX; 2447 if ( distance > 0 && delta > 0 ) { 2448 return 1; 2449 } else if ( distance < 0 && delta < 0 ) { 2450 return -1; 2451 } 2452 return 0; 2453}; 2454 2455 2456proto.staticClick = function( event, pointer ) { 2457 var clickedCell = this.getParentCell( event.target ); 2458 var cellElem = clickedCell && clickedCell.element; 2459 var cellIndex = clickedCell && this.cells.indexOf( clickedCell ); 2460 this.dispatchEvent( 'staticClick', event, [ pointer, cellElem, cellIndex ] ); 2461}; 2462 2463 2464proto.onscroll = function() { 2465 var scroll = getScrollPosition(); 2466 var scrollMoveX = this.pointerDownScroll.x - scroll.x; 2467 var scrollMoveY = this.pointerDownScroll.y - scroll.y; 2468 if ( Math.abs( scrollMoveX ) > 3 || Math.abs( scrollMoveY ) > 3 ) { 2469 this._pointerDone(); 2470 } 2471}; 2472 2473 2474function getScrollPosition() { 2475 return { 2476 x: window.pageXOffset, 2477 y: window.pageYOffset, 2478 }; 2479} 2480 2481 2482return Flickity; 2483 2484} ) ); 2485 2486( function( window, factory ) { 2487 if ( typeof define == 'function' && define.amd ) { 2488 define( 'flickity/js/prev-next-button',[ 2489 './flickity', 2490 'unipointer/unipointer', 2491 'fizzy-ui-utils/utils', 2492 ], function( Flickity, Unipointer, utils ) { 2493 return factory( window, Flickity, Unipointer, utils ); 2494 } ); 2495 } else if ( typeof module == 'object' && module.exports ) { 2496 module.exports = factory( 2497 window, 2498 require('./flickity'), 2499 require('unipointer'), 2500 require('fizzy-ui-utils') 2501 ); 2502 } else { 2503 factory( 2504 window, 2505 window.Flickity, 2506 window.Unipointer, 2507 window.fizzyUIUtils 2508 ); 2509 } 2510 2511}( window, function factory( window, Flickity, Unipointer, utils ) { 2512'use strict'; 2513 2514var svgURI = 'http://www.w3.org/2000/svg'; 2515 2516 2517function PrevNextButton( direction, parent ) { 2518 this.direction = direction; 2519 this.parent = parent; 2520 this._create(); 2521} 2522 2523PrevNextButton.prototype = Object.create( Unipointer.prototype ); 2524 2525PrevNextButton.prototype._create = function() { 2526 this.isEnabled = true; 2527 this.isPrevious = this.direction == -1; 2528 var leftDirection = this.parent.options.rightToLeft ? 1 : -1; 2529 this.isLeft = this.direction == leftDirection; 2530 2531 var element = this.element = document.createElement('button'); 2532 element.className = 'flickity-button flickity-prev-next-button'; 2533 element.className += this.isPrevious ? ' previous' : ' next'; 2534 element.setAttribute( 'type', 'button' ); 2535 this.disable(); 2536 2537 element.setAttribute( 'aria-label', this.isPrevious ? 'Previous' : 'Next' ); 2538 2539 var svg = this.createSVG(); 2540 element.appendChild( svg ); 2541 this.parent.on( 'select', this.update.bind( this ) ); 2542 this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) ); 2543}; 2544 2545PrevNextButton.prototype.activate = function() { 2546 this.bindStartEvent( this.element ); 2547 this.element.addEventListener( 'click', this ); 2548 this.parent.element.appendChild( this.element ); 2549}; 2550 2551PrevNextButton.prototype.deactivate = function() { 2552 this.parent.element.removeChild( this.element ); 2553 this.unbindStartEvent( this.element ); 2554 this.element.removeEventListener( 'click', this ); 2555}; 2556 2557PrevNextButton.prototype.createSVG = function() { 2558 var svg = document.createElementNS( svgURI, 'svg' ); 2559 svg.setAttribute( 'class', 'flickity-button-icon' ); 2560 svg.setAttribute( 'viewBox', '0 0 100 100' ); 2561 var path = document.createElementNS( svgURI, 'path' ); 2562 var pathMovements = getArrowMovements( this.parent.options.arrowShape ); 2563 path.setAttribute( 'd', pathMovements ); 2564 path.setAttribute( 'class', 'arrow' ); 2565 if ( !this.isLeft ) { 2566 path.setAttribute( 'transform', 'translate(100, 100) rotate(180) ' ); 2567 } 2568 svg.appendChild( path ); 2569 return svg; 2570}; 2571 2572function getArrowMovements( shape ) { 2573 if ( typeof shape == 'string' ) { 2574 return shape; 2575 } 2576 return 'M ' + shape.x0 + ',50' + 2577 ' L ' + shape.x1 + ',' + ( shape.y1 + 50 ) + 2578 ' L ' + shape.x2 + ',' + ( shape.y2 + 50 ) + 2579 ' L ' + shape.x3 + ',50 ' + 2580 ' L ' + shape.x2 + ',' + ( 50 - shape.y2 ) + 2581 ' L ' + shape.x1 + ',' + ( 50 - shape.y1 ) + 2582 ' Z'; 2583} 2584 2585PrevNextButton.prototype.handleEvent = utils.handleEvent; 2586 2587PrevNextButton.prototype.onclick = function() { 2588 if ( !this.isEnabled ) { 2589 return; 2590 } 2591 this.parent.uiChange(); 2592 var method = this.isPrevious ? 'previous' : 'next'; 2593 this.parent[ method ](); 2594}; 2595 2596 2597PrevNextButton.prototype.enable = function() { 2598 if ( this.isEnabled ) { 2599 return; 2600 } 2601 this.element.disabled = false;
2602 this.isEnabled = true; 2603}; 2604 2605PrevNextButton.prototype.disable = function() { 2606 if ( !this.isEnabled ) { 2607 return; 2608 } 2609 this.element.disabled = true; 2610 this.isEnabled = false; 2611}; 2612 2613PrevNextButton.prototype.update = function() { 2614 var slides = this.parent.slides; 2615 if ( this.parent.options.wrapAround && slides.length > 1 ) { 2616 this.enable(); 2617 return; 2618 } 2619 var lastIndex = slides.length ? slides.length - 1 : 0; 2620 var boundIndex = this.isPrevious ? 0 : lastIndex; 2621 var method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable'; 2622 this[ method ](); 2623}; 2624 2625PrevNextButton.prototype.destroy = function() { 2626 this.deactivate(); 2627 this.allOff(); 2628}; 2629 2630 2631utils.extend( Flickity.defaults, { 2632 prevNextButtons: true, 2633 arrowShape: { 2634 x0: 10, 2635 x1: 60, y1: 50, 2636 x2: 70, y2: 40, 2637 x3: 30, 2638 }, 2639} ); 2640 2641Flickity.createMethods.push('_createPrevNextButtons'); 2642var proto = Flickity.prototype; 2643 2644proto._createPrevNextButtons = function() { 2645 if ( !this.options.prevNextButtons ) { 2646 return; 2647 } 2648 2649 this.prevButton = new PrevNextButton( -1, this ); 2650 this.nextButton = new PrevNextButton( 1, this ); 2651 2652 this.on( 'activate', this.activatePrevNextButtons ); 2653}; 2654 2655proto.activatePrevNextButtons = function() { 2656 this.prevButton.activate(); 2657 this.nextButton.activate(); 2658 this.on( 'deactivate', this.deactivatePrevNextButtons ); 2659}; 2660 2661proto.deactivatePrevNextButtons = function() { 2662 this.prevButton.deactivate(); 2663 this.nextButton.deactivate(); 2664 this.off( 'deactivate', this.deactivatePrevNextButtons ); 2665}; 2666 2667 2668Flickity.PrevNextButton = PrevNextButton; 2669 2670return Flickity; 2671 2672} ) ); 2673 2674( function( window, factory ) { 2675 if ( typeof define == 'function' && define.amd ) { 2676 define( 'flickity/js/page-dots',[ 2677 './flickity', 2678 'unipointer/unipointer', 2679 'fizzy-ui-utils/utils', 2680 ], function( Flickity, Unipointer, utils ) { 2681 return factory( window, Flickity, Unipointer, utils ); 2682 } ); 2683 } else if ( typeof module == 'object' && module.exports ) { 2684 module.exports = factory( 2685 window, 2686 require('./flickity'), 2687 require('unipointer'), 2688 require('fizzy-ui-utils') 2689 ); 2690 } else { 2691 factory( 2692 window, 2693 window.Flickity, 2694 window.Unipointer, 2695 window.fizzyUIUtils 2696 ); 2697 } 2698 2699}( window, function factory( window, Flickity, Unipointer, utils ) { 2700 2701 2702 2703 2704function PageDots( parent ) { 2705 this.parent = parent; 2706 this._create(); 2707} 2708 2709PageDots.prototype = Object.create( Unipointer.prototype ); 2710 2711PageDots.prototype._create = function() { 2712 this.holder = document.createElement('ol'); 2713 this.holder.className = 'flickity-page-dots'; 2714 this.dots = []; 2715 this.handleClick = this.onClick.bind( this ); 2716 this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) ); 2717}; 2718 2719PageDots.prototype.activate = function() { 2720 this.setDots(); 2721 this.holder.addEventListener( 'click', this.handleClick ); 2722 this.bindStartEvent( this.holder ); 2723 this.parent.element.appendChild( this.holder ); 2724}; 2725 2726PageDots.prototype.deactivate = function() { 2727 this.holder.removeEventListener( 'click', this.handleClick ); 2728 this.unbindStartEvent( this.holder ); 2729 this.parent.element.removeChild( this.holder ); 2730}; 2731 2732PageDots.prototype.setDots = function() { 2733 var delta = this.parent.slides.length - this.dots.length; 2734 if ( delta > 0 ) { 2735 this.addDots( delta ); 2736 } else if ( delta < 0 ) { 2737 this.removeDots( -delta ); 2738 } 2739}; 2740 2741PageDots.prototype.addDots = function( count ) { 2742 var fragment = document.createDocumentFragment(); 2743 var newDots = []; 2744 var length = this.dots.length; 2745 var max = length + count; 2746 2747 for ( var i = length; i < max; i++ ) { 2748 var dot = document.createElement('li'); 2749 dot.className = 'dot'; 2750 dot.setAttribute( 'aria-label', 'Page dot ' + ( i + 1 ) ); 2751 fragment.appendChild( dot ); 2752 newDots.push( dot ); 2753 } 2754 2755 this.holder.appendChild( fragment ); 2756 this.dots = this.dots.concat( newDots ); 2757}; 2758 2759PageDots.prototype.removeDots = function( count ) { 2760 var removeDots = this.dots.splice( this.dots.length - count, count ); 2761 removeDots.forEach( function( dot ) { 2762 this.holder.removeChild( dot ); 2763 }, this ); 2764}; 2765 2766PageDots.prototype.updateSelected = function() { 2767 if ( this.selectedDot ) { 2768 this.selectedDot.className = 'dot'; 2769 this.selectedDot.removeAttribute('aria-current'); 2770 } 2771 if ( !this.dots.length ) { 2772 return; 2773 } 2774 this.selectedDot = this.dots[ this.parent.selectedIndex ]; 2775 this.selectedDot.className = 'dot is-selected'; 2776 this.selectedDot.setAttribute( 'aria-current', 'step' ); 2777}; 2778 2779PageDots.prototype.onTap = 2780PageDots.prototype.onClick = function( event ) { 2781 var target = event.target; 2782 if ( target.nodeName != 'LI' ) { 2783 return; 2784 } 2785 2786 this.parent.uiChange(); 2787 var index = this.dots.indexOf( target ); 2788 this.parent.select( index ); 2789}; 2790 2791PageDots.prototype.destroy = function() { 2792 this.deactivate(); 2793 this.allOff(); 2794}; 2795 2796Flickity.PageDots = PageDots; 2797 2798 2799utils.extend( Flickity.defaults, { 2800 pageDots: true, 2801} ); 2802 2803Flickity.createMethods.push('_createPageDots'); 2804 2805var proto = Flickity.prototype; 2806 2807proto._createPageDots = function() { 2808 if ( !this.options.pageDots ) { 2809 return; 2810 } 2811 this.pageDots = new PageDots( this ); 2812 this.on( 'activate', this.activatePageDots ); 2813 this.on( 'select', this.updateSelectedPageDots ); 2814 this.on( 'cellChange', this.updatePageDots ); 2815 this.on( 'resize', this.updatePageDots ); 2816 this.on( 'deactivate', this.deactivatePageDots ); 2817}; 2818 2819proto.activatePageDots = function() { 2820 this.pageDots.activate(); 2821}; 2822 2823proto.updateSelectedPageDots = function() { 2824 this.pageDots.updateSelected(); 2825}; 2826 2827proto.updatePageDots = function() { 2828 this.pageDots.setDots(); 2829}; 2830 2831proto.deactivatePageDots = function() { 2832 this.pageDots.deactivate(); 2833}; 2834 2835 2836Flickity.PageDots = PageDots; 2837 2838return Flickity; 2839 2840} ) ); 2841 2842( function( window, factory ) { 2843 if ( typeof define == 'function' && define.amd ) { 2844 define( 'flickity/js/player',[ 2845 'ev-emitter/ev-emitter', 2846 'fizzy-ui-utils/utils', 2847 './flickity', 2848 ], function( EvEmitter, utils, Flickity ) { 2849 return factory( EvEmitter, utils, Flickity ); 2850 } ); 2851 } else if ( typeof module == 'object' && module.exports ) { 2852 module.exports = factory( 2853 require('ev-emitter'), 2854 require('fizzy-ui-utils'), 2855 require('./flickity') 2856 ); 2857 } else { 2858 factory( 2859 window.EvEmitter, 2860 window.fizzyUIUtils, 2861 window.Flickity 2862 ); 2863 } 2864 2865}( window, function factory( EvEmitter, utils, Flickity ) { 2866 2867 2868 2869 2870function Player( parent ) { 2871 this.parent = parent; 2872 this.state = 'stopped'; 2873 this.onVisibilityChange = this.visibilityChange.bind( this ); 2874 this.onVisibilityPlay = this.visibilityPlay.bind( this ); 2875} 2876 2877Player.prototype = Object.create( EvEmitter.prototype ); 2878 2879Player.prototype.play = function() { 2880 if ( this.state == 'playing' ) { 2881 return; 2882 } 2883 var isPageHidden = document.hidden; 2884 if ( isPageHidden ) { 2885 document.addEventListener( 'visibilitychange', this.onVisibilityPlay ); 2886 return; 2887 } 2888 2889 this.state = 'playing'; 2890 document.addEventListener( 'visibilitychange', this.onVisibilityChange ); 2891 this.tick(); 2892}; 2893 2894Player.prototype.tick = function() { 2895 if ( this.state != 'playing' ) { 2896 return; 2897 } 2898 2899 var time = this.parent.options.autoPlay; 2900 time = typeof time == 'number' ? time : 3000; 2901 var _this = this; 2902 this.clear(); 2903 this.timeout = setTimeout( function() { 2904 _this.parent.next( true ); 2905 _this.tick(); 2906 }, time ); 2907}; 2908 2909Player.prototype.stop = function() { 2910 this.state = 'stopped'; 2911 this.clear(); 2912 document.removeEventListener( 'visibilitychange', this.onVisibilityChange ); 2913}; 2914 2915Player.prototype.clear = function() { 2916 clearTimeout( this.timeout ); 2917}; 2918 2919Player.prototype.pause = function() { 2920 if ( this.state == 'playing' ) { 2921 this.state = 'paused'; 2922 this.clear(); 2923 } 2924}; 2925 2926Player.prototype.unpause = function() { 2927 if ( this.state == 'paused' ) { 2928 this.play(); 2929 } 2930}; 2931 2932Player.prototype.visibilityChange = function() { 2933 var isPageHidden = document.hidden; 2934 this[ isPageHidden ? 'pause' : 'unpause' ](); 2935}; 2936 2937Player.prototype.visibilityPlay = function() { 2938 this.play(); 2939 document.removeEventListener( 'visibilitychange', this.onVisibilityPlay ); 2940}; 2941 2942 2943utils.extend( Flickity.defaults, { 2944 pauseAutoPlayOnHover: true, 2945} ); 2946 2947Flickity.createMethods.push('_createPlayer'); 2948var proto = Flickity.prototype; 2949 2950proto._createPlayer = function() { 2951 this.player = new Player( this ); 2952 2953 this.on( 'activate', this.activatePlayer ); 2954 this.on( 'uiChange', this.stopPlayer ); 2955 this.on( 'pointerDown', this.stopPlayer ); 2956 this.on( 'deactivate', this.deactivatePlayer ); 2957}; 2958 2959proto.activatePlayer = function() { 2960 if ( !this.options.autoPlay ) { 2961 return; 2962 } 2963 this.player.play(); 2964 this.element.addEventListener( 'mouseenter', this ); 2965}; 2966 2967 2968proto.playPlayer = function() { 2969 this.player.play(); 2970}; 2971 2972proto.stopPlayer = function() { 2973 this.player.stop(); 2974}; 2975 2976proto.pausePlayer = function() { 2977 this.player.pause(); 2978}; 2979 2980proto.unpausePlayer = function() { 2981 this.player.unpause(); 2982}; 2983 2984proto.deactivatePlayer = function() { 2985 this.player.stop(); 2986 this.element.removeEventListener( 'mouseenter', this ); 2987}; 2988 2989 2990proto.onmouseenter = function() { 2991 if ( !this.options.pauseAutoPlayOnHover ) { 2992 return; 2993 } 2994 this.player.pause(); 2995 this.element.addEventListener( 'mouseleave', this ); 2996}; 2997 2998proto.onmouseleave = function() { 2999 this.player.unpause(); 3000 this.element.removeEventListener( 'mouseleave', this ); 3001}; 3002 3003 3004Flickity.Player = Player; 3005 3006return Flickity; 3007 3008} ) ); 3009 3010( function( window, factory ) { 3011 if ( typeof define == 'function' && define.amd ) { 3012 define( 'flickity/js/add-remove-cell',[ 3013 './flickity', 3014 'fizzy-ui-utils/utils', 3015 ], function( Flickity, utils ) { 3016 return factory( window, Flickity, utils ); 3017 } ); 3018 } else if ( typeof module == 'object' && module.exports ) { 3019 module.exports = factory( 3020 window, 3021 require('./flickity'), 3022 require('fizzy-ui-utils') 3023 ); 3024 } else { 3025 factory( 3026 window, 3027 window.Flickity, 3028 window.fizzyUIUtils 3029 ); 3030 } 3031 3032}( window, function factory( window, Flickity, utils ) { 3033 3034 3035 3036function getCellsFragment( cells ) { 3037 var fragment = document.createDocumentFragment();
3038 cells.forEach( function( cell ) { 3039 fragment.appendChild( cell.element ); 3040 } ); 3041 return fragment; 3042} 3043 3044 3045var proto = Flickity.prototype; 3046 3047proto.insert = function( elems, index ) { 3048 var cells = this._makeCells( elems ); 3049 if ( !cells || !cells.length ) { 3050 return; 3051 } 3052 var len = this.cells.length; 3053 index = index === undefined ? len : index; 3054 var fragment = getCellsFragment( cells ); 3055 var isAppend = index == len; 3056 if ( isAppend ) { 3057 this.slider.appendChild( fragment ); 3058 } else { 3059 var insertCellElement = this.cells[ index ].element; 3060 this.slider.insertBefore( fragment, insertCellElement ); 3061 } 3062 if ( index === 0 ) { 3063 this.cells = cells.concat( this.cells ); 3064 } else if ( isAppend ) { 3065 this.cells = this.cells.concat( cells ); 3066 } else { 3067 var endCells = this.cells.splice( index, len - index ); 3068 this.cells = this.cells.concat( cells ).concat( endCells ); 3069 } 3070 3071 this._sizeCells( cells ); 3072 this.cellChange( index, true ); 3073}; 3074 3075proto.append = function( elems ) { 3076 this.insert( elems, this.cells.length ); 3077}; 3078 3079proto.prepend = function( elems ) { 3080 this.insert( elems, 0 ); 3081}; 3082 3083proto.remove = function( elems ) { 3084 var cells = this.getCells( elems ); 3085 if ( !cells || !cells.length ) { 3086 return; 3087 } 3088 3089 var minCellIndex = this.cells.length - 1; 3090 cells.forEach( function( cell ) { 3091 cell.remove(); 3092 var index = this.cells.indexOf( cell ); 3093 minCellIndex = Math.min( index, minCellIndex ); 3094 utils.removeFrom( this.cells, cell ); 3095 }, this ); 3096 3097 this.cellChange( minCellIndex, true ); 3098}; 3099 3100proto.cellSizeChange = function( elem ) { 3101 var cell = this.getCell( elem ); 3102 if ( !cell ) { 3103 return; 3104 } 3105 cell.getSize(); 3106 3107 var index = this.cells.indexOf( cell ); 3108 this.cellChange( index ); 3109}; 3110 3111proto.cellChange = function( changedCellIndex, isPositioningSlider ) { 3112 var prevSelectedElem = this.selectedElement; 3113 this._positionCells( changedCellIndex ); 3114 this._getWrapShiftCells(); 3115 this.setGallerySize(); 3116 var cell = this.getCell( prevSelectedElem ); 3117 if ( cell ) { 3118 this.selectedIndex = this.getCellSlideIndex( cell ); 3119 } 3120 this.selectedIndex = Math.min( this.slides.length - 1, this.selectedIndex ); 3121 3122 this.emitEvent( 'cellChange', [ changedCellIndex ] ); 3123 this.select( this.selectedIndex ); 3124 if ( isPositioningSlider ) { 3125 this.positionSliderAtSelected(); 3126 } 3127}; 3128 3129 3130return Flickity; 3131 3132} ) ); 3133 3134( function( window, factory ) { 3135 if ( typeof define == 'function' && define.amd ) { 3136 define( 'flickity/js/lazyload',[ 3137 './flickity', 3138 'fizzy-ui-utils/utils', 3139 ], function( Flickity, utils ) { 3140 return factory( window, Flickity, utils ); 3141 } ); 3142 } else if ( typeof module == 'object' && module.exports ) { 3143 module.exports = factory( 3144 window, 3145 require('./flickity'), 3146 require('fizzy-ui-utils') 3147 ); 3148 } else { 3149 factory( 3150 window, 3151 window.Flickity, 3152 window.fizzyUIUtils 3153 ); 3154 } 3155 3156}( window, function factory( window, Flickity, utils ) { 3157'use strict'; 3158 3159Flickity.createMethods.push('_createLazyload'); 3160var proto = Flickity.prototype; 3161 3162proto._createLazyload = function() { 3163 this.on( 'select', this.lazyLoad ); 3164}; 3165 3166proto.lazyLoad = function() { 3167 var lazyLoad = this.options.lazyLoad; 3168 if ( !lazyLoad ) { 3169 return; 3170 } 3171 var adjCount = typeof lazyLoad == 'number' ? lazyLoad : 0; 3172 var cellElems = this.getAdjacentCellElements( adjCount ); 3173 var lazyImages = [];
3174 cellElems.forEach( function( cellElem ) { 3175 var lazyCellImages = getCellLazyImages( cellElem ); 3176 lazyImages = lazyImages.concat( lazyCellImages ); 3177 } ); 3178 lazyImages.forEach( function( img ) { 3179 new LazyLoader( img, this ); 3180 }, this ); 3181}; 3182 3183function getCellLazyImages( cellElem ) { 3184 if ( cellElem.nodeName == 'IMG' ) { 3185 var lazyloadAttr = cellElem.getAttribute('data-flickity-lazyload'); 3186 var srcAttr = cellElem.getAttribute('data-flickity-lazyload-src'); 3187 var srcsetAttr = cellElem.getAttribute('data-flickity-lazyload-srcset'); 3188 if ( lazyloadAttr || srcAttr || srcsetAttr ) { 3189 return [ cellElem ]; 3190 } 3191 } 3192 var lazySelector = 'img[data-flickity-lazyload], ' + 3193 'img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]'; 3194 var imgs = cellElem.querySelectorAll( lazySelector ); 3195 return utils.makeArray( imgs ); 3196} 3197 3198 3199function LazyLoader( img, flickity ) { 3200 this.img = img; 3201 this.flickity = flickity; 3202 this.load(); 3203} 3204 3205LazyLoader.prototype.handleEvent = utils.handleEvent; 3206 3207LazyLoader.prototype.load = function() { 3208 this.img.addEventListener( 'load', this ); 3209 this.img.addEventListener( 'error', this ); 3210 var src = this.img.getAttribute('data-flickity-lazyload') || 3211 this.img.getAttribute('data-flickity-lazyload-src'); 3212 var srcset = this.img.getAttribute('data-flickity-lazyload-srcset'); 3213 this.img.src = src; 3214 if ( srcset ) { 3215 this.img.setAttribute( 'srcset', srcset ); 3216 } 3217 this.img.removeAttribute('data-flickity-lazyload'); 3218 this.img.removeAttribute('data-flickity-lazyload-src'); 3219 this.img.removeAttribute('data-flickity-lazyload-srcset'); 3220}; 3221 3222LazyLoader.prototype.onload = function( event ) { 3223 this.complete( event, 'flickity-lazyloaded' ); 3224}; 3225 3226LazyLoader.prototype.onerror = function( event ) { 3227 this.complete( event, 'flickity-lazyerror' ); 3228}; 3229 3230LazyLoader.prototype.complete = function( event, className ) { 3231 this.img.removeEventListener( 'load', this ); 3232 this.img.removeEventListener( 'error', this ); 3233 3234 var cell = this.flickity.getParentCell( this.img ); 3235 var cellElem = cell && cell.element; 3236 this.flickity.cellSizeChange( cellElem ); 3237 3238 this.img.classList.add( className ); 3239 this.flickity.dispatchEvent( 'lazyLoad', event, cellElem ); 3240}; 3241 3242 3243Flickity.LazyLoader = LazyLoader; 3244 3245return Flickity; 3246 3247} ) ); 3248 3249/*! 3250 * Flickity v2.3.0 3251 * Touch, responsive, flickable carousels 3252 * 3253 * Licensed GPLv3 for open source use 3254 * or Flickity Commercial License for commercial use 3255 * 3256 * https://flickity.metafizzy.co 3257 * Copyright 2015-2021 Metafizzy 3258 */ 3259 3260( function( window, factory ) { 3261 if ( typeof define == 'function' && define.amd ) { 3262 define( 'flickity/js/index',[ 3263 './flickity', 3264 './drag', 3265 './prev-next-button', 3266 './page-dots', 3267 './player', 3268 './add-remove-cell', 3269 './lazyload', 3270 ], factory ); 3271 } else if ( typeof module == 'object' && module.exports ) { 3272 module.exports = factory( 3273 require('./flickity'), 3274 require('./drag'), 3275 require('./prev-next-button'), 3276 require('./page-dots'), 3277 require('./player'), 3278 require('./add-remove-cell'), 3279 require('./lazyload') 3280 ); 3281 } 3282 3283} )( window, function factory( Flickity ) { 3284 return Flickity; 3285} ); 3286 3287/*! 3288 * Flickity asNavFor v2.0.2 3289 * enable asNavFor for Flickity 3290 */ 3291 3292 3293( function( window, factory ) { 3294 if ( typeof define == 'function' && define.amd ) { 3295 define( 'flickity-as-nav-for/as-nav-for',[ 3296 'flickity/js/index', 3297 'fizzy-ui-utils/utils' 3298 ], factory ); 3299 } else if ( typeof module == 'object' && module.exports ) { 3300 module.exports = factory( 3301 require('flickity'), 3302 require('fizzy-ui-utils') 3303 ); 3304 } else { 3305 window.Flickity = factory( 3306 window.Flickity, 3307 window.fizzyUIUtils 3308 ); 3309 } 3310 3311}( window, function factory( Flickity, utils ) { 3312 3313 3314 3315 3316 3317Flickity.createMethods.push('_createAsNavFor'); 3318 3319var proto = Flickity.prototype; 3320 3321proto._createAsNavFor = function() { 3322 this.on( 'activate', this.activateAsNavFor ); 3323 this.on( 'deactivate', this.deactivateAsNavFor ); 3324 this.on( 'destroy', this.destroyAsNavFor ); 3325 3326 var asNavForOption = this.options.asNavFor; 3327 if ( !asNavForOption ) { 3328 return; 3329 } 3330 var _this = this; 3331 setTimeout( function initNavCompanion() { 3332 _this.setNavCompanion( asNavForOption ); 3333 }); 3334}; 3335 3336proto.setNavCompanion = function( elem ) { 3337 elem = utils.getQueryElement( elem ); 3338 var companion = Flickity.data( elem ); 3339 if ( !companion || companion == this ) { 3340 return; 3341 } 3342 3343 this.navCompanion = companion; 3344 var _this = this; 3345 this.onNavCompanionSelect = function() { 3346 _this.navCompanionSelect(); 3347 }; 3348 companion.on( 'select', this.onNavCompanionSelect ); 3349 this.on( 'staticClick', this.onNavStaticClick ); 3350 3351 this.navCompanionSelect( true ); 3352}; 3353 3354proto.navCompanionSelect = function( isInstant ) { 3355 var companionCells = this.navCompanion && this.navCompanion.selectedCells; 3356 if ( !companionCells ) { 3357 return; 3358 } 3359 var selectedCell = companionCells[0]; 3360 var firstIndex = this.navCompanion.cells.indexOf( selectedCell ); 3361 var lastIndex = firstIndex + companionCells.length - 1; 3362 var selectIndex = Math.floor( lerp( firstIndex, lastIndex, 3363 this.navCompanion.cellAlign ) ); 3364 this.selectCell( selectIndex, false, isInstant ); 3365 this.removeNavSelectedElements(); 3366 if ( selectIndex >= this.cells.length ) { 3367 return; 3368 } 3369 3370 var selectedCells = this.cells.slice( firstIndex, lastIndex + 1 ); 3371 this.navSelectedElements = selectedCells.map( function( cell ) { 3372 return cell.element; 3373 }); 3374 this.changeNavSelectedClass('add'); 3375}; 3376 3377function lerp( a, b, t ) { 3378 return ( b - a ) * t + a; 3379} 3380 3381proto.changeNavSelectedClass = function( method ) {
vendor: 10,635 bytes, lines 3382-3830
3382 this.navSelectedElements.forEach( function( navElem ) { 3383 navElem.classList[ method ]('is-nav-selected'); 3384 }); 3385}; 3386 3387proto.activateAsNavFor = function() { 3388 this.navCompanionSelect( true ); 3389}; 3390 3391proto.removeNavSelectedElements = function() { 3392 if ( !this.navSelectedElements ) { 3393 return; 3394 } 3395 this.changeNavSelectedClass('remove'); 3396 delete this.navSelectedElements; 3397}; 3398 3399proto.onNavStaticClick = function( event, pointer, cellElement, cellIndex ) { 3400 if ( typeof cellIndex == 'number' ) { 3401 this.navCompanion.selectCell( cellIndex ); 3402 } 3403}; 3404 3405proto.deactivateAsNavFor = function() { 3406 this.removeNavSelectedElements(); 3407}; 3408 3409proto.destroyAsNavFor = function() { 3410 if ( !this.navCompanion ) { 3411 return; 3412 } 3413 this.navCompanion.off( 'select', this.onNavCompanionSelect ); 3414 this.off( 'staticClick', this.onNavStaticClick ); 3415 delete this.navCompanion; 3416}; 3417 3418 3419return Flickity; 3420 3421})); 3422 3423/*! 3424 * imagesLoaded v4.1.4 3425 * JavaScript is all like "You images are done yet or what?" 3426 * MIT License 3427 */ 3428 3429( function( window, factory ) { 'use strict'; 3430 3431 3432 if ( typeof define == 'function' && define.amd ) { 3433 define( 'imagesloaded/imagesloaded',[ 3434 'ev-emitter/ev-emitter' 3435 ], function( EvEmitter ) { 3436 return factory( window, EvEmitter ); 3437 }); 3438 } else if ( typeof module == 'object' && module.exports ) { 3439 module.exports = factory( 3440 window, 3441 require('ev-emitter') 3442 ); 3443 } else { 3444 window.imagesLoaded = factory( 3445 window, 3446 window.EvEmitter 3447 ); 3448 } 3449 3450})( typeof window !== 'undefined' ? window : this, 3451 3452 3453function factory( window, EvEmitter ) { 3454 3455 3456 3457var $ = window.jQuery; 3458var console = window.console; 3459 3460 3461function extend( a, b ) { 3462 for ( var prop in b ) { 3463 a[ prop ] = b[ prop ]; 3464 } 3465 return a; 3466} 3467 3468var arraySlice = Array.prototype.slice; 3469 3470function makeArray( obj ) { 3471 if ( Array.isArray( obj ) ) { 3472 return obj; 3473 } 3474 3475 var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number'; 3476 if ( isArrayLike ) { 3477 return arraySlice.call( obj ); 3478 } 3479 3480 return [ obj ]; 3481} 3482 3483 3484function ImagesLoaded( elem, options, onAlways ) { 3485 if ( !( this instanceof ImagesLoaded ) ) { 3486 return new ImagesLoaded( elem, options, onAlways ); 3487 } 3488 var queryElem = elem; 3489 if ( typeof elem == 'string' ) { 3490 queryElem = document.querySelectorAll( elem ); 3491 } 3492 if ( !queryElem ) { 3493 console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) ); 3494 return; 3495 } 3496 3497 this.elements = makeArray( queryElem ); 3498 this.options = extend( {}, this.options ); 3499 if ( typeof options == 'function' ) { 3500 onAlways = options; 3501 } else { 3502 extend( this.options, options ); 3503 } 3504 3505 if ( onAlways ) { 3506 this.on( 'always', onAlways ); 3507 } 3508 3509 this.getImages(); 3510 3511 if ( $ ) { 3512 this.jqDeferred = new $.Deferred(); 3513 } 3514 3515 setTimeout( this.check.bind( this ) ); 3516} 3517 3518ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); 3519 3520ImagesLoaded.prototype.options = {}; 3521 3522ImagesLoaded.prototype.getImages = function() { 3523 this.images = []; 3524 3525 this.elements.forEach( this.addElementImages, this ); 3526}; 3527 3528ImagesLoaded.prototype.addElementImages = function( elem ) { 3529 if ( elem.nodeName == 'IMG' ) { 3530 this.addImage( elem ); 3531 } 3532 if ( this.options.background === true ) { 3533 this.addElementBackgroundImages( elem ); 3534 } 3535 3536 var nodeType = elem.nodeType; 3537 if ( !nodeType || !elementNodeTypes[ nodeType ] ) { 3538 return; 3539 } 3540 var childImgs = elem.querySelectorAll('img'); 3541 for ( var i=0; i < childImgs.length; i++ ) { 3542 var img = childImgs[i]; 3543 this.addImage( img ); 3544 } 3545 3546 if ( typeof this.options.background == 'string' ) { 3547 var children = elem.querySelectorAll( this.options.background ); 3548 for ( i=0; i < children.length; i++ ) { 3549 var child = children[i]; 3550 this.addElementBackgroundImages( child ); 3551 } 3552 } 3553}; 3554 3555var elementNodeTypes = { 3556 1: true, 3557 9: true, 3558 11: true 3559}; 3560 3561ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { 3562 var style = getComputedStyle( elem ); 3563 if ( !style ) { 3564 return; 3565 } 3566 var reURL = /url\((['"])?(.*?)\1\)/gi; 3567 var matches = reURL.exec( style.backgroundImage ); 3568 while ( matches !== null ) { 3569 var url = matches && matches[2]; 3570 if ( url ) { 3571 this.addBackground( url, elem ); 3572 } 3573 matches = reURL.exec( style.backgroundImage ); 3574 } 3575}; 3576 3577ImagesLoaded.prototype.addImage = function( img ) { 3578 var loadingImage = new LoadingImage( img ); 3579 this.images.push( loadingImage ); 3580}; 3581 3582ImagesLoaded.prototype.addBackground = function( url, elem ) { 3583 var background = new Background( url, elem ); 3584 this.images.push( background ); 3585}; 3586 3587ImagesLoaded.prototype.check = function() { 3588 var _this = this; 3589 this.progressedCount = 0; 3590 this.hasAnyBroken = false; 3591 if ( !this.images.length ) { 3592 this.complete(); 3593 return; 3594 } 3595 3596 function onProgress( image, elem, message ) { 3597 setTimeout( function() { 3598 _this.progress( image, elem, message ); 3599 }); 3600 } 3601 3602 this.images.forEach( function( loadingImage ) { 3603 loadingImage.once( 'progress', onProgress ); 3604 loadingImage.check(); 3605 }); 3606}; 3607 3608ImagesLoaded.prototype.progress = function( image, elem, message ) { 3609 this.progressedCount++; 3610 this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; 3611 this.emitEvent( 'progress', [ this, image, elem ] ); 3612 if ( this.jqDeferred && this.jqDeferred.notify ) { 3613 this.jqDeferred.notify( this, image ); 3614 } 3615 if ( this.progressedCount == this.images.length ) { 3616 this.complete(); 3617 } 3618 3619 if ( this.options.debug && console ) { 3620 console.log( 'progress: ' + message, image, elem ); 3621 } 3622}; 3623 3624ImagesLoaded.prototype.complete = function() { 3625 var eventName = this.hasAnyBroken ? 'fail' : 'done'; 3626 this.isComplete = true; 3627 this.emitEvent( eventName, [ this ] ); 3628 this.emitEvent( 'always', [ this ] ); 3629 if ( this.jqDeferred ) { 3630 var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; 3631 this.jqDeferred[ jqMethod ]( this ); 3632 } 3633}; 3634 3635 3636function LoadingImage( img ) { 3637 this.img = img; 3638} 3639 3640LoadingImage.prototype = Object.create( EvEmitter.prototype ); 3641 3642LoadingImage.prototype.check = function() { 3643 var isComplete = this.getIsImageComplete(); 3644 if ( isComplete ) { 3645 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 3646 return; 3647 } 3648 3649 this.proxyImage = new Image(); 3650 this.proxyImage.addEventListener( 'load', this ); 3651 this.proxyImage.addEventListener( 'error', this ); 3652 this.img.addEventListener( 'load', this ); 3653 this.img.addEventListener( 'error', this ); 3654 this.proxyImage.src = this.img.src; 3655}; 3656 3657LoadingImage.prototype.getIsImageComplete = function() { 3658 return this.img.complete && this.img.naturalWidth; 3659}; 3660 3661LoadingImage.prototype.confirm = function( isLoaded, message ) { 3662 this.isLoaded = isLoaded; 3663 this.emitEvent( 'progress', [ this, this.img, message ] ); 3664}; 3665 3666 3667LoadingImage.prototype.handleEvent = function( event ) { 3668 var method = 'on' + event.type; 3669 if ( this[ method ] ) { 3670 this[ method ]( event ); 3671 } 3672}; 3673 3674LoadingImage.prototype.onload = function() { 3675 this.confirm( true, 'onload' ); 3676 this.unbindEvents(); 3677}; 3678 3679LoadingImage.prototype.onerror = function() { 3680 this.confirm( false, 'onerror' ); 3681 this.unbindEvents(); 3682}; 3683 3684LoadingImage.prototype.unbindEvents = function() { 3685 this.proxyImage.removeEventListener( 'load', this ); 3686 this.proxyImage.removeEventListener( 'error', this ); 3687 this.img.removeEventListener( 'load', this ); 3688 this.img.removeEventListener( 'error', this ); 3689}; 3690 3691 3692function Background( url, element ) { 3693 this.url = url; 3694 this.element = element; 3695 this.img = new Image(); 3696} 3697 3698Background.prototype = Object.create( LoadingImage.prototype ); 3699 3700Background.prototype.check = function() { 3701 this.img.addEventListener( 'load', this ); 3702 this.img.addEventListener( 'error', this ); 3703 this.img.src = this.url; 3704 var isComplete = this.getIsImageComplete(); 3705 if ( isComplete ) { 3706 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 3707 this.unbindEvents(); 3708 } 3709}; 3710 3711Background.prototype.unbindEvents = function() { 3712 this.img.removeEventListener( 'load', this ); 3713 this.img.removeEventListener( 'error', this ); 3714}; 3715 3716Background.prototype.confirm = function( isLoaded, message ) { 3717 this.isLoaded = isLoaded; 3718 this.emitEvent( 'progress', [ this, this.element, message ] ); 3719}; 3720 3721 3722ImagesLoaded.makeJQueryPlugin = function( jQuery ) { 3723 jQuery = jQuery || window.jQuery; 3724 if ( !jQuery ) { 3725 return; 3726 } 3727 $ = jQuery; 3728 $.fn.imagesLoaded = function( options, callback ) { 3729 var instance = new ImagesLoaded( this, options, callback ); 3730 return instance.jqDeferred.promise( $(this) ); 3731 }; 3732}; 3733ImagesLoaded.makeJQueryPlugin(); 3734 3735 3736return ImagesLoaded; 3737 3738}); 3739 3740/*! 3741 * Flickity imagesLoaded v2.0.0 3742 * enables imagesLoaded option for Flickity 3743 */ 3744 3745 3746( function( window, factory ) { 3747 if ( typeof define == 'function' && define.amd ) { 3748 define( [ 3749 'flickity/js/index', 3750 'imagesloaded/imagesloaded' 3751 ], function( Flickity, imagesLoaded ) { 3752 return factory( window, Flickity, imagesLoaded ); 3753 }); 3754 } else if ( typeof module == 'object' && module.exports ) { 3755 module.exports = factory( 3756 window, 3757 require('flickity'), 3758 require('imagesloaded') 3759 ); 3760 } else { 3761 window.Flickity = factory( 3762 window, 3763 window.Flickity, 3764 window.imagesLoaded 3765 ); 3766 } 3767 3768}( window, function factory( window, Flickity, imagesLoaded ) { 3769'use strict'; 3770 3771Flickity.createMethods.push('_createImagesLoaded'); 3772 3773var proto = Flickity.prototype; 3774 3775proto._createImagesLoaded = function() { 3776 this.on( 'activate', this.imagesLoaded ); 3777}; 3778 3779proto.imagesLoaded = function() { 3780 if ( !this.options.imagesLoaded ) { 3781 return; 3782 } 3783 var _this = this; 3784 function onImagesLoadedProgress( instance, image ) { 3785 var cell = _this.getParentCell( image.img ); 3786 _this.cellSizeChange( cell && cell.element ); 3787 if ( !_this.options.freeScroll ) { 3788 _this.positionSliderAtSelected(); 3789 } 3790 } 3791 imagesLoaded( this.slider ).on( 'progress', onImagesLoadedProgress ); 3792}; 3793 3794return Flickity; 3795 3796})); 3797 3798 3799 3800( function( window, factory ) { 3801 if ( typeof define == 'function' && define.amd ) { 3802 define( [ 3803 'flickity/js/index', 3804 'fizzy-ui-utils/utils', 3805 ], factory ); 3806 } else if ( typeof module == 'object' && module.exports ) { 3807 module.exports = factory( 3808 require('flickity'), 3809 require('fizzy-ui-utils') 3810 ); 3811 } else { 3812 factory( 3813 window.Flickity, 3814 window.fizzyUIUtils 3815 ); 3816 } 3817 3818}( this, function factory( Flickity, utils ) { 3819 3820 3821var Slide = Flickity.Slide; 3822 3823var slideUpdateTarget = Slide.prototype.updateTarget; 3824Slide.prototype.updateTarget = function() { 3825 slideUpdateTarget.apply( this, arguments ); 3826 if ( !this.parent.options.fade ) { 3827 return; 3828 } 3829 var slideTargetX = this.target - this.x; 3830 var firstCellX = this.cells[0].x;
3831 this.cells.forEach( function( cell ) { 3832 var targetX = cell.x - firstCellX - slideTargetX; 3833 cell.renderPosition( targetX ); 3834 }); 3835}; 3836 3837Slide.prototype.setOpacity = function( alpha ) { 3838 this.cells.forEach( function( cell ) { 3839 cell.element.style.opacity = alpha; 3840 }); 3841}; 3842 3843 3844var proto = Flickity.prototype; 3845 3846Flickity.createMethods.push('_createFade'); 3847 3848proto._createFade = function() { 3849 this.fadeIndex = this.selectedIndex; 3850 this.prevSelectedIndex = this.selectedIndex; 3851 this.on( 'select', this.onSelectFade ); 3852 this.on( 'dragEnd', this.onDragEndFade ); 3853 this.on( 'settle', this.onSettleFade ); 3854 this.on( 'activate', this.onActivateFade ); 3855 this.on( 'deactivate', this.onDeactivateFade ); 3856}; 3857 3858var updateSlides = proto.updateSlides; 3859proto.updateSlides = function() { 3860 updateSlides.apply( this, arguments ); 3861 if ( !this.options.fade ) { 3862 return; 3863 } 3864 this.slides.forEach( function( slide, i ) { 3865 var alpha = i == this.selectedIndex ? 1 : 0; 3866 slide.setOpacity( alpha ); 3867 }, this ); 3868}; 3869 3870 3871proto.onSelectFade = function() { 3872 this.fadeIndex = Math.min( this.prevSelectedIndex, this.slides.length - 1 ); 3873 this.prevSelectedIndex = this.selectedIndex; 3874}; 3875 3876proto.onSettleFade = function() { 3877 delete this.didDragEnd; 3878 if ( !this.options.fade ) { 3879 return; 3880 } 3881 this.selectedSlide.setOpacity( 1 ); 3882 var fadedSlide = this.slides[ this.fadeIndex ]; 3883 if ( fadedSlide && this.fadeIndex != this.selectedIndex ) { 3884 this.slides[ this.fadeIndex ].setOpacity( 0 ); 3885 } 3886}; 3887 3888proto.onDragEndFade = function() { 3889 this.didDragEnd = true; 3890}; 3891 3892proto.onActivateFade = function() { 3893 if ( this.options.fade ) { 3894 this.element.classList.add('is-fade'); 3895 } 3896}; 3897 3898proto.onDeactivateFade = function() { 3899 if ( !this.options.fade ) { 3900 return; 3901 } 3902 this.element.classList.remove('is-fade'); 3903 this.slides.forEach( function( slide ) { 3904 slide.setOpacity(''); 3905 }); 3906}; 3907 3908 3909var positionSlider = proto.positionSlider; 3910proto.positionSlider = function() { 3911 if ( !this.options.fade ) { 3912 positionSlider.apply( this, arguments ); 3913 return; 3914 } 3915 3916 this.fadeSlides(); 3917 this.dispatchScrollEvent(); 3918}; 3919 3920var positionSliderAtSelected = proto.positionSliderAtSelected; 3921proto.positionSliderAtSelected = function() { 3922 if ( this.options.fade ) { 3923 this.setTranslateX( 0 ); 3924 } 3925 positionSliderAtSelected.apply( this, arguments ); 3926}; 3927 3928proto.fadeSlides = function() { 3929 if ( this.slides.length < 2 ) { 3930 return; 3931 } 3932 var indexes = this.getFadeIndexes(); 3933 var fadeSlideA = this.slides[ indexes.a ]; 3934 var fadeSlideB = this.slides[ indexes.b ]; 3935 var distance = this.wrapDifference( fadeSlideA.target, fadeSlideB.target ); 3936 var progress; 3937 if ( indexes.a === indexes.b ) { 3938 fadeSlideA.setOpacity( 1 ); 3939 return; 3940 } 3941 if ( Math.abs( distance ) < 1 ) { 3942 progress = fadeSlideA === this.selectedSlide ? 0 : 1; 3943 } else { 3944 progress = this.wrapDifference( fadeSlideA.target, -this.x ) / distance; 3945 if ( this.slides.length === 2 && this.options.wrapAround && progress < 0 ) { 3946 progress = -progress; 3947 } 3948 } 3949 3950 fadeSlideA.setOpacity( 1 - progress ); 3951 fadeSlideB.setOpacity( progress ); 3952 3953 var fadeHideIndex = indexes.a; 3954 if ( this.isDragging ) { 3955 fadeHideIndex = progress > 0.5 ? indexes.a : indexes.b; 3956 } 3957 var isNewHideIndex = this.fadeHideIndex != undefined && 3958 this.fadeHideIndex != fadeHideIndex && 3959 this.fadeHideIndex != indexes.a && 3960 this.fadeHideIndex != indexes.b; 3961 if ( isNewHideIndex ) { 3962 this.slides[ this.fadeHideIndex ].setOpacity( 0 ); 3963 } 3964 this.fadeHideIndex = fadeHideIndex; 3965}; 3966 3967proto.getFadeIndexes = function() { 3968 if ( !this.isDragging && !this.didDragEnd ) { 3969 return { 3970 a: this.fadeIndex, 3971 b: this.selectedIndex, 3972 }; 3973 } 3974 if ( this.options.wrapAround ) { 3975 return this.getFadeDragWrapIndexes(); 3976 } else { 3977 return this.getFadeDragLimitIndexes(); 3978 } 3979}; 3980 3981proto.getFadeDragWrapIndexes = function() { 3982 var distances = this.slides.map( function( slide, i ) { 3983 return this.getSlideDistance( -this.x, i ); 3984 }, this ); 3985 var absDistances = distances.map( function( distance ) { 3986 return Math.abs( distance ); 3987 }); 3988 var minDistance = Math.min.apply( Math, absDistances ); 3989 var closestIndex = absDistances.indexOf( minDistance ); 3990 var distance = distances[ closestIndex ]; 3991 var len = this.slides.length; 3992 3993 var delta = distance >= 0 ? 1 : -1; 3994 return { 3995 a: closestIndex, 3996 b: utils.modulo( closestIndex + delta, len ), 3997 }; 3998}; 3999 4000proto.getFadeDragLimitIndexes = function() { 4001 var dragIndex = 0; 4002 for ( var i=0; i < this.slides.length - 1; i++ ) { 4003 var slide = this.slides[i]; 4004 if ( -this.x < slide.target ) { 4005 break; 4006 } 4007 dragIndex = i; 4008 } 4009 return { 4010 a: dragIndex, 4011 b: dragIndex + 1, 4012 }; 4013}; 4014 4015proto.wrapDifference = function( a, b ) { 4016 var diff = b - a; 4017 4018 if ( !this.options.wrapAround ) { 4019 return diff; 4020 } 4021 4022 var diffPlus = diff + this.slideableWidth; 4023 var diffMinus = diff - this.slideableWidth; 4024 if ( Math.abs( diffPlus ) < Math.abs( diff ) ) { 4025 diff = diffPlus; 4026 } 4027 if ( Math.abs( diffMinus ) < Math.abs( diff ) ) { 4028 diff = diffMinus; 4029 } 4030 return diff; 4031}; 4032 4033 4034var _getWrapShiftCells = proto._getWrapShiftCells; 4035proto._getWrapShiftCells = function() { 4036 if ( !this.options.fade ) { 4037 _getWrapShiftCells.apply( this, arguments ); 4038 } 4039}; 4040 4041var shiftWrapCells = proto.shiftWrapCells; 4042proto.shiftWrapCells = function() { 4043 if ( !this.options.fade ) { 4044 shiftWrapCells.apply( this, arguments ); 4045 } 4046}; 4047 4048return Flickity; 4049 4050})); 4051 4052function formatMoney(cents, format) { 4053 if (typeof cents === 'string') { 4054 cents = cents.replace('.', ''); 4055 } 4056 let value = ''; 4057 const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/; 4058 const formatString = format || moneyFormat; 4059 4060 function formatWithDelimiters( 4061 number, 4062 precision = 2, 4063 thousands = ',', 4064 decimal = '.' 4065 ) { 4066 if (isNaN(number) || number == null) { 4067 return 0; 4068 } 4069 4070 number = (number / 100.0).toFixed(precision); 4071 4072 const parts = number.split('.'); 4073 const dollarsAmount = parts[0].replace( 4074 /(\d)(?=(\d\d\d)+(?!\d))/g, 4075 `$1${thousands}` 4076 ); 4077 const centsAmount = parts[1] ? decimal + parts[1] : ''; 4078 4079 return dollarsAmount + centsAmount; 4080 } 4081 4082 switch (formatString.match(placeholderRegex)[1]) { 4083 case 'amount': 4084 value = formatWithDelimiters(cents, 2); 4085 break; 4086 case 'amount_no_decimals': 4087 value = formatWithDelimiters(cents, 0); 4088 break; 4089 case 'amount_with_comma_separator': 4090 value = formatWithDelimiters(cents, 2, '.', ','); 4091 break; 4092 case 'amount_no_decimals_with_comma_separator': 4093 value = formatWithDelimiters(cents, 0, '.', ','); 4094 break; 4095 case "amount_with_apostrophe_separator": 4096 value = formatWithDelimiters(cents, 2, "'", "."); 4097 break; 4098 } 4099 4100 return formatString.replace(placeholderRegex, value); 4101} 4102var Cell = Flickity.Cell; 4103 4104Cell.prototype.create = function () { 4105 this.element.style.position = 'absolute'; 4106 this.x = 0; 4107 this.shift = 0; 4108 this.element.style[this.parent.originSide] = 0; 4109}; 4110 4111Cell.prototype.unselect = function () { 4112 this.element.classList.remove('is-selected'); 4113}; 4114 4115Flickity.prototype._createResizeClass = function () { 4116 this.element.classList.add('flickity-resize'); 4117}; 4118 4119Flickity.createMethods.push('_createResizeClass'); 4120 4121var resize = Flickity.prototype.resize; 4122Flickity.prototype.resize = function () { 4123 this.element.classList.remove('flickity-resize'); 4124 resize.call(this); 4125 this.element.classList.add('flickity-resize'); 4126};
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.