From 32ff8afa883e4edd3a1eb0e8edd5209930630104 Mon Sep 17 00:00:00 2001 From: Antonio Laguna Date: Mon, 27 Feb 2017 20:10:26 +0100 Subject: [PATCH] Disting --- static/js/webslides.js | 197 +++++++++++++++++++++++++++++-------- static/js/webslides.min.js | 2 +- 2 files changed, 159 insertions(+), 40 deletions(-) diff --git a/static/js/webslides.js b/static/js/webslides.js index 91b1062..6be1c82 100644 --- a/static/js/webslides.js +++ b/static/js/webslides.js @@ -63,7 +63,7 @@ /******/ __webpack_require__.p = "/static/js/"; /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 15); +/******/ return __webpack_require__(__webpack_require__.s = 16); /******/ }) /************************************************************************/ /******/ ([ @@ -71,7 +71,7 @@ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__custom_event__ = __webpack_require__(12); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__custom_event__ = __webpack_require__(13); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -294,10 +294,10 @@ var MobileDetector = function () { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__plugins_plugins__ = __webpack_require__(9); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__plugins_plugins__ = __webpack_require__(10); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__slide__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_dom__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__ = __webpack_require__(14); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__ = __webpack_require__(15); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -313,6 +313,7 @@ var CLASSES = { // Default plugins var PLUGINS = { + 'clickNav': __WEBPACK_IMPORTED_MODULE_0__plugins_plugins__["a" /* default */].ClickNav, 'grid': __WEBPACK_IMPORTED_MODULE_0__plugins_plugins__["a" /* default */].Grid, 'hash': __WEBPACK_IMPORTED_MODULE_0__plugins_plugins__["a" /* default */].Hash, 'keyboard': __WEBPACK_IMPORTED_MODULE_0__plugins_plugins__["a" /* default */].Keyboard, @@ -325,12 +326,15 @@ var WebSlides = function () { /** * Options for WebSlides * @param {number|boolean} autoslide Is false by default. If a number is - * provided, it will autoslide every given milliseconds. + * @param {boolean} changeOnClick Is false by default. If true, it will allow + * clicking on any place to change the slide. */ function WebSlides() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$autoslide = _ref.autoslide, - autoslide = _ref$autoslide === undefined ? false : _ref$autoslide; + autoslide = _ref$autoslide === undefined ? false : _ref$autoslide, + _ref$changeOnClick = _ref.changeOnClick, + changeOnClick = _ref$changeOnClick === undefined ? false : _ref$changeOnClick; _classCallCheck(this, WebSlides); @@ -390,6 +394,12 @@ var WebSlides = function () { * @private */ this.autoslide_ = autoslide; + /** + * Whether navigation should initiate on click or not. + * @type {boolean} + * @private + */ + this.changeOnClick_ = changeOnClick; if (!this.el) { throw new Error('Couldn\'t find the webslides container!'); @@ -846,6 +856,58 @@ var Slide = function () { /* 5 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CLICKABLE_ELS = ['INPUT', 'SELECT', 'BUTTON', 'A', 'TEXTAREA']; + +var ClickNav = function () { + /** + * ClickNav plugin that allows to click on the page to get to the next slide. + * @param {WebSlides} wsInstance The WebSlides instance + */ + function ClickNav(wsInstance) { + _classCallCheck(this, ClickNav); + + /** + * @type {WebSlides} + * @private + */ + this.ws_ = wsInstance; + + if (wsInstance.changeOnClick_) { + this.ws_.el.addEventListener('click', this.onClick_.bind(this)); + } + } + + /** + * Reacts to the click event. It will go to the next slide unless the element + * has a data-prevent-nav attribute or is on the list of CLICKABLE_ELS. + * @param {MouseEvent} event The click event. + * @private + */ + + + _createClass(ClickNav, [{ + key: 'onClick_', + value: function onClick_(event) { + if (CLICKABLE_ELS.indexOf(event.target.tagName) < 0 && typeof event.target.dataset.preventNav === 'undefined') { + this.ws_.goNext(); + } + } + }]); + + return ClickNav; +}(); + +/* harmony default export */ __webpack_exports__["a"] = ClickNav; + +/***/ }), +/* 6 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_keys__ = __webpack_require__(1); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -907,7 +969,7 @@ var Grid = function () { /* harmony default export */ __webpack_exports__["a"] = Grid; /***/ }), -/* 6 */ +/* 7 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1007,7 +1069,7 @@ var Hash = function () { /* harmony default export */ __webpack_exports__["a"] = Hash; /***/ }), -/* 7 */ +/* 8 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1078,7 +1140,7 @@ var Keyboard = function () { /* harmony default export */ __webpack_exports__["a"] = Keyboard; /***/ }), -/* 8 */ +/* 9 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1230,16 +1292,18 @@ var Navigation = function () { /* harmony default export */ __webpack_exports__["a"] = Navigation; /***/ }), -/* 9 */ +/* 10 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__grid__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hash__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keyboard__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__scroll__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__touch__ = __webpack_require__(11); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__click_nav__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__grid__ = __webpack_require__(6); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__hash__ = __webpack_require__(7); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__keyboard__ = __webpack_require__(8); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation__ = __webpack_require__(9); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__scroll__ = __webpack_require__(11); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__touch__ = __webpack_require__(12); + @@ -1248,16 +1312,17 @@ var Navigation = function () { /* harmony default export */ __webpack_exports__["a"] = { - Grid: __WEBPACK_IMPORTED_MODULE_0__grid__["a" /* default */], - Hash: __WEBPACK_IMPORTED_MODULE_1__hash__["a" /* default */], - Keyboard: __WEBPACK_IMPORTED_MODULE_2__keyboard__["a" /* default */], - Navigation: __WEBPACK_IMPORTED_MODULE_3__navigation__["a" /* default */], - Scroll: __WEBPACK_IMPORTED_MODULE_4__scroll__["a" /* default */], - Touch: __WEBPACK_IMPORTED_MODULE_5__touch__["a" /* default */] + ClickNav: __WEBPACK_IMPORTED_MODULE_0__click_nav__["a" /* default */], + Grid: __WEBPACK_IMPORTED_MODULE_1__grid__["a" /* default */], + Hash: __WEBPACK_IMPORTED_MODULE_2__hash__["a" /* default */], + Keyboard: __WEBPACK_IMPORTED_MODULE_3__keyboard__["a" /* default */], + Navigation: __WEBPACK_IMPORTED_MODULE_4__navigation__["a" /* default */], + Scroll: __WEBPACK_IMPORTED_MODULE_5__scroll__["a" /* default */], + Touch: __WEBPACK_IMPORTED_MODULE_6__touch__["a" /* default */] }; /***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1283,37 +1348,91 @@ var Scroll = function () { * @private */ this.ws_ = wsInstance; - + /** + * Where the scroll is going to happen. The WebSlides element. + * @type {Element} + * @private + */ this.scrollContainer_ = wsInstance.el; + /** + * Whether movement is happening up or down. + * @type {boolean} + * @private + */ this.isGoingUp_ = false; + /** + * Whether movement is happening left or right. + * @type {boolean} + * @private + */ + this.isGoingLeft_ = false; + /** + * Timeout id holder. + * @type {?number} + * @private + */ + this.timeout_ = null; - if (this.ws_.isVertical && !__WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__["a" /* default */].isAny()) { + if (!__WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__["a" /* default */].isAny()) { this.scrollContainer_.addEventListener('wheel', this.onMouseWheel_.bind(this)); + + if (!wsInstance.isVertical) { + wsInstance.el.addEventListener('ws:slide-change', this.onSlideChange_.bind(this)); + } } } /** - * Reacts to the wheel event. Detects whether is going up or down and decides - * if it needs to move the slide based on the amount of delta. - * @param {WheelEvent} event The Wheel Event. + * When the slides change, set an inner timeout to avoid prematurely + * changing to the next slide again. * @private */ _createClass(Scroll, [{ + key: 'onSlideChange_', + value: function onSlideChange_() { + var _this = this; + + this.timeout_ = setTimeout(function () { + _this.timeout_ = null; + }, 400); + } + + /** + * Reacts to the wheel event. Detects whether is going up or down and decides + * if it needs to move the slide based on the amount of delta. + * @param {WheelEvent} event The Wheel Event. + * @private + */ + + }, { key: 'onMouseWheel_', value: function onMouseWheel_(event) { - if (this.ws_.isMoving) { + if (this.ws_.isMoving || this.timeout_) { event.preventDefault(); return; } - var wheelDelta = event.deltaY; + var wheelDeltaY = event.deltaY, + wheelDeltaX = event.deltaX; - this.isGoingUp_ = wheelDelta < 0; + this.isGoingUp_ = wheelDeltaY < 0; + this.isGoingLeft_ = wheelDeltaX < 0; - if (Math.abs(wheelDelta) >= MIN_WHEEL_DELTA) { - if (this.isGoingUp_) { + // If we're mainly moving horizontally, prevent default + if (Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY)) { + if (!this.ws_.isVertical) { + event.preventDefault(); + } else { + // If we're moving horizontally but this is vertical, return to avoid + // unwanted navigation. + return; + } + } + + if (Math.abs(wheelDeltaY) >= MIN_WHEEL_DELTA || Math.abs(wheelDeltaX) >= MIN_WHEEL_DELTA) { + if (this.isGoingUp_ || this.isGoingLeft_) { this.ws_.goPrev(); } else { this.ws_.goNext(); @@ -1331,7 +1450,7 @@ var Scroll = function () { ; /***/ }), -/* 11 */ +/* 12 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1511,7 +1630,7 @@ var Touch = function () { ; /***/ }), -/* 12 */ +/* 13 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1554,7 +1673,7 @@ var WSCustomEvent = canIuseNativeCustom() ? NativeCustomEvent : IECustomEvent; /* harmony default export */ __webpack_exports__["a"] = WSCustomEvent; /***/ }), -/* 13 */ +/* 14 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1579,11 +1698,11 @@ function linear(p) { /* harmony default export */ __webpack_exports__["a"] = { swing: swing, linear: linear }; /***/ }), -/* 14 */ +/* 15 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__easing__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__easing__ = __webpack_require__(14); /* harmony export (immutable) */ __webpack_exports__["a"] = scrollTo; @@ -1630,7 +1749,7 @@ function scrollTo(y) { } /***/ }), -/* 15 */ +/* 16 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; diff --git a/static/js/webslides.min.js b/static/js/webslides.min.js index f089973..01e13bc 100644 --- a/static/js/webslides.min.js +++ b/static/js/webslides.min.js @@ -1 +1 @@ -!function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/static/js/",t(t.s=15)}([function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=n(12),o=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=document.createElement(e);return i.id=t,n&&(i.textContent=n),i}},{key:"hide",value:function(e){e.style.display="none"}},{key:"show",value:function(e){e.style.display=""}},{key:"fireEvent",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=new r.a(t,{detail:n});e.dispatchEvent(i)}},{key:"toArray",value:function(e){return[].slice.call(e)}}]),e}();t.a=a},function(e,t,n){"use strict";var i={ENTER:13,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40};t.a=i},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.autoslide,r=void 0!==n&&n;if(i(this,e),this.el=document.getElementById("webslides"),this.isMoving=!1,this.slides=null,this.currentSlideI_=-1,this.currentSlide_=null,this.maxSlide_=0,this.isVertical=this.el.classList.contains(l.VERTICAL),this.plugins={},this.interval_=null,this.autoslide_=r,!this.el)throw new Error("Couldn't find the webslides container!");this.removeChildren_(),this.grabSlides_(),this.createPlugins_(),this.initSlides_(),this.play(),this.onInit_()}return u(e,[{key:"removeChildren_",value:function(){for(var e=this.el.childNodes,t=e.length;t--;){var n=e[t];o.a.isCandidate(n)||this.el.removeChild(n)}}},{key:"createPlugins_",value:function(){var e=this;Object.keys(c).forEach(function(t){var n=c[t];e.plugins[t]=new n(e)})}},{key:"onInit_",value:function(){a.a.fireEvent(this.el,"ws:init")}},{key:"grabSlides_",value:function(){this.slides=a.a.toArray(this.el.childNodes).map(function(e,t){return new o.a(e,t)}),this.maxSlide_=this.slides.length}},{key:"goToSlide",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isValidIndexSlide_(e)&&!this.isMoving){this.isMoving=!0;var n=!1;null!==t?n=t:this.currentSlideI_>=0&&(n=e>this.currentSlideI_);var i=this.slides[e];null===this.currentSlide_||!this.isVertical||this.plugins.touch&&this.plugins.touch.isEnabled?this.transitionToSlide_(n,i,this.onSlideChange_):this.scrollTransitionToSlide_(n,i,this.onSlideChange_)}}},{key:"scrollTransitionToSlide_",value:function(e,t,i){var r=this;this.el.style.overflow="none",e?t.show():(t.moveBeforeFirst(),t.show(),n.i(s.a)(this.currentSlide_.el.offsetTop,0)),n.i(s.a)(t.el.offsetTop,500,function(){r.currentSlide_.hide(),e&&r.currentSlide_.moveAfterLast(),r.el.style.overflow="auto",setTimeout(function(){i.call(r,t)},150)})}},{key:"transitionToSlide_",value:function(e,t,i){n.i(s.a)(0,0),e||t.moveBeforeFirst(),this.currentSlide_&&(e&&this.currentSlide_.moveAfterLast(),this.currentSlide_.hide()),t.show(),i.call(this,t)}},{key:"onSlideChange_",value:function(e){this.currentSlide_=e,this.currentSlideI_=e.i,this.isMoving=!1,a.a.fireEvent(this.el,"ws:slide-change",{slides:this.maxSlide_,currentSlide0:this.currentSlideI_,currentSlide:this.currentSlideI_+1})}},{key:"goNext",value:function(){var e=this.currentSlideI_+1;e>=this.maxSlide_&&(e=0),this.goToSlide(e,!0)}},{key:"goPrev",value:function(){var e=this.currentSlideI_-1;e<0&&(e=this.maxSlide_-1),this.goToSlide(e,!1)}},{key:"isValidIndexSlide_",value:function(e){return e>=0&&e=this.maxSlide_)&&(e=0),0!==e)for(var t=0;t0&&(this.interval_=setInterval(this.goNext.bind(this),e))}},{key:"stop",value:function(){this.interval_&&(clearInterval(this.interval_),this.interval_=null)}}],[{key:"registerPlugin",value:function(e,t){c[e]=t}}]),e}();t.a=h},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=n(0),o=function(){function e(e,t){for(var n=0;n=a&&(this.isGoingUp_?this.ws_.goPrev():this.ws_.goNext(),e.preventDefault())}}]),e}();t.a=s},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=n(2),o=function(){function e(e,t){for(var n=0;nMath.abs(t)&&(e<-s?this.ws_.goPrev():e>s&&this.ws_.goNext())}}],[{key:"normalizeEventInfo",value:function(e){var t=void 0,n=void 0,i={pageX:0,pageY:0};return"undefined"!=typeof e.changedTouches?i=e.changedTouches[0]:"undefined"!=typeof e.originalEvent&&"undefined"!=typeof e.originalEvent.changedTouches&&(i=e.originalEvent.changedTouches[0]),t=e.offsetX||e.layerX||i.pageX,n=e.offsetY||e.layerY||i.pageY,{x:t,y:n}}}]),e}();t.a=u},function(e,t,n){"use strict";function i(){try{var e=new r("t",{detail:{a:"b"}});return"t"===e.type&&"b"===e.detail.a}catch(e){}return!1}var r=window.CustomEvent,o=function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n},a=i()?r:o;t.a=a},function(e,t,n){"use strict";function i(e){return.5-Math.cos(e*Math.PI)/2}function r(e){return e}t.a={swing:i,linear:r}},function(e,t,n){"use strict";function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=e-o.scrollTop,a=o.scrollTop,s=16;if(!t)return o.scrollTop=e,void n();var u=function u(l){l+=s;var c=Math.min(1,l/t),h=r.a.swing(c,l*c,e,i,t);o.scrollTop=Math.floor(a+h*i),l1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=document.createElement(e);return i.id=t,n&&(i.textContent=n),i}},{key:"hide",value:function(e){e.style.display="none"}},{key:"show",value:function(e){e.style.display=""}},{key:"fireEvent",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=new r.a(t,{detail:n});e.dispatchEvent(i)}},{key:"toArray",value:function(e){return[].slice.call(e)}}]),e}();t.a=o},function(e,t,n){"use strict";var i={ENTER:13,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40};t.a=i},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.autoslide,r=void 0!==n&&n,a=t.changeOnClick,o=void 0!==a&&a;if(i(this,e),this.el=document.getElementById("webslides"),this.isMoving=!1,this.slides=null,this.currentSlideI_=-1,this.currentSlide_=null,this.maxSlide_=0,this.isVertical=this.el.classList.contains(l.VERTICAL),this.plugins={},this.interval_=null,this.autoslide_=r,this.changeOnClick_=o,!this.el)throw new Error("Couldn't find the webslides container!");this.removeChildren_(),this.grabSlides_(),this.createPlugins_(),this.initSlides_(),this.play(),this.onInit_()}return u(e,[{key:"removeChildren_",value:function(){for(var e=this.el.childNodes,t=e.length;t--;){var n=e[t];a.a.isCandidate(n)||this.el.removeChild(n)}}},{key:"createPlugins_",value:function(){var e=this;Object.keys(c).forEach(function(t){var n=c[t];e.plugins[t]=new n(e)})}},{key:"onInit_",value:function(){o.a.fireEvent(this.el,"ws:init")}},{key:"grabSlides_",value:function(){this.slides=o.a.toArray(this.el.childNodes).map(function(e,t){return new a.a(e,t)}),this.maxSlide_=this.slides.length}},{key:"goToSlide",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isValidIndexSlide_(e)&&!this.isMoving){this.isMoving=!0;var n=!1;null!==t?n=t:this.currentSlideI_>=0&&(n=e>this.currentSlideI_);var i=this.slides[e];null===this.currentSlide_||!this.isVertical||this.plugins.touch&&this.plugins.touch.isEnabled?this.transitionToSlide_(n,i,this.onSlideChange_):this.scrollTransitionToSlide_(n,i,this.onSlideChange_)}}},{key:"scrollTransitionToSlide_",value:function(e,t,i){var r=this;this.el.style.overflow="none",e?t.show():(t.moveBeforeFirst(),t.show(),n.i(s.a)(this.currentSlide_.el.offsetTop,0)),n.i(s.a)(t.el.offsetTop,500,function(){r.currentSlide_.hide(),e&&r.currentSlide_.moveAfterLast(),r.el.style.overflow="auto",setTimeout(function(){i.call(r,t)},150)})}},{key:"transitionToSlide_",value:function(e,t,i){n.i(s.a)(0,0),e||t.moveBeforeFirst(),this.currentSlide_&&(e&&this.currentSlide_.moveAfterLast(),this.currentSlide_.hide()),t.show(),i.call(this,t)}},{key:"onSlideChange_",value:function(e){this.currentSlide_=e,this.currentSlideI_=e.i,this.isMoving=!1,o.a.fireEvent(this.el,"ws:slide-change",{slides:this.maxSlide_,currentSlide0:this.currentSlideI_,currentSlide:this.currentSlideI_+1})}},{key:"goNext",value:function(){var e=this.currentSlideI_+1;e>=this.maxSlide_&&(e=0),this.goToSlide(e,!0)}},{key:"goPrev",value:function(){var e=this.currentSlideI_-1;e<0&&(e=this.maxSlide_-1),this.goToSlide(e,!1)}},{key:"isValidIndexSlide_",value:function(e){return e>=0&&e=this.maxSlide_)&&(e=0),0!==e)for(var t=0;t0&&(this.interval_=setInterval(this.goNext.bind(this),e))}},{key:"stop",value:function(){this.interval_&&(clearInterval(this.interval_),this.interval_=null)}}],[{key:"registerPlugin",value:function(e,t){c[e]=t}}]),e}();t.a=h},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=n(0),a=function(){function e(e,t){for(var n=0;nMath.abs(t)){if(this.ws_.isVertical)return;e.preventDefault()}(Math.abs(t)>=o||Math.abs(n)>=o)&&(this.isGoingUp_||this.isGoingLeft_?this.ws_.goPrev():this.ws_.goNext(),e.preventDefault())}}]),e}();t.a=s},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=n(2),a=function(){function e(e,t){for(var n=0;nMath.abs(t)&&(e<-s?this.ws_.goPrev():e>s&&this.ws_.goNext())}}],[{key:"normalizeEventInfo",value:function(e){var t=void 0,n=void 0,i={pageX:0,pageY:0};return"undefined"!=typeof e.changedTouches?i=e.changedTouches[0]:"undefined"!=typeof e.originalEvent&&"undefined"!=typeof e.originalEvent.changedTouches&&(i=e.originalEvent.changedTouches[0]),t=e.offsetX||e.layerX||i.pageX,n=e.offsetY||e.layerY||i.pageY,{x:t,y:n}}}]),e}();t.a=u},function(e,t,n){"use strict";function i(){try{var e=new r("t",{detail:{a:"b"}});return"t"===e.type&&"b"===e.detail.a}catch(e){}return!1}var r=window.CustomEvent,a=function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n},o=i()?r:a;t.a=o},function(e,t,n){"use strict";function i(e){return.5-Math.cos(e*Math.PI)/2}function r(e){return e}t.a={swing:i,linear:r}},function(e,t,n){"use strict";function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=e-a.scrollTop,o=a.scrollTop,s=16;if(!t)return a.scrollTop=e,void n();var u=function u(l){l+=s;var c=Math.min(1,l/t),h=r.a.swing(c,l*c,e,i,t);a.scrollTop=Math.floor(o+h*i),l