diff --git a/CHANGELOG.md b/CHANGELOG.md index d84f917..deaef2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# 1.2.1 (2017-03-02) + +## Bugfixes + +- Scrollbar showing in Firefox + +# 1.2.0 (2017-03-02) + +## New Features + +- [[#48](https://github.com/jlantunez/webslides/issues/48)] Allows to navigate with AvPag & RePag to allow presentation devices to work. +- [[#49](https://github.com/jlantunez/webslides/issues/49)] Allowing to go to first and last slides by using home and end keys respectively. +- [[#50](https://github.com/jlantunez/webslides/issues/50)] Using the keyboard on inputs and editable content won't trigger any events that might cause navigation. +- [[#47](https://github.com/jlantunez/webslides/issues/47)] Allowing options to be configured. [Read More](/docs/technical.md#options). + # 1.1.0 (2017-02-28) ## Bugfixes @@ -20,19 +35,19 @@ It's also possible to scroll horizontally on horizontal presentations to move fo # 1.0.0 (2017-02-23) This release is a special one since it sets up in the path of a better development environment. Although it's far from -perfect, it's a solid beginning. +perfect, it's a solid beginning. -All the code has been migrated from **jQuery** with ES5 to **vanilla JavaScript with ES2015 (or ES6) and is fully modular**. -This means that WebSlides is a (base module)[src/js/modules/webslides.js] with a solid API (few public methods) and +All the code has been migrated from **jQuery** with ES5 to **vanilla JavaScript with ES2015 (or ES6) and is fully modular**. +This means that WebSlides is a (base module)[src/js/modules/webslides.js] with a solid API (few public methods) and it's extended by (plugins)[src/js/plugins]. This leads to more granularity and less code to dive through while fixing a -bug. +bug. **The benefit from this approach is that now it's really easy to extend WebSlides** to achieve what you need. You can also overwrite current plugins. Say you don't like the current navigation with arrows and want to create a menu instead, you can just write that for yourself with your custom needs and register it as `nav` and it will overwrite our nav with your code. -We hope this leads to a better environment in which WebSlides can grow better. +We hope this leads to a better environment in which WebSlides can grow better. All the technical specs live now in [this document](docs/technical.md). diff --git a/README.md b/README.md index 550a0fe..3d9d37f 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ Simply choose a demo and customize it in minutes. Latest version: [webslides.tv/ ### Why WebSlides? Good karma and productivity. Just a basic knowledge of HTML and CSS is required. Designers, marketers, and journalists can now focus on the content. -### Features +## Features -- Navigation (horizontal and vertical sliding): touchpad, keyboard shortcuts, and swipe. +- Navigation (horizontal and vertical sliding): remote presenters, touchpad, keyboard shortcuts, and swipe. - Slide counter. - Permalinks: go to a specific slide. - Autoslide. @@ -27,6 +27,20 @@ Good karma and productivity. Just a basic knowledge of HTML and CSS is required. - Fonts: Roboto, Maitree (Serif), and San Francisco. - Vertical rhythm (use multiples of 8). +### Key Navigation + +There's a handful of keys that can be used to achieve navigation within WebSlides. Here's the list: + +* `←`: If WebSlides is not vertical, it will go to the previous slide. +* `→`: If WebSlides is not vertical, it will go to the next slide. +* `↑`: If WebSlides is vertical, it will go to the previous slide. +* `↓`: If WebSlides is vertical, it will go to the next slide. +* `Page Up`: Go to the previous slide. +* `Page Down`: Go to the next slide. +* `Space`: Go to the next slide. +* `Home`: Go to the first slide. +* `End`: Go to the last slide. + ## Markup - Code is clean and scalable. It uses intuitive markup with popular naming conventions. There's no need to overuse classes or nesting. diff --git a/demos/classes.html b/demos/classes.html index c49013c..be55c38 100644 --- a/demos/classes.html +++ b/demos/classes.html @@ -1910,7 +1910,7 @@

Start in seconds

Create your own presentation instantly.
120+ prebuilt slides ready to use.

- + diff --git a/demos/components.html b/demos/components.html index 17804e2..bb76fe1 100644 --- a/demos/components.html +++ b/demos/components.html @@ -1733,7 +1733,7 @@

HTML Presentations Made Easy

- + @@ -3103,7 +3103,7 @@

Start in Seconds

Create your own presentation instantly.
120+ prebuilt slides ready to use.

- + diff --git a/demos/index.html b/demos/index.html index 9de1f39..aa43638 100644 --- a/demos/index.html +++ b/demos/index.html @@ -199,7 +199,7 @@

Start in seconds

Create your own presentation instantly.
120+ premium slides ready to use.

- + diff --git a/demos/keynote.html b/demos/keynote.html index 1cc31f1..4187a04 100644 --- a/demos/keynote.html +++ b/demos/keynote.html @@ -815,7 +815,7 @@

