From 62c6aba4786cf8e0400e8cf62abc3cee1861af01 Mon Sep 17 00:00:00 2001 From: Antonio Laguna Date: Mon, 27 Feb 2017 12:50:30 +0100 Subject: [PATCH] Disting --- static/js/webslides.js | 336 ++++++++++++++++--------------------- static/js/webslides.min.js | 2 +- 2 files changed, 149 insertions(+), 189 deletions(-) diff --git a/static/js/webslides.js b/static/js/webslides.js index 633ebb9..91b1062 100644 --- a/static/js/webslides.js +++ b/static/js/webslides.js @@ -136,28 +136,6 @@ var DOM = function () { el.style.display = ''; } - /** - * Locks the scroll on the document by setting the HTML to have a hidden - * overflow. - */ - - }, { - key: 'lockScroll', - value: function lockScroll() { - document.documentElement.style.overflow = 'hidden'; - } - - /** - * Unlocks the scroll on the document by setting the HTML to have an auto - * overflow. - */ - - }, { - key: 'unlockScroll', - value: function unlockScroll() { - document.documentElement.style.overflow = 'auto'; - } - /** * Fires a custom event on the given target. * @param {Element} target The target of the event. @@ -177,6 +155,18 @@ var DOM = function () { target.dispatchEvent(event); } + + /** + * Converts an iterable to an array. + * @param {*} iterable Element to convert to array + * @return {Array} the element casted to an array. + */ + + }, { + key: 'toArray', + value: function toArray(iterable) { + return [].slice.call(iterable); + } }]); return DOM; @@ -205,80 +195,99 @@ var Keys = { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__easing__ = __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"); } } -var SCROLLABLE_CONTAINER = getScrollableContainer(); +var UA = window.navigator.userAgent; -/** - * Returns the correct DOM element to be used for scrolling the - * page, due to Firefox not scrolling on document.body. - * @return {Element} Scrollable Element. - */ -function getScrollableContainer() { - if (SCROLLABLE_CONTAINER) { - return SCROLLABLE_CONTAINER; +var MobileDetector = function () { + function MobileDetector() { + _classCallCheck(this, MobileDetector); } - var documentElement = window.document.documentElement; - var scrollableContainer = void 0; + _createClass(MobileDetector, null, [{ + key: "isAndroid", - documentElement.scrollTop = 1; - - if (documentElement.scrollTop === 1) { - documentElement.scrollTop = 0; - scrollableContainer = documentElement; - } else { - scrollableContainer = document.body; - } - - SCROLLABLE_CONTAINER = scrollableContainer; - - return scrollableContainer; -} - -/** - * Smoothly scrolls to a given Y position using Easing.Swing. It'll run a - * callback upon finishing. - * @param {number} y Offset of the page to scroll to. - * @param {number} duration Duration of the animation. 500ms by default. - * @param {function} cb Callback function to call upon completion. - */ -function scrollTo(y) { - var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500; - var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {}; - - var scrollableContainer = getScrollableContainer(); - var delta = y - scrollableContainer.scrollTop; - var startLocation = scrollableContainer.scrollTop; - var increment = 16; - - if (!duration) { - scrollableContainer.scrollTop = y; - cb(); - return; - } - - var animateScroll = function animateScroll(elapsedTime) { - elapsedTime += increment; - var percent = Math.min(1, elapsedTime / duration); - var easingP = __WEBPACK_IMPORTED_MODULE_0__easing__["a" /* default */].swing(percent, elapsedTime * percent, y, delta, duration); - - scrollableContainer.scrollTop = Math.floor(startLocation + easingP * delta); - - if (elapsedTime < duration) { - setTimeout(function () { - return animateScroll(elapsedTime); - }, increment); - } else { - cb(); + /** + * Whether the device is Android or not. + * @return {Boolean} + */ + value: function isAndroid() { + return !!UA.match(/Android/i); } - }; - animateScroll(0); -} + /** + * Whether the device is BlackBerry or not. + * @return {Boolean} + */ -/* harmony default export */ __webpack_exports__["a"] = { getScrollableContainer: getScrollableContainer, scrollTo: scrollTo }; + }, { + key: "isBlackBerry", + value: function isBlackBerry() { + return !!UA.match(/BlackBerry/i); + } + + /** + * Whether the device is iOS or not. + * @return {Boolean} + */ + + }, { + key: "isiOS", + value: function isiOS() { + return !!UA.match(/iPhone/i); + } + + /** + * Whether the device is Opera or not. + * @return {Boolean} + */ + + }, { + key: "isOpera", + value: function isOpera() { + return !!UA.match(/Opera Mini/i); + } + + /** + * Whether the device is Windows or not. + * @return {Boolean} + */ + + }, { + key: "isWindows", + value: function isWindows() { + return !!UA.match(/IEMobile/i); + } + + /** + * Whether the device is Windows Phone or not. + * @return {Boolean} + */ + + }, { + key: "isWindowsPhone", + value: function isWindowsPhone() { + return !!UA.match(/Windows Phone/i); + } + + /** + * Whether the device is any mobile device or not. + * @return {Boolean} + */ + + }, { + key: "isAny", + value: function isAny() { + return MobileDetector.isAndroid() || MobileDetector.isBlackBerry() || MobileDetector.isiOS() || MobileDetector.isOpera() || MobileDetector.isWindows() || MobileDetector.isWindowsPhone(); + } + }]); + + return MobileDetector; +}(); + +/* harmony default export */ __webpack_exports__["a"] = MobileDetector; /***/ }), /* 3 */ @@ -288,7 +297,7 @@ function scrollTo(y) { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__plugins_plugins__ = __webpack_require__(9); /* 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__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__ = __webpack_require__(14); 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"); } } @@ -455,7 +464,7 @@ var WebSlides = function () { }, { key: 'grabSlides_', value: function grabSlides_() { - this.slides = Array.from(this.el.childNodes).map(function (slide, i) { + this.slides = __WEBPACK_IMPORTED_MODULE_2__utils_dom__["a" /* default */].toArray(this.el.childNodes).map(function (slide, i) { return new __WEBPACK_IMPORTED_MODULE_1__slide__["a" /* default */](slide, i); }); @@ -503,9 +512,7 @@ var WebSlides = function () { * @param {Function} callback Callback to be called upon finishing. This is an * async function so it'll happen once the scroll animation finishes. * @private - * @see DOM.lockScroll - * @see DOM.unlockScroll - * @see ScrollHelper.scrollTo + * @see scrollTo */ }, { @@ -513,24 +520,24 @@ var WebSlides = function () { value: function scrollTransitionToSlide_(isMovingForward, nextSlide, callback) { var _this2 = this; - __WEBPACK_IMPORTED_MODULE_2__utils_dom__["a" /* default */].lockScroll(); + this.el.style.overflow = 'none'; if (!isMovingForward) { nextSlide.moveBeforeFirst(); nextSlide.show(); - __WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */].scrollTo(this.currentSlide_.el.offsetTop, 0); + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */])(this.currentSlide_.el.offsetTop, 0); } else { nextSlide.show(); } - __WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */].scrollTo(nextSlide.el.offsetTop, 500, function () { + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */])(nextSlide.el.offsetTop, 500, function () { _this2.currentSlide_.hide(); if (isMovingForward) { _this2.currentSlide_.moveAfterLast(); } - __WEBPACK_IMPORTED_MODULE_2__utils_dom__["a" /* default */].unlockScroll(); + _this2.el.style.overflow = 'auto'; setTimeout(function () { callback.call(_this2, nextSlide); }, 150); @@ -549,7 +556,7 @@ var WebSlides = function () { }, { key: 'transitionToSlide_', value: function transitionToSlide_(isMovingForward, nextSlide, callback) { - __WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */].scrollTo(0, 0); + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */])(0, 0); if (!isMovingForward) { nextSlide.moveBeforeFirst(); @@ -689,7 +696,7 @@ var WebSlides = function () { value: function play(time) { time = time || this.autoslide_; - if (!this.interval_ && Number.isInteger(time) && time > 0) { + if (!this.interval_ && typeof time === 'number' && time > 0) { this.interval_ = setInterval(this.goNext.bind(this), time); } } @@ -968,7 +975,7 @@ var Hash = function () { slide = parseInt(results[1], 10); } - if (!Number.isInteger(slide) || slide < 0 || !Array.isArray(results)) { + if (typeof slide !== 'number' || slide < 0 || !Array.isArray(results)) { slide = null; } else { slide--; // Convert to 0 index @@ -1254,7 +1261,7 @@ var Navigation = function () { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_scroll_to__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__ = __webpack_require__(2); 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"); } } @@ -1277,10 +1284,10 @@ var Scroll = function () { */ this.ws_ = wsInstance; - this.scrollContainer_ = __WEBPACK_IMPORTED_MODULE_0__utils_scroll_to__["a" /* default */].getScrollableContainer(); + this.scrollContainer_ = wsInstance.el; this.isGoingUp_ = false; - if (this.ws_.isVertical) { + if (this.ws_.isVertical && !__WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__["a" /* default */].isAny()) { this.scrollContainer_.addEventListener('wheel', this.onMouseWheel_.bind(this)); } } @@ -1297,6 +1304,7 @@ var Scroll = function () { key: 'onMouseWheel_', value: function onMouseWheel_(event) { if (this.ws_.isMoving) { + event.preventDefault(); return; } @@ -1327,7 +1335,7 @@ var Scroll = function () { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__ = __webpack_require__(14); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__ = __webpack_require__(2); 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"); } } @@ -1575,99 +1583,51 @@ function linear(p) { /***/ (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; }; }(); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__easing__ = __webpack_require__(13); +/* harmony export (immutable) */ __webpack_exports__["a"] = scrollTo; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var UA = window.navigator.userAgent; +var SCROLLABLE_CONTAINER = document.getElementById('webslides'); -var MobileDetector = function () { - function MobileDetector() { - _classCallCheck(this, MobileDetector); +/** + * Smoothly scrolls to a given Y position using Easing.Swing. It'll run a + * callback upon finishing. + * @param {number} y Offset of the page to scroll to. + * @param {number} duration Duration of the animation. 500ms by default. + * @param {function} cb Callback function to call upon completion. + */ +function scrollTo(y) { + var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500; + var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {}; + + var delta = y - SCROLLABLE_CONTAINER.scrollTop; + var startLocation = SCROLLABLE_CONTAINER.scrollTop; + var increment = 16; + + if (!duration) { + SCROLLABLE_CONTAINER.scrollTop = y; + cb(); + return; } - _createClass(MobileDetector, null, [{ - key: "isAndroid", + var animateScroll = function animateScroll(elapsedTime) { + elapsedTime += increment; + var percent = Math.min(1, elapsedTime / duration); + var easingP = __WEBPACK_IMPORTED_MODULE_0__easing__["a" /* default */].swing(percent, elapsedTime * percent, y, delta, duration); - /** - * Whether the device is Android or not. - * @return {Boolean} - */ - value: function isAndroid() { - return !!UA.match(/Android/i); + SCROLLABLE_CONTAINER.scrollTop = Math.floor(startLocation + easingP * delta); + + if (elapsedTime < duration) { + setTimeout(function () { + return animateScroll(elapsedTime); + }, increment); + } else { + cb(); } + }; - /** - * Whether the device is BlackBerry or not. - * @return {Boolean} - */ - - }, { - key: "isBlackBerry", - value: function isBlackBerry() { - return !!UA.match(/BlackBerry/i); - } - - /** - * Whether the device is iOS or not. - * @return {Boolean} - */ - - }, { - key: "isiOS", - value: function isiOS() { - return !!UA.match(/iPhone/i); - } - - /** - * Whether the device is Opera or not. - * @return {Boolean} - */ - - }, { - key: "isOpera", - value: function isOpera() { - return !!UA.match(/Opera Mini/i); - } - - /** - * Whether the device is Windows or not. - * @return {Boolean} - */ - - }, { - key: "isWindows", - value: function isWindows() { - return !!UA.match(/IEMobile/i); - } - - /** - * Whether the device is Windows Phone or not. - * @return {Boolean} - */ - - }, { - key: "isWindowsPhone", - value: function isWindowsPhone() { - return !!UA.match(/Windows Phone/i); - } - - /** - * Whether the device is any mobile device or not. - * @return {Boolean} - */ - - }, { - key: "isAny", - value: function isAny() { - return MobileDetector.isAndroid() || MobileDetector.isBlackBerry() || MobileDetector.isiOS() || MobileDetector.isOpera() || MobileDetector.isWindows() || MobileDetector.isWindowsPhone(); - } - }]); - - return MobileDetector; -}(); - -/* harmony default export */ __webpack_exports__["a"] = MobileDetector; + animateScroll(0); +} /***/ }), /* 15 */ diff --git a/static/js/webslides.min.js b/static/js/webslides.min.js index 004faaf..f089973 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:"lockScroll",value:function(){document.documentElement.style.overflow="hidden"}},{key:"unlockScroll",value:function(){document.documentElement.style.overflow="auto"}},{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)}}]),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(){if(a)return a;var e=window.document.documentElement,t=void 0;return e.scrollTop=1,1===e.scrollTop?(e.scrollTop=0,t=e):t=document.body,a=t,t}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=i(),a=e-r.scrollTop,s=r.scrollTop,l=16;if(!t)return r.scrollTop=e,void n();var u=function i(u){u+=l;var c=Math.min(1,u/t),h=o.a.swing(c,u*c,e,a,t);r.scrollTop=Math.floor(s+h*a),u0&&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(u.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 l(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=Array.from(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,n){var i=this;a.a.lockScroll(),e?t.show():(t.moveBeforeFirst(),t.show(),s.a.scrollTo(this.currentSlide_.el.offsetTop,0)),s.a.scrollTo(t.el.offsetTop,500,function(){i.currentSlide_.hide(),e&&i.currentSlide_.moveAfterLast(),a.a.unlockScroll(),setTimeout(function(){n.call(i,t)},150)})}},{key:"transitionToSlide_",value:function(e,t,n){s.a.scrollTo(0,0),e||t.moveBeforeFirst(),this.currentSlide_&&(e&&this.currentSlide_.moveAfterLast(),this.currentSlide_.hide()),t.show(),n.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(14),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=l},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,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;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),l