Comparing version 1.2.1 to 2.0.0
{ | ||
"name": "flickity", | ||
"version": "1.2.1", | ||
"description": "Touch, responsive, flickable galleries", | ||
"description": "Touch, responsive, flickable carousels", | ||
"main": [ | ||
@@ -10,24 +9,15 @@ "js/index.js", | ||
"dependencies": { | ||
"classie": "~1.0.1", | ||
"doc-ready": "~1.0.4", | ||
"eventEmitter": "~4.2.11", | ||
"eventie": "~1.0.5", | ||
"fizzy-ui-utils": "~1.0.1", | ||
"get-size": "~1.2.2", | ||
"get-style-property": "~1.0.4", | ||
"matches-selector": "~1.0.2", | ||
"tap-listener": "~1.1.1", | ||
"unidragger": "~1.1.5" | ||
"desandro-matches-selector": "^2.0.0", | ||
"ev-emitter": "^1.0.2", | ||
"fizzy-ui-utils": "^2.0.0", | ||
"get-size": "^2.0.0", | ||
"tap-listener": "^2.0.0", | ||
"unidragger": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"flickity-imagesloaded": "~1.0.0", | ||
"flickity-as-nav-for": "~1.0.0", | ||
"jquery-bridget": "~1.1.0", | ||
"qunit": "~1.16.0" | ||
"flickity-imagesloaded": "^2.0.0", | ||
"flickity-as-nav-for": "^2.0.0", | ||
"jquery-bridget": "^2.0.0", | ||
"qunit": "^2.0.0" | ||
}, | ||
"moduleType": [ | ||
"amd", | ||
"globals", | ||
"node" | ||
], | ||
"keywords": [ | ||
@@ -38,2 +28,3 @@ "gallery", | ||
], | ||
"homepage": "http://flickity.metafizzy.co", | ||
"authors": [ | ||
@@ -40,0 +31,0 @@ "Metafizzy" |
/*! | ||
* Flickity PACKAGED v1.2.1 | ||
* Touch, responsive, flickable galleries | ||
* Flickity PACKAGED v2.0.0 | ||
* Touch, responsive, flickable carousels | ||
* | ||
@@ -9,6 +9,6 @@ * Licensed GPLv3 for open source use | ||
* http://flickity.metafizzy.co | ||
* Copyright 2015 Metafizzy | ||
* Copyright 2016 Metafizzy | ||
*/ | ||
!function(t){function e(){}function i(t){function i(e){e.prototype.option||(e.prototype.option=function(e){t.isPlainObject(e)&&(this.options=t.extend(!0,this.options,e))})}function o(e,i){t.fn[e]=function(o){if("string"==typeof o){for(var s=n.call(arguments,1),a=0,l=this.length;l>a;a++){var h=this[a],c=t.data(h,e);if(c)if(t.isFunction(c[o])&&"_"!==o.charAt(0)){var p=c[o].apply(c,s);if(void 0!==p)return p}else r("no such method '"+o+"' for "+e+" instance");else r("cannot call methods on "+e+" prior to initialization; attempted to call '"+o+"'")}return this}return this.each(function(){var n=t.data(this,e);n?(n.option(o),n._init()):(n=new i(this,o),t.data(this,e,n))})}}if(t){var r="undefined"==typeof console?e:function(t){console.error(t)};return t.bridget=function(t,e){i(e),o(t,e)},t.bridget}}var n=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],i):i("object"==typeof exports?require("jquery"):t.jQuery)}(window),function(t){function e(t){return new RegExp("(^|\\s+)"+t+"(\\s+|$)")}function i(t,e){var i=n(t,e)?r:o;i(t,e)}var n,o,r;"classList"in document.documentElement?(n=function(t,e){return t.classList.contains(e)},o=function(t,e){t.classList.add(e)},r=function(t,e){t.classList.remove(e)}):(n=function(t,i){return e(i).test(t.className)},o=function(t,e){n(t,e)||(t.className=t.className+" "+e)},r=function(t,i){t.className=t.className.replace(e(i)," ")});var s={hasClass:n,addClass:o,removeClass:r,toggleClass:i,has:n,add:o,remove:r,toggle:i};"function"==typeof define&&define.amd?define("classie/classie",s):"object"==typeof exports?module.exports=s:t.classie=s}(window),function(){"use strict";function t(){}function e(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function i(t){return function(){return this[t].apply(this,arguments)}}var n=t.prototype,o=this,r=o.EventEmitter;n.getListeners=function(t){var e,i,n=this._getEvents();if(t instanceof RegExp){e={};for(i in n)n.hasOwnProperty(i)&&t.test(i)&&(e[i]=n[i])}else e=n[t]||(n[t]=[]);return e},n.flattenListeners=function(t){var e,i=[];for(e=0;e<t.length;e+=1)i.push(t[e].listener);return i},n.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&(e={},e[t]=i),e||i},n.addListener=function(t,i){var n,o=this.getListenersAsObject(t),r="object"==typeof i;for(n in o)o.hasOwnProperty(n)&&-1===e(o[n],i)&&o[n].push(r?i:{listener:i,once:!1});return this},n.on=i("addListener"),n.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},n.once=i("addOnceListener"),n.defineEvent=function(t){return this.getListeners(t),this},n.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},n.removeListener=function(t,i){var n,o,r=this.getListenersAsObject(t);for(o in r)r.hasOwnProperty(o)&&(n=e(r[o],i),-1!==n&&r[o].splice(n,1));return this},n.off=i("removeListener"),n.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},n.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},n.manipulateListeners=function(t,e,i){var n,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(n=i.length;n--;)r.call(this,e,i[n]);else for(n in e)e.hasOwnProperty(n)&&(o=e[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},n.removeEvent=function(t){var e,i=typeof t,n=this._getEvents();if("string"===i)delete n[t];else if(t instanceof RegExp)for(e in n)n.hasOwnProperty(e)&&t.test(e)&&delete n[e];else delete this._events;return this},n.removeAllListeners=i("removeEvent"),n.emitEvent=function(t,e){var i,n,o,r,s=this.getListenersAsObject(t);for(o in s)if(s.hasOwnProperty(o))for(n=s[o].length;n--;)i=s[o][n],i.once===!0&&this.removeListener(t,i.listener),r=i.listener.apply(this,e||[]),r===this._getOnceReturnValue()&&this.removeListener(t,i.listener);return this},n.trigger=i("emitEvent"),n.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},n.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},n._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},n._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return o.EventEmitter=r,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:o.EventEmitter=t}.call(this),function(t){function e(e){var i=t.event;return i.target=i.target||i.srcElement||e,i}var i=document.documentElement,n=function(){};i.addEventListener?n=function(t,e,i){t.addEventListener(e,i,!1)}:i.attachEvent&&(n=function(t,i,n){t[i+n]=n.handleEvent?function(){var i=e(t);n.handleEvent.call(n,i)}:function(){var i=e(t);n.call(t,i)},t.attachEvent("on"+i,t[i+n])});var o=function(){};i.removeEventListener?o=function(t,e,i){t.removeEventListener(e,i,!1)}:i.detachEvent&&(o=function(t,e,i){t.detachEvent("on"+e,t[e+i]);try{delete t[e+i]}catch(n){t[e+i]=void 0}});var r={bind:n,unbind:o};"function"==typeof define&&define.amd?define("eventie/eventie",r):"object"==typeof exports?module.exports=r:t.eventie=r}(window),function(t){function e(t){if(t){if("string"==typeof n[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e,o=0,r=i.length;r>o;o++)if(e=i[o]+t,"string"==typeof n[e])return e}}var i="Webkit Moz ms Ms O".split(" "),n=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return e}):"object"==typeof exports?module.exports=e:t.getStyleProperty=e}(window),function(t,e){function i(t){var e=parseFloat(t),i=-1===t.indexOf("%")&&!isNaN(e);return i&&e}function n(){}function o(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0,i=a.length;i>e;e++){var n=a[e];t[n]=0}return t}function r(e){function n(){if(!d){d=!0;var n=t.getComputedStyle;if(h=function(){var t=n?function(t){return n(t,null)}:function(t){return t.currentStyle};return function(e){var i=t(e);return i||s("Style returned "+i+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),i}}(),c=e("boxSizing")){var o=document.createElement("div");o.style.width="200px",o.style.padding="1px 2px 3px 4px",o.style.borderStyle="solid",o.style.borderWidth="1px 2px 3px 4px",o.style[c]="border-box";var r=document.body||document.documentElement;r.appendChild(o);var a=h(o);p=200===i(a.width),r.removeChild(o)}}}function r(t){if(n(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var e=h(t);if("none"===e.display)return o();var r={};r.width=t.offsetWidth,r.height=t.offsetHeight;for(var s=r.isBorderBox=!(!c||!e[c]||"border-box"!==e[c]),d=0,u=a.length;u>d;d++){var f=a[d],v=e[f];v=l(t,v);var y=parseFloat(v);r[f]=isNaN(y)?0:y}var g=r.paddingLeft+r.paddingRight,m=r.paddingTop+r.paddingBottom,b=r.marginLeft+r.marginRight,x=r.marginTop+r.marginBottom,S=r.borderLeftWidth+r.borderRightWidth,C=r.borderTopWidth+r.borderBottomWidth,w=s&&p,E=i(e.width);E!==!1&&(r.width=E+(w?0:g+S));var P=i(e.height);return P!==!1&&(r.height=P+(w?0:m+C)),r.innerWidth=r.width-(g+S),r.innerHeight=r.height-(m+C),r.outerWidth=r.width+b,r.outerHeight=r.height+x,r}}function l(e,i){if(t.getComputedStyle||-1===i.indexOf("%"))return i;var n=e.style,o=n.left,r=e.runtimeStyle,s=r&&r.left;return s&&(r.left=e.currentStyle.left),n.left=i,i=n.pixelLeft,n.left=o,s&&(r.left=s),i}var h,c,p,d=!1;return r}var s="undefined"==typeof console?n:function(t){console.error(t)},a=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],r):"object"==typeof exports?module.exports=r(require("desandro-get-style-property")):t.getSize=r(t.getStyleProperty)}(window),function(t){function e(t){"function"==typeof t&&(e.isReady?t():s.push(t))}function i(t){var i="readystatechange"===t.type&&"complete"!==r.readyState;e.isReady||i||n()}function n(){e.isReady=!0;for(var t=0,i=s.length;i>t;t++){var n=s[t];n()}}function o(o){return"complete"===r.readyState?n():(o.bind(r,"DOMContentLoaded",i),o.bind(r,"readystatechange",i),o.bind(t,"load",i)),e}var r=t.document,s=[];e.isReady=!1,"function"==typeof define&&define.amd?define("doc-ready/doc-ready",["eventie/eventie"],o):"object"==typeof exports?module.exports=o(require("eventie")):t.docReady=o(t.eventie)}(window),function(t){"use strict";function e(t,e){return t[s](e)}function i(t){if(!t.parentNode){var e=document.createDocumentFragment();e.appendChild(t)}}function n(t,e){i(t);for(var n=t.parentNode.querySelectorAll(e),o=0,r=n.length;r>o;o++)if(n[o]===t)return!0;return!1}function o(t,n){return i(t),e(t,n)}var r,s=function(){if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0,n=e.length;n>i;i++){var o=e[i],r=o+"MatchesSelector";if(t[r])return r}}();if(s){var a=document.createElement("div"),l=e(a,"div");r=l?e:o}else r=n;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return r}):"object"==typeof exports?module.exports=r:window.matchesSelector=r}(Element.prototype),function(t,e){"use strict";"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["doc-ready/doc-ready","matches-selector/matches-selector"],function(i,n){return e(t,i,n)}):"object"==typeof exports?module.exports=e(t,require("doc-ready"),require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.docReady,t.matchesSelector)}(window,function(t,e,i){var n={};n.extend=function(t,e){for(var i in e)t[i]=e[i];return t},n.modulo=function(t,e){return(t%e+e)%e};var o=Object.prototype.toString;n.isArray=function(t){return"[object Array]"==o.call(t)},n.makeArray=function(t){var e=[];if(n.isArray(t))e=t;else if(t&&"number"==typeof t.length)for(var i=0,o=t.length;o>i;i++)e.push(t[i]);else e.push(t);return e},n.indexOf=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var i=0,n=t.length;n>i;i++)if(t[i]===e)return i;return-1},n.removeFrom=function(t,e){var i=n.indexOf(t,e);-1!=i&&t.splice(i,1)},n.isElement="function"==typeof HTMLElement||"object"==typeof HTMLElement?function(t){return t instanceof HTMLElement}:function(t){return t&&"object"==typeof t&&1==t.nodeType&&"string"==typeof t.nodeName},n.setText=function(){function t(t,i){e=e||(void 0!==document.documentElement.textContent?"textContent":"innerText"),t[e]=i}var e;return t}(),n.getParent=function(t,e){for(;t!=document.body;)if(t=t.parentNode,i(t,e))return t},n.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},n.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},n.filterFindElements=function(t,e){t=n.makeArray(t);for(var o=[],r=0,s=t.length;s>r;r++){var a=t[r];if(n.isElement(a))if(e){i(a,e)&&o.push(a);for(var l=a.querySelectorAll(e),h=0,c=l.length;c>h;h++)o.push(l[h])}else o.push(a)}return o},n.debounceMethod=function(t,e,i){var n=t.prototype[e],o=e+"Timeout";t.prototype[e]=function(){var t=this[o];t&&clearTimeout(t);var e=arguments,r=this;this[o]=setTimeout(function(){n.apply(r,e),delete r[o]},i||100)}},n.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var r=t.console;return n.htmlInit=function(i,o){e(function(){for(var e=n.toDashed(o),s=document.querySelectorAll(".js-"+e),a="data-"+e+"-options",l=0,h=s.length;h>l;l++){var c,p=s[l],d=p.getAttribute(a);try{c=d&&JSON.parse(d)}catch(u){r&&r.error("Error parsing "+a+" on "+p.nodeName.toLowerCase()+(p.id?"#"+p.id:"")+": "+u);continue}var f=new i(p,c),v=t.jQuery;v&&v.data(p,o,f)}})},n}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity/js/cell",["get-size/get-size"],function(i){return e(t,i)}):"object"==typeof exports?module.exports=e(t,require("get-size")):(t.Flickity=t.Flickity||{},t.Flickity.Cell=e(t,t.getSize))}(window,function(t,e){function i(t,e){this.element=t,this.parent=e,this.create()}var n="attachEvent"in t;return i.prototype.create=function(){this.element.style.position="absolute",n&&this.element.setAttribute("unselectable","on"),this.x=0,this.shift=0},i.prototype.destroy=function(){this.element.style.position="";var t=this.parent.originSide;this.element.style[t]=""},i.prototype.getSize=function(){this.size=e(this.element)},i.prototype.setPosition=function(t){this.x=t,this.setDefaultTarget(),this.renderPosition(t)},i.prototype.setDefaultTarget=function(){var t="left"==this.parent.originSide?"marginLeft":"marginRight";this.target=this.x+this.size[t]+this.size.width*this.parent.cellAlign},i.prototype.renderPosition=function(t){var e=this.parent.originSide;this.element.style[e]=this.parent.getPositionValue(t)},i.prototype.wrapShift=function(t){this.shift=t,this.renderPosition(this.x+this.parent.slideableWidth*t)},i.prototype.remove=function(){this.element.parentNode.removeChild(this.element)},i}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity/js/animate",["get-style-property/get-style-property","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof exports?module.exports=e(t,require("desandro-get-style-property"),require("fizzy-ui-utils")):(t.Flickity=t.Flickity||{},t.Flickity.animatePrototype=e(t,t.getStyleProperty,t.fizzyUIUtils))}(window,function(t,e,i){for(var n,o=0,r="webkit moz ms o".split(" "),s=t.requestAnimationFrame,a=t.cancelAnimationFrame,l=0;l<r.length&&(!s||!a);l++)n=r[l],s=s||t[n+"RequestAnimationFrame"],a=a||t[n+"CancelAnimationFrame"]||t[n+"CancelRequestAnimationFrame"];s&&a||(s=function(e){var i=(new Date).getTime(),n=Math.max(0,16-(i-o)),r=t.setTimeout(function(){e(i+n)},n);return o=i+n,r},a=function(e){t.clearTimeout(e)});var h={};h.startAnimation=function(){this.isAnimating||(this.isAnimating=!0,this.restingFrames=0,this.animate())},h.animate=function(){this.applyDragForce(),this.applySelectedAttraction();var t=this.x;if(this.integratePhysics(),this.positionSlider(),this.settle(t),this.isAnimating){var e=this;s(function(){e.animate()})}};var c=e("transform"),p=!!e("perspective");return h.positionSlider=function(){var t=this.x;this.options.wrapAround&&this.cells.length>1&&(t=i.modulo(t,this.slideableWidth),t-=this.slideableWidth,this.shiftWrapCells(t)),t+=this.cursorPosition,t=this.options.rightToLeft&&c?-t:t;var e=this.getPositionValue(t);c?this.slider.style[c]=p&&this.isAnimating?"translate3d("+e+",0,0)":"translateX("+e+")":this.slider.style[this.originSide]=e},h.positionSliderAtSelected=function(){if(this.cells.length){var t=this.cells[this.selectedIndex];this.x=-t.target,this.positionSlider()}},h.getPositionValue=function(t){return this.options.percentPosition?.01*Math.round(t/this.size.innerWidth*1e4)+"%":Math.round(t)+"px"},h.settle=function(t){this.isPointerDown||Math.round(100*this.x)!=Math.round(100*t)||this.restingFrames++,this.restingFrames>2&&(this.isAnimating=!1,delete this.isFreeScrolling,p&&this.positionSlider(),this.dispatchEvent("settle"))},h.shiftWrapCells=function(t){var e=this.cursorPosition+t;this._shiftCells(this.beforeShiftCells,e,-1);var i=this.size.innerWidth-(t+this.slideableWidth+this.cursorPosition);this._shiftCells(this.afterShiftCells,i,1)},h._shiftCells=function(t,e,i){for(var n=0,o=t.length;o>n;n++){var r=t[n],s=e>0?i:0;r.wrapShift(s),e-=r.size.outerWidth}},h._unshiftCells=function(t){if(t&&t.length)for(var e=0,i=t.length;i>e;e++)t[e].wrapShift(0)},h.integratePhysics=function(){this.velocity+=this.accel,this.x+=this.velocity,this.velocity*=this.getFrictionFactor(),this.accel=0},h.applyForce=function(t){this.accel+=t},h.getFrictionFactor=function(){return 1-this.options[this.isFreeScrolling?"freeScrollFriction":"friction"]},h.getRestingPosition=function(){return this.x+this.velocity/(1-this.getFrictionFactor())},h.applyDragForce=function(){if(this.isPointerDown){var t=this.dragX-this.x,e=t-this.velocity;this.applyForce(e)}},h.applySelectedAttraction=function(){var t=this.cells.length;if(!this.isPointerDown&&!this.isFreeScrolling&&t){var e=this.cells[this.selectedIndex],i=this.options.wrapAround&&t>1?this.slideableWidth*Math.floor(this.selectedIndex/t):0,n=-1*(e.target+i)-this.x,o=n*this.options.selectedAttraction;this.applyForce(o)}},h}),function(t,e){"use strict";if("function"==typeof define&&define.amd)define("flickity/js/flickity",["classie/classie","eventEmitter/EventEmitter","eventie/eventie","get-size/get-size","fizzy-ui-utils/utils","./cell","./animate"],function(i,n,o,r,s,a,l){return e(t,i,n,o,r,s,a,l)});else if("object"==typeof exports)module.exports=e(t,require("desandro-classie"),require("wolfy87-eventemitter"),require("eventie"),require("get-size"),require("fizzy-ui-utils"),require("./cell"),require("./animate"));else{var i=t.Flickity;t.Flickity=e(t,t.classie,t.EventEmitter,t.eventie,t.getSize,t.fizzyUIUtils,i.Cell,i.animatePrototype)}}(window,function(t,e,i,n,o,r,s,a){function l(t,e){for(t=r.makeArray(t);t.length;)e.appendChild(t.shift())}function h(t,e){var i=r.getQueryElement(t);return i?(this.element=i,c&&(this.$element=c(this.element)),this.options=r.extend({},this.constructor.defaults),this.option(e),void this._create()):void(d&&d.error("Bad element for Flickity: "+(i||t)))}var c=t.jQuery,p=t.getComputedStyle,d=t.console,u=0,f={};h.defaults={accessibility:!0,cellAlign:"center",freeScrollFriction:.075,friction:.28,percentPosition:!0,resize:!0,selectedAttraction:.025,setGallerySize:!0},h.createMethods=[],r.extend(h.prototype,i.prototype),h.prototype._create=function(){var e=this.guid=++u;this.element.flickityGUID=e,f[e]=this,this.selectedIndex=0,this.restingFrames=0,this.x=0,this.velocity=0,this.accel=0,this.originSide=this.options.rightToLeft?"right":"left",this.viewport=document.createElement("div"),this.viewport.className="flickity-viewport",h.setUnselectable(this.viewport),this._createSlider(),(this.options.resize||this.options.watchCSS)&&(n.bind(t,"resize",this),this.isResizeBound=!0);for(var i=0,o=h.createMethods.length;o>i;i++){var r=h.createMethods[i];this[r]()}this.options.watchCSS?this.watchCSS():this.activate()},h.prototype.option=function(t){r.extend(this.options,t)},h.prototype.activate=function(){if(!this.isActive){this.isActive=!0,e.add(this.element,"flickity-enabled"),this.options.rightToLeft&&e.add(this.element,"flickity-rtl"),this.getSize();var t=this._filterFindCellElements(this.element.children);l(t,this.slider),this.viewport.appendChild(this.slider),this.element.appendChild(this.viewport),this.reloadCells(),this.options.accessibility&&(this.element.tabIndex=0,n.bind(this.element,"keydown",this)),this.emit("activate");var i,o=this.options.initialIndex;i=this.isInitActivated?this.selectedIndex:void 0!==o&&this.cells[o]?o:0,this.select(i,!1,!0),this.isInitActivated=!0}},h.prototype._createSlider=function(){var t=document.createElement("div");t.className="flickity-slider",t.style[this.originSide]=0,this.slider=t},h.prototype._filterFindCellElements=function(t){return r.filterFindElements(t,this.options.cellSelector)},h.prototype.reloadCells=function(){this.cells=this._makeCells(this.slider.children),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize()},h.prototype._makeCells=function(t){for(var e=this._filterFindCellElements(t),i=[],n=0,o=e.length;o>n;n++){var r=e[n],a=new s(r,this);i.push(a)}return i},h.prototype.getLastCell=function(){return this.cells[this.cells.length-1]},h.prototype.positionCells=function(){this._sizeCells(this.cells),this._positionCells(0)},h.prototype._positionCells=function(t){t=t||0,this.maxCellHeight=t?this.maxCellHeight||0:0;var e=0;if(t>0){var i=this.cells[t-1];e=i.x+i.size.outerWidth}for(var n,o=this.cells.length,r=t;o>r;r++)n=this.cells[r],n.setPosition(e),e+=n.size.outerWidth,this.maxCellHeight=Math.max(n.size.outerHeight,this.maxCellHeight);this.slideableWidth=e,this._containCells()},h.prototype._sizeCells=function(t){for(var e=0,i=t.length;i>e;e++){var n=t[e];n.getSize()}},h.prototype._init=h.prototype.reposition=function(){this.positionCells(),this.positionSliderAtSelected()},h.prototype.getSize=function(){this.size=o(this.element),this.setCellAlign(),this.cursorPosition=this.size.innerWidth*this.cellAlign};var v={center:{left:.5,right:.5},left:{left:0,right:1},right:{right:0,left:1}};h.prototype.setCellAlign=function(){var t=v[this.options.cellAlign];this.cellAlign=t?t[this.originSide]:this.options.cellAlign},h.prototype.setGallerySize=function(){this.options.setGallerySize&&(this.viewport.style.height=this.maxCellHeight+"px")},h.prototype._getWrapShiftCells=function(){if(this.options.wrapAround){this._unshiftCells(this.beforeShiftCells),this._unshiftCells(this.afterShiftCells);var t=this.cursorPosition,e=this.cells.length-1;this.beforeShiftCells=this._getGapCells(t,e,-1),t=this.size.innerWidth-this.cursorPosition,this.afterShiftCells=this._getGapCells(t,0,1)}},h.prototype._getGapCells=function(t,e,i){for(var n=[];t>0;){var o=this.cells[e];if(!o)break;n.push(o),e+=i,t-=o.size.outerWidth}return n},h.prototype._containCells=function(){if(this.options.contain&&!this.options.wrapAround&&this.cells.length)for(var t=this.options.rightToLeft?"marginRight":"marginLeft",e=this.options.rightToLeft?"marginLeft":"marginRight",i=this.cells[0].size[t],n=this.getLastCell(),o=this.slideableWidth-n.size[e],r=o-this.size.innerWidth*(1-this.cellAlign),s=o<this.size.innerWidth,a=0,l=this.cells.length;l>a;a++){var h=this.cells[a];h.setDefaultTarget(),s?h.target=o*this.cellAlign:(h.target=Math.max(h.target,this.cursorPosition+i),h.target=Math.min(h.target,r))}},h.prototype.dispatchEvent=function(t,e,i){var n=[e].concat(i);if(this.emitEvent(t,n),c&&this.$element)if(e){var o=c.Event(e);o.type=t,this.$element.trigger(o,i)}else this.$element.trigger(t,i)},h.prototype.select=function(t,e,i){if(this.isActive){t=parseInt(t,10);var n=this.cells.length;this.options.wrapAround&&n>1&&(0>t?this.x-=this.slideableWidth:t>=n&&(this.x+=this.slideableWidth)),(this.options.wrapAround||e)&&(t=r.modulo(t,n)),this.cells[t]&&(this.selectedIndex=t,this.setSelectedCell(),i?this.positionSliderAtSelected():this.startAnimation(),this.dispatchEvent("cellSelect"))}},h.prototype.previous=function(t){this.select(this.selectedIndex-1,t)},h.prototype.next=function(t){this.select(this.selectedIndex+1,t)},h.prototype.setSelectedCell=function(){this._removeSelectedCellClass(),this.selectedCell=this.cells[this.selectedIndex],this.selectedElement=this.selectedCell.element,e.add(this.selectedElement,"is-selected")},h.prototype._removeSelectedCellClass=function(){this.selectedCell&&e.remove(this.selectedCell.element,"is-selected")},h.prototype.getCell=function(t){for(var e=0,i=this.cells.length;i>e;e++){var n=this.cells[e];if(n.element==t)return n}},h.prototype.getCells=function(t){t=r.makeArray(t);for(var e=[],i=0,n=t.length;n>i;i++){var o=t[i],s=this.getCell(o);s&&e.push(s)}return e},h.prototype.getCellElements=function(){for(var t=[],e=0,i=this.cells.length;i>e;e++)t.push(this.cells[e].element);return t},h.prototype.getParentCell=function(t){var e=this.getCell(t);return e?e:(t=r.getParent(t,".flickity-slider > *"),this.getCell(t))},h.prototype.getAdjacentCellElements=function(t,e){if(!t)return[this.selectedElement];e=void 0===e?this.selectedIndex:e;var i=this.cells.length;if(1+2*t>=i)return this.getCellElements();for(var n=[],o=e-t;e+t>=o;o++){var s=this.options.wrapAround?r.modulo(o,i):o,a=this.cells[s];a&&n.push(a.element)}return n},h.prototype.uiChange=function(){this.emit("uiChange")},h.prototype.childUIPointerDown=function(t){this.emitEvent("childUIPointerDown",[t])},h.prototype.onresize=function(){this.watchCSS(),this.resize()},r.debounceMethod(h,"onresize",150),h.prototype.resize=function(){this.isActive&&(this.getSize(),this.options.wrapAround&&(this.x=r.modulo(this.x,this.slideableWidth)),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize(),this.positionSliderAtSelected())};var y=h.supportsConditionalCSS=function(){var t;return function(){if(void 0!==t)return t;if(!p)return void(t=!1);var e=document.createElement("style"),i=document.createTextNode('body:after { content: "foo"; display: none; }');e.appendChild(i),document.head.appendChild(e);var n=p(document.body,":after").content;return t=-1!=n.indexOf("foo"),document.head.removeChild(e),t}}();h.prototype.watchCSS=function(){var t=this.options.watchCSS;if(t){var e=y();if(!e){var i="fallbackOn"==t?"activate":"deactivate";return void this[i]()}var n=p(this.element,":after").content;-1!=n.indexOf("flickity")?this.activate():this.deactivate()}},h.prototype.onkeydown=function(t){if(this.options.accessibility&&(!document.activeElement||document.activeElement==this.element))if(37==t.keyCode){var e=this.options.rightToLeft?"next":"previous";this.uiChange(),this[e]()}else if(39==t.keyCode){var i=this.options.rightToLeft?"previous":"next";this.uiChange(),this[i]()}},h.prototype.deactivate=function(){if(this.isActive){e.remove(this.element,"flickity-enabled"),e.remove(this.element,"flickity-rtl");for(var t=0,i=this.cells.length;i>t;t++){var o=this.cells[t];o.destroy()}this._removeSelectedCellClass(),this.element.removeChild(this.viewport),l(this.slider.children,this.element),this.options.accessibility&&(this.element.removeAttribute("tabIndex"),n.unbind(this.element,"keydown",this)),this.isActive=!1,this.emit("deactivate")}},h.prototype.destroy=function(){this.deactivate(),this.isResizeBound&&n.unbind(t,"resize",this),this.emit("destroy"),c&&this.$element&&c.removeData(this.element,"flickity"),delete this.element.flickityGUID,delete f[this.guid]},r.extend(h.prototype,a);var g="attachEvent"in t;return h.setUnselectable=function(t){g&&t.setAttribute("unselectable","on")},h.data=function(t){t=r.getQueryElement(t);var e=t&&t.flickityGUID;return e&&f[e]},r.htmlInit(h,"flickity"),c&&c.bridget&&c.bridget("flickity",h),h.Cell=s,h}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("unipointer/unipointer",["eventEmitter/EventEmitter","eventie/eventie"],function(i,n){return e(t,i,n)}):"object"==typeof exports?module.exports=e(t,require("wolfy87-eventemitter"),require("eventie")):t.Unipointer=e(t,t.EventEmitter,t.eventie)}(window,function(t,e,i){function n(){}function o(){}o.prototype=new e,o.prototype.bindStartEvent=function(t){this._bindStartEvent(t,!0)},o.prototype.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},o.prototype._bindStartEvent=function(e,n){n=void 0===n?!0:!!n;var o=n?"bind":"unbind";t.navigator.pointerEnabled?i[o](e,"pointerdown",this):t.navigator.msPointerEnabled?i[o](e,"MSPointerDown",this):(i[o](e,"mousedown",this),i[o](e,"touchstart",this))},o.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},o.prototype.getTouch=function(t){for(var e=0,i=t.length;i>e;e++){var n=t[e];if(n.identifier==this.pointerIdentifier)return n}},o.prototype.onmousedown=function(t){var e=t.button;e&&0!==e&&1!==e||this._pointerDown(t,t)},o.prototype.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},o.prototype.onMSPointerDown=o.prototype.onpointerdown=function(t){this._pointerDown(t,t)},o.prototype._pointerDown=function(t,e){this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==e.pointerId?e.pointerId:e.identifier,this.pointerDown(t,e))},o.prototype.pointerDown=function(t,e){this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])};var r={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"],MSPointerDown:["MSPointerMove","MSPointerUp","MSPointerCancel"]};return o.prototype._bindPostStartEvents=function(e){if(e){for(var n=r[e.type],o=e.preventDefault?t:document,s=0,a=n.length;a>s;s++){var l=n[s];i.bind(o,l,this)}this._boundPointerEvents={events:n,node:o}}},o.prototype._unbindPostStartEvents=function(){var t=this._boundPointerEvents;if(t&&t.events){for(var e=0,n=t.events.length;n>e;e++){var o=t.events[e];i.unbind(t.node,o,this)}delete this._boundPointerEvents}},o.prototype.onmousemove=function(t){this._pointerMove(t,t)},o.prototype.onMSPointerMove=o.prototype.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},o.prototype.ontouchmove=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerMove(t,e)},o.prototype._pointerMove=function(t,e){this.pointerMove(t,e)},o.prototype.pointerMove=function(t,e){this.emitEvent("pointerMove",[t,e])},o.prototype.onmouseup=function(t){this._pointerUp(t,t)},o.prototype.onMSPointerUp=o.prototype.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},o.prototype.ontouchend=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerUp(t,e)},o.prototype._pointerUp=function(t,e){this._pointerDone(),this.pointerUp(t,e)},o.prototype.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e])},o.prototype._pointerDone=function(){this.isPointerDown=!1,delete this.pointerIdentifier,this._unbindPostStartEvents(),this.pointerDone()},o.prototype.pointerDone=n,o.prototype.onMSPointerCancel=o.prototype.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},o.prototype.ontouchcancel=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerCancel(t,e)},o.prototype._pointerCancel=function(t,e){this._pointerDone(),this.pointerCancel(t,e)},o.prototype.pointerCancel=function(t,e){this.emitEvent("pointerCancel",[t,e])},o.getPointerPoint=function(t){return{x:void 0!==t.pageX?t.pageX:t.clientX,y:void 0!==t.pageY?t.pageY:t.clientY}},o}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("unidragger/unidragger",["eventie/eventie","unipointer/unipointer"],function(i,n){return e(t,i,n)}):"object"==typeof exports?module.exports=e(t,require("eventie"),require("unipointer")):t.Unidragger=e(t,t.eventie,t.Unipointer)}(window,function(t,e,i){function n(){}function o(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function r(){}function s(){return!1}r.prototype=new i,r.prototype.bindHandles=function(){this._bindHandles(!0)},r.prototype.unbindHandles=function(){this._bindHandles(!1)};var a=t.navigator;r.prototype._bindHandles=function(t){t=void 0===t?!0:!!t;var i;i=a.pointerEnabled?function(e){e.style.touchAction=t?"none":""}:a.msPointerEnabled?function(e){e.style.msTouchAction=t?"none":""}:function(){t&&h(s)};for(var n=t?"bind":"unbind",o=0,r=this.handles.length;r>o;o++){var s=this.handles[o];this._bindStartEvent(s,t),i(s),e[n](s,"click",this)}};var l="attachEvent"in document.documentElement,h=l?function(t){"IMG"==t.nodeName&&(t.ondragstart=s);for(var e=t.querySelectorAll("img"),i=0,n=e.length;n>i;i++){var o=e[i];o.ondragstart=s}}:n;r.prototype.pointerDown=function(i,n){if("INPUT"==i.target.nodeName&&"range"==i.target.type)return this.isPointerDown=!1,void delete this.pointerIdentifier;this._dragPointerDown(i,n);var o=document.activeElement;o&&o.blur&&o.blur(),this._bindPostStartEvents(i),this.pointerDownScroll=r.getScrollPosition(),e.bind(t,"scroll",this),this.emitEvent("pointerDown",[i,n])},r.prototype._dragPointerDown=function(t,e){this.pointerDownPoint=i.getPointerPoint(e);var n="touchstart"==t.type,r=t.target.nodeName;n||"SELECT"==r||o(t)},r.prototype.pointerMove=function(t,e){var i=this._dragPointerMove(t,e);this.emitEvent("pointerMove",[t,e,i]),this._dragMove(t,e,i)},r.prototype._dragPointerMove=function(t,e){var n=i.getPointerPoint(e),o={x:n.x-this.pointerDownPoint.x,y:n.y-this.pointerDownPoint.y};return!this.isDragging&&this.hasDragStarted(o)&&this._dragStart(t,e),o},r.prototype.hasDragStarted=function(t){return Math.abs(t.x)>3||Math.abs(t.y)>3},r.prototype.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e]),this._dragPointerUp(t,e)},r.prototype._dragPointerUp=function(t,e){this.isDragging?this._dragEnd(t,e):this._staticClick(t,e)},r.prototype.pointerDone=function(){e.unbind(t,"scroll",this)},r.prototype._dragStart=function(t,e){ | ||
this.isDragging=!0,this.dragStartPoint=r.getPointerPoint(e),this.isPreventingClicks=!0,this.dragStart(t,e)},r.prototype.dragStart=function(t,e){this.emitEvent("dragStart",[t,e])},r.prototype._dragMove=function(t,e,i){this.isDragging&&this.dragMove(t,e,i)},r.prototype.dragMove=function(t,e,i){o(t),this.emitEvent("dragMove",[t,e,i])},r.prototype._dragEnd=function(t,e){this.isDragging=!1;var i=this;setTimeout(function(){delete i.isPreventingClicks}),this.dragEnd(t,e)},r.prototype.dragEnd=function(t,e){this.emitEvent("dragEnd",[t,e])},r.prototype.pointerDone=function(){e.unbind(t,"scroll",this),delete this.pointerDownScroll},r.prototype.onclick=function(t){this.isPreventingClicks&&o(t)},r.prototype._staticClick=function(t,e){if(!this.isIgnoringMouseUp||"mouseup"!=t.type){var i=t.target.nodeName;if(("INPUT"==i||"TEXTAREA"==i)&&t.target.focus(),this.staticClick(t,e),"mouseup"!=t.type){this.isIgnoringMouseUp=!0;var n=this;setTimeout(function(){delete n.isIgnoringMouseUp},400)}}},r.prototype.staticClick=function(t,e){this.emitEvent("staticClick",[t,e])},r.prototype.onscroll=function(){var t=r.getScrollPosition(),e=this.pointerDownScroll.x-t.x,i=this.pointerDownScroll.y-t.y;(Math.abs(e)>3||Math.abs(i)>3)&&this._pointerDone()},r.getPointerPoint=function(t){return{x:void 0!==t.pageX?t.pageX:t.clientX,y:void 0!==t.pageY?t.pageY:t.clientY}};var c=void 0!==t.pageYOffset;return r.getScrollPosition=function(){return{x:c?t.pageXOffset:document.body.scrollLeft,y:c?t.pageYOffset:document.body.scrollTop}},r.getPointerPoint=i.getPointerPoint,r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity/js/drag",["classie/classie","eventie/eventie","./flickity","unidragger/unidragger","fizzy-ui-utils/utils"],function(i,n,o,r,s){return e(t,i,n,o,r,s)}):"object"==typeof exports?module.exports=e(t,require("desandro-classie"),require("eventie"),require("./flickity"),require("unidragger"),require("fizzy-ui-utils")):t.Flickity=e(t,t.classie,t.eventie,t.Flickity,t.Unidragger,t.fizzyUIUtils)}(window,function(t,e,i,n,o,r){function s(t){t.preventDefault?t.preventDefault():t.returnValue=!1}r.extend(n.defaults,{draggable:!0}),n.createMethods.push("_createDrag"),r.extend(n.prototype,o.prototype),n.prototype._createDrag=function(){this.on("activate",this.bindDrag),this.on("uiChange",this._uiChangeDrag),this.on("childUIPointerDown",this._childUIPointerDownDrag),this.on("deactivate",this.unbindDrag)},n.prototype.bindDrag=function(){this.options.draggable&&!this.isDragBound&&(e.add(this.element,"is-draggable"),this.handles=[this.viewport],this.bindHandles(),this.isDragBound=!0)},n.prototype.unbindDrag=function(){this.isDragBound&&(e.remove(this.element,"is-draggable"),this.unbindHandles(),delete this.isDragBound)},n.prototype._uiChangeDrag=function(){delete this.isFreeScrolling},n.prototype._childUIPointerDownDrag=function(t){s(t),this.pointerDownFocus(t)},n.prototype.pointerDown=function(n,r){if("INPUT"==n.target.nodeName&&"range"==n.target.type)return this.isPointerDown=!1,void delete this.pointerIdentifier;this._dragPointerDown(n,r);var s=document.activeElement;s&&s.blur&&s!=this.element&&s!=document.body&&s.blur(),this.pointerDownFocus(n),this.dragX=this.x,e.add(this.viewport,"is-pointer-down"),this._bindPostStartEvents(n),this.pointerDownScroll=o.getScrollPosition(),i.bind(t,"scroll",this),this.dispatchEvent("pointerDown",n,[r])};var a={touchstart:!0,MSPointerDown:!0},l={INPUT:!0,SELECT:!0};return n.prototype.pointerDownFocus=function(e){if(this.options.accessibility&&!a[e.type]&&!l[e.target.nodeName]){var i=t.pageYOffset;this.element.focus(),t.pageYOffset!=i&&t.scrollTo(t.pageXOffset,i)}},n.prototype.hasDragStarted=function(t){return Math.abs(t.x)>3},n.prototype.pointerUp=function(t,i){e.remove(this.viewport,"is-pointer-down"),this.dispatchEvent("pointerUp",t,[i]),this._dragPointerUp(t,i)},n.prototype.pointerDone=function(){i.unbind(t,"scroll",this),delete this.pointerDownScroll},n.prototype.dragStart=function(t,e){this.dragStartPosition=this.x,this.startAnimation(),this.dispatchEvent("dragStart",t,[e])},n.prototype.dragMove=function(t,e,i){s(t),this.previousDragX=this.dragX;var n=this.options.rightToLeft?-1:1,o=this.dragStartPosition+i.x*n;if(!this.options.wrapAround&&this.cells.length){var r=Math.max(-this.cells[0].target,this.dragStartPosition);o=o>r?.5*(o+r):o;var a=Math.min(-this.getLastCell().target,this.dragStartPosition);o=a>o?.5*(o+a):o}this.dragX=o,this.dragMoveTime=new Date,this.dispatchEvent("dragMove",t,[e,i])},n.prototype.dragEnd=function(t,e){this.options.freeScroll&&(this.isFreeScrolling=!0);var i=this.dragEndRestingSelect();if(this.options.freeScroll&&!this.options.wrapAround){var n=this.getRestingPosition();this.isFreeScrolling=-n>this.cells[0].target&&-n<this.getLastCell().target}else this.options.freeScroll||i!=this.selectedIndex||(i+=this.dragEndBoostSelect());delete this.previousDragX,this.select(i),this.dispatchEvent("dragEnd",t,[e])},n.prototype.dragEndRestingSelect=function(){var t=this.getRestingPosition(),e=Math.abs(this.getCellDistance(-t,this.selectedIndex)),i=this._getClosestResting(t,e,1),n=this._getClosestResting(t,e,-1),o=i.distance<n.distance?i.index:n.index;return o},n.prototype._getClosestResting=function(t,e,i){for(var n=this.selectedIndex,o=1/0,r=this.options.contain&&!this.options.wrapAround?function(t,e){return e>=t}:function(t,e){return e>t};r(e,o)&&(n+=i,o=e,e=this.getCellDistance(-t,n),null!==e);)e=Math.abs(e);return{distance:o,index:n-i}},n.prototype.getCellDistance=function(t,e){var i=this.cells.length,n=this.options.wrapAround&&i>1,o=n?r.modulo(e,i):e,s=this.cells[o];if(!s)return null;var a=n?this.slideableWidth*Math.floor(e/i):0;return t-(s.target+a)},n.prototype.dragEndBoostSelect=function(){if(void 0===this.previousDragX||!this.dragMoveTime||new Date-this.dragMoveTime>100)return 0;var t=this.getCellDistance(-this.dragX,this.selectedIndex),e=this.previousDragX-this.dragX;return t>0&&e>0?1:0>t&&0>e?-1:0},n.prototype.staticClick=function(t,e){var i=this.getParentCell(t.target),n=i&&i.element,o=i&&r.indexOf(this.cells,i);this.dispatchEvent("staticClick",t,[e,n,o])},n}),function(t,e){"function"==typeof define&&define.amd?define("tap-listener/tap-listener",["unipointer/unipointer"],function(i){return e(t,i)}):"object"==typeof exports?module.exports=e(t,require("unipointer")):t.TapListener=e(t,t.Unipointer)}(window,function(t,e){function i(t){this.bindTap(t)}i.prototype=new e,i.prototype.bindTap=function(t){t&&(this.unbindTap(),this.tapElement=t,this._bindStartEvent(t,!0))},i.prototype.unbindTap=function(){this.tapElement&&(this._bindStartEvent(this.tapElement,!0),delete this.tapElement)};var n=void 0!==t.pageYOffset;return i.prototype.pointerUp=function(i,o){if(!this.isIgnoringMouseUp||"mouseup"!=i.type){var r=e.getPointerPoint(o),s=this.tapElement.getBoundingClientRect(),a=n?t.pageXOffset:document.body.scrollLeft,l=n?t.pageYOffset:document.body.scrollTop,h=r.x>=s.left+a&&r.x<=s.right+a&&r.y>=s.top+l&&r.y<=s.bottom+l;h&&this.emitEvent("tap",[i,o]),"mouseup"!=i.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),320))}},i.prototype.destroy=function(){this.pointerDone(),this.unbindTap()},i}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity/js/prev-next-button",["eventie/eventie","./flickity","tap-listener/tap-listener","fizzy-ui-utils/utils"],function(i,n,o,r){return e(t,i,n,o,r)}):"object"==typeof exports?module.exports=e(t,require("eventie"),require("./flickity"),require("tap-listener"),require("fizzy-ui-utils")):e(t,t.eventie,t.Flickity,t.TapListener,t.fizzyUIUtils)}(window,function(t,e,i,n,o){function r(t,e){this.direction=t,this.parent=e,this._create()}function s(t){return"string"==typeof t?t:"M "+t.x0+",50 L "+t.x1+","+(t.y1+50)+" L "+t.x2+","+(t.y2+50)+" L "+t.x3+",50 L "+t.x2+","+(50-t.y2)+" L "+t.x1+","+(50-t.y1)+" Z"}var a="http://www.w3.org/2000/svg",l=function(){function t(){if(void 0!==e)return e;var t=document.createElement("div");return t.innerHTML="<svg/>",e=(t.firstChild&&t.firstChild.namespaceURI)==a}var e;return t}();return r.prototype=new n,r.prototype._create=function(){this.isEnabled=!0,this.isPrevious=-1==this.direction;var t=this.parent.options.rightToLeft?1:-1;this.isLeft=this.direction==t;var e=this.element=document.createElement("button");if(e.className="flickity-prev-next-button",e.className+=this.isPrevious?" previous":" next",e.setAttribute("type","button"),this.disable(),e.setAttribute("aria-label",this.isPrevious?"previous":"next"),i.setUnselectable(e),l()){var n=this.createSVG();e.appendChild(n)}else this.setArrowText(),e.className+=" no-svg";var o=this;this.onCellSelect=function(){o.update()},this.parent.on("cellSelect",this.onCellSelect),this.on("tap",this.onTap),this.on("pointerDown",function(t,e){o.parent.childUIPointerDown(e)})},r.prototype.activate=function(){this.bindTap(this.element),e.bind(this.element,"click",this),this.parent.element.appendChild(this.element)},r.prototype.deactivate=function(){this.parent.element.removeChild(this.element),n.prototype.destroy.call(this),e.unbind(this.element,"click",this)},r.prototype.createSVG=function(){var t=document.createElementNS(a,"svg");t.setAttribute("viewBox","0 0 100 100");var e=document.createElementNS(a,"path"),i=s(this.parent.options.arrowShape);return e.setAttribute("d",i),e.setAttribute("class","arrow"),this.isLeft||e.setAttribute("transform","translate(100, 100) rotate(180) "),t.appendChild(e),t},r.prototype.setArrowText=function(){var t=this.parent.options,e=this.isLeft?t.leftArrowText:t.rightArrowText;o.setText(this.element,e)},r.prototype.onTap=function(){if(this.isEnabled){this.parent.uiChange();var t=this.isPrevious?"previous":"next";this.parent[t]()}},r.prototype.handleEvent=o.handleEvent,r.prototype.onclick=function(){var t=document.activeElement;t&&t==this.element&&this.onTap()},r.prototype.enable=function(){this.isEnabled||(this.element.disabled=!1,this.isEnabled=!0)},r.prototype.disable=function(){this.isEnabled&&(this.element.disabled=!0,this.isEnabled=!1)},r.prototype.update=function(){var t=this.parent.cells;if(this.parent.options.wrapAround&&t.length>1)return void this.enable();var e=t.length?t.length-1:0,i=this.isPrevious?0:e,n=this.parent.selectedIndex==i?"disable":"enable";this[n]()},r.prototype.destroy=function(){this.deactivate()},o.extend(i.defaults,{prevNextButtons:!0,leftArrowText:"‹",rightArrowText:"›",arrowShape:{x0:10,x1:60,y1:50,x2:70,y2:40,x3:30}}),i.createMethods.push("_createPrevNextButtons"),i.prototype._createPrevNextButtons=function(){this.options.prevNextButtons&&(this.prevButton=new r(-1,this),this.nextButton=new r(1,this),this.on("activate",this.activatePrevNextButtons))},i.prototype.activatePrevNextButtons=function(){this.prevButton.activate(),this.nextButton.activate(),this.on("deactivate",this.deactivatePrevNextButtons)},i.prototype.deactivatePrevNextButtons=function(){this.prevButton.deactivate(),this.nextButton.deactivate(),this.off("deactivate",this.deactivatePrevNextButtons)},i.PrevNextButton=r,i}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity/js/page-dots",["eventie/eventie","./flickity","tap-listener/tap-listener","fizzy-ui-utils/utils"],function(i,n,o,r){return e(t,i,n,o,r)}):"object"==typeof exports?module.exports=e(t,require("eventie"),require("./flickity"),require("tap-listener"),require("fizzy-ui-utils")):e(t,t.eventie,t.Flickity,t.TapListener,t.fizzyUIUtils)}(window,function(t,e,i,n,o){function r(t){this.parent=t,this._create()}return r.prototype=new n,r.prototype._create=function(){this.holder=document.createElement("ol"),this.holder.className="flickity-page-dots",i.setUnselectable(this.holder),this.dots=[];var t=this;this.onCellSelect=function(){t.updateSelected()},this.parent.on("cellSelect",this.onCellSelect),this.on("tap",this.onTap),this.on("pointerDown",function(e,i){t.parent.childUIPointerDown(i)})},r.prototype.activate=function(){this.setDots(),this.bindTap(this.holder),this.parent.element.appendChild(this.holder)},r.prototype.deactivate=function(){this.parent.element.removeChild(this.holder),n.prototype.destroy.call(this)},r.prototype.setDots=function(){var t=this.parent.cells.length-this.dots.length;t>0?this.addDots(t):0>t&&this.removeDots(-t)},r.prototype.addDots=function(t){for(var e=document.createDocumentFragment(),i=[];t;){var n=document.createElement("li");n.className="dot",e.appendChild(n),i.push(n),t--}this.holder.appendChild(e),this.dots=this.dots.concat(i)},r.prototype.removeDots=function(t){for(var e=this.dots.splice(this.dots.length-t,t),i=0,n=e.length;n>i;i++){var o=e[i];this.holder.removeChild(o)}},r.prototype.updateSelected=function(){this.selectedDot&&(this.selectedDot.className="dot"),this.dots.length&&(this.selectedDot=this.dots[this.parent.selectedIndex],this.selectedDot.className="dot is-selected")},r.prototype.onTap=function(t){var e=t.target;if("LI"==e.nodeName){this.parent.uiChange();var i=o.indexOf(this.dots,e);this.parent.select(i)}},r.prototype.destroy=function(){this.deactivate()},i.PageDots=r,o.extend(i.defaults,{pageDots:!0}),i.createMethods.push("_createPageDots"),i.prototype._createPageDots=function(){this.options.pageDots&&(this.pageDots=new r(this),this.on("activate",this.activatePageDots),this.on("cellAddedRemoved",this.onCellAddedRemovedPageDots),this.on("deactivate",this.deactivatePageDots))},i.prototype.activatePageDots=function(){this.pageDots.activate()},i.prototype.onCellAddedRemovedPageDots=function(){this.pageDots.setDots()},i.prototype.deactivatePageDots=function(){this.pageDots.deactivate()},i.PageDots=r,i}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity/js/player",["eventEmitter/EventEmitter","eventie/eventie","fizzy-ui-utils/utils","./flickity"],function(t,i,n,o){return e(t,i,n,o)}):"object"==typeof exports?module.exports=e(require("wolfy87-eventemitter"),require("eventie"),require("fizzy-ui-utils"),require("./flickity")):e(t.EventEmitter,t.eventie,t.fizzyUIUtils,t.Flickity)}(window,function(t,e,i,n){function o(t){if(this.parent=t,this.state="stopped",s){var e=this;this.onVisibilityChange=function(){e.visibilityChange()}}}var r,s;return"hidden"in document?(r="hidden",s="visibilitychange"):"webkitHidden"in document&&(r="webkitHidden",s="webkitvisibilitychange"),o.prototype=new t,o.prototype.play=function(){"playing"!=this.state&&(this.state="playing",s&&document.addEventListener(s,this.onVisibilityChange,!1),this.tick())},o.prototype.tick=function(){if("playing"==this.state){var t=this.parent.options.autoPlay;t="number"==typeof t?t:3e3;var e=this;this.clear(),this.timeout=setTimeout(function(){e.parent.next(!0),e.tick()},t)}},o.prototype.stop=function(){this.state="stopped",this.clear(),s&&document.removeEventListener(s,this.onVisibilityChange,!1)},o.prototype.clear=function(){clearTimeout(this.timeout)},o.prototype.pause=function(){"playing"==this.state&&(this.state="paused",this.clear())},o.prototype.unpause=function(){"paused"==this.state&&this.play()},o.prototype.visibilityChange=function(){var t=document[r];this[t?"pause":"unpause"]()},i.extend(n.defaults,{pauseAutoPlayOnHover:!0}),n.createMethods.push("_createPlayer"),n.prototype._createPlayer=function(){this.player=new o(this),this.on("activate",this.activatePlayer),this.on("uiChange",this.stopPlayer),this.on("pointerDown",this.stopPlayer),this.on("deactivate",this.deactivatePlayer)},n.prototype.activatePlayer=function(){this.options.autoPlay&&(this.player.play(),e.bind(this.element,"mouseenter",this),this.isMouseenterBound=!0)},n.prototype.playPlayer=function(){this.player.play()},n.prototype.stopPlayer=function(){this.player.stop()},n.prototype.pausePlayer=function(){this.player.pause()},n.prototype.unpausePlayer=function(){this.player.unpause()},n.prototype.deactivatePlayer=function(){this.player.stop(),this.isMouseenterBound&&(e.unbind(this.element,"mouseenter",this),delete this.isMouseenterBound)},n.prototype.onmouseenter=function(){this.options.pauseAutoPlayOnHover&&(this.player.pause(),e.bind(this.element,"mouseleave",this))},n.prototype.onmouseleave=function(){this.player.unpause(),e.unbind(this.element,"mouseleave",this)},n.Player=o,n}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity/js/add-remove-cell",["./flickity","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof exports?module.exports=e(t,require("./flickity"),require("fizzy-ui-utils")):e(t,t.Flickity,t.fizzyUIUtils)}(window,function(t,e,i){function n(t){for(var e=document.createDocumentFragment(),i=0,n=t.length;n>i;i++){var o=t[i];e.appendChild(o.element)}return e}return e.prototype.insert=function(t,e){var i=this._makeCells(t);if(i&&i.length){var o=this.cells.length;e=void 0===e?o:e;var r=n(i),s=e==o;if(s)this.slider.appendChild(r);else{var a=this.cells[e].element;this.slider.insertBefore(r,a)}if(0===e)this.cells=i.concat(this.cells);else if(s)this.cells=this.cells.concat(i);else{var l=this.cells.splice(e,o-e);this.cells=this.cells.concat(i).concat(l)}this._sizeCells(i);var h=e>this.selectedIndex?0:i.length;this._cellAddedRemoved(e,h)}},e.prototype.append=function(t){this.insert(t,this.cells.length)},e.prototype.prepend=function(t){this.insert(t,0)},e.prototype.remove=function(t){var e,n,o,r=this.getCells(t),s=0;for(e=0,n=r.length;n>e;e++){o=r[e];var a=i.indexOf(this.cells,o)<this.selectedIndex;s-=a?1:0}for(e=0,n=r.length;n>e;e++)o=r[e],o.remove(),i.removeFrom(this.cells,o);r.length&&this._cellAddedRemoved(0,s)},e.prototype._cellAddedRemoved=function(t,e){e=e||0,this.selectedIndex+=e,this.selectedIndex=Math.max(0,Math.min(this.cells.length-1,this.selectedIndex)),this.emitEvent("cellAddedRemoved",[t,e]),this.cellChange(t,!0)},e.prototype.cellSizeChange=function(t){var e=this.getCell(t);if(e){e.getSize();var n=i.indexOf(this.cells,e);this.cellChange(n)}},e.prototype.cellChange=function(t,e){var i=this.slideableWidth;if(this._positionCells(t),this._getWrapShiftCells(),this.setGallerySize(),this.options.freeScroll){var n=i-this.slideableWidth;this.x+=n*this.cellAlign,this.positionSlider()}else e&&this.positionSliderAtSelected(),this.select(this.selectedIndex)},e}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity/js/lazyload",["classie/classie","eventie/eventie","./flickity","fizzy-ui-utils/utils"],function(i,n,o,r){return e(t,i,n,o,r)}):"object"==typeof exports?module.exports=e(t,require("desandro-classie"),require("eventie"),require("./flickity"),require("fizzy-ui-utils")):e(t,t.classie,t.eventie,t.Flickity,t.fizzyUIUtils)}(window,function(t,e,i,n,o){"use strict";function r(t){if("IMG"==t.nodeName&&t.getAttribute("data-flickity-lazyload"))return[t];var e=t.querySelectorAll("img[data-flickity-lazyload]");return o.makeArray(e)}function s(t,e){this.img=t,this.flickity=e,this.load()}return n.createMethods.push("_createLazyload"),n.prototype._createLazyload=function(){this.on("cellSelect",this.lazyLoad)},n.prototype.lazyLoad=function(){var t=this.options.lazyLoad;if(t){for(var e="number"==typeof t?t:0,i=this.getAdjacentCellElements(e),n=[],o=0,a=i.length;a>o;o++){var l=i[o],h=r(l);n=n.concat(h)}for(o=0,a=n.length;a>o;o++){var c=n[o];new s(c,this)}}},s.prototype.handleEvent=o.handleEvent,s.prototype.load=function(){i.bind(this.img,"load",this),i.bind(this.img,"error",this),this.img.src=this.img.getAttribute("data-flickity-lazyload"),this.img.removeAttribute("data-flickity-lazyload")},s.prototype.onload=function(t){this.complete(t,"flickity-lazyloaded")},s.prototype.onerror=function(t){this.complete(t,"flickity-lazyerror")},s.prototype.complete=function(t,n){i.unbind(this.img,"load",this),i.unbind(this.img,"error",this);var o=this.flickity.getParentCell(this.img),r=o&&o.element;this.flickity.cellSizeChange(r),e.add(this.img,n),this.flickity.dispatchEvent("lazyLoad",t,r)},n.LazyLoader=s,n}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity/js/index",["./flickity","./drag","./prev-next-button","./page-dots","./player","./add-remove-cell","./lazyload"],e):"object"==typeof exports&&(module.exports=e(require("./flickity"),require("./drag"),require("./prev-next-button"),require("./page-dots"),require("./player"),require("./add-remove-cell"),require("./lazyload")))}(window,function(t){return t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("flickity-as-nav-for/as-nav-for",["classie/classie","flickity/js/index","fizzy-ui-utils/utils"],function(i,n,o){return e(t,i,n,o)}):"object"==typeof exports?module.exports=e(t,require("desandro-classie"),require("flickity"),require("fizzy-ui-utils")):t.Flickity=e(t,t.classie,t.Flickity,t.fizzyUIUtils)}(window,function(t,e,i,n){return i.createMethods.push("_createAsNavFor"),i.prototype._createAsNavFor=function(){this.on("activate",this.activateAsNavFor),this.on("deactivate",this.deactivateAsNavFor),this.on("destroy",this.destroyAsNavFor);var t=this.options.asNavFor;if(t){var e=this;setTimeout(function(){e.setNavCompanion(t)})}},i.prototype.setNavCompanion=function(t){t=n.getQueryElement(t);var e=i.data(t);if(e&&e!=this){this.navCompanion=e;var o=this;this.onNavCompanionSelect=function(){o.navCompanionSelect()},e.on("cellSelect",this.onNavCompanionSelect),this.on("staticClick",this.onNavStaticClick),this.navCompanionSelect()}},i.prototype.navCompanionSelect=function(){if(this.navCompanion){var t=this.navCompanion.selectedIndex;this.select(t),this.removeNavSelectedElement(),this.selectedIndex==t&&(this.navSelectedElement=this.cells[t].element,e.add(this.navSelectedElement,"is-nav-selected"))}},i.prototype.activateAsNavFor=function(){this.navCompanionSelect()},i.prototype.removeNavSelectedElement=function(){this.navSelectedElement&&(e.remove(this.navSelectedElement,"is-nav-selected"),delete this.navSelectedElement)},i.prototype.onNavStaticClick=function(t,e,i,n){"number"==typeof n&&this.navCompanion.select(n)},i.prototype.deactivateAsNavFor=function(){this.removeNavSelectedElement()},i.prototype.destroyAsNavFor=function(){this.navCompanion&&(this.navCompanion.off("cellSelect",this.onNavCompanionSelect),this.off("staticClick",this.onNavStaticClick),delete this.navCompanion)},i}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("imagesloaded/imagesloaded",["eventEmitter/EventEmitter","eventie/eventie"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("wolfy87-eventemitter"),require("eventie")):t.imagesLoaded=e(t,t.EventEmitter,t.eventie)}(window,function(t,e,i){function n(t,e){for(var i in e)t[i]=e[i];return t}function o(t){return"[object Array]"==p.call(t)}function r(t){var e=[];if(o(t))e=t;else if("number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e}function s(t,e,i){if(!(this instanceof s))return new s(t,e,i);"string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=r(t),this.options=n({},this.options),"function"==typeof e?i=e:n(this.options,e),i&&this.on("always",i),this.getImages(),h&&(this.jqDeferred=new h.Deferred);var o=this;setTimeout(function(){o.check()})}function a(t){this.img=t}function l(t,e){this.url=t,this.element=e,this.img=new Image}var h=t.jQuery,c=t.console,p=Object.prototype.toString;s.prototype=new e,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var t=0;t<this.elements.length;t++){var e=this.elements[t];this.addElementImages(e)}},s.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),this.options.background===!0&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&d[e]){for(var i=t.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=t.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var d={1:!0,9:!0,11:!0};s.prototype.addElementBackgroundImages=function(t){for(var e=u(t),i=/url\(['"]*([^'"\)]+)['"]*\)/gi,n=i.exec(e.backgroundImage);null!==n;){var o=n&&n[1];o&&this.addBackground(o,t),n=i.exec(e.backgroundImage)}};var u=t.getComputedStyle||function(t){return t.currentStyle};return s.prototype.addImage=function(t){var e=new a(t);this.images.push(e)},s.prototype.addBackground=function(t,e){var i=new l(t,e);this.images.push(i)},s.prototype.check=function(){function t(t,i,n){setTimeout(function(){e.progress(t,i,n)})}var e=this;if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length)return void this.complete();for(var i=0;i<this.images.length;i++){var n=this.images[i];n.once("progress",t),n.check()}},s.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emit("progress",this,t,e),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&c&&c.log("progress: "+i,t,e)},s.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emit(t,this),this.emit("always",this),this.jqDeferred){var e=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[e](this)}},a.prototype=new e,a.prototype.check=function(){var t=this.getIsImageComplete();return t?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,i.bind(this.proxyImage,"load",this),i.bind(this.proxyImage,"error",this),i.bind(this.img,"load",this),i.bind(this.img,"error",this),void(this.proxyImage.src=this.img.src))},a.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},a.prototype.confirm=function(t,e){this.isLoaded=t,this.emit("progress",this,this.img,e)},a.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},a.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},a.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},a.prototype.unbindEvents=function(){i.unbind(this.proxyImage,"load",this),i.unbind(this.proxyImage,"error",this),i.unbind(this.img,"load",this),i.unbind(this.img,"error",this)},l.prototype=new a,l.prototype.check=function(){i.bind(this.img,"load",this),i.bind(this.img,"error",this),this.img.src=this.url;var t=this.getIsImageComplete();t&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},l.prototype.unbindEvents=function(){i.unbind(this.img,"load",this),i.unbind(this.img,"error",this)},l.prototype.confirm=function(t,e){this.isLoaded=t,this.emit("progress",this,this.element,e)},s.makeJQueryPlugin=function(e){e=e||t.jQuery,e&&(h=e,h.fn.imagesLoaded=function(t,e){var i=new s(this,t,e);return i.jqDeferred.promise(h(this))})},s.makeJQueryPlugin(),s}),function(t,e){"use strict";"function"==typeof define&&define.amd?define(["flickity/js/index","imagesloaded/imagesloaded"],function(i,n){return e(t,i,n)}):"object"==typeof exports?module.exports=e(t,require("flickity"),require("imagesloaded")):t.Flickity=e(t,t.Flickity,t.imagesLoaded)}(window,function(t,e,i){"use strict";return e.createMethods.push("_createImagesLoaded"),e.prototype._createImagesLoaded=function(){this.on("activate",this.imagesLoaded)},e.prototype.imagesLoaded=function(){function t(t,i){var n=e.getParentCell(i.img);e.cellSizeChange(n&&n.element),e.options.freeScroll||e.positionSliderAtSelected()}if(this.options.imagesLoaded){var e=this;i(this.slider).on("progress",t)}},e}); | ||
!function(t,e){"use strict";"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,o,a){function h(t,e,n){var s,o="$()."+i+'("'+e+'")';return t.each(function(t,h){var l=a.data(h,i);if(!l)return void r(i+" not initialized. Cannot call methods, i.e. "+o);var c=l[e];if(!c||"_"==e.charAt(0))return void r(o+" is not a valid method");var d=c.apply(l,n);s=void 0===s?d:s}),void 0!==s?s:t}function l(t,e){t.each(function(t,n){var s=a.data(n,i);s?(s.option(e),s._init()):(s=new o(n,e),a.data(n,i,s))})}a=a||e||t.jQuery,a&&(o.prototype.option||(o.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=s.call(arguments,1);return h(this,t,e)}return l(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var s=Array.prototype.slice,o=t.console,r="undefined"==typeof o?function(){}:function(t){o.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return n.indexOf(e)==-1&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return n!=-1&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,s=i[n];e=e||[];for(var o=this._onceEvents&&this._onceEvents[t];s;){var r=o&&o[s];r&&(this.off(t,s),delete o[s]),s.apply(this,e),n+=r?0:1,s=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=t.indexOf("%")==-1&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<l;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}function s(){if(!c){c=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var s=n(e);o.isBoxSizeOuter=r=200==t(s.width),i.removeChild(e)}}function o(e){if(s(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var o=n(e);if("none"==o.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var c=a.isBorderBox="border-box"==o.boxSizing,d=0;d<l;d++){var u=h[d],f=o[u],p=parseFloat(f);a[u]=isNaN(p)?0:p}var v=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,m=a.marginLeft+a.marginRight,y=a.marginTop+a.marginBottom,S=a.borderLeftWidth+a.borderRightWidth,E=a.borderTopWidth+a.borderBottomWidth,b=c&&r,x=t(o.width);x!==!1&&(a.width=x+(b?0:v+S));var C=t(o.height);return C!==!1&&(a.height=C+(b?0:g+E)),a.innerWidth=a.width-(v+S),a.innerHeight=a.height-(g+E),a.outerWidth=a.width+m,a.outerHeight=a.height+y,a}}var r,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],l=h.length,c=!1;return o}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var n=e[i],s=n+"MatchesSelector";if(t[s])return s}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e},i.makeArray=function(t){var e=[];if(Array.isArray(t))e=t;else if(t&&"number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e},i.removeFrom=function(t,e){var i=t.indexOf(e);i!=-1&&t.splice(i,1)},i.getParent=function(t,i){for(;t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.filterFindElements=function(t,n){t=i.makeArray(t);var s=[];return t.forEach(function(t){if(t instanceof HTMLElement){if(!n)return void s.push(t);e(t,n)&&s.push(t);for(var i=t.querySelectorAll(n),o=0;o<i.length;o++)s.push(i[o])}}),s},i.debounceMethod=function(t,e,i){var n=t.prototype[e],s=e+"Timeout";t.prototype[e]=function(){var t=this[s];t&&clearTimeout(t);var e=arguments,o=this;this[s]=setTimeout(function(){n.apply(o,e),delete o[s]},i||100)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?t():document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var n=t.console;return i.htmlInit=function(e,s){i.docReady(function(){var o=i.toDashed(s),r="data-"+o,a=document.querySelectorAll("["+r+"]"),h=document.querySelectorAll(".js-"+o),l=i.makeArray(a).concat(i.makeArray(h)),c=r+"-options",d=t.jQuery;l.forEach(function(t){var i,o=t.getAttribute(r)||t.getAttribute(c);try{i=o&&JSON.parse(o)}catch(a){return void(n&&n.error("Error parsing "+r+" on "+t.className+": "+a))}var h=new e(t,i);d&&d.data(t,s,h)})})},i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/cell",["get-size/get-size"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("get-size")):(t.Flickity=t.Flickity||{},t.Flickity.Cell=e(t,t.getSize))}(window,function(t,e){function i(t,e){this.element=t,this.parent=e,this.create()}var n=i.prototype;return n.create=function(){this.element.style.position="absolute",this.x=0,this.shift=0},n.destroy=function(){this.element.style.position="";var t=this.parent.originSide;this.element.style[t]=""},n.getSize=function(){this.size=e(this.element)},n.setPosition=function(t){this.x=t,this.updateTarget(),this.renderPosition(t)},n.updateTarget=n.setDefaultTarget=function(){var t="left"==this.parent.originSide?"marginLeft":"marginRight";this.target=this.x+this.size[t]+this.size.width*this.parent.cellAlign},n.renderPosition=function(t){var e=this.parent.originSide;this.element.style[e]=this.parent.getPositionValue(t)},n.wrapShift=function(t){this.shift=t,this.renderPosition(this.x+this.parent.slideableWidth*t)},n.remove=function(){this.element.parentNode.removeChild(this.element)},i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/slide",e):"object"==typeof module&&module.exports?module.exports=e():(t.Flickity=t.Flickity||{},t.Flickity.Slide=e())}(window,function(){"use strict";function t(t){this.parent=t,this.isOriginLeft="left"==t.originSide,this.cells=[],this.outerWidth=0,this.height=0}var e=t.prototype;return e.addCell=function(t){if(this.cells.push(t),this.outerWidth+=t.size.outerWidth,this.height=Math.max(t.size.outerHeight,this.height),1==this.cells.length){this.x=t.x;var e=this.isOriginLeft?"marginLeft":"marginRight";this.firstMargin=t.size[e]}},e.updateTarget=function(){var t=this.isOriginLeft?"marginRight":"marginLeft",e=this.getLastCell(),i=e?e.size[t]:0,n=this.outerWidth-(this.firstMargin+i);this.target=this.x+this.firstMargin+n*this.parent.cellAlign},e.getLastCell=function(){return this.cells[this.cells.length-1]},e.select=function(){this.changeSelectedClass("add")},e.unselect=function(){this.changeSelectedClass("remove")},e.changeSelectedClass=function(t){this.cells.forEach(function(e){e.element.classList[t]("is-selected")})},e.getCellElements=function(){return this.cells.map(function(t){return t.element})},t}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/animate",["fizzy-ui-utils/utils"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("fizzy-ui-utils")):(t.Flickity=t.Flickity||{},t.Flickity.animatePrototype=e(t,t.fizzyUIUtils))}(window,function(t,e){var i=t.requestAnimationFrame||t.webkitRequestAnimationFrame,n=0;i||(i=function(t){var e=(new Date).getTime(),i=Math.max(0,16-(e-n)),s=setTimeout(t,i);return n=e+i,s});var s={};s.startAnimation=function(){this.isAnimating||(this.isAnimating=!0,this.restingFrames=0,this.animate())},s.animate=function(){this.applyDragForce(),this.applySelectedAttraction();var t=this.x;if(this.integratePhysics(),this.positionSlider(),this.settle(t),this.isAnimating){var e=this;i(function(){e.animate()})}};var o=function(){var t=document.documentElement.style;return"string"==typeof t.transform?"transform":"WebkitTransform"}();return s.positionSlider=function(){var t=this.x;this.options.wrapAround&&this.cells.length>1&&(t=e.modulo(t,this.slideableWidth),t-=this.slideableWidth,this.shiftWrapCells(t)),t+=this.cursorPosition,t=this.options.rightToLeft&&o?-t:t;var i=this.getPositionValue(t);o?this.slider.style[o]=this.isAnimating?"translate3d("+i+",0,0)":"translateX("+i+")":this.slider.style[this.originSide]=i;var n=this.slides[0];if(n){var s=-this.x-n.target,r=s/this.slidesWidth;this.emitEvent("scroll",[r,s])}},s.positionSliderAtSelected=function(){this.cells.length&&(this.x=-this.selectedSlide.target,this.positionSlider())},s.getPositionValue=function(t){return this.options.percentPosition?.01*Math.round(t/this.size.innerWidth*1e4)+"%":Math.round(t)+"px"},s.settle=function(t){this.isPointerDown||Math.round(100*this.x)!=Math.round(100*t)||this.restingFrames++,this.restingFrames>2&&(this.isAnimating=!1,delete this.isFreeScrolling,this.positionSlider(),this.dispatchEvent("settle"))},s.shiftWrapCells=function(t){var e=this.cursorPosition+t;this._shiftCells(this.beforeShiftCells,e,-1);var i=this.size.innerWidth-(t+this.slideableWidth+this.cursorPosition);this._shiftCells(this.afterShiftCells,i,1)},s._shiftCells=function(t,e,i){for(var n=0;n<t.length;n++){var s=t[n],o=e>0?i:0;s.wrapShift(o),e-=s.size.outerWidth}},s._unshiftCells=function(t){if(t&&t.length)for(var e=0;e<t.length;e++)t[e].wrapShift(0)},s.integratePhysics=function(){this.x+=this.velocity,this.velocity*=this.getFrictionFactor()},s.applyForce=function(t){this.velocity+=t},s.getFrictionFactor=function(){return 1-this.options[this.isFreeScrolling?"freeScrollFriction":"friction"]},s.getRestingPosition=function(){return this.x+this.velocity/(1-this.getFrictionFactor())},s.applyDragForce=function(){if(this.isPointerDown){var t=this.dragX-this.x,e=t-this.velocity;this.applyForce(e)}},s.applySelectedAttraction=function(){if(!this.isPointerDown&&!this.isFreeScrolling&&this.cells.length){var t=this.selectedSlide.target*-1-this.x,e=t*this.options.selectedAttraction;this.applyForce(e)}},s}),function(t,e){if("function"==typeof define&&define.amd)define("flickity/js/flickity",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./cell","./slide","./animate"],function(i,n,s,o,r,a){return e(t,i,n,s,o,r,a)});else if("object"==typeof module&&module.exports)module.exports=e(t,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./cell"),require("./slide"),require("./animate"));else{var i=t.Flickity;t.Flickity=e(t,t.EvEmitter,t.getSize,t.fizzyUIUtils,i.Cell,i.Slide,i.animatePrototype)}}(window,function(t,e,i,n,s,o,r){function a(t,e){for(t=n.makeArray(t);t.length;)e.appendChild(t.shift())}function h(t,e){var i=n.getQueryElement(t);return i?(this.element=i,l&&(this.$element=l(this.element)),this.options=n.extend({},this.constructor.defaults),this.option(e),void this._create()):void(d&&d.error("Bad element for Flickity: "+(i||t)))}var l=t.jQuery,c=t.getComputedStyle,d=t.console,u=0,f={};h.defaults={accessibility:!0,cellAlign:"center",freeScrollFriction:.075,friction:.28,namespaceJQueryEvents:!0,percentPosition:!0,resize:!0,selectedAttraction:.025,setGallerySize:!0},h.createMethods=[];var p=h.prototype;n.extend(p,e.prototype),p._create=function(){var e=this.guid=++u;this.element.flickityGUID=e,f[e]=this,this.selectedIndex=0,this.restingFrames=0,this.x=0,this.velocity=0,this.originSide=this.options.rightToLeft?"right":"left",this.viewport=document.createElement("div"),this.viewport.className="flickity-viewport",this._createSlider(),(this.options.resize||this.options.watchCSS)&&t.addEventListener("resize",this),h.createMethods.forEach(function(t){this[t]()},this),this.options.watchCSS?this.watchCSS():this.activate()},p.option=function(t){n.extend(this.options,t)},p.activate=function(){if(!this.isActive){this.isActive=!0,this.element.classList.add("flickity-enabled"),this.options.rightToLeft&&this.element.classList.add("flickity-rtl"),this.getSize();var t=this._filterFindCellElements(this.element.children);a(t,this.slider),this.viewport.appendChild(this.slider),this.element.appendChild(this.viewport),this.reloadCells(),this.options.accessibility&&(this.element.tabIndex=0,this.element.addEventListener("keydown",this)),this.emitEvent("activate");var e,i=this.options.initialIndex;e=this.isInitActivated?this.selectedIndex:void 0!==i&&this.cells[i]?i:0,this.select(e,!1,!0),this.isInitActivated=!0}},p._createSlider=function(){var t=document.createElement("div");t.className="flickity-slider",t.style[this.originSide]=0,this.slider=t},p._filterFindCellElements=function(t){return n.filterFindElements(t,this.options.cellSelector)},p.reloadCells=function(){this.cells=this._makeCells(this.slider.children),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize()},p._makeCells=function(t){var e=this._filterFindCellElements(t),i=e.map(function(t){return new s(t,this)},this);return i},p.getLastCell=function(){return this.cells[this.cells.length-1]},p.getLastSlide=function(){return this.slides[this.slides.length-1]},p.positionCells=function(){this._sizeCells(this.cells),this._positionCells(0)},p._positionCells=function(t){t=t||0,this.maxCellHeight=t?this.maxCellHeight||0:0;var e=0;if(t>0){var i=this.cells[t-1];e=i.x+i.size.outerWidth}for(var n=this.cells.length,s=t;s<n;s++){var o=this.cells[s];o.setPosition(e),e+=o.size.outerWidth,this.maxCellHeight=Math.max(o.size.outerHeight,this.maxCellHeight)}this.slideableWidth=e,this.updateSlides(),this._containSlides(),this.slidesWidth=n?this.getLastSlide().target-this.slides[0].target:0},p._sizeCells=function(t){t.forEach(function(t){t.getSize()})},p.updateSlides=function(){if(this.slides=[],this.cells.length){var t=new o(this);this.slides.push(t);var e="left"==this.originSide,i=e?"marginRight":"marginLeft",n=this._getCanCellFit();this.cells.forEach(function(e,s){if(!t.cells.length)return void t.addCell(e);var r=t.outerWidth-t.firstMargin+(e.size.outerWidth-e.size[i]);n.call(this,s,r)?t.addCell(e):(t.updateTarget(),t=new o(this),this.slides.push(t),t.addCell(e))},this),t.updateTarget(),this.updateSelectedSlide()}},p._getCanCellFit=function(){var t=this.options.groupCells;if(!t)return function(){return!1};if("number"==typeof t){var e=parseInt(t,10);return function(t){return t%e!==0}}var i="string"==typeof t&&t.match(/^(\d+)%$/),n=i?parseInt(i[1],10)/100:1;return function(t,e){return e<=(this.size.innerWidth+1)*n}},p._init=p.reposition=function(){this.positionCells(),this.positionSliderAtSelected()},p.getSize=function(){this.size=i(this.element),this.setCellAlign(),this.cursorPosition=this.size.innerWidth*this.cellAlign};var v={center:{left:.5,right:.5},left:{left:0,right:1},right:{right:0,left:1}};return p.setCellAlign=function(){var t=v[this.options.cellAlign];this.cellAlign=t?t[this.originSide]:this.options.cellAlign},p.setGallerySize=function(){if(this.options.setGallerySize){var t=this.options.adaptiveHeight&&this.selectedSlide?this.selectedSlide.height:this.maxCellHeight;this.viewport.style.height=t+"px"}},p._getWrapShiftCells=function(){if(this.options.wrapAround){this._unshiftCells(this.beforeShiftCells),this._unshiftCells(this.afterShiftCells);var t=this.cursorPosition,e=this.cells.length-1;this.beforeShiftCells=this._getGapCells(t,e,-1),t=this.size.innerWidth-this.cursorPosition,this.afterShiftCells=this._getGapCells(t,0,1)}},p._getGapCells=function(t,e,i){for(var n=[];t>0;){var s=this.cells[e];if(!s)break;n.push(s),e+=i,t-=s.size.outerWidth}return n},p._containSlides=function(){if(this.options.contain&&!this.options.wrapAround&&this.cells.length){var t=this.options.rightToLeft,e=t?"marginRight":"marginLeft",i=t?"marginLeft":"marginRight",n=this.slideableWidth-this.getLastCell().size[i],s=n<this.size.innerWidth,o=this.cursorPosition+this.cells[0].size[e],r=n-this.size.innerWidth*(1-this.cellAlign);this.slides.forEach(function(t){s?t.target=n*this.cellAlign:(t.target=Math.max(t.target,o),t.target=Math.min(t.target,r))},this)}},p.dispatchEvent=function(t,e,i){var n=[e].concat(i);if(this.emitEvent(t,n),l&&this.$element){t+=this.options.namespaceJQueryEvents?".flickity":"";var s=t;if(e){var o=l.Event(e);o.type=t,s=o}this.$element.trigger(s,i)}},p.select=function(t,e,i){this.isActive&&(t=parseInt(t,10),this._wrapSelect(t),(this.options.wrapAround||e)&&(t=n.modulo(t,this.slides.length)),this.slides[t]&&(this.selectedIndex=t,this.updateSelectedSlide(),i?this.positionSliderAtSelected():this.startAnimation(),this.options.adaptiveHeight&&this.setGallerySize(),this.dispatchEvent("select"),this.dispatchEvent("cellSelect")))},p._wrapSelect=function(t){var e=this.slides.length,i=this.options.wrapAround&&e>1;if(!i)return t;var s=n.modulo(t,e),o=Math.abs(s-this.selectedIndex),r=Math.abs(s+e-this.selectedIndex),a=Math.abs(s-e-this.selectedIndex);!this.isDragSelect&&r<o?t+=e:!this.isDragSelect&&a<o&&(t-=e),t<0?this.x-=this.slideableWidth:t>=e&&(this.x+=this.slideableWidth)},p.previous=function(t){this.select(this.selectedIndex-1,t)},p.next=function(t){this.select(this.selectedIndex+1,t)},p.updateSelectedSlide=function(){var t=this.slides[this.selectedIndex];t&&(this.unselectSelectedSlide(),this.selectedSlide=t,t.select(),this.selectedCells=t.cells,this.selectedElements=t.getCellElements(),this.selectedCell=t.cells[0],this.selectedElement=this.selectedElements[0])},p.unselectSelectedSlide=function(){this.selectedSlide&&this.selectedSlide.unselect()},p.selectCell=function(t,e,i){var n;"number"==typeof t?n=this.cells[t]:("string"==typeof t&&(t=this.element.querySelector(t)),n=this.getCell(t));for(var s=0;n&&s<this.slides.length;s++){var o=this.slides[s],r=o.cells.indexOf(n);if(r!=-1)return void this.select(s,e,i)}},p.getCell=function(t){for(var e=0;e<this.cells.length;e++){var i=this.cells[e];if(i.element==t)return i}},p.getCells=function(t){t=n.makeArray(t);var e=[];return t.forEach(function(t){var i=this.getCell(t);i&&e.push(i)},this),e},p.getCellElements=function(){return this.cells.map(function(t){return t.element})},p.getParentCell=function(t){var e=this.getCell(t);return e?e:(t=n.getParent(t,".flickity-slider > *"),this.getCell(t))},p.getAdjacentCellElements=function(t,e){if(!t)return this.selectedSlide.getCellElements();e=void 0===e?this.selectedIndex:e;var i=this.slides.length;if(1+2*t>=i)return this.getCellElements();for(var s=[],o=e-t;o<=e+t;o++){var r=this.options.wrapAround?n.modulo(o,i):o,a=this.slides[r];a&&(s=s.concat(a.getCellElements()))}return s},p.uiChange=function(){this.emitEvent("uiChange")},p.childUIPointerDown=function(t){this.emitEvent("childUIPointerDown",[t])},p.onresize=function(){this.watchCSS(),this.resize()},n.debounceMethod(h,"onresize",150),p.resize=function(){if(this.isActive){this.getSize(),this.options.wrapAround&&(this.x=n.modulo(this.x,this.slideableWidth)),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize(),this.emitEvent("resize");var t=this.selectedElements&&this.selectedElements[0];this.selectCell(t,!1,!0)}},p.watchCSS=function(){var t=this.options.watchCSS;if(t){var e=c(this.element,":after").content;e.indexOf("flickity")!=-1?this.activate():this.deactivate()}},p.onkeydown=function(t){if(this.options.accessibility&&(!document.activeElement||document.activeElement==this.element))if(37==t.keyCode){var e=this.options.rightToLeft?"next":"previous";this.uiChange(),this[e]()}else if(39==t.keyCode){var i=this.options.rightToLeft?"previous":"next";this.uiChange(),this[i]()}},p.deactivate=function(){this.isActive&&(this.element.classList.remove("flickity-enabled"),this.element.classList.remove("flickity-rtl"),this.cells.forEach(function(t){t.destroy()}),this.unselectSelectedSlide(),this.element.removeChild(this.viewport),a(this.slider.children,this.element),this.options.accessibility&&(this.element.removeAttribute("tabIndex"),this.element.removeEventListener("keydown",this)),this.isActive=!1,this.emitEvent("deactivate"))},p.destroy=function(){this.deactivate(),t.removeEventListener("resize",this),this.emitEvent("destroy"),l&&this.$element&&l.removeData(this.element,"flickity"),delete this.element.flickityGUID,delete f[this.guid]},n.extend(p,r),h.data=function(t){t=n.getQueryElement(t);var e=t&&t.flickityGUID;return e&&f[e]},n.htmlInit(h,"flickity"),l&&l.bridget&&l.bridget("flickity",h),h.Cell=s,h}),function(t,e){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.Unipointer=e(t,t.EvEmitter)}(window,function(t,e){function i(){}function n(){}var s=n.prototype=Object.create(e.prototype);s.bindStartEvent=function(t){this._bindStartEvent(t,!0)},s.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},s._bindStartEvent=function(e,i){i=void 0===i||!!i;var n=i?"addEventListener":"removeEventListener";t.navigator.pointerEnabled?e[n]("pointerdown",this):t.navigator.msPointerEnabled?e[n]("MSPointerDown",this):(e[n]("mousedown",this),e[n]("touchstart",this))},s.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},s.getTouch=function(t){for(var e=0;e<t.length;e++){var i=t[e];if(i.identifier==this.pointerIdentifier)return i}},s.onmousedown=function(t){var e=t.button;e&&0!==e&&1!==e||this._pointerDown(t,t)},s.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},s.onMSPointerDown=s.onpointerdown=function(t){this._pointerDown(t,t)},s._pointerDown=function(t,e){this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==e.pointerId?e.pointerId:e.identifier,this.pointerDown(t,e))},s.pointerDown=function(t,e){this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])};var o={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"],MSPointerDown:["MSPointerMove","MSPointerUp","MSPointerCancel"]};return s._bindPostStartEvents=function(e){if(e){var i=o[e.type];i.forEach(function(e){t.addEventListener(e,this)},this),this._boundPointerEvents=i}},s._unbindPostStartEvents=function(){this._boundPointerEvents&&(this._boundPointerEvents.forEach(function(e){t.removeEventListener(e,this)},this),delete this._boundPointerEvents)},s.onmousemove=function(t){this._pointerMove(t,t)},s.onMSPointerMove=s.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},s.ontouchmove=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerMove(t,e)},s._pointerMove=function(t,e){this.pointerMove(t,e)},s.pointerMove=function(t,e){this.emitEvent("pointerMove",[t,e])},s.onmouseup=function(t){this._pointerUp(t,t)},s.onMSPointerUp=s.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},s.ontouchend=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerUp(t,e)},s._pointerUp=function(t,e){this._pointerDone(),this.pointerUp(t,e)},s.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e])},s._pointerDone=function(){this.isPointerDown=!1,delete this.pointerIdentifier,this._unbindPostStartEvents(),this.pointerDone()},s.pointerDone=i,s.onMSPointerCancel=s.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},s.ontouchcancel=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerCancel(t,e)},s._pointerCancel=function(t,e){this._pointerDone(),this.pointerCancel(t,e)},s.pointerCancel=function(t,e){this.emitEvent("pointerCancel",[t,e])},n.getPointerPoint=function(t){return{x:t.pageX,y:t.pageY}},n}),function(t,e){"function"==typeof define&&define.amd?define("unidragger/unidragger",["unipointer/unipointer"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("unipointer")):t.Unidragger=e(t,t.Unipointer)}(window,function(t,e){function i(){}function n(){}var s=n.prototype=Object.create(e.prototype);s.bindHandles=function(){this._bindHandles(!0)},s.unbindHandles=function(){this._bindHandles(!1)};var o=t.navigator;return s._bindHandles=function(t){t=void 0===t||!!t;var e;e=o.pointerEnabled?function(e){e.style.touchAction=t?"none":""}:o.msPointerEnabled?function(e){e.style.msTouchAction=t?"none":""}:i;for(var n=t?"addEventListener":"removeEventListener",s=0;s<this.handles.length;s++){var r=this.handles[s];this._bindStartEvent(r,t),e(r),r[n]("click",this)}},s.pointerDown=function(t,e){if("INPUT"==t.target.nodeName&&"range"==t.target.type)return this.isPointerDown=!1,void delete this.pointerIdentifier;this._dragPointerDown(t,e);var i=document.activeElement;i&&i.blur&&i.blur(),this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])},s._dragPointerDown=function(t,i){this.pointerDownPoint=e.getPointerPoint(i);var n=this.canPreventDefaultOnPointerDown(t,i);n&&t.preventDefault()},s.canPreventDefaultOnPointerDown=function(t){return"SELECT"!=t.target.nodeName},s.pointerMove=function(t,e){var i=this._dragPointerMove(t,e);this.emitEvent("pointerMove",[t,e,i]),this._dragMove(t,e,i)},s._dragPointerMove=function(t,i){var n=e.getPointerPoint(i),s={x:n.x-this.pointerDownPoint.x,y:n.y-this.pointerDownPoint.y};return!this.isDragging&&this.hasDragStarted(s)&&this._dragStart(t,i),s},s.hasDragStarted=function(t){return Math.abs(t.x)>3||Math.abs(t.y)>3},s.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e]),this._dragPointerUp(t,e)},s._dragPointerUp=function(t,e){this.isDragging?this._dragEnd(t,e):this._staticClick(t,e)},s._dragStart=function(t,i){this.isDragging=!0,this.dragStartPoint=e.getPointerPoint(i),this.isPreventingClicks=!0,this.dragStart(t,i)},s.dragStart=function(t,e){this.emitEvent("dragStart",[t,e])},s._dragMove=function(t,e,i){this.isDragging&&this.dragMove(t,e,i)},s.dragMove=function(t,e,i){t.preventDefault(),this.emitEvent("dragMove",[t,e,i])},s._dragEnd=function(t,e){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,e)},s.dragEnd=function(t,e){this.emitEvent("dragEnd",[t,e])},s.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},s._staticClick=function(t,e){if(!this.isIgnoringMouseUp||"mouseup"!=t.type){var i=t.target.nodeName;"INPUT"!=i&&"TEXTAREA"!=i||t.target.focus(),this.staticClick(t,e),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400))}},s.staticClick=function(t,e){this.emitEvent("staticClick",[t,e])},n.getPointerPoint=e.getPointerPoint,n}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/drag",["./flickity","unidragger/unidragger","fizzy-ui-utils/utils"],function(i,n,s){return e(t,i,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("unidragger"),require("fizzy-ui-utils")):t.Flickity=e(t,t.Flickity,t.Unidragger,t.fizzyUIUtils)}(window,function(t,e,i,n){function s(){return{x:t.pageXOffset,y:t.pageYOffset}}n.extend(e.defaults,{draggable:!0,dragThreshold:3}),e.createMethods.push("_createDrag");var o=e.prototype;n.extend(o,i.prototype),o._createDrag=function(){this.on("activate",this.bindDrag),this.on("uiChange",this._uiChangeDrag),this.on("childUIPointerDown",this._childUIPointerDownDrag),this.on("deactivate",this.unbindDrag)},o.bindDrag=function(){this.options.draggable&&!this.isDragBound&&(this.element.classList.add("is-draggable"),this.handles=[this.viewport],this.bindHandles(),this.isDragBound=!0)},o.unbindDrag=function(){this.isDragBound&&(this.element.classList.remove("is-draggable"),this.unbindHandles(),delete this.isDragBound)},o._uiChangeDrag=function(){delete this.isFreeScrolling},o._childUIPointerDownDrag=function(t){t.preventDefault(),this.pointerDownFocus(t)};var r={TEXTAREA:!0,INPUT:!0},a={radio:!0,checkbox:!0,button:!0,submit:!0,image:!0,file:!0};o.pointerDown=function(e,i){var n=r[e.target.nodeName]&&!a[e.target.type];if(n)return this.isPointerDown=!1,void delete this.pointerIdentifier;this._dragPointerDown(e,i);var o=document.activeElement;o&&o.blur&&o!=this.element&&o!=document.body&&o.blur(),this.pointerDownFocus(e),this.dragX=this.x,this.viewport.classList.add("is-pointer-down"),this._bindPostStartEvents(e),this.pointerDownScroll=s(),t.addEventListener("scroll",this),this.dispatchEvent("pointerDown",e,[i])};var h={touchstart:!0,MSPointerDown:!0},l={INPUT:!0,SELECT:!0};return o.pointerDownFocus=function(e){if(this.options.accessibility&&!h[e.type]&&!l[e.target.nodeName]){var i=t.pageYOffset;this.element.focus(),t.pageYOffset!=i&&t.scrollTo(t.pageXOffset,i)}},o.canPreventDefaultOnPointerDown=function(t){var e="touchstart"==t.type,i=t.target.nodeName;return!e&&"SELECT"!=i},o.hasDragStarted=function(t){return Math.abs(t.x)>this.options.dragThreshold},o.pointerUp=function(t,e){delete this.isTouchScrolling,this.viewport.classList.remove("is-pointer-down"),this.dispatchEvent("pointerUp",t,[e]),this._dragPointerUp(t,e)},o.pointerDone=function(){t.removeEventListener("scroll",this),delete this.pointerDownScroll},o.dragStart=function(t,e){this.dragStartPosition=this.x,this.startAnimation(),this.dispatchEvent("dragStart",t,[e])},o.dragMove=function(t,e,i){t.preventDefault(),this.previousDragX=this.dragX;var n=this.options.rightToLeft?-1:1,s=this.dragStartPosition+i.x*n;if(!this.options.wrapAround&&this.slides.length){var o=Math.max(-this.slides[0].target,this.dragStartPosition);s=s>o?.5*(s+o):s;var r=Math.min(-this.getLastSlide().target,this.dragStartPosition);s=s<r?.5*(s+r):s}this.dragX=s,this.dragMoveTime=new Date,this.dispatchEvent("dragMove",t,[e,i])},o.dragEnd=function(t,e){this.options.freeScroll&&(this.isFreeScrolling=!0);var i=this.dragEndRestingSelect();if(this.options.freeScroll&&!this.options.wrapAround){var n=this.getRestingPosition();this.isFreeScrolling=-n>this.slides[0].target&&-n<this.getLastSlide().target}else this.options.freeScroll||i!=this.selectedIndex||(i+=this.dragEndBoostSelect());delete this.previousDragX,this.isDragSelect=this.options.wrapAround,this.select(i),delete this.isDragSelect,this.dispatchEvent("dragEnd",t,[e])},o.dragEndRestingSelect=function(){var t=this.getRestingPosition(),e=Math.abs(this.getSlideDistance(-t,this.selectedIndex)),i=this._getClosestResting(t,e,1),n=this._getClosestResting(t,e,-1),s=i.distance<n.distance?i.index:n.index;return s},o._getClosestResting=function(t,e,i){for(var n=this.selectedIndex,s=1/0,o=this.options.contain&&!this.options.wrapAround?function(t,e){ | ||
return t<=e}:function(t,e){return t<e};o(e,s)&&(n+=i,s=e,e=this.getSlideDistance(-t,n),null!==e);)e=Math.abs(e);return{distance:s,index:n-i}},o.getSlideDistance=function(t,e){var i=this.slides.length,s=this.options.wrapAround&&i>1,o=s?n.modulo(e,i):e,r=this.slides[o];if(!r)return null;var a=s?this.slideableWidth*Math.floor(e/i):0;return t-(r.target+a)},o.dragEndBoostSelect=function(){if(void 0===this.previousDragX||!this.dragMoveTime||new Date-this.dragMoveTime>100)return 0;var t=this.getSlideDistance(-this.dragX,this.selectedIndex),e=this.previousDragX-this.dragX;return t>0&&e>0?1:t<0&&e<0?-1:0},o.staticClick=function(t,e){var i=this.getParentCell(t.target),n=i&&i.element,s=i&&this.cells.indexOf(i);this.dispatchEvent("staticClick",t,[e,n,s])},o.onscroll=function(){var t=s(),e=this.pointerDownScroll.x-t.x,i=this.pointerDownScroll.y-t.y;(Math.abs(e)>3||Math.abs(i)>3)&&this._pointerDone()},e}),function(t,e){"function"==typeof define&&define.amd?define("tap-listener/tap-listener",["unipointer/unipointer"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("unipointer")):t.TapListener=e(t,t.Unipointer)}(window,function(t,e){function i(t){this.bindTap(t)}var n=i.prototype=Object.create(e.prototype);return n.bindTap=function(t){t&&(this.unbindTap(),this.tapElement=t,this._bindStartEvent(t,!0))},n.unbindTap=function(){this.tapElement&&(this._bindStartEvent(this.tapElement,!0),delete this.tapElement)},n.pointerUp=function(i,n){if(!this.isIgnoringMouseUp||"mouseup"!=i.type){var s=e.getPointerPoint(n),o=this.tapElement.getBoundingClientRect(),r=t.pageXOffset,a=t.pageYOffset,h=s.x>=o.left+r&&s.x<=o.right+r&&s.y>=o.top+a&&s.y<=o.bottom+a;if(h&&this.emitEvent("tap",[i,n]),"mouseup"!=i.type){this.isIgnoringMouseUp=!0;var l=this;setTimeout(function(){delete l.isIgnoringMouseUp},400)}}},n.destroy=function(){this.pointerDone(),this.unbindTap()},i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/prev-next-button",["./flickity","tap-listener/tap-listener","fizzy-ui-utils/utils"],function(i,n,s){return e(t,i,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("tap-listener"),require("fizzy-ui-utils")):e(t,t.Flickity,t.TapListener,t.fizzyUIUtils)}(window,function(t,e,i,n){"use strict";function s(t,e){this.direction=t,this.parent=e,this._create()}function o(t){return"string"==typeof t?t:"M "+t.x0+",50 L "+t.x1+","+(t.y1+50)+" L "+t.x2+","+(t.y2+50)+" L "+t.x3+",50 L "+t.x2+","+(50-t.y2)+" L "+t.x1+","+(50-t.y1)+" Z"}var r="http://www.w3.org/2000/svg";s.prototype=new i,s.prototype._create=function(){this.isEnabled=!0,this.isPrevious=this.direction==-1;var t=this.parent.options.rightToLeft?1:-1;this.isLeft=this.direction==t;var e=this.element=document.createElement("button");e.className="flickity-prev-next-button",e.className+=this.isPrevious?" previous":" next",e.setAttribute("type","button"),this.disable(),e.setAttribute("aria-label",this.isPrevious?"previous":"next");var i=this.createSVG();e.appendChild(i),this.parent.on("select",function(){this.update()}.bind(this)),this.on("tap",this.onTap),this.on("pointerDown",function(t,e){this.parent.childUIPointerDown(e)}.bind(this))},s.prototype.activate=function(){this.bindTap(this.element),this.element.addEventListener("click",this),this.parent.element.appendChild(this.element)},s.prototype.deactivate=function(){this.parent.element.removeChild(this.element),i.prototype.destroy.call(this),this.element.removeEventListener("click",this)},s.prototype.createSVG=function(){var t=document.createElementNS(r,"svg");t.setAttribute("viewBox","0 0 100 100");var e=document.createElementNS(r,"path"),i=o(this.parent.options.arrowShape);return e.setAttribute("d",i),e.setAttribute("class","arrow"),this.isLeft||e.setAttribute("transform","translate(100, 100) rotate(180) "),t.appendChild(e),t},s.prototype.onTap=function(){if(this.isEnabled){this.parent.uiChange();var t=this.isPrevious?"previous":"next";this.parent[t]()}},s.prototype.handleEvent=n.handleEvent,s.prototype.onclick=function(){var t=document.activeElement;t&&t==this.element&&this.onTap()},s.prototype.enable=function(){this.isEnabled||(this.element.disabled=!1,this.isEnabled=!0)},s.prototype.disable=function(){this.isEnabled&&(this.element.disabled=!0,this.isEnabled=!1)},s.prototype.update=function(){var t=this.parent.slides;if(this.parent.options.wrapAround&&t.length>1)return void this.enable();var e=t.length?t.length-1:0,i=this.isPrevious?0:e,n=this.parent.selectedIndex==i?"disable":"enable";this[n]()},s.prototype.destroy=function(){this.deactivate()},n.extend(e.defaults,{prevNextButtons:!0,arrowShape:{x0:10,x1:60,y1:50,x2:70,y2:40,x3:30}}),e.createMethods.push("_createPrevNextButtons");var a=e.prototype;return a._createPrevNextButtons=function(){this.options.prevNextButtons&&(this.prevButton=new s((-1),this),this.nextButton=new s(1,this),this.on("activate",this.activatePrevNextButtons))},a.activatePrevNextButtons=function(){this.prevButton.activate(),this.nextButton.activate(),this.on("deactivate",this.deactivatePrevNextButtons)},a.deactivatePrevNextButtons=function(){this.prevButton.deactivate(),this.nextButton.deactivate(),this.off("deactivate",this.deactivatePrevNextButtons)},e.PrevNextButton=s,e}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/page-dots",["./flickity","tap-listener/tap-listener","fizzy-ui-utils/utils"],function(i,n,s){return e(t,i,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("tap-listener"),require("fizzy-ui-utils")):e(t,t.Flickity,t.TapListener,t.fizzyUIUtils)}(window,function(t,e,i,n){function s(t){this.parent=t,this._create()}s.prototype=new i,s.prototype._create=function(){this.holder=document.createElement("ol"),this.holder.className="flickity-page-dots",this.dots=[],this.on("tap",this.onTap)},s.prototype.activate=function(){this.setDots(),this.bindTap(this.holder),this.parent.element.appendChild(this.holder)},s.prototype.deactivate=function(){this.parent.element.removeChild(this.holder),i.prototype.destroy.call(this)},s.prototype.setDots=function(){var t=this.parent.slides.length-this.dots.length;t>0?this.addDots(t):t<0&&this.removeDots(-t)},s.prototype.addDots=function(t){for(var e=document.createDocumentFragment(),i=[];t;){var n=document.createElement("li");n.className="dot",e.appendChild(n),i.push(n),t--}this.holder.appendChild(e),this.dots=this.dots.concat(i)},s.prototype.removeDots=function(t){var e=this.dots.splice(this.dots.length-t,t);e.forEach(function(t){this.holder.removeChild(t)},this)},s.prototype.updateSelected=function(){this.selectedDot&&(this.selectedDot.className="dot"),this.dots.length&&(this.selectedDot=this.dots[this.parent.selectedIndex],this.selectedDot.className="dot is-selected")},s.prototype.onTap=function(t){var e=t.target;if("LI"==e.nodeName){this.parent.uiChange();var i=this.dots.indexOf(e);this.parent.select(i)}},s.prototype.destroy=function(){this.deactivate()},e.PageDots=s,n.extend(e.defaults,{pageDots:!0}),e.createMethods.push("_createPageDots");var o=e.prototype;return o._createPageDots=function(){this.options.pageDots&&(this.pageDots=new s(this),this.on("activate",this.activatePageDots),this.on("select",this.updateSelectedPageDots),this.on("cellChange",this.updatePageDots),this.on("resize",this.updatePageDots),this.on("deactivate",this.deactivatePageDots),this.pageDots.on("pointerDown",function(t,e){this.childUIPointerDown(e)}.bind(this)))},o.activatePageDots=function(){this.pageDots.activate()},o.updateSelectedPageDots=function(){this.pageDots.updateSelected()},o.updatePageDots=function(){this.pageDots.setDots()},o.deactivatePageDots=function(){this.pageDots.deactivate()},e.PageDots=s,e}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/player",["ev-emitter/ev-emitter","fizzy-ui-utils/utils","./flickity"],function(t,i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("fizzy-ui-utils"),require("./flickity")):e(t.EvEmitter,t.fizzyUIUtils,t.Flickity)}(window,function(t,e,i){function n(t){this.parent=t,this.state="stopped",o&&(this.onVisibilityChange=function(){this.visibilityChange()}.bind(this),this.onVisibilityPlay=function(){this.visibilityPlay()}.bind(this))}var s,o;"hidden"in document?(s="hidden",o="visibilitychange"):"webkitHidden"in document&&(s="webkitHidden",o="webkitvisibilitychange"),n.prototype=Object.create(t.prototype),n.prototype.play=function(){if("playing"!=this.state){var t=document[s];if(o&&t)return void document.addEventListener(o,this.onVisibilityPlay);this.state="playing",o&&document.addEventListener(o,this.onVisibilityChange),this.tick()}},n.prototype.tick=function(){if("playing"==this.state){var t=this.parent.options.autoPlay;t="number"==typeof t?t:3e3;var e=this;this.clear(),this.timeout=setTimeout(function(){e.parent.next(!0),e.tick()},t)}},n.prototype.stop=function(){this.state="stopped",this.clear(),o&&document.removeEventListener(o,this.onVisibilityChange)},n.prototype.clear=function(){clearTimeout(this.timeout)},n.prototype.pause=function(){"playing"==this.state&&(this.state="paused",this.clear())},n.prototype.unpause=function(){"paused"==this.state&&this.play()},n.prototype.visibilityChange=function(){var t=document[s];this[t?"pause":"unpause"]()},n.prototype.visibilityPlay=function(){this.play(),document.removeEventListener(o,this.onVisibilityPlay)},e.extend(i.defaults,{pauseAutoPlayOnHover:!0}),i.createMethods.push("_createPlayer");var r=i.prototype;return r._createPlayer=function(){this.player=new n(this),this.on("activate",this.activatePlayer),this.on("uiChange",this.stopPlayer),this.on("pointerDown",this.stopPlayer),this.on("deactivate",this.deactivatePlayer)},r.activatePlayer=function(){this.options.autoPlay&&(this.player.play(),this.element.addEventListener("mouseenter",this))},r.playPlayer=function(){this.player.play()},r.stopPlayer=function(){this.player.stop()},r.pausePlayer=function(){this.player.pause()},r.unpausePlayer=function(){this.player.unpause()},r.deactivatePlayer=function(){this.player.stop(),this.element.removeEventListener("mouseenter",this)},r.onmouseenter=function(){this.options.pauseAutoPlayOnHover&&(this.player.pause(),this.element.addEventListener("mouseleave",this))},r.onmouseleave=function(){this.player.unpause(),this.element.removeEventListener("mouseleave",this)},i.Player=n,i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/add-remove-cell",["./flickity","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("fizzy-ui-utils")):e(t,t.Flickity,t.fizzyUIUtils)}(window,function(t,e,i){function n(t){var e=document.createDocumentFragment();return t.forEach(function(t){e.appendChild(t.element)}),e}var s=e.prototype;return s.insert=function(t,e){var i=this._makeCells(t);if(i&&i.length){var s=this.cells.length;e=void 0===e?s:e;var o=n(i),r=e==s;if(r)this.slider.appendChild(o);else{var a=this.cells[e].element;this.slider.insertBefore(o,a)}if(0===e)this.cells=i.concat(this.cells);else if(r)this.cells=this.cells.concat(i);else{var h=this.cells.splice(e,s-e);this.cells=this.cells.concat(i).concat(h)}this._sizeCells(i);var l=e>this.selectedIndex?0:i.length;this._cellAddedRemoved(e,l)}},s.append=function(t){this.insert(t,this.cells.length)},s.prepend=function(t){this.insert(t,0)},s.remove=function(t){var e,n,s=this.getCells(t),o=0,r=s.length;for(e=0;e<r;e++){n=s[e];var a=this.cells.indexOf(n)<this.selectedIndex;o-=a?1:0}for(e=0;e<r;e++)n=s[e],n.remove(),i.removeFrom(this.cells,n);s.length&&this._cellAddedRemoved(0,o)},s._cellAddedRemoved=function(t,e){e=e||0,this.selectedIndex+=e,this.selectedIndex=Math.max(0,Math.min(this.slides.length-1,this.selectedIndex)),this.cellChange(t,!0),this.emitEvent("cellAddedRemoved",[t,e])},s.cellSizeChange=function(t){var e=this.getCell(t);if(e){e.getSize();var i=this.cells.indexOf(e);this.cellChange(i)}},s.cellChange=function(t,e){var i=this.slideableWidth;if(this._positionCells(t),this._getWrapShiftCells(),this.setGallerySize(),this.emitEvent("cellChange",[t]),this.options.freeScroll){var n=i-this.slideableWidth;this.x+=n*this.cellAlign,this.positionSlider()}else e&&this.positionSliderAtSelected(),this.select(this.selectedIndex)},e}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/lazyload",["./flickity","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("fizzy-ui-utils")):e(t,t.Flickity,t.fizzyUIUtils)}(window,function(t,e,i){"use strict";function n(t){if("IMG"==t.nodeName&&t.getAttribute("data-flickity-lazyload"))return[t];var e=t.querySelectorAll("img[data-flickity-lazyload]");return i.makeArray(e)}function s(t,e){this.img=t,this.flickity=e,this.load()}e.createMethods.push("_createLazyload");var o=e.prototype;return o._createLazyload=function(){this.on("select",this.lazyLoad)},o.lazyLoad=function(){var t=this.options.lazyLoad;if(t){var e="number"==typeof t?t:0,i=this.getAdjacentCellElements(e),o=[];i.forEach(function(t){var e=n(t);o=o.concat(e)}),o.forEach(function(t){new s(t,this)},this)}},s.prototype.handleEvent=i.handleEvent,s.prototype.load=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.img.getAttribute("data-flickity-lazyload"),this.img.removeAttribute("data-flickity-lazyload")},s.prototype.onload=function(t){this.complete(t,"flickity-lazyloaded")},s.prototype.onerror=function(t){this.complete(t,"flickity-lazyerror")},s.prototype.complete=function(t,e){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this);var i=this.flickity.getParentCell(this.img),n=i&&i.element;this.flickity.cellSizeChange(n),this.img.classList.add(e),this.flickity.dispatchEvent("lazyLoad",t,n)},e.LazyLoader=s,e}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/index",["./flickity","./drag","./prev-next-button","./page-dots","./player","./add-remove-cell","./lazyload"],e):"object"==typeof module&&module.exports&&(module.exports=e(require("./flickity"),require("./drag"),require("./prev-next-button"),require("./page-dots"),require("./player"),require("./add-remove-cell"),require("./lazyload")))}(window,function(t){return t}),function(t,e){"function"==typeof define&&define.amd?define("flickity-as-nav-for/as-nav-for",["flickity/js/index","fizzy-ui-utils/utils"],function(i,n,s){return e(t,i,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("flickity"),require("fizzy-ui-utils")):t.Flickity=e(t,t.Flickity,t.fizzyUIUtils)}(window,function(t,e,i){e.createMethods.push("_createAsNavFor");var n=e.prototype;return n._createAsNavFor=function(){this.on("activate",this.activateAsNavFor),this.on("deactivate",this.deactivateAsNavFor),this.on("destroy",this.destroyAsNavFor);var t=this.options.asNavFor;if(t){var e=this;setTimeout(function(){e.setNavCompanion(t)})}},n.setNavCompanion=function(t){t=i.getQueryElement(t);var n=e.data(t);if(n&&n!=this){this.navCompanion=n;var s=this;this.onNavCompanionSelect=function(){s.navCompanionSelect()},n.on("select",this.onNavCompanionSelect),this.on("staticClick",this.onNavStaticClick),this.navCompanionSelect()}},n.navCompanionSelect=function(){if(this.navCompanion){var t=this.navCompanion.selectedCells[0],e=this.navCompanion.cells.indexOf(t);this.selectCell(e),this.removeNavSelectedElements(),e>=this.cells.length||(this.navSelectedElements=this.slides[this.selectedIndex].getCellElements(),this.changeNavSelectedClass("add"))}},n.changeNavSelectedClass=function(t){this.navSelectedElements.forEach(function(e){e.classList[t]("is-nav-selected")})},n.activateAsNavFor=function(){this.navCompanionSelect()},n.removeNavSelectedElements=function(){this.navSelectedElements&&(this.changeNavSelectedClass("remove"),delete this.navSelectedElements)},n.onNavStaticClick=function(t,e,i,n){"number"==typeof n&&this.navCompanion.selectCell(n)},n.deactivateAsNavFor=function(){this.removeNavSelectedElements()},n.destroyAsNavFor=function(){this.navCompanion&&(this.navCompanion.off("select",this.onNavCompanionSelect),this.off("staticClick",this.onNavStaticClick),delete this.navCompanion)},e}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("imagesloaded/imagesloaded",["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}(window,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){var e=[];if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e}function s(t,e,o){return this instanceof s?("string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=n(t),this.options=i({},this.options),"function"==typeof e?o=e:i(this.options,e),o&&this.on("always",o),this.getImages(),a&&(this.jqDeferred=new a.Deferred),void setTimeout(function(){this.check()}.bind(this))):new s(t,e,o)}function o(t){this.img=t}function r(t,e){this.url=t,this.element=e,this.img=new Image}var a=t.jQuery,h=t.console;s.prototype=Object.create(e.prototype),s.prototype.options={},s.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},s.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),this.options.background===!0&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&l[e]){for(var i=t.querySelectorAll("img"),n=0;n<i.length;n++){var s=i[n];this.addImage(s)}if("string"==typeof this.options.background){var o=t.querySelectorAll(this.options.background);for(n=0;n<o.length;n++){var r=o[n];this.addElementBackgroundImages(r)}}}};var l={1:!0,9:!0,11:!0};return s.prototype.addElementBackgroundImages=function(t){var e=getComputedStyle(t);if(e)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(e.backgroundImage);null!==n;){var s=n&&n[2];s&&this.addBackground(s,t),n=i.exec(e.backgroundImage)}},s.prototype.addImage=function(t){var e=new o(t);this.images.push(e)},s.prototype.addBackground=function(t,e){var i=new r(t,e);this.images.push(i)},s.prototype.check=function(){function t(t,i,n){setTimeout(function(){e.progress(t,i,n)})}var e=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(e){e.once("progress",t),e.check()}):void this.complete()},s.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&h&&h.log("progress: "+i,t,e)},s.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){var e=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[e](this)}},o.prototype=Object.create(e.prototype),o.prototype.check=function(){var t=this.getIsImageComplete();return t?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},o.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},o.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.img,e])},o.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},o.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},o.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},o.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},r.prototype=Object.create(o.prototype),r.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var t=this.getIsImageComplete();t&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},r.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},r.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},s.makeJQueryPlugin=function(e){e=e||t.jQuery,e&&(a=e,a.fn.imagesLoaded=function(t,e){var i=new s(this,t,e);return i.jqDeferred.promise(a(this))})},s.makeJQueryPlugin(),s}),function(t,e){"function"==typeof define&&define.amd?define(["flickity/js/index","imagesloaded/imagesloaded"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("flickity"),require("imagesloaded")):t.Flickity=e(t,t.Flickity,t.imagesLoaded)}(window,function(t,e,i){"use strict";e.createMethods.push("_createImagesLoaded");var n=e.prototype;return n._createImagesLoaded=function(){this.on("activate",this.imagesLoaded)},n.imagesLoaded=function(){function t(t,i){var n=e.getParentCell(i.img);e.cellSizeChange(n&&n.element),e.options.freeScroll||e.positionSliderAtSelected()}if(this.options.imagesLoaded){var e=this;i(this.slider).on("progress",t)}},e}); |
@@ -42,51 +42,6 @@ /*jshint node: true, strict: false */ | ||
// refactored from gulp-requirejs-optimize | ||
// https://www.npmjs.com/package/gulp-requirejs-optimize/ | ||
var gutil = require('gulp-util'); | ||
var through = require('through2'); | ||
var requirejs = require('requirejs'); | ||
var chalk = require('chalk'); | ||
var rjsOptimize = require('gulp-requirejs-optimize'); | ||
function rjsOptimize( options ) { | ||
var stream; | ||
requirejs.define('node/print', [], function() { | ||
return function(msg) { | ||
if( msg.substring(0, 5) === 'Error' ) { | ||
gutil.log( chalk.red( msg ) ); | ||
} else { | ||
gutil.log( msg ); | ||
} | ||
}; | ||
}); | ||
options = options || {}; | ||
stream = through.obj(function (file, enc, cb) { | ||
if ( file.isNull() ) { | ||
this.push( file ); | ||
return cb(); | ||
} | ||
options.logLevel = 2; | ||
options.out = function( text ) { | ||
var outFile = new gutil.File({ | ||
path: file.relative, | ||
contents: new Buffer( text ) | ||
}); | ||
cb( null, outFile ); | ||
}; | ||
gutil.log('RequireJS optimizing'); | ||
requirejs.optimize( options, null, function( err ) { | ||
var gulpError = new gutil.PluginError( 'requirejsOptimize', err.message ); | ||
stream.emit( 'error', gulpError ); | ||
}); | ||
}); | ||
return stream; | ||
} | ||
// regex for banner comment | ||
@@ -115,3 +70,3 @@ var reBannerComment = new RegExp('^\\s*(?:\\/\\*[\\s\\S]*?\\*\\/)\\s*'); | ||
include: [ | ||
'jquery-bridget/jquery.bridget', | ||
'jquery-bridget/jquery-bridget', | ||
'flickity/js/index', | ||
@@ -151,3 +106,3 @@ 'flickity-as-nav-for/as-nav-for', | ||
var minifyCSS = require('gulp-minify-css'); | ||
var cleanCSS = require('gulp-clean-css'); | ||
@@ -159,3 +114,3 @@ gulp.task( 'css', function() { | ||
// minify | ||
.pipe( minifyCSS({ advanced: false }) ) | ||
.pipe( cleanCSS({ advanced: false }) ) | ||
.pipe( rename('flickity.min.css') ) | ||
@@ -162,0 +117,0 @@ .pipe( replace( '*/', '*/\n' ) ) |
@@ -0,5 +1,5 @@ | ||
// add, remove cell | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
@@ -13,3 +13,3 @@ // AMD | ||
}); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
@@ -37,6 +37,5 @@ module.exports = factory( | ||
var fragment = document.createDocumentFragment(); | ||
for ( var i=0, len = cells.length; i < len; i++ ) { | ||
var cell = cells[i]; | ||
cells.forEach( function( cell ) { | ||
fragment.appendChild( cell.element ); | ||
} | ||
}); | ||
return fragment; | ||
@@ -47,2 +46,4 @@ } | ||
var proto = Flickity.prototype; | ||
/** | ||
@@ -53,3 +54,3 @@ * Insert, prepend, or append cells | ||
*/ | ||
Flickity.prototype.insert = function( elems, index ) { | ||
proto.insert = function( elems, index ) { | ||
var cells = this._makeCells( elems ); | ||
@@ -91,7 +92,7 @@ if ( !cells || !cells.length ) { | ||
Flickity.prototype.append = function( elems ) { | ||
proto.append = function( elems ) { | ||
this.insert( elems, this.cells.length ); | ||
}; | ||
Flickity.prototype.prepend = function( elems ) { | ||
proto.prepend = function( elems ) { | ||
this.insert( elems, 0 ); | ||
@@ -104,14 +105,15 @@ }; | ||
*/ | ||
Flickity.prototype.remove = function( elems ) { | ||
proto.remove = function( elems ) { | ||
var cells = this.getCells( elems ); | ||
var selectedIndexDelta = 0; | ||
var i, len, cell; | ||
var len = cells.length; | ||
var i, cell; | ||
// calculate selectedIndexDelta, easier if done in seperate loop | ||
for ( i=0, len = cells.length; i < len; i++ ) { | ||
for ( i=0; i < len; i++ ) { | ||
cell = cells[i]; | ||
var wasBefore = utils.indexOf( this.cells, cell ) < this.selectedIndex; | ||
var wasBefore = this.cells.indexOf( cell ) < this.selectedIndex; | ||
selectedIndexDelta -= wasBefore ? 1 : 0; | ||
} | ||
for ( i=0, len = cells.length; i < len; i++ ) { | ||
for ( i=0; i < len; i++ ) { | ||
cell = cells[i]; | ||
@@ -130,9 +132,11 @@ cell.remove(); | ||
// updates when cells are added or removed | ||
Flickity.prototype._cellAddedRemoved = function( changedCellIndex, selectedIndexDelta ) { | ||
proto._cellAddedRemoved = function( changedCellIndex, selectedIndexDelta ) { | ||
// TODO this math isn't perfect with grouped slides | ||
selectedIndexDelta = selectedIndexDelta || 0; | ||
this.selectedIndex += selectedIndexDelta; | ||
this.selectedIndex = Math.max( 0, Math.min( this.cells.length - 1, this.selectedIndex ) ); | ||
this.selectedIndex = Math.max( 0, Math.min( this.slides.length - 1, this.selectedIndex ) ); | ||
this.cellChange( changedCellIndex, true ); | ||
// backwards compatibility | ||
this.emitEvent( 'cellAddedRemoved', [ changedCellIndex, selectedIndexDelta ] ); | ||
this.cellChange( changedCellIndex, true ); | ||
}; | ||
@@ -144,3 +148,3 @@ | ||
*/ | ||
Flickity.prototype.cellSizeChange = function( elem ) { | ||
proto.cellSizeChange = function( elem ) { | ||
var cell = this.getCell( elem ); | ||
@@ -152,3 +156,3 @@ if ( !cell ) { | ||
var index = utils.indexOf( this.cells, cell ); | ||
var index = this.cells.indexOf( cell ); | ||
this.cellChange( index ); | ||
@@ -161,3 +165,3 @@ }; | ||
*/ | ||
Flickity.prototype.cellChange = function( changedCellIndex, isPositioningSlider ) { | ||
proto.cellChange = function( changedCellIndex, isPositioningSlider ) { | ||
var prevSlideableWidth = this.slideableWidth; | ||
@@ -167,2 +171,3 @@ this._positionCells( changedCellIndex ); | ||
this.setGallerySize(); | ||
this.emitEvent( 'cellChange', [ changedCellIndex ] ); | ||
// position slider | ||
@@ -169,0 +174,0 @@ if ( this.options.freeScroll ) { |
@@ -0,18 +1,16 @@ | ||
// animate | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
// AMD | ||
define( [ | ||
'get-style-property/get-style-property', | ||
'fizzy-ui-utils/utils' | ||
], function( getStyleProperty, utils ) { | ||
return factory( window, getStyleProperty, utils ); | ||
], function( utils ) { | ||
return factory( window, utils ); | ||
}); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
module.exports = factory( | ||
window, | ||
require('desandro-get-style-property'), | ||
require('fizzy-ui-utils') | ||
@@ -25,3 +23,2 @@ ); | ||
window, | ||
window.getStyleProperty, | ||
window.fizzyUIUtils | ||
@@ -31,3 +28,3 @@ ); | ||
}( window, function factory( window, getStyleProperty, utils ) { | ||
}( window, function factory( window, utils ) { | ||
@@ -38,36 +35,16 @@ 'use strict'; | ||
// https://gist.github.com/1866474 | ||
// get rAF, prefixed, if present | ||
var requestAnimationFrame = window.requestAnimationFrame || | ||
window.webkitRequestAnimationFrame; | ||
// fallback to setTimeout | ||
var lastTime = 0; | ||
var prefixes = 'webkit moz ms o'.split(' '); | ||
// get unprefixed rAF and cAF, if present | ||
var requestAnimationFrame = window.requestAnimationFrame; | ||
var cancelAnimationFrame = window.cancelAnimationFrame; | ||
// loop through vendor prefixes and get prefixed rAF and cAF | ||
var prefix; | ||
for( var i = 0; i < prefixes.length; i++ ) { | ||
if ( requestAnimationFrame && cancelAnimationFrame ) { | ||
break; | ||
} | ||
prefix = prefixes[i]; | ||
requestAnimationFrame = requestAnimationFrame || window[ prefix + 'RequestAnimationFrame' ]; | ||
cancelAnimationFrame = cancelAnimationFrame || window[ prefix + 'CancelAnimationFrame' ] || | ||
window[ prefix + 'CancelRequestAnimationFrame' ]; | ||
} | ||
// fallback to setTimeout and clearTimeout if either request/cancel is not supported | ||
if ( !requestAnimationFrame || !cancelAnimationFrame ) { | ||
if ( !requestAnimationFrame ) { | ||
requestAnimationFrame = function( callback ) { | ||
var currTime = new Date().getTime(); | ||
var timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ); | ||
var id = window.setTimeout( function() { | ||
callback( currTime + timeToCall ); | ||
}, timeToCall ); | ||
var id = setTimeout( callback, timeToCall ); | ||
lastTime = currTime + timeToCall; | ||
return id; | ||
}; | ||
cancelAnimationFrame = function( id ) { | ||
window.clearTimeout( id ); | ||
}; | ||
} | ||
@@ -105,16 +82,12 @@ | ||
} | ||
/** / | ||
// log animation frame rate | ||
var now = new Date(); | ||
if ( this.then ) { | ||
console.log( ~~( 1000 / (now-this.then)) + 'fps' ) | ||
} | ||
this.then = now; | ||
/**/ | ||
}; | ||
var transformProperty = getStyleProperty('transform'); | ||
var is3d = !!getStyleProperty('perspective'); | ||
var transformProperty = ( function () { | ||
var style = document.documentElement.style; | ||
if ( typeof style.transform == 'string' ) { | ||
return 'transform'; | ||
} | ||
return 'WebkitTransform'; | ||
})(); | ||
@@ -131,3 +104,2 @@ proto.positionSlider = function() { | ||
x = x + this.cursorPosition; | ||
// reverse if right-to-left and using transform | ||
@@ -141,3 +113,3 @@ x = this.options.rightToLeft && transformProperty ? -x : x; | ||
// but use 2D when settled, for better font-rendering | ||
this.slider.style[ transformProperty ] = is3d && this.isAnimating ? | ||
this.slider.style[ transformProperty ] = this.isAnimating ? | ||
'translate3d(' + value + ',0,0)' : 'translateX(' + value + ')'; | ||
@@ -147,2 +119,9 @@ } else { | ||
} | ||
// scroll event | ||
var firstSlide = this.slides[0]; | ||
if ( firstSlide ) { | ||
var positionX = -this.x - firstSlide.target; | ||
var progress = positionX / this.slidesWidth; | ||
this.emitEvent( 'scroll', [ progress, positionX ] ); | ||
} | ||
}; | ||
@@ -154,4 +133,3 @@ | ||
} | ||
var selectedCell = this.cells[ this.selectedIndex ]; | ||
this.x = -selectedCell.target; | ||
this.x = -this.selectedSlide.target; | ||
this.positionSlider(); | ||
@@ -180,5 +158,3 @@ }; | ||
// render position with translateX when settled | ||
if ( is3d ) { | ||
this.positionSlider(); | ||
} | ||
this.positionSlider(); | ||
this.dispatchEvent('settle'); | ||
@@ -198,3 +174,3 @@ } | ||
proto._shiftCells = function( cells, gap, shift ) { | ||
for ( var i=0, len = cells.length; i < len; i++ ) { | ||
for ( var i=0; i < cells.length; i++ ) { | ||
var cell = cells[i]; | ||
@@ -211,3 +187,3 @@ var cellShift = gap > 0 ? shift : 0; | ||
} | ||
for ( var i=0, len = cells.length; i < len; i++ ) { | ||
for ( var i=0; i < cells.length; i++ ) { | ||
cells[i].wrapShift( 0 ); | ||
@@ -220,11 +196,8 @@ } | ||
proto.integratePhysics = function() { | ||
this.velocity += this.accel; | ||
this.x += this.velocity; | ||
this.velocity *= this.getFrictionFactor(); | ||
// reset acceleration | ||
this.accel = 0; | ||
}; | ||
proto.applyForce = function( force ) { | ||
this.accel += force; | ||
this.velocity += force; | ||
}; | ||
@@ -236,3 +209,2 @@ | ||
proto.getRestingPosition = function() { | ||
@@ -255,10 +227,6 @@ // my thanks to Steven Wittens, who simplified this math greatly | ||
// do not attract if pointer down or no cells | ||
var len = this.cells.length; | ||
if ( this.isPointerDown || this.isFreeScrolling || !len ) { | ||
if ( this.isPointerDown || this.isFreeScrolling || !this.cells.length ) { | ||
return; | ||
} | ||
var cell = this.cells[ this.selectedIndex ]; | ||
var wrap = this.options.wrapAround && len > 1 ? | ||
this.slideableWidth * Math.floor( this.selectedIndex / len ) : 0; | ||
var distance = ( cell.target + wrap ) * -1 - this.x; | ||
var distance = this.selectedSlide.target * -1 - this.x; | ||
var force = distance * this.options.selectedAttraction; | ||
@@ -265,0 +233,0 @@ this.applyForce( force ); |
@@ -0,5 +1,5 @@ | ||
// Flickity.Cell | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
@@ -12,3 +12,3 @@ // AMD | ||
}); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
@@ -39,10 +39,6 @@ module.exports = factory( | ||
var isIE8 = 'attachEvent' in window; | ||
var proto = Cell.prototype; | ||
Cell.prototype.create = function() { | ||
proto.create = function() { | ||
this.element.style.position = 'absolute'; | ||
// IE8 prevent child from changing focus http://stackoverflow.com/a/17525223/182183 | ||
if ( isIE8 ) { | ||
this.element.setAttribute( 'unselectable', 'on' ); | ||
} | ||
this.x = 0; | ||
@@ -52,3 +48,3 @@ this.shift = 0; | ||
Cell.prototype.destroy = function() { | ||
proto.destroy = function() { | ||
// reset style | ||
@@ -60,13 +56,14 @@ this.element.style.position = ''; | ||
Cell.prototype.getSize = function() { | ||
proto.getSize = function() { | ||
this.size = getSize( this.element ); | ||
}; | ||
Cell.prototype.setPosition = function( x ) { | ||
proto.setPosition = function( x ) { | ||
this.x = x; | ||
this.setDefaultTarget(); | ||
this.updateTarget(); | ||
this.renderPosition( x ); | ||
}; | ||
Cell.prototype.setDefaultTarget = function() { | ||
// setDefaultTarget v1 method, backwards compatibility, remove in v3 | ||
proto.updateTarget = proto.setDefaultTarget = function() { | ||
var marginProperty = this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight'; | ||
@@ -77,3 +74,3 @@ this.target = this.x + this.size[ marginProperty ] + | ||
Cell.prototype.renderPosition = function( x ) { | ||
proto.renderPosition = function( x ) { | ||
// render position of cell with in slider | ||
@@ -87,3 +84,3 @@ var side = this.parent.originSide; | ||
**/ | ||
Cell.prototype.wrapShift = function( shift ) { | ||
proto.wrapShift = function( shift ) { | ||
this.shift = shift; | ||
@@ -93,3 +90,3 @@ this.renderPosition( this.x + this.parent.slideableWidth * shift ); | ||
Cell.prototype.remove = function() { | ||
proto.remove = function() { | ||
this.element.parentNode.removeChild( this.element ); | ||
@@ -96,0 +93,0 @@ }; |
185
js/drag.js
@@ -0,22 +1,18 @@ | ||
// drag | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
// AMD | ||
define( [ | ||
'classie/classie', | ||
'eventie/eventie', | ||
'./flickity', | ||
'unidragger/unidragger', | ||
'fizzy-ui-utils/utils' | ||
], function( classie, eventie, Flickity, Unidragger, utils ) { | ||
return factory( window, classie, eventie, Flickity, Unidragger, utils ); | ||
], function( Flickity, Unidragger, utils ) { | ||
return factory( window, Flickity, Unidragger, utils ); | ||
}); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
module.exports = factory( | ||
window, | ||
require('desandro-classie'), | ||
require('eventie'), | ||
require('./flickity'), | ||
@@ -30,4 +26,2 @@ require('unidragger'), | ||
window, | ||
window.classie, | ||
window.eventie, | ||
window.Flickity, | ||
@@ -39,19 +33,11 @@ window.Unidragger, | ||
}( window, function factory( window, classie, eventie, Flickity, Unidragger, utils ) { | ||
}( window, function factory( window, Flickity, Unidragger, utils ) { | ||
'use strict'; | ||
// handle IE8 prevent default | ||
function preventDefaultEvent( event ) { | ||
if ( event.preventDefault ) { | ||
event.preventDefault(); | ||
} else { | ||
event.returnValue = false; | ||
} | ||
} | ||
// ----- defaults ----- // | ||
utils.extend( Flickity.defaults, { | ||
draggable: true | ||
draggable: true, | ||
dragThreshold: 3, | ||
}); | ||
@@ -65,7 +51,8 @@ | ||
utils.extend( Flickity.prototype, Unidragger.prototype ); | ||
var proto = Flickity.prototype; | ||
utils.extend( proto, Unidragger.prototype ); | ||
// -------------------------- -------------------------- // | ||
Flickity.prototype._createDrag = function() { | ||
proto._createDrag = function() { | ||
this.on( 'activate', this.bindDrag ); | ||
@@ -77,7 +64,7 @@ this.on( 'uiChange', this._uiChangeDrag ); | ||
Flickity.prototype.bindDrag = function() { | ||
proto.bindDrag = function() { | ||
if ( !this.options.draggable || this.isDragBound ) { | ||
return; | ||
} | ||
classie.add( this.element, 'is-draggable' ); | ||
this.element.classList.add('is-draggable'); | ||
this.handles = [ this.viewport ]; | ||
@@ -88,7 +75,7 @@ this.bindHandles(); | ||
Flickity.prototype.unbindDrag = function() { | ||
proto.unbindDrag = function() { | ||
if ( !this.isDragBound ) { | ||
return; | ||
} | ||
classie.remove( this.element, 'is-draggable' ); | ||
this.element.classList.remove('is-draggable'); | ||
this.unbindHandles(); | ||
@@ -98,8 +85,8 @@ delete this.isDragBound; | ||
Flickity.prototype._uiChangeDrag = function() { | ||
proto._uiChangeDrag = function() { | ||
delete this.isFreeScrolling; | ||
}; | ||
Flickity.prototype._childUIPointerDownDrag = function( event ) { | ||
preventDefaultEvent( event ); | ||
proto._childUIPointerDownDrag = function( event ) { | ||
event.preventDefault(); | ||
this.pointerDownFocus( event ); | ||
@@ -110,5 +97,23 @@ }; | ||
Flickity.prototype.pointerDown = function( event, pointer ) { | ||
// dismiss range sliders | ||
if ( event.target.nodeName == 'INPUT' && event.target.type == 'range' ) { | ||
// nodes that have text fields | ||
var cursorNodes = { | ||
TEXTAREA: true, | ||
INPUT: true, | ||
}; | ||
// input types that do not have text fields | ||
var clickTypes = { | ||
radio: true, | ||
checkbox: true, | ||
button: true, | ||
submit: true, | ||
image: true, | ||
file: true, | ||
}; | ||
proto.pointerDown = function( event, pointer ) { | ||
// dismiss inputs with text fields. #404 | ||
var isCursorInput = cursorNodes[ event.target.nodeName ] && | ||
!clickTypes[ event.target.type ]; | ||
if ( isCursorInput ) { | ||
// reset pointerDown logic | ||
@@ -132,8 +137,8 @@ this.isPointerDown = false; | ||
this.dragX = this.x; | ||
classie.add( this.viewport, 'is-pointer-down' ); | ||
this.viewport.classList.add('is-pointer-down'); | ||
// bind move and end events | ||
this._bindPostStartEvents( event ); | ||
// track scrolling | ||
this.pointerDownScroll = Unidragger.getScrollPosition(); | ||
eventie.bind( window, 'scroll', this ); | ||
this.pointerDownScroll = getScrollPosition(); | ||
window.addEventListener( 'scroll', this ); | ||
@@ -153,3 +158,3 @@ this.dispatchEvent( 'pointerDown', event, [ pointer ] ); | ||
Flickity.prototype.pointerDownFocus = function( event ) { | ||
proto.pointerDownFocus = function( event ) { | ||
// focus element, if not touch, and its not an input or select | ||
@@ -168,6 +173,13 @@ if ( !this.options.accessibility || touchStartEvents[ event.type ] || | ||
proto.canPreventDefaultOnPointerDown = function( event ) { | ||
// prevent default, unless touchstart or <select> | ||
var isTouchstart = event.type == 'touchstart'; | ||
var targetNodeName = event.target.nodeName; | ||
return !isTouchstart && targetNodeName != 'SELECT'; | ||
}; | ||
// ----- move ----- // | ||
Flickity.prototype.hasDragStarted = function( moveVector ) { | ||
return Math.abs( moveVector.x ) > 3; | ||
proto.hasDragStarted = function( moveVector ) { | ||
return Math.abs( moveVector.x ) > this.options.dragThreshold; | ||
}; | ||
@@ -177,4 +189,5 @@ | ||
Flickity.prototype.pointerUp = function( event, pointer ) { | ||
classie.remove( this.viewport, 'is-pointer-down' ); | ||
proto.pointerUp = function( event, pointer ) { | ||
delete this.isTouchScrolling; | ||
this.viewport.classList.remove('is-pointer-down'); | ||
this.dispatchEvent( 'pointerUp', event, [ pointer ] ); | ||
@@ -184,4 +197,4 @@ this._dragPointerUp( event, pointer ); | ||
Flickity.prototype.pointerDone = function() { | ||
eventie.unbind( window, 'scroll', this ); | ||
proto.pointerDone = function() { | ||
window.removeEventListener( 'scroll', this ); | ||
delete this.pointerDownScroll; | ||
@@ -192,3 +205,3 @@ }; | ||
Flickity.prototype.dragStart = function( event, pointer ) { | ||
proto.dragStart = function( event, pointer ) { | ||
this.dragStartPosition = this.x; | ||
@@ -199,4 +212,4 @@ this.startAnimation(); | ||
Flickity.prototype.dragMove = function( event, pointer, moveVector ) { | ||
preventDefaultEvent( event ); | ||
proto.dragMove = function( event, pointer, moveVector ) { | ||
event.preventDefault(); | ||
@@ -208,7 +221,7 @@ this.previousDragX = this.dragX; | ||
if ( !this.options.wrapAround && this.cells.length ) { | ||
if ( !this.options.wrapAround && this.slides.length ) { | ||
// slow drag | ||
var originBound = Math.max( -this.cells[0].target, this.dragStartPosition ); | ||
var originBound = Math.max( -this.slides[0].target, this.dragStartPosition ); | ||
dragX = dragX > originBound ? ( dragX + originBound ) * 0.5 : dragX; | ||
var endBound = Math.min( -this.getLastCell().target, this.dragStartPosition ); | ||
var endBound = Math.min( -this.getLastSlide().target, this.dragStartPosition ); | ||
dragX = dragX < endBound ? ( dragX + endBound ) * 0.5 : dragX; | ||
@@ -223,3 +236,3 @@ } | ||
Flickity.prototype.dragEnd = function( event, pointer ) { | ||
proto.dragEnd = function( event, pointer ) { | ||
if ( this.options.freeScroll ) { | ||
@@ -233,7 +246,7 @@ this.isFreeScrolling = true; | ||
// if free-scroll & not wrap around | ||
// do not free-scroll if going outside of bounding cells | ||
// so bounding cells can attract slider, and keep it in bounds | ||
// do not free-scroll if going outside of bounding slides | ||
// so bounding slides can attract slider, and keep it in bounds | ||
var restingX = this.getRestingPosition(); | ||
this.isFreeScrolling = -restingX > this.cells[0].target && | ||
-restingX < this.getLastCell().target; | ||
this.isFreeScrolling = -restingX > this.slides[0].target && | ||
-restingX < this.getLastSlide().target; | ||
} else if ( !this.options.freeScroll && index == this.selectedIndex ) { | ||
@@ -246,10 +259,13 @@ // boost selection if selected index has not changed | ||
// TODO refactor this, selecting here feels weird | ||
// HACK, set flag so dragging stays in correct direction | ||
this.isDragSelect = this.options.wrapAround; | ||
this.select( index ); | ||
delete this.isDragSelect; | ||
this.dispatchEvent( 'dragEnd', event, [ pointer ] ); | ||
}; | ||
Flickity.prototype.dragEndRestingSelect = function() { | ||
proto.dragEndRestingSelect = function() { | ||
var restingX = this.getRestingPosition(); | ||
// how far away from selected cell | ||
var distance = Math.abs( this.getCellDistance( -restingX, this.selectedIndex ) ); | ||
// how far away from selected slide | ||
var distance = Math.abs( this.getSlideDistance( -restingX, this.selectedIndex ) ); | ||
// get closet resting going up and going down | ||
@@ -272,3 +288,3 @@ var positiveResting = this._getClosestResting( restingX, distance, 1 ); | ||
*/ | ||
Flickity.prototype._getClosestResting = function( restingX, distance, increment ) { | ||
proto._getClosestResting = function( restingX, distance, increment ) { | ||
var index = this.selectedIndex; | ||
@@ -283,3 +299,3 @@ var minDistance = Infinity; | ||
minDistance = distance; | ||
distance = this.getCellDistance( -restingX, index ); | ||
distance = this.getSlideDistance( -restingX, index ); | ||
if ( distance === null ) { | ||
@@ -298,21 +314,21 @@ break; | ||
/** | ||
* measure distance between x and a cell target | ||
* measure distance between x and a slide target | ||
* @param {Number} x | ||
* @param {Integer} index - cell index | ||
* @param {Integer} index - slide index | ||
*/ | ||
Flickity.prototype.getCellDistance = function( x, index ) { | ||
var len = this.cells.length; | ||
// wrap around if at least 2 cells | ||
proto.getSlideDistance = function( x, index ) { | ||
var len = this.slides.length; | ||
// wrap around if at least 2 slides | ||
var isWrapAround = this.options.wrapAround && len > 1; | ||
var cellIndex = isWrapAround ? utils.modulo( index, len ) : index; | ||
var cell = this.cells[ cellIndex ]; | ||
if ( !cell ) { | ||
var slideIndex = isWrapAround ? utils.modulo( index, len ) : index; | ||
var slide = this.slides[ slideIndex ]; | ||
if ( !slide ) { | ||
return null; | ||
} | ||
// add distance for wrap-around cells | ||
// add distance for wrap-around slides | ||
var wrap = isWrapAround ? this.slideableWidth * Math.floor( index / len ) : 0; | ||
return x - ( cell.target + wrap ); | ||
return x - ( slide.target + wrap ); | ||
}; | ||
Flickity.prototype.dragEndBoostSelect = function() { | ||
proto.dragEndBoostSelect = function() { | ||
// do not boost if no previousDragX or dragMoveTime | ||
@@ -325,3 +341,3 @@ if ( this.previousDragX === undefined || !this.dragMoveTime || | ||
var distance = this.getCellDistance( -this.dragX, this.selectedIndex ); | ||
var distance = this.getSlideDistance( -this.dragX, this.selectedIndex ); | ||
var delta = this.previousDragX - this.dragX; | ||
@@ -340,10 +356,31 @@ if ( distance > 0 && delta > 0 ) { | ||
Flickity.prototype.staticClick = function( event, pointer ) { | ||
proto.staticClick = function( event, pointer ) { | ||
// get clickedCell, if cell was clicked | ||
var clickedCell = this.getParentCell( event.target ); | ||
var cellElem = clickedCell && clickedCell.element; | ||
var cellIndex = clickedCell && utils.indexOf( this.cells, clickedCell ); | ||
var cellIndex = clickedCell && this.cells.indexOf( clickedCell ); | ||
this.dispatchEvent( 'staticClick', event, [ pointer, cellElem, cellIndex ] ); | ||
}; | ||
// ----- scroll ----- // | ||
proto.onscroll = function() { | ||
var scroll = getScrollPosition(); | ||
var scrollMoveX = this.pointerDownScroll.x - scroll.x; | ||
var scrollMoveY = this.pointerDownScroll.y - scroll.y; | ||
// cancel click/tap if scroll is too much | ||
if ( Math.abs( scrollMoveX ) > 3 || Math.abs( scrollMoveY ) > 3 ) { | ||
this._pointerDone(); | ||
} | ||
}; | ||
// ----- utils ----- // | ||
function getScrollPosition() { | ||
return { | ||
x: window.pageXOffset, | ||
y: window.pageYOffset | ||
}; | ||
} | ||
// ----- ----- // | ||
@@ -350,0 +387,0 @@ |
@@ -1,32 +0,26 @@ | ||
/** | ||
* Flickity main | ||
*/ | ||
// Flickity main | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
// AMD | ||
define( [ | ||
'classie/classie', | ||
'eventEmitter/EventEmitter', | ||
'eventie/eventie', | ||
'ev-emitter/ev-emitter', | ||
'get-size/get-size', | ||
'fizzy-ui-utils/utils', | ||
'./cell', | ||
'./slide', | ||
'./animate' | ||
], function( classie, EventEmitter, eventie, getSize, utils, Cell, animatePrototype ) { | ||
return factory( window, classie, EventEmitter, eventie, getSize, utils, Cell, animatePrototype ); | ||
], function( EvEmitter, getSize, utils, Cell, Slide, animatePrototype ) { | ||
return factory( window, EvEmitter, getSize, utils, Cell, Slide, animatePrototype ); | ||
}); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
module.exports = factory( | ||
window, | ||
require('desandro-classie'), | ||
require('wolfy87-eventemitter'), | ||
require('eventie'), | ||
require('ev-emitter'), | ||
require('get-size'), | ||
require('fizzy-ui-utils'), | ||
require('./cell'), | ||
require('./slide'), | ||
require('./animate') | ||
@@ -40,8 +34,7 @@ ); | ||
window, | ||
window.classie, | ||
window.EventEmitter, | ||
window.eventie, | ||
window.EvEmitter, | ||
window.getSize, | ||
window.fizzyUIUtils, | ||
_Flickity.Cell, | ||
_Flickity.Slide, | ||
_Flickity.animatePrototype | ||
@@ -51,4 +44,4 @@ ); | ||
}( window, function factory( window, classie, EventEmitter, eventie, getSize, | ||
utils, Cell, animatePrototype ) { | ||
}( window, function factory( window, EvEmitter, getSize, | ||
utils, Cell, Slide, animatePrototype ) { | ||
@@ -99,2 +92,3 @@ 'use strict'; | ||
accessibility: true, | ||
// adaptiveHeight: false, | ||
cellAlign: 'center', | ||
@@ -105,2 +99,3 @@ // cellSelector: undefined, | ||
friction: 0.28, // friction when selecting | ||
namespaceJQueryEvents: true, | ||
// initialIndex: 0, | ||
@@ -118,6 +113,7 @@ percentPosition: true, | ||
var proto = Flickity.prototype; | ||
// inherit EventEmitter | ||
utils.extend( Flickity.prototype, EventEmitter.prototype ); | ||
utils.extend( proto, EvEmitter.prototype ); | ||
Flickity.prototype._create = function() { | ||
proto._create = function() { | ||
// add id for Flickity.data | ||
@@ -134,3 +130,2 @@ var id = this.guid = ++GUID; | ||
this.velocity = 0; | ||
this.accel = 0; | ||
this.originSide = this.options.rightToLeft ? 'right' : 'left'; | ||
@@ -140,14 +135,11 @@ // create viewport & slider | ||
this.viewport.className = 'flickity-viewport'; | ||
Flickity.setUnselectable( this.viewport ); | ||
this._createSlider(); | ||
if ( this.options.resize || this.options.watchCSS ) { | ||
eventie.bind( window, 'resize', this ); | ||
this.isResizeBound = true; | ||
window.addEventListener( 'resize', this ); | ||
} | ||
for ( var i=0, len = Flickity.createMethods.length; i < len; i++ ) { | ||
var method = Flickity.createMethods[i]; | ||
Flickity.createMethods.forEach( function( method ) { | ||
this[ method ](); | ||
} | ||
}, this ); | ||
@@ -166,7 +158,7 @@ if ( this.options.watchCSS ) { | ||
*/ | ||
Flickity.prototype.option = function( opts ) { | ||
proto.option = function( opts ) { | ||
utils.extend( this.options, opts ); | ||
}; | ||
Flickity.prototype.activate = function() { | ||
proto.activate = function() { | ||
if ( this.isActive ) { | ||
@@ -176,5 +168,5 @@ return; | ||
this.isActive = true; | ||
classie.add( this.element, 'flickity-enabled' ); | ||
this.element.classList.add('flickity-enabled'); | ||
if ( this.options.rightToLeft ) { | ||
classie.add( this.element, 'flickity-rtl' ); | ||
this.element.classList.add('flickity-rtl'); | ||
} | ||
@@ -195,6 +187,6 @@ | ||
// listen for key presses | ||
eventie.bind( this.element, 'keydown', this ); | ||
this.element.addEventListener( 'keydown', this ); | ||
} | ||
this.emit('activate'); | ||
this.emitEvent('activate'); | ||
@@ -217,3 +209,3 @@ var index; | ||
// slider positions the cells | ||
Flickity.prototype._createSlider = function() { | ||
proto._createSlider = function() { | ||
// slider element does all the positioning | ||
@@ -226,3 +218,3 @@ var slider = document.createElement('div'); | ||
Flickity.prototype._filterFindCellElements = function( elems ) { | ||
proto._filterFindCellElements = function( elems ) { | ||
return utils.filterFindElements( elems, this.options.cellSelector ); | ||
@@ -232,3 +224,3 @@ }; | ||
// goes through all children | ||
Flickity.prototype.reloadCells = function() { | ||
proto.reloadCells = function() { | ||
// collection of item elements | ||
@@ -246,12 +238,9 @@ this.cells = this._makeCells( this.slider.children ); | ||
*/ | ||
Flickity.prototype._makeCells = function( elems ) { | ||
proto._makeCells = function( elems ) { | ||
var cellElems = this._filterFindCellElements( elems ); | ||
// create new Flickity for collection | ||
var cells = []; | ||
for ( var i=0, len = cellElems.length; i < len; i++ ) { | ||
var elem = cellElems[i]; | ||
var cell = new Cell( elem, this ); | ||
cells.push( cell ); | ||
} | ||
var cells = cellElems.map( function( cellElem ) { | ||
return new Cell( cellElem, this ); | ||
}, this ); | ||
@@ -261,8 +250,12 @@ return cells; | ||
Flickity.prototype.getLastCell = function() { | ||
proto.getLastCell = function() { | ||
return this.cells[ this.cells.length - 1 ]; | ||
}; | ||
proto.getLastSlide = function() { | ||
return this.slides[ this.slides.length - 1 ]; | ||
}; | ||
// positions all cells | ||
Flickity.prototype.positionCells = function() { | ||
proto.positionCells = function() { | ||
// size all cells | ||
@@ -278,3 +271,3 @@ this._sizeCells( this.cells ); | ||
*/ | ||
Flickity.prototype._positionCells = function( index ) { | ||
proto._positionCells = function( index ) { | ||
index = index || 0; | ||
@@ -290,5 +283,5 @@ // also measure maxCellHeight | ||
} | ||
var cell; | ||
for ( var len = this.cells.length, i=index; i < len; i++ ) { | ||
cell = this.cells[i]; | ||
var len = this.cells.length; | ||
for ( var i=index; i < len; i++ ) { | ||
var cell = this.cells[i]; | ||
cell.setPosition( cellX ); | ||
@@ -300,4 +293,8 @@ cellX += cell.size.outerWidth; | ||
this.slideableWidth = cellX; | ||
// contain cell target | ||
this._containCells(); | ||
// slides | ||
this.updateSlides(); | ||
// contain slides target | ||
this._containSlides(); | ||
// update slidesWidth | ||
this.slidesWidth = len ? this.getLastSlide().target - this.slides[0].target : 0; | ||
}; | ||
@@ -309,12 +306,76 @@ | ||
*/ | ||
Flickity.prototype._sizeCells = function( cells ) { | ||
for ( var i=0, len = cells.length; i < len; i++ ) { | ||
var cell = cells[i]; | ||
proto._sizeCells = function( cells ) { | ||
cells.forEach( function( cell ) { | ||
cell.getSize(); | ||
}); | ||
}; | ||
// -------------------------- -------------------------- // | ||
proto.updateSlides = function() { | ||
this.slides = []; | ||
if ( !this.cells.length ) { | ||
return; | ||
} | ||
var slide = new Slide( this ); | ||
this.slides.push( slide ); | ||
var isOriginLeft = this.originSide == 'left'; | ||
var nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft'; | ||
var canCellFit = this._getCanCellFit(); | ||
this.cells.forEach( function( cell, i ) { | ||
// just add cell if first cell in slide | ||
if ( !slide.cells.length ) { | ||
slide.addCell( cell ); | ||
return; | ||
} | ||
var slideWidth = ( slide.outerWidth - slide.firstMargin ) + | ||
( cell.size.outerWidth - cell.size[ nextMargin ] ); | ||
if ( canCellFit.call( this, i, slideWidth ) ) { | ||
slide.addCell( cell ); | ||
} else { | ||
// doesn't fit, new slide | ||
slide.updateTarget(); | ||
slide = new Slide( this ); | ||
this.slides.push( slide ); | ||
slide.addCell( cell ); | ||
} | ||
}, this ); | ||
// last slide | ||
slide.updateTarget(); | ||
// update .selectedSlide | ||
this.updateSelectedSlide(); | ||
}; | ||
proto._getCanCellFit = function() { | ||
var groupCells = this.options.groupCells; | ||
if ( !groupCells ) { | ||
return function() { | ||
return false; | ||
}; | ||
} else if ( typeof groupCells == 'number' ) { | ||
// group by number. 3 -> [0,1,2], [3,4,5], ... | ||
var number = parseInt( groupCells, 10 ); | ||
return function( i ) { | ||
return ( i % number ) !== 0; | ||
}; | ||
} | ||
// default, group by width of slide | ||
// parse '75% | ||
var percentMatch = typeof groupCells == 'string' && | ||
groupCells.match(/^(\d+)%$/); | ||
var percent = percentMatch ? parseInt( percentMatch[1], 10 ) / 100 : 1; | ||
return function( i, slideWidth ) { | ||
return slideWidth <= ( this.size.innerWidth + 1 ) * percent; | ||
}; | ||
}; | ||
// alias _init for jQuery plugin .flickity() | ||
Flickity.prototype._init = | ||
Flickity.prototype.reposition = function() { | ||
proto._init = | ||
proto.reposition = function() { | ||
this.positionCells(); | ||
@@ -324,3 +385,3 @@ this.positionSliderAtSelected(); | ||
Flickity.prototype.getSize = function() { | ||
proto.getSize = function() { | ||
this.size = getSize( this.element ); | ||
@@ -347,3 +408,3 @@ this.setCellAlign(); | ||
Flickity.prototype.setCellAlign = function() { | ||
proto.setCellAlign = function() { | ||
var shorthand = cellAlignShorthands[ this.options.cellAlign ]; | ||
@@ -353,9 +414,11 @@ this.cellAlign = shorthand ? shorthand[ this.originSide ] : this.options.cellAlign; | ||
Flickity.prototype.setGallerySize = function() { | ||
proto.setGallerySize = function() { | ||
if ( this.options.setGallerySize ) { | ||
this.viewport.style.height = this.maxCellHeight + 'px'; | ||
var height = this.options.adaptiveHeight && this.selectedSlide ? | ||
this.selectedSlide.height : this.maxCellHeight; | ||
this.viewport.style.height = height + 'px'; | ||
} | ||
}; | ||
Flickity.prototype._getWrapShiftCells = function() { | ||
proto._getWrapShiftCells = function() { | ||
// only for wrap-around | ||
@@ -380,3 +443,3 @@ if ( !this.options.wrapAround ) { | ||
Flickity.prototype._getGapCells = function( gapX, cellIndex, increment ) { | ||
proto._getGapCells = function( gapX, cellIndex, increment ) { | ||
// keep adding cells until the cover the initial gap | ||
@@ -399,28 +462,26 @@ var cells = []; | ||
// contain cell targets so no excess sliding | ||
Flickity.prototype._containCells = function() { | ||
proto._containSlides = function() { | ||
if ( !this.options.contain || this.options.wrapAround || !this.cells.length ) { | ||
return; | ||
} | ||
var startMargin = this.options.rightToLeft ? 'marginRight' : 'marginLeft'; | ||
var endMargin = this.options.rightToLeft ? 'marginLeft' : 'marginRight'; | ||
var firstCellStartMargin = this.cells[0].size[ startMargin ]; | ||
var lastCell = this.getLastCell(); | ||
var contentWidth = this.slideableWidth - lastCell.size[ endMargin ]; | ||
var endLimit = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign ); | ||
var isRightToLeft = this.options.rightToLeft; | ||
var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft'; | ||
var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight'; | ||
var contentWidth = this.slideableWidth - this.getLastCell().size[ endMargin ]; | ||
// content is less than gallery size | ||
var isContentSmaller = contentWidth < this.size.innerWidth; | ||
// bounds | ||
var beginBound = this.cursorPosition + this.cells[0].size[ beginMargin ]; | ||
var endBound = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign ); | ||
// contain each cell target | ||
for ( var i=0, len = this.cells.length; i < len; i++ ) { | ||
var cell = this.cells[i]; | ||
// reset default target | ||
cell.setDefaultTarget(); | ||
this.slides.forEach( function( slide ) { | ||
if ( isContentSmaller ) { | ||
// all cells fit inside gallery | ||
cell.target = contentWidth * this.cellAlign; | ||
slide.target = contentWidth * this.cellAlign; | ||
} else { | ||
// contain to bounds | ||
cell.target = Math.max( cell.target, this.cursorPosition + firstCellStartMargin ); | ||
cell.target = Math.min( cell.target, endLimit ); | ||
slide.target = Math.max( slide.target, beginBound ); | ||
slide.target = Math.min( slide.target, endBound ); | ||
} | ||
} | ||
}, this ); | ||
}; | ||
@@ -436,3 +497,3 @@ | ||
*/ | ||
Flickity.prototype.dispatchEvent = function( type, event, args ) { | ||
proto.dispatchEvent = function( type, event, args ) { | ||
var emitArgs = [ event ].concat( args ); | ||
@@ -442,11 +503,12 @@ this.emitEvent( type, emitArgs ); | ||
if ( jQuery && this.$element ) { | ||
// default trigger with type if no event | ||
type += this.options.namespaceJQueryEvents ? '.flickity' : ''; | ||
var $event = type; | ||
if ( event ) { | ||
// create jQuery event | ||
var $event = jQuery.Event( event ); | ||
$event.type = type; | ||
this.$element.trigger( $event, args ); | ||
} else { | ||
// just trigger with type if no event available | ||
this.$element.trigger( type, args ); | ||
var jQEvent = jQuery.Event( event ); | ||
jQEvent.type = type; | ||
$event = jQEvent; | ||
} | ||
this.$element.trigger( $event, args ); | ||
} | ||
@@ -458,7 +520,7 @@ }; | ||
/** | ||
* @param {Integer} index - index of the cell | ||
* @param {Integer} index - index of the slide | ||
* @param {Boolean} isWrap - will wrap-around to last/first if at the end | ||
* @param {Boolean} isInstant - will immediately set position at selected cell | ||
*/ | ||
Flickity.prototype.select = function( index, isWrap, isInstant ) { | ||
proto.select = function( index, isWrap, isInstant ) { | ||
if ( !this.isActive ) { | ||
@@ -468,21 +530,13 @@ return; | ||
index = parseInt( index, 10 ); | ||
// wrap position so slider is within normal area | ||
var len = this.cells.length; | ||
if ( this.options.wrapAround && len > 1 ) { | ||
if ( index < 0 ) { | ||
this.x -= this.slideableWidth; | ||
} else if ( index >= len ) { | ||
this.x += this.slideableWidth; | ||
} | ||
} | ||
this._wrapSelect( index ); | ||
if ( this.options.wrapAround || isWrap ) { | ||
index = utils.modulo( index, len ); | ||
index = utils.modulo( index, this.slides.length ); | ||
} | ||
// bail if invalid index | ||
if ( !this.cells[ index ] ) { | ||
if ( !this.slides[ index ] ) { | ||
return; | ||
} | ||
this.selectedIndex = index; | ||
this.setSelectedCell(); | ||
this.updateSelectedSlide(); | ||
if ( isInstant ) { | ||
@@ -493,26 +547,97 @@ this.positionSliderAtSelected(); | ||
} | ||
if ( this.options.adaptiveHeight ) { | ||
this.setGallerySize(); | ||
} | ||
this.dispatchEvent('select'); | ||
// old v1 event name, remove in v3 | ||
this.dispatchEvent('cellSelect'); | ||
}; | ||
Flickity.prototype.previous = function( isWrap ) { | ||
// wraps position for wrapAround, to move to closest slide. #113 | ||
proto._wrapSelect = function( index ) { | ||
var len = this.slides.length; | ||
var isWrapping = this.options.wrapAround && len > 1; | ||
if ( !isWrapping ) { | ||
return index; | ||
} | ||
var wrapIndex = utils.modulo( index, len ); | ||
// go to shortest | ||
var delta = Math.abs( wrapIndex - this.selectedIndex ); | ||
var backWrapDelta = Math.abs( ( wrapIndex + len ) - this.selectedIndex ); | ||
var forewardWrapDelta = Math.abs( ( wrapIndex - len ) - this.selectedIndex ); | ||
if ( !this.isDragSelect && backWrapDelta < delta ) { | ||
index += len; | ||
} else if ( !this.isDragSelect && forewardWrapDelta < delta ) { | ||
index -= len; | ||
} | ||
// wrap position so slider is within normal area | ||
if ( index < 0 ) { | ||
this.x -= this.slideableWidth; | ||
} else if ( index >= len ) { | ||
this.x += this.slideableWidth; | ||
} | ||
}; | ||
proto.previous = function( isWrap ) { | ||
this.select( this.selectedIndex - 1, isWrap ); | ||
}; | ||
Flickity.prototype.next = function( isWrap ) { | ||
proto.next = function( isWrap ) { | ||
this.select( this.selectedIndex + 1, isWrap ); | ||
}; | ||
Flickity.prototype.setSelectedCell = function() { | ||
this._removeSelectedCellClass(); | ||
this.selectedCell = this.cells[ this.selectedIndex ]; | ||
this.selectedElement = this.selectedCell.element; | ||
classie.add( this.selectedElement, 'is-selected' ); | ||
proto.updateSelectedSlide = function() { | ||
var slide = this.slides[ this.selectedIndex ]; | ||
// selectedIndex could be outside of slides, if triggered before resize() | ||
if ( !slide ) { | ||
return; | ||
} | ||
// unselect previous selected slide | ||
this.unselectSelectedSlide(); | ||
// update new selected slide | ||
this.selectedSlide = slide; | ||
slide.select(); | ||
this.selectedCells = slide.cells; | ||
this.selectedElements = slide.getCellElements(); | ||
// HACK: selectedCell & selectedElement is first cell in slide, backwards compatibility | ||
// Remove in v3? | ||
this.selectedCell = slide.cells[0]; | ||
this.selectedElement = this.selectedElements[0]; | ||
}; | ||
Flickity.prototype._removeSelectedCellClass = function() { | ||
if ( this.selectedCell ) { | ||
classie.remove( this.selectedCell.element, 'is-selected' ); | ||
proto.unselectSelectedSlide = function() { | ||
if ( this.selectedSlide ) { | ||
this.selectedSlide.unselect(); | ||
} | ||
}; | ||
/** | ||
* select slide from number or cell element | ||
* @param {Element or Number} elem | ||
*/ | ||
proto.selectCell = function( value, isWrap, isInstant ) { | ||
// get cell | ||
var cell; | ||
if ( typeof value == 'number' ) { | ||
cell = this.cells[ value ]; | ||
} else { | ||
// use string as selector | ||
if ( typeof value == 'string' ) { | ||
value = this.element.querySelector( value ); | ||
} | ||
// get cell from element | ||
cell = this.getCell( value ); | ||
} | ||
// select slide that has cell | ||
for ( var i=0; cell && i < this.slides.length; i++ ) { | ||
var slide = this.slides[i]; | ||
var index = slide.cells.indexOf( cell ); | ||
if ( index != -1 ) { | ||
this.select( i, isWrap, isInstant ); | ||
return; | ||
} | ||
} | ||
}; | ||
// -------------------------- get cells -------------------------- // | ||
@@ -525,5 +650,5 @@ | ||
*/ | ||
Flickity.prototype.getCell = function( elem ) { | ||
proto.getCell = function( elem ) { | ||
// loop through cells to get the one that matches | ||
for ( var i=0, len = this.cells.length; i < len; i++ ) { | ||
for ( var i=0; i < this.cells.length; i++ ) { | ||
var cell = this.cells[i]; | ||
@@ -541,7 +666,6 @@ if ( cell.element == elem ) { | ||
*/ | ||
Flickity.prototype.getCells = function( elems ) { | ||
proto.getCells = function( elems ) { | ||
elems = utils.makeArray( elems ); | ||
var cells = []; | ||
for ( var i=0, len = elems.length; i < len; i++ ) { | ||
var elem = elems[i]; | ||
elems.forEach( function( elem ) { | ||
var cell = this.getCell( elem ); | ||
@@ -551,3 +675,3 @@ if ( cell ) { | ||
} | ||
} | ||
}, this ); | ||
return cells; | ||
@@ -560,8 +684,6 @@ }; | ||
*/ | ||
Flickity.prototype.getCellElements = function() { | ||
var cellElems = []; | ||
for ( var i=0, len = this.cells.length; i < len; i++ ) { | ||
cellElems.push( this.cells[i].element ); | ||
} | ||
return cellElems; | ||
proto.getCellElements = function() { | ||
return this.cells.map( function( cell ) { | ||
return cell.element; | ||
}); | ||
}; | ||
@@ -574,3 +696,3 @@ | ||
*/ | ||
Flickity.prototype.getParentCell = function( elem ) { | ||
proto.getParentCell = function( elem ) { | ||
// first check if elem is cell | ||
@@ -587,14 +709,14 @@ var cell = this.getCell( elem ); | ||
/** | ||
* get cells adjacent to a cell | ||
* @param {Integer} adjCount - number of adjacent cells | ||
* @param {Integer} index - index of cell to start | ||
* get cells adjacent to a slide | ||
* @param {Integer} adjCount - number of adjacent slides | ||
* @param {Integer} index - index of slide to start | ||
* @returns {Array} cells - array of Flickity.Cells | ||
*/ | ||
Flickity.prototype.getAdjacentCellElements = function( adjCount, index ) { | ||
proto.getAdjacentCellElements = function( adjCount, index ) { | ||
if ( !adjCount ) { | ||
return [ this.selectedElement ]; | ||
return this.selectedSlide.getCellElements(); | ||
} | ||
index = index === undefined ? this.selectedIndex : index; | ||
var len = this.cells.length; | ||
var len = this.slides.length; | ||
if ( 1 + ( adjCount * 2 ) >= len ) { | ||
@@ -606,6 +728,6 @@ return this.getCellElements(); | ||
for ( var i = index - adjCount; i <= index + adjCount ; i++ ) { | ||
var cellIndex = this.options.wrapAround ? utils.modulo( i, len ) : i; | ||
var cell = this.cells[ cellIndex ]; | ||
if ( cell ) { | ||
cellElems.push( cell.element ); | ||
var slideIndex = this.options.wrapAround ? utils.modulo( i, len ) : i; | ||
var slide = this.slides[ slideIndex ]; | ||
if ( slide ) { | ||
cellElems = cellElems.concat( slide.getCellElements() ); | ||
} | ||
@@ -618,7 +740,7 @@ } | ||
Flickity.prototype.uiChange = function() { | ||
this.emit('uiChange'); | ||
proto.uiChange = function() { | ||
this.emitEvent('uiChange'); | ||
}; | ||
Flickity.prototype.childUIPointerDown = function( event ) { | ||
proto.childUIPointerDown = function( event ) { | ||
this.emitEvent( 'childUIPointerDown', [ event ] ); | ||
@@ -629,3 +751,3 @@ }; | ||
Flickity.prototype.onresize = function() { | ||
proto.onresize = function() { | ||
this.watchCSS(); | ||
@@ -637,3 +759,3 @@ this.resize(); | ||
Flickity.prototype.resize = function() { | ||
proto.resize = function() { | ||
if ( !this.isActive ) { | ||
@@ -650,30 +772,11 @@ return; | ||
this.setGallerySize(); | ||
this.positionSliderAtSelected(); | ||
this.emitEvent('resize'); | ||
// update selected index for group slides, instant | ||
// TODO: position can be lost between groups of various numbers | ||
var selectedElement = this.selectedElements && this.selectedElements[0]; | ||
this.selectCell( selectedElement, false, true ); | ||
}; | ||
var supportsConditionalCSS = Flickity.supportsConditionalCSS = ( function() { | ||
var supports; | ||
return function checkSupport() { | ||
if ( supports !== undefined ) { | ||
return supports; | ||
} | ||
if ( !getComputedStyle ) { | ||
supports = false; | ||
return; | ||
} | ||
// style body's :after and check that | ||
var style = document.createElement('style'); | ||
var cssText = document.createTextNode('body:after { content: "foo"; display: none; }'); | ||
style.appendChild( cssText ); | ||
document.head.appendChild( style ); | ||
var afterContent = getComputedStyle( document.body, ':after' ).content; | ||
// check if able to get :after content | ||
supports = afterContent.indexOf('foo') != -1; | ||
document.head.removeChild( style ); | ||
return supports; | ||
}; | ||
})(); | ||
// watches the :after property, activates/deactivates | ||
Flickity.prototype.watchCSS = function() { | ||
proto.watchCSS = function() { | ||
var watchOption = this.options.watchCSS; | ||
@@ -683,9 +786,2 @@ if ( !watchOption ) { | ||
} | ||
var supports = supportsConditionalCSS(); | ||
if ( !supports ) { | ||
// activate if watch option is fallbackOn | ||
var method = watchOption == 'fallbackOn' ? 'activate' : 'deactivate'; | ||
this[ method ](); | ||
return; | ||
} | ||
@@ -704,3 +800,3 @@ var afterContent = getComputedStyle( this.element, ':after' ).content; | ||
// go previous/next if left/right keys pressed | ||
Flickity.prototype.onkeydown = function( event ) { | ||
proto.onkeydown = function( event ) { | ||
// only work if element is in focus | ||
@@ -728,14 +824,13 @@ if ( !this.options.accessibility || | ||
// deactivate all Flickity functionality, but keep stuff available | ||
Flickity.prototype.deactivate = function() { | ||
proto.deactivate = function() { | ||
if ( !this.isActive ) { | ||
return; | ||
} | ||
classie.remove( this.element, 'flickity-enabled' ); | ||
classie.remove( this.element, 'flickity-rtl' ); | ||
this.element.classList.remove('flickity-enabled'); | ||
this.element.classList.remove('flickity-rtl'); | ||
// destroy cells | ||
for ( var i=0, len = this.cells.length; i < len; i++ ) { | ||
var cell = this.cells[i]; | ||
this.cells.forEach( function( cell ) { | ||
cell.destroy(); | ||
} | ||
this._removeSelectedCellClass(); | ||
}); | ||
this.unselectSelectedSlide(); | ||
this.element.removeChild( this.viewport ); | ||
@@ -746,15 +841,13 @@ // move child elements back into element | ||
this.element.removeAttribute('tabIndex'); | ||
eventie.unbind( this.element, 'keydown', this ); | ||
this.element.removeEventListener( 'keydown', this ); | ||
} | ||
// set flags | ||
this.isActive = false; | ||
this.emit('deactivate'); | ||
this.emitEvent('deactivate'); | ||
}; | ||
Flickity.prototype.destroy = function() { | ||
proto.destroy = function() { | ||
this.deactivate(); | ||
if ( this.isResizeBound ) { | ||
eventie.unbind( window, 'resize', this ); | ||
} | ||
this.emit('destroy'); | ||
window.removeEventListener( 'resize', this ); | ||
this.emitEvent('destroy'); | ||
if ( jQuery && this.$element ) { | ||
@@ -769,17 +862,6 @@ jQuery.removeData( this.element, 'flickity' ); | ||
utils.extend( Flickity.prototype, animatePrototype ); | ||
utils.extend( proto, animatePrototype ); | ||
// -------------------------- extras -------------------------- // | ||
// quick check for IE8 | ||
var isIE8 = 'attachEvent' in window; | ||
Flickity.setUnselectable = function( elem ) { | ||
if ( !isIE8 ) { | ||
return; | ||
} | ||
// IE8 prevent child from changing focus http://stackoverflow.com/a/17525223/182183 | ||
elem.setAttribute( 'unselectable', 'on' ); | ||
}; | ||
/** | ||
@@ -786,0 +868,0 @@ * get Flickity instance from element |
/*! | ||
* Flickity v1.2.1 | ||
* Touch, responsive, flickable galleries | ||
* Flickity v2.0.0 | ||
* Touch, responsive, flickable carousels | ||
* | ||
@@ -9,9 +9,8 @@ * Licensed GPLv3 for open source use | ||
* http://flickity.metafizzy.co | ||
* Copyright 2015 Metafizzy | ||
* Copyright 2016 Metafizzy | ||
*/ | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
@@ -28,3 +27,3 @@ // AMD | ||
], factory ); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
@@ -31,0 +30,0 @@ module.exports = factory( |
@@ -0,21 +1,17 @@ | ||
// lazyload | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
// AMD | ||
define( [ | ||
'classie/classie', | ||
'eventie/eventie', | ||
'./flickity', | ||
'fizzy-ui-utils/utils' | ||
], function( classie, eventie, Flickity, utils ) { | ||
return factory( window, classie, eventie, Flickity, utils ); | ||
], function( Flickity, utils ) { | ||
return factory( window, Flickity, utils ); | ||
}); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
module.exports = factory( | ||
window, | ||
require('desandro-classie'), | ||
require('eventie'), | ||
require('./flickity'), | ||
@@ -28,4 +24,2 @@ require('fizzy-ui-utils') | ||
window, | ||
window.classie, | ||
window.eventie, | ||
window.Flickity, | ||
@@ -36,12 +30,13 @@ window.fizzyUIUtils | ||
}( window, function factory( window, classie, eventie, Flickity, utils ) { | ||
}( window, function factory( window, Flickity, utils ) { | ||
'use strict'; | ||
Flickity.createMethods.push('_createLazyload'); | ||
var proto = Flickity.prototype; | ||
Flickity.prototype._createLazyload = function() { | ||
this.on( 'cellSelect', this.lazyLoad ); | ||
proto._createLazyload = function() { | ||
this.on( 'select', this.lazyLoad ); | ||
}; | ||
Flickity.prototype.lazyLoad = function() { | ||
proto.lazyLoad = function() { | ||
var lazyLoad = this.options.lazyLoad; | ||
@@ -56,12 +51,10 @@ if ( !lazyLoad ) { | ||
var lazyImages = []; | ||
for ( var i=0, len = cellElems.length; i < len; i++ ) { | ||
var cellElem = cellElems[i]; | ||
cellElems.forEach( function( cellElem ) { | ||
var lazyCellImages = getCellLazyImages( cellElem ); | ||
lazyImages = lazyImages.concat( lazyCellImages ); | ||
} | ||
}); | ||
// load lazy images | ||
for ( i=0, len = lazyImages.length; i < len; i++ ) { | ||
var img = lazyImages[i]; | ||
lazyImages.forEach( function( img ) { | ||
new LazyLoader( img, this ); | ||
} | ||
}, this ); | ||
}; | ||
@@ -94,4 +87,4 @@ | ||
LazyLoader.prototype.load = function() { | ||
eventie.bind( this.img, 'load', this ); | ||
eventie.bind( this.img, 'error', this ); | ||
this.img.addEventListener( 'load', this ); | ||
this.img.addEventListener( 'error', this ); | ||
// load image | ||
@@ -113,4 +106,4 @@ this.img.src = this.img.getAttribute('data-flickity-lazyload'); | ||
// unbind events | ||
eventie.unbind( this.img, 'load', this ); | ||
eventie.unbind( this.img, 'error', this ); | ||
this.img.removeEventListener( 'load', this ); | ||
this.img.removeEventListener( 'error', this ); | ||
@@ -121,3 +114,3 @@ var cell = this.flickity.getParentCell( this.img ); | ||
classie.add( this.img, className ); | ||
this.img.classList.add( className ); | ||
this.flickity.dispatchEvent( 'lazyLoad', event, cellElem ); | ||
@@ -124,0 +117,0 @@ }; |
@@ -0,20 +1,18 @@ | ||
// page dots | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
// AMD | ||
define( [ | ||
'eventie/eventie', | ||
'./flickity', | ||
'tap-listener/tap-listener', | ||
'fizzy-ui-utils/utils' | ||
], function( eventie, Flickity, TapListener, utils ) { | ||
return factory( window, eventie, Flickity, TapListener, utils ); | ||
], function( Flickity, TapListener, utils ) { | ||
return factory( window, Flickity, TapListener, utils ); | ||
}); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
module.exports = factory( | ||
window, | ||
require('eventie'), | ||
require('./flickity'), | ||
@@ -28,3 +26,2 @@ require('tap-listener'), | ||
window, | ||
window.eventie, | ||
window.Flickity, | ||
@@ -36,3 +33,3 @@ window.TapListener, | ||
}( window, function factory( window, eventie, Flickity, TapListener, utils ) { | ||
}( window, function factory( window, Flickity, TapListener, utils ) { | ||
@@ -54,17 +51,7 @@ // -------------------------- PageDots -------------------------- // | ||
this.holder.className = 'flickity-page-dots'; | ||
Flickity.setUnselectable( this.holder ); | ||
// create dots, array of elements | ||
this.dots = []; | ||
// update on select | ||
var _this = this; | ||
this.onCellSelect = function() { | ||
_this.updateSelected(); | ||
}; | ||
this.parent.on( 'cellSelect', this.onCellSelect ); | ||
// tap | ||
this.on( 'tap', this.onTap ); | ||
// pointerDown | ||
this.on( 'pointerDown', function onPointerDown( button, event ) { | ||
_this.parent.childUIPointerDown( event ); | ||
}); | ||
}; | ||
@@ -86,4 +73,4 @@ | ||
PageDots.prototype.setDots = function() { | ||
// get difference between number of cells and number of dots | ||
var delta = this.parent.cells.length - this.dots.length; | ||
// get difference between number of slides and number of dots | ||
var delta = this.parent.slides.length - this.dots.length; | ||
if ( delta > 0 ) { | ||
@@ -114,6 +101,5 @@ this.addDots( delta ); | ||
// remove from DOM | ||
for ( var i=0, len = removeDots.length; i < len; i++ ) { | ||
var dot = removeDots[i]; | ||
removeDots.forEach( function( dot ) { | ||
this.holder.removeChild( dot ); | ||
} | ||
}, this ); | ||
}; | ||
@@ -142,3 +128,3 @@ | ||
this.parent.uiChange(); | ||
var index = utils.indexOf( this.dots, target ); | ||
var index = this.dots.indexOf( target ); | ||
this.parent.select( index ); | ||
@@ -161,3 +147,5 @@ }; | ||
Flickity.prototype._createPageDots = function() { | ||
var proto = Flickity.prototype; | ||
proto._createPageDots = function() { | ||
if ( !this.options.pageDots ) { | ||
@@ -167,16 +155,27 @@ return; | ||
this.pageDots = new PageDots( this ); | ||
// events | ||
this.on( 'activate', this.activatePageDots ); | ||
this.on( 'cellAddedRemoved', this.onCellAddedRemovedPageDots ); | ||
this.on( 'select', this.updateSelectedPageDots ); | ||
this.on( 'cellChange', this.updatePageDots ); | ||
this.on( 'resize', this.updatePageDots ); | ||
this.on( 'deactivate', this.deactivatePageDots ); | ||
this.pageDots.on( 'pointerDown', function( button, event ) { | ||
this.childUIPointerDown( event ); | ||
}.bind( this )); | ||
}; | ||
Flickity.prototype.activatePageDots = function() { | ||
proto.activatePageDots = function() { | ||
this.pageDots.activate(); | ||
}; | ||
Flickity.prototype.onCellAddedRemovedPageDots = function() { | ||
proto.updateSelectedPageDots = function() { | ||
this.pageDots.updateSelected(); | ||
}; | ||
proto.updatePageDots = function() { | ||
this.pageDots.setDots(); | ||
}; | ||
Flickity.prototype.deactivatePageDots = function() { | ||
proto.deactivatePageDots = function() { | ||
this.pageDots.deactivate(); | ||
@@ -183,0 +182,0 @@ }; |
@@ -0,20 +1,18 @@ | ||
// player & autoPlay | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
// AMD | ||
define( [ | ||
'eventEmitter/EventEmitter', | ||
'eventie/eventie', | ||
'ev-emitter/ev-emitter', | ||
'fizzy-ui-utils/utils', | ||
'./flickity' | ||
], function( EventEmitter, eventie, utils, Flickity ) { | ||
return factory( EventEmitter, eventie, utils, Flickity ); | ||
], function( EvEmitter, utils, Flickity ) { | ||
return factory( EvEmitter, utils, Flickity ); | ||
}); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
module.exports = factory( | ||
require('wolfy87-eventemitter'), | ||
require('eventie'), | ||
require('ev-emitter'), | ||
require('fizzy-ui-utils'), | ||
@@ -26,4 +24,3 @@ require('./flickity') | ||
factory( | ||
window.EventEmitter, | ||
window.eventie, | ||
window.EvEmitter, | ||
window.fizzyUIUtils, | ||
@@ -34,3 +31,3 @@ window.Flickity | ||
}( window, function factory( EventEmitter, eventie, utils, Flickity ) { | ||
}( window, function factory( EvEmitter, utils, Flickity ) { | ||
@@ -58,10 +55,12 @@ 'use strict'; | ||
if ( visibilityEvent ) { | ||
var _this = this; | ||
this.onVisibilityChange = function() { | ||
_this.visibilityChange(); | ||
}; | ||
this.visibilityChange(); | ||
}.bind( this ); | ||
this.onVisibilityPlay = function() { | ||
this.visibilityPlay(); | ||
}.bind( this ); | ||
} | ||
} | ||
Player.prototype = new EventEmitter(); | ||
Player.prototype = Object.create( EvEmitter.prototype ); | ||
@@ -73,6 +72,13 @@ // start play | ||
} | ||
// do not play if page is hidden, start playing when page is visible | ||
var isPageHidden = document[ hiddenProperty ]; | ||
if ( visibilityEvent && isPageHidden ) { | ||
document.addEventListener( visibilityEvent, this.onVisibilityPlay ); | ||
return; | ||
} | ||
this.state = 'playing'; | ||
// listen to visibility change | ||
if ( visibilityEvent ) { | ||
document.addEventListener( visibilityEvent, this.onVisibilityChange, false ); | ||
document.addEventListener( visibilityEvent, this.onVisibilityChange ); | ||
} | ||
@@ -106,3 +112,3 @@ // start ticking | ||
if ( visibilityEvent ) { | ||
document.removeEventListener( visibilityEvent, this.onVisibilityChange, false ); | ||
document.removeEventListener( visibilityEvent, this.onVisibilityChange ); | ||
} | ||
@@ -123,3 +129,3 @@ }; | ||
Player.prototype.unpause = function() { | ||
// re-start play if in unpaused state | ||
// re-start play if paused | ||
if ( this.state == 'paused' ) { | ||
@@ -132,6 +138,11 @@ this.play(); | ||
Player.prototype.visibilityChange = function() { | ||
var isHidden = document[ hiddenProperty ]; | ||
this[ isHidden ? 'pause' : 'unpause' ](); | ||
var isPageHidden = document[ hiddenProperty ]; | ||
this[ isPageHidden ? 'pause' : 'unpause' ](); | ||
}; | ||
Player.prototype.visibilityPlay = function() { | ||
this.play(); | ||
document.removeEventListener( visibilityEvent, this.onVisibilityPlay ); | ||
}; | ||
// -------------------------- Flickity -------------------------- // | ||
@@ -144,4 +155,5 @@ | ||
Flickity.createMethods.push('_createPlayer'); | ||
var proto = Flickity.prototype; | ||
Flickity.prototype._createPlayer = function() { | ||
proto._createPlayer = function() { | ||
this.player = new Player( this ); | ||
@@ -155,3 +167,3 @@ | ||
Flickity.prototype.activatePlayer = function() { | ||
proto.activatePlayer = function() { | ||
if ( !this.options.autoPlay ) { | ||
@@ -161,4 +173,3 @@ return; | ||
this.player.play(); | ||
eventie.bind( this.element, 'mouseenter', this ); | ||
this.isMouseenterBound = true; | ||
this.element.addEventListener( 'mouseenter', this ); | ||
}; | ||
@@ -168,24 +179,21 @@ | ||
Flickity.prototype.playPlayer = function() { | ||
proto.playPlayer = function() { | ||
this.player.play(); | ||
}; | ||
Flickity.prototype.stopPlayer = function() { | ||
proto.stopPlayer = function() { | ||
this.player.stop(); | ||
}; | ||
Flickity.prototype.pausePlayer = function() { | ||
proto.pausePlayer = function() { | ||
this.player.pause(); | ||
}; | ||
Flickity.prototype.unpausePlayer = function() { | ||
proto.unpausePlayer = function() { | ||
this.player.unpause(); | ||
}; | ||
Flickity.prototype.deactivatePlayer = function() { | ||
proto.deactivatePlayer = function() { | ||
this.player.stop(); | ||
if ( this.isMouseenterBound ) { | ||
eventie.unbind( this.element, 'mouseenter', this ); | ||
delete this.isMouseenterBound; | ||
} | ||
this.element.removeEventListener( 'mouseenter', this ); | ||
}; | ||
@@ -196,3 +204,3 @@ | ||
// pause auto-play on hover | ||
Flickity.prototype.onmouseenter = function() { | ||
proto.onmouseenter = function() { | ||
if ( !this.options.pauseAutoPlayOnHover ) { | ||
@@ -202,9 +210,9 @@ return; | ||
this.player.pause(); | ||
eventie.bind( this.element, 'mouseleave', this ); | ||
this.element.addEventListener( 'mouseleave', this ); | ||
}; | ||
// resume auto-play on hover off | ||
Flickity.prototype.onmouseleave = function() { | ||
proto.onmouseleave = function() { | ||
this.player.unpause(); | ||
eventie.unbind( this.element, 'mouseleave', this ); | ||
this.element.removeEventListener( 'mouseleave', this ); | ||
}; | ||
@@ -211,0 +219,0 @@ |
@@ -1,22 +0,18 @@ | ||
// -------------------------- prev/next button -------------------------- // | ||
// prev/next buttons | ||
( function( window, factory ) { | ||
'use strict'; | ||
// universal module definition | ||
/* jshint strict: false */ | ||
if ( typeof define == 'function' && define.amd ) { | ||
// AMD | ||
define( [ | ||
'eventie/eventie', | ||
'./flickity', | ||
'tap-listener/tap-listener', | ||
'fizzy-ui-utils/utils' | ||
], function( eventie, Flickity, TapListener, utils ) { | ||
return factory( window, eventie, Flickity, TapListener, utils ); | ||
], function( Flickity, TapListener, utils ) { | ||
return factory( window, Flickity, TapListener, utils ); | ||
}); | ||
} else if ( typeof exports == 'object' ) { | ||
} else if ( typeof module == 'object' && module.exports ) { | ||
// CommonJS | ||
module.exports = factory( | ||
window, | ||
require('eventie'), | ||
require('./flickity'), | ||
@@ -30,3 +26,2 @@ require('tap-listener'), | ||
window, | ||
window.eventie, | ||
window.Flickity, | ||
@@ -38,25 +33,7 @@ window.TapListener, | ||
}( window, function factory( window, eventie, Flickity, TapListener, utils ) { | ||
}( window, function factory( window, Flickity, TapListener, utils ) { | ||
'use strict'; | ||
// ----- inline SVG support ----- // | ||
var svgURI = 'http://www.w3.org/2000/svg'; | ||
// only check on demand, not on script load | ||
var supportsInlineSVG = ( function() { | ||
var supports; | ||
function checkSupport() { | ||
if ( supports !== undefined ) { | ||
return supports; | ||
} | ||
var div = document.createElement('div'); | ||
div.innerHTML = '<svg/>'; | ||
supports = ( div.firstChild && div.firstChild.namespaceURI ) == svgURI; | ||
return supports; | ||
} | ||
return checkSupport; | ||
})(); | ||
// -------------------------- PrevNextButton -------------------------- // | ||
@@ -89,18 +66,9 @@ | ||
Flickity.setUnselectable( element ); | ||
// create arrow | ||
if ( supportsInlineSVG() ) { | ||
var svg = this.createSVG(); | ||
element.appendChild( svg ); | ||
} else { | ||
// SVG not supported, set button text | ||
this.setArrowText(); | ||
element.className += ' no-svg'; | ||
} | ||
var svg = this.createSVG(); | ||
element.appendChild( svg ); | ||
// update on select | ||
var _this = this; | ||
this.onCellSelect = function() { | ||
_this.update(); | ||
}; | ||
this.parent.on( 'cellSelect', this.onCellSelect ); | ||
this.parent.on( 'select', function() { | ||
this.update(); | ||
}.bind( this )); | ||
// tap | ||
@@ -110,4 +78,4 @@ this.on( 'tap', this.onTap ); | ||
this.on( 'pointerDown', function onPointerDown( button, event ) { | ||
_this.parent.childUIPointerDown( event ); | ||
}); | ||
this.parent.childUIPointerDown( event ); | ||
}.bind( this )); | ||
}; | ||
@@ -118,3 +86,3 @@ | ||
// click events from keyboard | ||
eventie.bind( this.element, 'click', this ); | ||
this.element.addEventListener( 'click', this ); | ||
// add to DOM | ||
@@ -130,3 +98,3 @@ this.parent.element.appendChild( this.element ); | ||
// click events from keyboard | ||
eventie.unbind( this.element, 'click', this ); | ||
this.element.removeEventListener( 'click', this ); | ||
}; | ||
@@ -165,8 +133,2 @@ | ||
PrevNextButton.prototype.setArrowText = function() { | ||
var parentOptions = this.parent.options; | ||
var arrowText = this.isLeft ? parentOptions.leftArrowText : parentOptions.rightArrowText; | ||
utils.setText( this.element, arrowText ); | ||
}; | ||
PrevNextButton.prototype.onTap = function() { | ||
@@ -210,10 +172,10 @@ if ( !this.isEnabled ) { | ||
PrevNextButton.prototype.update = function() { | ||
// index of first or last cell, if previous or next | ||
var cells = this.parent.cells; | ||
// enable is wrapAround and at least 2 cells | ||
if ( this.parent.options.wrapAround && cells.length > 1 ) { | ||
// index of first or last slide, if previous or next | ||
var slides = this.parent.slides; | ||
// enable is wrapAround and at least 2 slides | ||
if ( this.parent.options.wrapAround && slides.length > 1 ) { | ||
this.enable(); | ||
return; | ||
} | ||
var lastIndex = cells.length ? cells.length - 1 : 0; | ||
var lastIndex = slides.length ? slides.length - 1 : 0; | ||
var boundIndex = this.isPrevious ? 0 : lastIndex; | ||
@@ -232,4 +194,2 @@ var method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable'; | ||
prevNextButtons: true, | ||
leftArrowText: '‹', | ||
rightArrowText: '›', | ||
arrowShape: { | ||
@@ -244,4 +204,5 @@ x0: 10, | ||
Flickity.createMethods.push('_createPrevNextButtons'); | ||
var proto = Flickity.prototype; | ||
Flickity.prototype._createPrevNextButtons = function() { | ||
proto._createPrevNextButtons = function() { | ||
if ( !this.options.prevNextButtons ) { | ||
@@ -257,3 +218,3 @@ return; | ||
Flickity.prototype.activatePrevNextButtons = function() { | ||
proto.activatePrevNextButtons = function() { | ||
this.prevButton.activate(); | ||
@@ -264,3 +225,3 @@ this.nextButton.activate(); | ||
Flickity.prototype.deactivatePrevNextButtons = function() { | ||
proto.deactivatePrevNextButtons = function() { | ||
this.prevButton.deactivate(); | ||
@@ -267,0 +228,0 @@ this.nextButton.deactivate(); |
{ | ||
"name": "flickity", | ||
"version": "1.2.1", | ||
"description": "Touch, responsive, flickable galleries", | ||
"version": "2.0.0", | ||
"description": "Touch, responsive, flickable carousels", | ||
"main": "js/index.js", | ||
"style": "css/flickity.css", | ||
"dependencies": { | ||
"desandro-classie": "~1.0.1", | ||
"desandro-matches-selector": "~1.0.2", | ||
"doc-ready": "~1.0.3", | ||
"eventie": "~1.0.6", | ||
"get-size": "~1.2.2", | ||
"desandro-get-style-property": "~1.0.4", | ||
"wolfy87-eventemitter": "~4.2.11", | ||
"unidragger": "~1.1.5", | ||
"fizzy-ui-utils": "~1.0.0", | ||
"tap-listener": "~1.1.1" | ||
"desandro-matches-selector": "^2.0.0", | ||
"ev-emitter": "^1.0.2", | ||
"fizzy-ui-utils": "^2.0.0", | ||
"get-size": "^2.0.0", | ||
"tap-listener": "^2.0.0", | ||
"unidragger": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"flickity-imagesloaded": "~1.0.0", | ||
"flickity-as-nav-for": "~1.0.0", | ||
"jquery-bridget": "~1.1.0", | ||
"flickity-imagesloaded": "^2.0.0", | ||
"flickity-as-nav-for": "^2.0.0", | ||
"jquery-bridget": "^2.0.0", | ||
"gulp": "^3.8.10", | ||
@@ -27,9 +23,8 @@ "gulp-jshint": "^1.9.0", | ||
"gulp-util": "^3.0.2", | ||
"through2": "^0.6.3", | ||
"requirejs": "^2.1.15", | ||
"chalk": "^0.5.1", | ||
"gulp-replace": "^0.5.1", | ||
"gulp-requirejs-optimize": "github:metafizzy/gulp-requirejs-optimize", | ||
"gulp-uglify": "^1.0.2", | ||
"gulp-json-lint": "0.0.1", | ||
"gulp-minify-css": "^0.4.5", | ||
"gulp-clean-css": "^2.0.4", | ||
"minimist": "^1.1.0" | ||
@@ -59,3 +54,6 @@ }, | ||
}, | ||
"homepage": "http://flickity.metafizzy.co" | ||
"homepage": "http://flickity.metafizzy.co", | ||
"directories": { | ||
"test": "test" | ||
} | ||
} |
# Flickity | ||
_Touch, responsive, flickable galleries_ | ||
_Touch, responsive, flickable carousels_ | ||
@@ -12,7 +12,7 @@ See [flickity.metafizzy.co](http://flickity.metafizzy.co) for complete docs and demos. | ||
+ CSS: | ||
- [flickity.css](https://github.com/metafizzy/flickity/raw/master/dist/flickity.css) un-minified, or | ||
- [flickity.css](https://github.com/metafizzy/flickity/raw/master/dist/flickity.min.css) minified | ||
- [flickity.min.css](https://npmcdn.com/flickity@2.0/dist/flickity.pkgd.min.css) minified, or | ||
- [flickity.css](https://npmcdn.com/flickity@2.0/dist/flickity.pkgd.css) un-minified | ||
+ JavaScript: | ||
- [flickity.pkgd.js](https://github.com/metafizzy/flickity/raw/master/dist/flickity.pkgd.js) un-minified, or | ||
- [flickity.pkgd.min.js](https://github.com/metafizzy/flickity/raw/master/dist/flickity.pkgd.min.js) minified | ||
- [flickity.pkgd.min.js](https://npmcdn.com/flickity@2.0/dist/flickity.pkgd.min.js) minified, or | ||
- [flickity.pkgd.js](https://npmcdn.com/flickity@2.0/dist/flickity.pkgd.js) un-minified | ||
@@ -24,11 +24,11 @@ ### CDN | ||
``` html | ||
<link rel="stylesheet" href="https://npmcdn.com/flickity@1.2/dist/flickity.pkgd.css"> | ||
<link rel="stylesheet" href="https://npmcdn.com/flickity@2.0/dist/flickity.pkgd.min.css"> | ||
<!-- or --> | ||
<link rel="stylesheet" href="https://npmcdn.com/flickity@1.2/dist/flickity.pkgd.min.css"> | ||
<link rel="stylesheet" href="https://npmcdn.com/flickity@2.0/dist/flickity.pkgd.css"> | ||
``` | ||
``` html | ||
<script src="https://npmcdn.com/flickity@1.2/dist/flickity.pkgd.js"></script> | ||
<script src="https://npmcdn.com/flickity@2.0/dist/flickity.pkgd.min.js"></script> | ||
<!-- or --> | ||
<script src="https://npmcdn.com/flickity@1.2/dist/flickity.pkgd.min.js"></script> | ||
<script src="https://npmcdn.com/flickity@2.0/dist/flickity.pkgd.js"></script> | ||
``` | ||
@@ -59,6 +59,6 @@ | ||
``` html | ||
<div class="gallery"> | ||
<div class="cell">...</div> | ||
<div class="cell">...</div> | ||
<div class="cell">...</div> | ||
<div class="carousel"> | ||
<div class="carousel-cell">...</div> | ||
<div class="carousel-cell">...</div> | ||
<div class="carousel-cell">...</div> | ||
... | ||
@@ -77,2 +77,5 @@ </div> | ||
adaptiveHeight: false, | ||
// set carousel height to the selected slide | ||
autoPlay: false, | ||
@@ -99,2 +102,6 @@ // advances to the next cell | ||
dragThreshold: 3, | ||
// number of pixels a user must scroll horizontally to start dragging | ||
// increase to allow more room for vertical scroll for touch devices | ||
freeScroll: false, | ||
@@ -107,2 +114,5 @@ // enables content to be freely scrolled and flicked | ||
groupCells: false, | ||
// group cells together in slides | ||
initialIndex: 0, | ||
@@ -140,4 +150,2 @@ // zero-based index of the initial selected cell | ||
// activates if #element:after { content: 'flickity' } | ||
// IE8 and Android 2.3 do not support watching :after | ||
// set watch: 'fallbackOn' to enable for these browsers | ||
@@ -144,0 +152,0 @@ wrapAround: false |
@@ -1,3 +0,2 @@ | ||
test( 'add/remove cells', function() { | ||
QUnit.test( 'add/remove cells', function( assert ) { | ||
'use strict'; | ||
@@ -19,3 +18,2 @@ | ||
var elem = document.querySelector('#add-remove-cells'); | ||
@@ -26,5 +24,5 @@ var flkty = new Flickity( elem ); | ||
function checkCellElem( cellElem, index, message ) { | ||
equal( sliderElem.children[ index ], cellElem, message + ' cell element in DOM correct' ); | ||
equal( flkty.cells[ index ].element, cellElem, message + ' element added as cell' ); | ||
ok( isPositionApprox( cellElem.style.left, index * 25 ), ' element positioned' ); | ||
assert.equal( sliderElem.children[ index ], cellElem, message + ' cell element in DOM correct' ); | ||
assert.equal( flkty.cells[ index ].element, cellElem, message + ' element added as cell' ); | ||
assert.ok( isPositionApprox( cellElem.style.left, index * 25 ), ' element positioned' ); | ||
} | ||
@@ -36,3 +34,3 @@ | ||
checkCellElem( cellElem, 0, 'prepended' ); | ||
equal( flkty.selectedIndex, 1, 'selectedIndex +1 after prepend' ); | ||
assert.equal( flkty.selectedIndex, 1, 'selectedIndex +1 after prepend' ); | ||
// append cell element | ||
@@ -43,3 +41,3 @@ cellElem = makeCellElem(); | ||
checkCellElem( cellElem, lastIndex, 'appended' ); | ||
equal( flkty.selectedIndex, 1, 'selectedIndex same after prepend' ); | ||
assert.equal( flkty.selectedIndex, 1, 'selectedIndex same after prepend' ); | ||
// insert single cell element | ||
@@ -50,5 +48,5 @@ cellElem = makeCellElem(); // this one gets removed first | ||
checkCellElem( cellElem, 2, 'single inserted' ); | ||
equal( flkty.selectedIndex, 3, 'selectedIndex +1 after insert before' ); | ||
assert.equal( flkty.selectedIndex, 3, 'selectedIndex +1 after insert before' ); | ||
flkty.insert( makeCellElem(), 4 ); | ||
equal( flkty.selectedIndex, 3, 'selectedIndex same after insert before' ); | ||
assert.equal( flkty.selectedIndex, 3, 'selectedIndex same after insert before' ); | ||
// insert multiple cell elements | ||
@@ -60,3 +58,3 @@ var cellElems = [ makeCellElem(), makeCellElem(), makeCellElem() ]; | ||
checkCellElem( cellElems[2], 5, 'third multiple inserted' ); | ||
equal( flkty.selectedIndex, 6, 'selectedIndex +6 after 3 insert before' ); | ||
assert.equal( flkty.selectedIndex, 6, 'selectedIndex +6 after 3 insert before' ); | ||
@@ -68,7 +66,7 @@ function checkCellPositions() { | ||
if ( !isPositionApprox( cell.element.style.left, i * 25 ) ) { | ||
ok( false, 'gap in cell position ' + i + ' after removal' ); | ||
assert.ok( false, 'gap in cell position ' + i + ' after removal' ); | ||
isGap = true; | ||
} | ||
} | ||
ok( !isGap, 'no gaps in cell positions' ); | ||
assert.ok( !isGap, 'no gaps in cell positions' ); | ||
} | ||
@@ -79,5 +77,5 @@ | ||
flkty.remove( cellElem ); | ||
equal( len - sliderElem.children.length, 1, 'element removed from DOM' ); | ||
equal( len - flkty.cells.length, 1, 'cell removed' ); | ||
equal( flkty.selectedIndex, 5, 'selectedIndex -1 after remove before' ); | ||
assert.equal( len - sliderElem.children.length, 1, 'element removed from DOM' ); | ||
assert.equal( len - flkty.cells.length, 1, 'cell removed' ); | ||
assert.equal( flkty.selectedIndex, 5, 'selectedIndex -1 after remove before' ); | ||
checkCellPositions(); | ||
@@ -88,5 +86,5 @@ // remove multiple | ||
flkty.remove([ cellElems[2], cellElems[0], cellElems[1] ]); | ||
equal( len - sliderElem.children.length, 3, 'elements removed from DOM' ); | ||
equal( len - flkty.cells.length, 3, 'cells removed' ); | ||
equal( flkty.selectedIndex, 2, 'selectedIndex -2 after 2 removed before' ); | ||
assert.equal( len - sliderElem.children.length, 3, 'elements removed from DOM' ); | ||
assert.equal( len - flkty.cells.length, 3, 'cells removed' ); | ||
assert.equal( flkty.selectedIndex, 2, 'selectedIndex -2 after 2 removed before' ); | ||
checkCellPositions(); | ||
@@ -96,7 +94,6 @@ | ||
flkty.remove( flkty.getCellElements() ); | ||
equal( flkty.cells.length, 0, 'all cells removed' ); | ||
assert.equal( flkty.cells.length, 0, 'all cells removed' ); | ||
flkty.resize(); | ||
ok( true, 'resize with zero items didnt freak out' ); | ||
assert.ok( true, 'resize with zero items didnt freak out' ); | ||
}); |
@@ -1,3 +0,2 @@ | ||
test( 'auto play', function( assert ) { | ||
QUnit.test( 'auto play', function( assert ) { | ||
'use strict'; | ||
@@ -12,5 +11,6 @@ | ||
var selectCount = 0; | ||
var testDelay = flkty.options.autoPlay + 100; | ||
var tests; | ||
function nextTest() { | ||
@@ -25,3 +25,3 @@ if ( tests.length ) { | ||
} | ||
tests = [ | ||
@@ -33,11 +33,11 @@ // check that player runs | ||
if ( selectCount < 5 ) { | ||
equal( flkty.selectedIndex, selectCount % flkty.cells.length, | ||
assert.equal( flkty.selectedIndex, selectCount % flkty.cells.length, | ||
'auto-played to ' + flkty.selectedIndex ); | ||
} else if ( selectCount == 5 ) { | ||
// HACK do async, should be able to stop after a tick | ||
flkty.off( 'cellSelect', onSelect ); | ||
flkty.off( 'select', onSelect ); | ||
nextTest(); | ||
} | ||
}; | ||
flkty.on( 'cellSelect', onSelect ); | ||
flkty.on( 'select', onSelect ); | ||
}, | ||
@@ -47,16 +47,29 @@ // pause & unpause | ||
function onPauseSelect() { | ||
ok( false, 'player ticked during pause' ); | ||
assert.ok( false, 'player ticked during pause' ); | ||
} | ||
flkty.on( 'cellSelect', onPauseSelect ); | ||
flkty.on( 'select', onPauseSelect ); | ||
flkty.pausePlayer(); | ||
setTimeout( function() { | ||
ok( true, 'player did not tick during pause' ); | ||
flkty.off( 'cellSelect', onPauseSelect ); | ||
flkty.once( 'cellSelect', function() { | ||
ok( true, 'player resumed after unpausing' ); | ||
assert.ok( true, 'player did not tick during pause' ); | ||
flkty.off( 'select', onPauseSelect ); | ||
flkty.once( 'select', function() { | ||
assert.ok( true, 'player resumed after unpausing' ); | ||
nextTest(); | ||
}); | ||
flkty.unpausePlayer(); | ||
}, flkty.options.autoPlay + 100 ); | ||
}, testDelay ); | ||
}, | ||
// stopPlayer | ||
function() { | ||
var ticks = 0; | ||
function onSelect() { | ||
ticks++; | ||
} | ||
flkty.stopPlayer(); | ||
setTimeout( function() { | ||
flkty.off( 'select', onSelect ); | ||
assert.equal( ticks, 0, 'no ticks after stopped' ); | ||
nextTest(); | ||
}, testDelay * 2 ); | ||
}, | ||
// double playPlayer() | ||
@@ -69,11 +82,11 @@ function() { | ||
flkty.stopPlayer(); | ||
flkty.on( 'cellSelect', onSelect ); | ||
flkty.on( 'select', onSelect ); | ||
flkty.playPlayer(); | ||
flkty.playPlayer(); | ||
setTimeout( function() { | ||
flkty.off( 'cellSelect', onSelect ); | ||
equal( ticks, 1, 'only one tick after double playPlayer' ); | ||
flkty.off( 'select', onSelect ); | ||
assert.equal( ticks, 1, 'only one tick after double playPlayer' ); | ||
nextTest(); | ||
}, flkty.options.autoPlay + 100 ); | ||
} | ||
}, testDelay ); | ||
}, | ||
]; | ||
@@ -80,0 +93,0 @@ |
@@ -1,2 +0,2 @@ | ||
test( 'cellSelector', function() { | ||
QUnit.test( 'cellSelector', function( assert ) { | ||
'use strict'; | ||
@@ -22,12 +22,12 @@ | ||
var queriedCellElems = elem.querySelectorAll( flkty.options.cellSelector ); | ||
equal( cellElems.length, flkty.cells.length, 'getCellElements returns corrent number of elements' ); | ||
assert.equal( cellElems.length, flkty.cells.length, 'getCellElements returns corrent number of elements' ); | ||
for( i=0, len = cellElems.length; i < len; i++ ) { | ||
equal( cellElems[i], queriedCellElems[i], 'cell element same as queried cell element' ); | ||
assert.equal( cellElems[i], queriedCellElems[i], 'cell element same as queried cell element' ); | ||
} | ||
ok( cellsMatchSelector, 'all cell elements match cellSelector' ); | ||
assert.ok( cellsMatchSelector, 'all cell elements match cellSelector' ); | ||
equal( notCell1.parentNode, elem, 'notCell1 parent node is still gallery' ); | ||
equal( notCell2.parentNode, elem, 'notCell2 parent node is still gallery' ); | ||
assert.equal( notCell1.parentNode, elem, 'notCell1 parent node is still gallery' ); | ||
assert.equal( notCell2.parentNode, elem, 'notCell2 parent node is still gallery' ); | ||
}); |
@@ -1,2 +0,2 @@ | ||
test( 'contain', function() { | ||
QUnit.test( 'contain', function( assert ) { | ||
@@ -9,14 +9,14 @@ 'use strict'; | ||
equal( Math.round( flkty.x + flkty.cursorPosition ), 0, 'selected at 0, position left edge' ); | ||
assert.equal( Math.round( flkty.x + flkty.cursorPosition ), 0, 'selected at 0, position left edge' ); | ||
flkty.select( 1 ); | ||
flkty.positionSliderAtSelected(); | ||
equal( Math.round( flkty.x + flkty.cursorPosition ), 0, 'selected at 1, position left edge' ); | ||
assert.equal( Math.round( flkty.x + flkty.cursorPosition ), 0, 'selected at 1, position left edge' ); | ||
flkty.select( 4 ); | ||
flkty.positionSliderAtSelected(); | ||
var endLimit = flkty.slideableWidth - flkty.size.innerWidth * ( 1 - flkty.cellAlign ); | ||
equal( Math.round( -endLimit ), Math.round( flkty.x ), 'selected at 4, position right edge' ); | ||
assert.equal( Math.round( -endLimit ), Math.round( flkty.x ), 'selected at 4, position right edge' ); | ||
flkty.select( 5 ); | ||
flkty.positionSliderAtSelected(); | ||
equal( Math.round( -endLimit ), Math.round( flkty.x ), 'selected at 5, position right edge' ); | ||
assert.equal( Math.round( -endLimit ), Math.round( flkty.x ), 'selected at 5, position right edge' ); | ||
}); |
@@ -1,2 +0,2 @@ | ||
test( 'destroy', function( assert ) { | ||
QUnit.test( 'destroy', function( assert ) { | ||
@@ -12,11 +12,11 @@ 'use strict'; | ||
flkty.destroy(); | ||
strictEqual( elem.flickityGUID, undefined, 'flickityGUID removed' ); | ||
ok( !flkty.isActive, 'not active' ); | ||
ok( !Flickity.data( elem ), '.data() returns falsey' ); | ||
ok( elem.children[0], '.cell', 'cell is back as first child' ); | ||
ok( !matchesSelector( elem, '.flickity-enabled'), 'flickity-enabled class removed' ); | ||
ok( !elem.querySelector('.flickity-prev-next-button'), 'no buttons' ); | ||
ok( !elem.querySelector('.flickity-page-dots'), 'no page dots' ); | ||
ok( !elem.style.height, 'no height set' ); | ||
ok( !elem.children[0].style.left, 'first cell has no left position' ); | ||
assert.strictEqual( elem.flickityGUID, undefined, 'flickityGUID removed' ); | ||
assert.ok( !flkty.isActive, 'not active' ); | ||
assert.ok( !Flickity.data( elem ), '.data() returns falsey' ); | ||
assert.ok( elem.children[0], '.cell', 'cell is back as first child' ); | ||
assert.ok( !matchesSelector( elem, '.flickity-enabled'), 'flickity-enabled class removed' ); | ||
assert.ok( !elem.querySelector('.flickity-prev-next-button'), 'no buttons' ); | ||
assert.ok( !elem.querySelector('.flickity-page-dots'), 'no page dots' ); | ||
assert.ok( !elem.style.height, 'no height set' ); | ||
assert.ok( !elem.children[0].style.left, 'first cell has no left position' ); | ||
@@ -23,0 +23,0 @@ done(); |
@@ -65,7 +65,7 @@ ( function() { | ||
var flkty = args.flickity; | ||
var msgCell = 'cell[' + args.index + ']'; | ||
var msgCell = 'slide[' + args.index + ']'; | ||
return function fakeDragTest() { | ||
var selectMsg = ( args.message ? args.message + '. ' : '' ) + 'selected ' + msgCell; | ||
flkty.once( 'cellSelect', function() { | ||
flkty.once( 'select', function() { | ||
assert.equal( flkty.selectedIndex, args.index, selectMsg ); | ||
@@ -75,6 +75,6 @@ }); | ||
var settleMsg = ( args.message ? args.message + '. ' : '' ) + 'settled ' + msgCell; | ||
var target = flkty.cells[ args.index ].target; | ||
var target = flkty.slides[ args.index ].target; | ||
flkty.once( 'settle', function() { | ||
assert.equal( Math.round( -flkty.x ), Math.round( target ), settleMsg ); | ||
args.callback(); | ||
setTimeout( args.callback ); | ||
}); | ||
@@ -88,3 +88,3 @@ | ||
test( 'drag', function( assert ) { | ||
QUnit.test( 'drag', function( assert ) { | ||
// async test | ||
@@ -125,5 +125,5 @@ var done = assert.async(); | ||
flkty.once( 'staticClick', function() { | ||
ok( true, 'staticClick fired on non-drag'); | ||
equal( flkty.selectedIndex, 2, 'selected index still at 2 after click' ); | ||
doNextDragTest(); | ||
assert.ok( true, 'staticClick fired on non-drag'); | ||
assert.equal( flkty.selectedIndex, 2, 'selected index still at 2 after click' ); | ||
setTimeout( doNextDragTest ); | ||
}); | ||
@@ -135,4 +135,4 @@ fakeDrag( flkty, [ 0, 1, 0, -2, -1 ] ); | ||
flkty.once( 'settle', function() { | ||
equal( flkty.selectedIndex, 2, 'move out then back. same cell' ); | ||
doNextDragTest(); | ||
assert.equal( flkty.selectedIndex, 2, 'move out then back. same cell' ); | ||
setTimeout( doNextDragTest ); | ||
}); | ||
@@ -152,3 +152,3 @@ fakeDrag( flkty, [ 0, 10, 20, 30, 20 ] ); | ||
test( 'drag with wrapAround', function( assert ) { | ||
QUnit.test( 'drag with wrapAround', function( assert ) { | ||
// async test | ||
@@ -155,0 +155,0 @@ var done = assert.async(); |
@@ -1,2 +0,2 @@ | ||
test('empty', function() { | ||
QUnit.test( 'empty', function( assert ) { | ||
'use strict'; | ||
@@ -8,9 +8,9 @@ | ||
ok( true, 'empty gallery ok' ); | ||
ok( flkty.prevButton.element.disabled, 'previous button disabled' ); | ||
ok( flkty.nextButton.element.disabled, 'next button disabled' ); | ||
equal( flkty.pageDots.dots.length, 0, '0 page dots'); | ||
assert.ok( true, 'empty gallery ok' ); | ||
assert.ok( flkty.prevButton.element.disabled, 'previous button disabled' ); | ||
assert.ok( flkty.nextButton.element.disabled, 'next button disabled' ); | ||
assert.equal( flkty.pageDots.dots.length, 0, '0 page dots'); | ||
flkty.resize(); | ||
ok( true, 'resize with empty gallery ok'); | ||
assert.ok( true, 'resize with empty gallery ok'); | ||
@@ -24,8 +24,8 @@ function makeCellElem() { | ||
flkty.append( makeCellElem() ); | ||
equal( flkty.cells.length, 1, 'added cell to empty gallery' ); | ||
assert.equal( flkty.cells.length, 1, 'added cell to empty gallery' ); | ||
ok( flkty.prevButton.element.disabled, 'previous button disabled' ); | ||
ok( flkty.nextButton.element.disabled, 'next button disabled' ); | ||
equal( flkty.pageDots.dots.length, 1, '1 page dots'); | ||
assert.ok( flkty.prevButton.element.disabled, 'previous button disabled' ); | ||
assert.ok( flkty.nextButton.element.disabled, 'next button disabled' ); | ||
assert.equal( flkty.pageDots.dots.length, 1, '1 page dots'); | ||
@@ -39,4 +39,4 @@ // destroy and re-init with higher initialIndex | ||
// #291 | ||
ok( true, 'initializing with initialIndex > cells doesnt throw error' ); | ||
assert.ok( true, 'initializing with initialIndex > cells doesnt throw error' ); | ||
}); |
@@ -1,6 +0,4 @@ | ||
test( 'getParentCell', function() { | ||
QUnit.test( 'getParentCell', function( assert ) { | ||
'use strict'; | ||
var utils = window.fizzyUIUtils; | ||
var gallery = document.querySelector('#get-parent-cell'); | ||
@@ -11,30 +9,30 @@ var flkty = new Flickity( gallery ); | ||
var cell = flkty.getParentCell( gallery.querySelector('.cell1') ); | ||
ok( cell, 'getParentCell( cell ) ok' ); | ||
ok( cell instanceof Flickity.Cell, 'cell is Flickity.Cell' ); | ||
var index = utils.indexOf( flkty.cells, cell ); | ||
equal( index, 0, 'cell is index 0' ); | ||
assert.ok( cell, 'getParentCell( cell ) ok' ); | ||
assert.ok( cell instanceof Flickity.Cell, 'cell is Flickity.Cell' ); | ||
var index = flkty.cells.indexOf( cell ); | ||
assert.equal( index, 0, 'cell is index 0' ); | ||
// cell3 | ||
cell = flkty.getParentCell( gallery.querySelector('.cell3') ); | ||
ok( cell, 'getParentCell( cell ) ok' ); | ||
ok( cell instanceof Flickity.Cell, 'cell is Flickity.Cell' ); | ||
index = utils.indexOf( flkty.cells, cell ); | ||
equal( index, 2, 'cell is index 2' ); | ||
assert.ok( cell, 'getParentCell( cell ) ok' ); | ||
assert.ok( cell instanceof Flickity.Cell, 'cell is Flickity.Cell' ); | ||
index = flkty.cells.indexOf( cell ); | ||
assert.equal( index, 2, 'cell is index 2' ); | ||
// child1 | ||
cell = flkty.getParentCell( gallery.querySelector('.child1') ); | ||
ok( cell, 'getParentCell( cell ) ok' ); | ||
ok( cell instanceof Flickity.Cell, 'cell is Flickity.Cell' ); | ||
index = utils.indexOf( flkty.cells, cell ); | ||
equal( index, 0, 'cell is index 0' ); | ||
assert.ok( cell, 'getParentCell( cell ) ok' ); | ||
assert.ok( cell instanceof Flickity.Cell, 'cell is Flickity.Cell' ); | ||
index = flkty.cells.indexOf( cell ); | ||
assert.equal( index, 0, 'cell is index 0' ); | ||
// child2 | ||
cell = flkty.getParentCell( gallery.querySelector('.child2') ); | ||
ok( cell, 'getParentCell( cell ) ok' ); | ||
ok( cell instanceof Flickity.Cell, 'cell is Flickity.Cell' ); | ||
index = utils.indexOf( flkty.cells, cell ); | ||
equal( index, 1, 'cell is index 1' ); | ||
assert.ok( cell, 'getParentCell( cell ) ok' ); | ||
assert.ok( cell instanceof Flickity.Cell, 'cell is Flickity.Cell' ); | ||
index = flkty.cells.indexOf( cell ); | ||
assert.equal( index, 1, 'cell is index 1' ); | ||
// outside | ||
cell = flkty.getParentCell( document.querySelector('.outside') ); | ||
ok( !cell, 'getParentCell( notCell ) not ok' ); | ||
index = utils.indexOf( flkty.cells, cell ); | ||
equal( index, -1, 'not cell is index -1' ); | ||
assert.ok( !cell, 'getParentCell( notCell ) not ok' ); | ||
index = flkty.cells.indexOf( cell ); | ||
assert.equal( index, -1, 'not cell is index -1' ); | ||
}); |
@@ -1,6 +0,4 @@ | ||
test( 'getWrapCells', function() { | ||
QUnit.test( 'getWrapCells', function( assert ) { | ||
'use strict'; | ||
var flkty = new Flickity( '#get-wrap-cells', { | ||
@@ -11,4 +9,4 @@ wrapAround: true | ||
// center align, 2 cells on each side | ||
equal( flkty.beforeShiftCells.length, 2, 'center align, 2 before shift cells' ); | ||
equal( flkty.afterShiftCells.length, 2, 'center align, 2 after shift cells' ); | ||
assert.equal( flkty.beforeShiftCells.length, 2, 'center align, 2 before shift cells' ); | ||
assert.equal( flkty.afterShiftCells.length, 2, 'center align, 2 after shift cells' ); | ||
@@ -18,4 +16,4 @@ flkty.options.cellAlign = 'left'; | ||
// left align, 0, 4 | ||
equal( flkty.beforeShiftCells.length, 0, 'left align, 1 before shift cells' ); | ||
equal( flkty.afterShiftCells.length, 4, 'left align, 4 after shift cells' ); | ||
assert.equal( flkty.beforeShiftCells.length, 0, 'left align, 1 before shift cells' ); | ||
assert.equal( flkty.afterShiftCells.length, 4, 'left align, 4 after shift cells' ); | ||
@@ -25,5 +23,5 @@ flkty.options.cellAlign = 'right'; | ||
// right align, 4, 0 | ||
equal( flkty.beforeShiftCells.length, 4, 'right align, 4 before shift cells' ); | ||
equal( flkty.afterShiftCells.length, 0, 'right align, 0 after shift cells' ); | ||
assert.equal( flkty.beforeShiftCells.length, 4, 'right align, 4 before shift cells' ); | ||
assert.equal( flkty.afterShiftCells.length, 0, 'right align, 0 after shift cells' ); | ||
}); |
@@ -5,7 +5,7 @@ ( function() { | ||
module('Flickity'); | ||
QUnit.module('Flickity'); | ||
var utils = window.fizzyUIUtils; | ||
test( 'init', function() { | ||
QUnit.test( 'init', function( assert ) { | ||
@@ -16,21 +16,21 @@ var elem = document.querySelector('#init'); | ||
for ( var prop in Flickity.defaults ) { | ||
equal( flkty.options[ prop ], Flickity.defaults[ prop ], prop + ' option matches default' ); | ||
assert.equal( flkty.options[ prop ], Flickity.defaults[ prop ], prop + ' option matches default' ); | ||
} | ||
equal( flkty.element, elem, '.element is proper element' ); | ||
assert.equal( flkty.element, elem, '.element is proper element' ); | ||
var children = utils.makeArray( flkty.element.children ); | ||
notEqual( utils.indexOf( children, flkty.viewport ), -1, 'viewport element is a child element' ); | ||
equal( flkty.viewport.children[0], flkty.slider, 'slider is in viewport' ); | ||
equal( flkty.viewport.style.height, '100px', 'viewport height set' ); | ||
assert.notEqual( children.indexOf( flkty.viewport ), -1, 'viewport element is a child element' ); | ||
assert.equal( flkty.viewport.children[0], flkty.slider, 'slider is in viewport' ); | ||
assert.equal( flkty.viewport.style.height, '100px', 'viewport height set' ); | ||
ok( flkty.isActive, 'isActive' ); | ||
ok( matchesSelector( elem, '.flickity-enabled' ), 'flickity-enabled class added' ); | ||
assert.ok( flkty.isActive, 'isActive' ); | ||
assert.ok( matchesSelector( elem, '.flickity-enabled' ), 'flickity-enabled class added' ); | ||
equal( flkty.cells.length, 6, 'has 6 cells' ); | ||
equal( flkty.cells[0].element.style.left, '0%', 'first cell left: 0%' ); | ||
equal( flkty.cells[5].element.style.left, '500%', '6th cell left: 500%' ); | ||
assert.equal( flkty.cells.length, 6, 'has 6 cells' ); | ||
assert.equal( flkty.cells[0].element.style.left, '0%', 'first cell left: 0%' ); | ||
assert.equal( flkty.cells[5].element.style.left, '500%', '6th cell left: 500%' ); | ||
equal( flkty.selectedIndex, 0, 'selectedIndex = 0' ); | ||
equal( flkty.cursorPosition, 200, 'cursorPosition = 200' ); | ||
equal( flkty.x + flkty.cursorPosition, 0, 'x + cursorPosition = 0' ); | ||
assert.equal( flkty.selectedIndex, 0, 'selectedIndex = 0' ); | ||
assert.equal( flkty.cursorPosition, 200, 'cursorPosition = 200' ); | ||
assert.equal( flkty.x + flkty.cursorPosition, 0, 'x + cursorPosition = 0' ); | ||
@@ -37,0 +37,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
test( 'lazyload', function( assert ) { | ||
QUnit.test( 'lazyload', function( assert ) { | ||
'use strict'; | ||
@@ -15,5 +15,5 @@ | ||
equal( event.type, 'load', 'event.type == load' ); | ||
ok( event.target.complete, 'img ' + loadCount + ' is complete' ); | ||
ok( cellElem, 'cellElement argument there' ); | ||
assert.equal( event.type, 'load', 'event.type == load' ); | ||
assert.ok( event.target.complete, 'img ' + loadCount + ' is complete' ); | ||
assert.ok( cellElem, 'cellElement argument there' ); | ||
@@ -26,3 +26,3 @@ // after first 2 have loaded, select 7th cell | ||
var loadedImgs = gallery.querySelectorAll('.flickity-lazyloaded'); | ||
equal( loadedImgs.length, '5', 'only 5 images loaded' ); | ||
assert.equal( loadedImgs.length, '5', 'only 5 images loaded' ); | ||
done(); | ||
@@ -29,0 +29,0 @@ } |
@@ -1,3 +0,2 @@ | ||
test( 'pageDots', function() { | ||
QUnit.test( 'pageDots', function( assert ) { | ||
'use strict'; | ||
@@ -11,5 +10,5 @@ | ||
ok( dotsHolder, 'dots holder in DOM' ); | ||
equal( flkty.pageDots.holder, dotsHolder, 'dots holder element matches flkty.pageDots.holder' ); | ||
equal( dotsElems.length, flkty.cells.length, 'number of dots matches number of cells' ); | ||
assert.ok( dotsHolder, 'dots holder in DOM' ); | ||
assert.equal( flkty.pageDots.holder, dotsHolder, 'dots holder element matches flkty.pageDots.holder' ); | ||
assert.equal( dotsElems.length, flkty.cells.length, 'number of dots matches number of cells' ); | ||
@@ -27,10 +26,10 @@ function getSelectedDotIndex() { | ||
equal( getSelectedDotIndex(), 0, 'first dot is selected' ); | ||
assert.equal( getSelectedDotIndex(), 0, 'first dot is selected' ); | ||
flkty.select( 2 ); | ||
equal( getSelectedDotIndex(), 2, '3rd dot is selected' ); | ||
assert.equal( getSelectedDotIndex(), 2, '3rd dot is selected' ); | ||
// fake tap | ||
flkty.pageDots.onTap( { target: dotsElems[4] } ); | ||
equal( flkty.selectedIndex, 4, 'tap dot selects cell' ); | ||
assert.equal( flkty.selectedIndex, 4, 'tap dot selects cell' ); | ||
}); |
@@ -30,20 +30,20 @@ ( function() { | ||
test( 'position cells', function() { | ||
QUnit.test( 'position cells', function( assert ) { | ||
var flkty = new Flickity('#position-cells'); | ||
ok( checkCellPositions( flkty, [ 0, 40, 65, 125, 165, 225 ] ), 'percent cell position' ); | ||
assert.ok( checkCellPositions( flkty, [ 0, 40, 65, 125, 165, 225 ] ), 'percent cell position' ); | ||
// .cell { margin: 0 2%; } | ||
classie.add( flkty.element, 'percent-margin' ); | ||
flkty.element.classList.add('percent-margin'); | ||
flkty.positionCells(); | ||
ok( checkCellPositions( flkty, [ 0, 44, 73, 137, 181, 245 ] ), 'percent cell position with margin' ); | ||
classie.remove( flkty.element, 'percent-margin' ); | ||
assert.ok( checkCellPositions( flkty, [ 0, 44, 73, 137, 181, 245 ] ), 'percent cell position with margin' ); | ||
flkty.element.classList.remove('percent-margin'); | ||
// pixel-based position | ||
flkty.options.percentPosition = false; | ||
flkty.positionCells(); | ||
ok( checkCellPositions( flkty, [ 0, 160, 260, 500, 660, 900 ] ), 'pixel cell position' ); | ||
assert.ok( checkCellPositions( flkty, [ 0, 160, 260, 500, 660, 900 ] ), 'pixel cell position' ); | ||
// pixel margin, { margin: 0 10px; } | ||
classie.add( flkty.element, 'pixel-margin' ); | ||
flkty.element.classList.add('pixel-margin'); | ||
flkty.positionCells(); | ||
ok( checkCellPositions( flkty, [ 0, 180, 300, 560, 740, 1000 ] ), 'pixel cell position with margin' ); | ||
assert.ok( checkCellPositions( flkty, [ 0, 180, 300, 560, 740, 1000 ] ), 'pixel cell position with margin' ); | ||
@@ -50,0 +50,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
test( 'prev-next-buttons', function() { | ||
QUnit.test( 'prev-next-buttons', function( assert ) { | ||
'use strict'; | ||
@@ -9,25 +9,20 @@ | ||
var nextElem = elem.querySelector('.flickity-prev-next-button.next'); | ||
ok( prevElem, 'previous button in DOM' ); | ||
ok( nextElem, 'next button in DOM' ); | ||
equal( flkty.prevButton.element, prevElem, 'previous button element matches prevButton.element' ); | ||
equal( flkty.nextButton.element, nextElem, 'next button element matches nextButton.element' ); | ||
ok( prevElem.disabled, 'previous button is disabled at first index' ); | ||
assert.ok( prevElem, 'previous button in DOM' ); | ||
assert.ok( nextElem, 'next button in DOM' ); | ||
assert.equal( flkty.prevButton.element, prevElem, 'previous button element matches prevButton.element' ); | ||
assert.equal( flkty.nextButton.element, nextElem, 'next button element matches nextButton.element' ); | ||
assert.ok( prevElem.disabled, 'previous button is disabled at first index' ); | ||
var isIE8 = 'attachEvent' in window; | ||
// cannot focus disabled button in IE8 | ||
if ( isIE8 ) { | ||
prevElem.disabled = false; | ||
} | ||
prevElem.focus(); | ||
prevElem.click(); | ||
equal( flkty.selectedIndex, 0, 'selectedIndex still at 0' ); | ||
assert.equal( flkty.selectedIndex, 0, 'selectedIndex still at 0' ); | ||
nextElem.focus(); | ||
nextElem.click(); | ||
equal( flkty.selectedIndex, 1, 'next button clicked, selectedIndex at 1' ); | ||
assert.equal( flkty.selectedIndex, 1, 'next button clicked, selectedIndex at 1' ); | ||
prevElem.focus(); | ||
prevElem.click(); | ||
equal( flkty.selectedIndex, 0, 'previous button clicked, selectedIndex back at 0' ); | ||
assert.equal( flkty.selectedIndex, 0, 'previous button clicked, selectedIndex back at 0' ); | ||
flkty.select( 5 ); | ||
ok( nextElem.disabled, 'next button disabled when at last cell' ); | ||
assert.ok( nextElem.disabled, 'next button disabled when at last cell' ); | ||
}); |
@@ -1,2 +0,2 @@ | ||
test( 'resize', function() { | ||
QUnit.test( 'resize', function( assert ) { | ||
@@ -12,6 +12,6 @@ 'use strict'; | ||
equal( flkty.selectedIndex, 2, 'selectedIndex = 2' ); | ||
equal( flkty.cursorPosition, 250, 'cursorPosition = 250' ); | ||
equal( flkty.x + flkty.cursorPosition, -1000, 'x + cursorPosition = -1000' ); | ||
assert.equal( flkty.selectedIndex, 2, 'selectedIndex = 2' ); | ||
assert.equal( flkty.cursorPosition, 250, 'cursorPosition = 250' ); | ||
assert.equal( flkty.x + flkty.cursorPosition, -1000, 'x + cursorPosition = -1000' ); | ||
}); |
@@ -1,38 +0,10 @@ | ||
docReady( function() { | ||
QUnit.test( 'watch fallback', function( assert ) { | ||
'use strict'; | ||
if ( Flickity.supportsConditionalCSS() ) { | ||
var elem = document.querySelector('#watch'); | ||
var flkty = new Flickity( elem, { | ||
watchCSS: true | ||
}); | ||
test( 'watch', function() { | ||
var elem = document.querySelector('#watch'); | ||
var flkty = new Flickity( elem, { | ||
watchCSS: true | ||
}); | ||
ok( !flkty.isActive, 'not active without :after' ); | ||
// add :after via CSS class | ||
classie.add( elem, 'has-after' ); | ||
flkty.watchCSS(); | ||
ok( flkty.isActive, 'active with :after' ); | ||
}); | ||
} else { | ||
test( 'watch fallback', function() { | ||
var elem = document.querySelector('#watch'); | ||
var flkty = new Flickity( elem, { | ||
watchCSS: true | ||
}); | ||
ok( !flkty.isActive, 'fallback not active, watchCSS: true' ); | ||
flkty.options.watchCSS = 'fallbackOn'; | ||
flkty.watchCSS(); | ||
ok( flkty.isActive, 'active with watchCSS: "fallbackOn" '); | ||
}); | ||
} | ||
assert.ok( !flkty.isActive, 'fallback not active, watchCSS: true' ); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
650558
6
14
84
154
7483
+ Addedev-emitter@^1.0.2
+ Addeddesandro-matches-selector@2.0.2(transitive)
+ Addedev-emitter@1.1.1(transitive)
+ Addedfizzy-ui-utils@2.0.7(transitive)
+ Addedget-size@2.0.3(transitive)
+ Addedtap-listener@2.0.0(transitive)
+ Addedunidragger@2.4.0(transitive)
+ Addedunipointer@2.4.0(transitive)
- Removeddesandro-classie@~1.0.1
- Removeddesandro-get-style-property@~1.0.4
- Removeddoc-ready@~1.0.3
- Removedeventie@~1.0.6
- Removedwolfy87-eventemitter@~4.2.11
- Removeddesandro-classie@1.0.1(transitive)
- Removeddesandro-get-style-property@1.0.4(transitive)
- Removeddesandro-matches-selector@1.0.3(transitive)
- Removeddoc-ready@1.0.4(transitive)
- Removedeventie@1.0.6(transitive)
- Removedfizzy-ui-utils@1.0.1(transitive)
- Removedget-size@1.2.2(transitive)
- Removedtap-listener@1.1.2(transitive)
- Removedunidragger@1.1.5(transitive)
- Removedunipointer@1.1.0(transitive)
- Removedwolfy87-eventemitter@4.2.11(transitive)
Updatedfizzy-ui-utils@^2.0.0
Updatedget-size@^2.0.0
Updatedtap-listener@^2.0.0
Updatedunidragger@^2.1.0