Start in seconds

120+ prebuilt slides ready to use.

- + diff --git a/demos/landings.html b/demos/landings.html index bf5eb81..e552c92 100644 --- a/demos/landings.html +++ b/demos/landings.html @@ -236,7 +236,7 @@

HTML Presentations Made Easy

- + diff --git a/demos/portfolios.html b/demos/portfolios.html index 8f00bbe..acacab8 100644 --- a/demos/portfolios.html +++ b/demos/portfolios.html @@ -105,7 +105,7 @@

- +

Mercedes-Benz

Defining a new platform for the connected car

diff --git a/docs/technical.md b/docs/technical.md index 85f5e3b..f04cb72 100644 --- a/docs/technical.md +++ b/docs/technical.md @@ -25,11 +25,18 @@ WebSlides constructor accepts an object with options. |-----------|----------------|-----------|-------------------------------------------------------------------------------| | `autoslide` | `number` or `boolean` | `false` | Amount of milliseconds to wait to go to next slide automatically. | | `changeOnClick` | `boolean` | `false` | If true, clicking on the page will go to the next slide unless it's a clickable element. See [ClickToNav docs](./click-to-nav.md) for more info. | +| `minWheelDelta` | `number` | `40` | Controls the amount of scroll needed to trigger a navigation. Lower this number to decrease the scroll resistance. | +| `scrollWait` | `number` | `450` | Controls the amount of time needed to wait for a scroll transition to happen again. | +| `slideOffset` | `number` | `50` | Amount of sliding needed to trigger a new navigation. | ```javascript const ws = new WebSlides({ - autoslide: false + autoslide = false, + changeOnClick = false, + minWheelDelta = 40, + scrollWait = 450, + slideOffset = 50 }); ``` @@ -103,9 +110,13 @@ Registers a plugin to be loaded when the instance is created. It allows Those being: - - Navigation - - Hash - - Keyboard +- ClickNav +- Grid +- Hash +- Keyboard +- Navigation +- Scroll +- Touch | Param | Type | Description | | --- | --- | --- | diff --git a/index.html b/index.html index bd29b9c..79a96dd 100644 --- a/index.html +++ b/index.html @@ -109,7 +109,7 @@ Just the essentials and using lovely CSS.

- + @@ -329,7 +329,7 @@

Ready to Start?

Create your own presentation instantly.
120+ premium slides ready to use.

- + diff --git a/package.json b/package.json index c193c58..706b027 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webslides", - "version": "1.1.0", + "version": "1.2.1", "description": "Making HTML presentations easy", "main": "index.js", "repository": { @@ -31,9 +31,11 @@ "babel-cli": "^6.23.0", "babel-core": "^6.23.1", "babel-loader": "^6.3.2", + "babel-preset-env": "^1.1.11", "babel-preset-es2015": "^6.22.0", "npm-run-all": "^4.0.2", "rimraf": "^2.6.0", + "smart-banner-webpack-plugin": "^3.0.1", "webpack": "^2.2.1", "webpack-dev-server": "^2.4.1" }, diff --git a/src/js/modules/webslides.js b/src/js/modules/webslides.js index b137260..890368c 100644 --- a/src/js/modules/webslides.js +++ b/src/js/modules/webslides.js @@ -208,7 +208,7 @@ export default class WebSlides { * @see scrollTo */ scrollTransitionToSlide_(isMovingForward, nextSlide, callback) { - this.el.style.overflow = 'none'; + this.el.style.overflow = 'hidden'; if (!isMovingForward) { nextSlide.moveBeforeFirst(); diff --git a/static/js/webslides.js b/static/js/webslides.js index 0a46daa..f9038e2 100644 --- a/static/js/webslides.js +++ b/static/js/webslides.js @@ -1,3 +1,11 @@ +/*! + * Name: WebSlides + * Version: 1.2.1 + * Date: 2017-03-02 + * Description: Making HTML presentations easy + * URL: https://github.com/jlantunez/webslides#readme + * Credits: @jlantunez, @LuisSacristan, @Belelros + */ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -182,6 +190,10 @@ var DOM = function () { var Keys = { ENTER: 13, SPACE: 32, + RE_PAGE: 33, + AV_PAGE: 34, + END: 35, + HOME: 36, LEFT: 37, UP: 38, RIGHT: 39, @@ -325,16 +337,29 @@ var PLUGINS = { var WebSlides = function () { /** * Options for WebSlides - * @param {number|boolean} autoslide Is false by default. If a number is - * @param {boolean} changeOnClick Is false by default. If true, it will allow + * @param {number|boolean} autoslide If a number is provided, it will allow + * autosliding by said amount of miliseconds. + * @param {boolean} changeOnClick If true, it will allow * clicking on any place to change the slide. + * @param {number} minWheelDelta Controls the amount of needed scroll to + * trigger navigation. + * @param {number} scrollWait Controls the amount of time to wait till + * navigation can occur again with scroll. + * @param {number} slideOffset Controls the amount of needed touch delta to + * trigger navigation. */ function WebSlides() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$autoslide = _ref.autoslide, autoslide = _ref$autoslide === undefined ? false : _ref$autoslide, _ref$changeOnClick = _ref.changeOnClick, - changeOnClick = _ref$changeOnClick === undefined ? false : _ref$changeOnClick; + changeOnClick = _ref$changeOnClick === undefined ? false : _ref$changeOnClick, + _ref$minWheelDelta = _ref.minWheelDelta, + minWheelDelta = _ref$minWheelDelta === undefined ? 40 : _ref$minWheelDelta, + _ref$scrollWait = _ref.scrollWait, + scrollWait = _ref$scrollWait === undefined ? 450 : _ref$scrollWait, + _ref$slideOffset = _ref.slideOffset, + slideOffset = _ref$slideOffset === undefined ? 50 : _ref$slideOffset; _classCallCheck(this, WebSlides); @@ -388,18 +413,16 @@ var WebSlides = function () { */ this.interval_ = null; /** - * Amount of time to wait to go to next slide automatically or false to - * disable the feature. - * @type {boolean|number} - * @private + * Options dictionary. + * @type {Object} */ - this.autoslide_ = autoslide; - /** - * Whether navigation should initiate on click or not. - * @type {boolean} - * @private - */ - this.changeOnClick_ = changeOnClick; + this.options = { + autoslide: autoslide, + changeOnClick: changeOnClick, + minWheelDelta: minWheelDelta, + scrollWait: scrollWait, + slideOffset: slideOffset + }; if (!this.el) { throw new Error('Couldn\'t find the webslides container!'); @@ -494,7 +517,7 @@ var WebSlides = function () { value: function goToSlide(slideI) { var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - if (this.isValidIndexSlide_(slideI) && !this.isMoving) { + if (this.isValidIndexSlide_(slideI) && !this.isMoving && this.currentSlideI_ !== slideI) { this.isMoving = true; var isMovingForward = false; @@ -530,7 +553,7 @@ var WebSlides = function () { value: function scrollTransitionToSlide_(isMovingForward, nextSlide, callback) { var _this2 = this; - this.el.style.overflow = 'none'; + this.el.style.overflow = 'hidden'; if (!isMovingForward) { nextSlide.moveBeforeFirst(); @@ -704,7 +727,7 @@ var WebSlides = function () { * automatically. */ value: function play(time) { - time = time || this.autoslide_; + time = time || this.options.autoslide; if (!this.interval_ && typeof time === 'number' && time > 0) { this.interval_ = setInterval(this.goNext.bind(this), time); @@ -877,7 +900,7 @@ var ClickNav = function () { */ this.ws_ = wsInstance; - if (wsInstance.changeOnClick_) { + if (wsInstance.options.changeOnClick) { this.ws_.el.addEventListener('click', this.onClick_.bind(this)); } } @@ -1109,27 +1132,50 @@ var Keyboard = function () { key: 'onKeyPress_', value: function onKeyPress_(event) { var method = void 0; + var argument = void 0; - if (event.which === __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].SPACE) { - method = this.ws_.goNext; - } else { - if (this.ws_.isVertical) { - if (event.which === __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].DOWN) { - method = this.ws_.goNext; - } else if (event.which === __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].UP) { - method = this.ws_.goPrev; - } - } else { - if (event.which === __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].RIGHT) { - method = this.ws_.goNext; - } else if (event.which === __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].LEFT) { - method = this.ws_.goPrev; - } + // Check if there's a focused element that might use the keyboard. + if (document.activeElement) { + var isContentEditable = document.activeElement.contentEditable !== 'inherit'; + var isInput = ['INPUT', 'SELECT', 'OPTION', 'TEXTAREA'].indexOf(document.activeElement.tagName) > -1; + + if (isInput || isContentEditable) { + return; } } + switch (event.which) { + case __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].AV_PAGE: + case __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].SPACE: + method = this.ws_.goNext; + break; + case __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].RE_PAGE: + method = this.ws_.goPrev; + break; + case __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].HOME: + method = this.ws_.goToSlide; + argument = 0; + break; + case __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].END: + method = this.ws_.goToSlide; + argument = this.ws_.maxSlide_ - 1; + break; + case __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].DOWN: + method = this.ws_.isVertical ? this.ws_.goNext : null; + break; + case __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].UP: + method = this.ws_.isVertical ? this.ws_.goPrev : null; + break; + case __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].LEFT: + method = !this.ws_.isVertical ? this.ws_.goPrev : null; + break; + case __WEBPACK_IMPORTED_MODULE_0__utils_keys__["a" /* default */].RIGHT: + method = !this.ws_.isVertical ? this.ws_.goNext : null; + break; + } + if (method) { - method.call(this.ws_); + method.call(this.ws_, argument); } } }]); @@ -1333,8 +1379,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons -var MIN_WHEEL_DELTA = 40; - var Scroll = function () { /** * Scroll handler for the WebSlides. @@ -1396,7 +1440,7 @@ var Scroll = function () { this.timeout_ = setTimeout(function () { _this.timeout_ = null; - }, 450); + }, this.ws_.options.scrollWait); } /** @@ -1433,7 +1477,7 @@ var Scroll = function () { } } - if (Math.abs(wheelDeltaY) >= MIN_WHEEL_DELTA || Math.abs(wheelDeltaX) >= MIN_WHEEL_DELTA) { + if (Math.abs(wheelDeltaY) >= this.ws_.options.minWheelDelta || Math.abs(wheelDeltaX) >= this.ws_.options.minWheelDelta) { if (isHorizontalMovement && this.isGoingLeft_ || !isHorizontalMovement && this.isGoingUp_) { this.ws_.goPrev(); } else { @@ -1476,8 +1520,6 @@ var EVENTS = { } }; -var SLIDE_OFFSET = 50; - var Touch = function () { /** * @param {WebSlides} wsInstance The WebSlides instance @@ -1590,9 +1632,9 @@ var Touch = function () { // It's an horizontal drag if (Math.abs(diffX) > Math.abs(diffY)) { - if (diffX < -SLIDE_OFFSET) { + if (diffX < -this.ws_.options.slideOffset) { this.ws_.goPrev(); - } else if (diffX > SLIDE_OFFSET) { + } else if (diffX > this.ws_.options.slideOffset) { this.ws_.goNext(); } } diff --git a/static/js/webslides.min.js b/static/js/webslides.min.js index 46766d3..6f55135 100644 --- a/static/js/webslides.min.js +++ b/static/js/webslides.min.js @@ -1 +1,9 @@ -!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=16)}([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(13),a=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=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.isGoingUp_=t<0,this.isGoingLeft_=n<0,r){if(i)return;e.preventDefault()}(Math.abs(t)>=o||Math.abs(n)>=o)&&(r&&this.isGoingLeft_||!r&&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),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),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=s},function(e,t,n){"use strict";var i={ENTER:13,SPACE:32,RE_PAGE:33,AV_PAGE:34,END:35,HOME:36,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,s=void 0!==a&&a,o=t.minWheelDelta,l=void 0===o?40:o,c=t.scrollWait,h=void 0===c?450:c,d=t.slideOffset,f=void 0===d?50:d;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.options={autoslide:r,changeOnClick:s,minWheelDelta:l,scrollWait:h,slideOffset:f},!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];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(){s.a.fireEvent(this.el,"ws:init")}},{key:"grabSlides_",value:function(){this.slides=s.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.currentSlideI_!==e){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="hidden",e?t.show():(t.moveBeforeFirst(),t.show(),n.i(o.a)(this.currentSlide_.el.offsetTop,0)),n.i(o.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(o.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,s.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;n-1;if(a||i)return}switch(e.which){case r.a.AV_PAGE:case r.a.SPACE:t=this.ws_.goNext;break;case r.a.RE_PAGE:t=this.ws_.goPrev;break;case r.a.HOME:t=this.ws_.goToSlide,n=0;break;case r.a.END:t=this.ws_.goToSlide,n=this.ws_.maxSlide_-1;break;case r.a.DOWN:t=this.ws_.isVertical?this.ws_.goNext:null;break;case r.a.UP:t=this.ws_.isVertical?this.ws_.goPrev:null;break;case r.a.LEFT:t=this.ws_.isVertical?null:this.ws_.goPrev;break;case r.a.RIGHT:t=this.ws_.isVertical?null:this.ws_.goNext}t&&t.call(this.ws_,n)}}]),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(0),a=function(){function e(e,t){for(var n=0;nMath.abs(t);if(this.isGoingUp_=t<0,this.isGoingLeft_=n<0,r){if(i)return;e.preventDefault()}(Math.abs(t)>=this.ws_.options.minWheelDelta||Math.abs(n)>=this.ws_.options.minWheelDelta)&&(r&&this.isGoingLeft_||!r&&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),a=function(){function e(e,t){for(var n=0;nMath.abs(t)&&(e<-this.ws_.options.slideOffset?this.ws_.goPrev():e>this.ws_.options.slideOffset&&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=o},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},s=i()?r:a;t.a=s},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,s=a.scrollTop,o=16;if(!t)return a.scrollTop=e,void n();var l=function l(u){u+=o;var c=Math.min(1,u/t),h=r.a.swing(c,u*c,e,i,t);a.scrollTop=Math.floor(s+h*i),u