diff --git a/src/js/modules/webslides.js b/src/js/modules/webslides.js index 489e0ed..ba44ced 100644 --- a/src/js/modules/webslides.js +++ b/src/js/modules/webslides.js @@ -44,6 +44,7 @@ export default class WebSlides { * navigation can occur again with scroll. * @param {number} slideOffset Controls the amount of needed touch delta to * trigger navigation. + * @param {boolean} showIndex Controls if the index can be shown. */ constructor({ autoslide = false, @@ -52,7 +53,8 @@ export default class WebSlides { minWheelDelta = 40, navigateOnScroll = true, scrollWait = 450, - slideOffset = 50 + slideOffset = 50, + showIndex = true } = {}) { /** * WebSlide element. @@ -113,7 +115,8 @@ export default class WebSlides { minWheelDelta, navigateOnScroll, scrollWait, - slideOffset + slideOffset, + showIndex }; /** * Initialisation flag. @@ -393,7 +396,9 @@ export default class WebSlides { * Toggles zoom */ toggleZoom() { - this.plugins.zoom.toggleZoom(); + if (this.options.showIndex) { + this.plugins.zoom.toggleZoom(); + } } /** diff --git a/src/js/plugins/zoom.js b/src/js/plugins/zoom.js index add9719..b4799e9 100644 --- a/src/js/plugins/zoom.js +++ b/src/js/plugins/zoom.js @@ -137,6 +137,7 @@ export default class Zoom { * Zoom In the slider, scales the slides and uses a grid layout to show them. */ zoomIn() { + if (!this.ws_.options.showIndex) return; this.enable(); const currentId = this.ws_.currentSlide_.el.id; const zoomedCurrent = this.zws_.el @@ -168,6 +169,7 @@ export default class Zoom { * Zoom Out the slider, remove scale from the slides. */ zoomOut() { + if (!this.ws_.options.showIndex) return; this.zws_.el.classList.remove('in'); setTimeout(() => { diff --git a/static/js/webslides.js b/static/js/webslides.js index 2e05fca..34a3f84 100644 --- a/static/js/webslides.js +++ b/static/js/webslides.js @@ -41,9 +41,6 @@ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { @@ -71,7 +68,7 @@ /******/ __webpack_require__.p = "/static/js/"; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 7); +/******/ return __webpack_require__(__webpack_require__.s = 5); /******/ }) /************************************************************************/ /******/ ([ @@ -79,7 +76,7 @@ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__custom_event__ = __webpack_require__(20); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__custom_event__ = __webpack_require__(9); 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"); } } @@ -363,8 +360,8 @@ var DOM = function () { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Slide; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Events; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Slide; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Events; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_dom__ = __webpack_require__(0); 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; }; }(); @@ -688,7 +685,7 @@ var MobileDetector = function () { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = scrollTo; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__easing__ = __webpack_require__(21); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__easing__ = __webpack_require__(20); var SCROLLABLE_CONTAINER = null; @@ -746,7 +743,19 @@ function scrollTo(y) { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__plugins_plugins__ = __webpack_require__(14); +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__modules_webslides__ = __webpack_require__(6); + +__webpack_require__(21); + +window.WebSlides = __WEBPACK_IMPORTED_MODULE_0__modules_webslides__["a" /* default */]; + +/***/ }), +/* 6 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__plugins_plugins__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__slide__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_dom__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__ = __webpack_require__(4); @@ -800,6 +809,7 @@ var WebSlides = function () { * navigation can occur again with scroll. * @param {number} slideOffset Controls the amount of needed touch delta to * trigger navigation. + * @param {boolean} showIndex Controls if the index can be shown. */ function WebSlides() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, @@ -816,7 +826,9 @@ var WebSlides = function () { _ref$scrollWait = _ref.scrollWait, scrollWait = _ref$scrollWait === undefined ? 450 : _ref$scrollWait, _ref$slideOffset = _ref.slideOffset, - slideOffset = _ref$slideOffset === undefined ? 50 : _ref$slideOffset; + slideOffset = _ref$slideOffset === undefined ? 50 : _ref$slideOffset, + _ref$showIndex = _ref.showIndex, + showIndex = _ref$showIndex === undefined ? true : _ref$showIndex; _classCallCheck(this, WebSlides); @@ -879,7 +891,8 @@ var WebSlides = function () { minWheelDelta: minWheelDelta, navigateOnScroll: navigateOnScroll, scrollWait: scrollWait, - slideOffset: slideOffset + slideOffset: slideOffset, + showIndex: showIndex }; /** * Initialisation flag. @@ -912,7 +925,7 @@ var WebSlides = function () { while (i--) { var node = nodes[i]; - if (!__WEBPACK_IMPORTED_MODULE_1__slide__["a" /* default */].isCandidate(node)) { + if (!__WEBPACK_IMPORTED_MODULE_1__slide__["b" /* default */].isCandidate(node)) { this.el.removeChild(node); } } @@ -958,7 +971,7 @@ var WebSlides = function () { key: 'grabSlides_', value: function grabSlides_() { 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); + return new __WEBPACK_IMPORTED_MODULE_1__slide__["b" /* default */](slide, i); }); this.maxSlide_ = this.slides.length; @@ -1018,12 +1031,12 @@ var WebSlides = function () { if (!isMovingForward) { nextSlide.moveBeforeFirst(); nextSlide.show(); - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */])(this.currentSlide_.el.offsetTop, 0); + Object(__WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */])(this.currentSlide_.el.offsetTop, 0); } else { nextSlide.show(); } - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */])(nextSlide.el.offsetTop, 500, function () { + Object(__WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */])(nextSlide.el.offsetTop, 500, function () { _this2.currentSlide_.hide(); if (isMovingForward) { @@ -1052,7 +1065,7 @@ var WebSlides = function () { value: function transitionToSlide_(isMovingForward, nextSlide, callback) { var _this3 = this; - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */])(0, 0); + Object(__WEBPACK_IMPORTED_MODULE_3__utils_scroll_to__["a" /* default */])(0, 0); var className = 'slideInRight'; if (!isMovingForward) { @@ -1200,7 +1213,9 @@ var WebSlides = function () { }, { key: 'toggleZoom', value: function toggleZoom() { - this.plugins.zoom.toggleZoom(); + if (this.options.showIndex) { + this.plugins.zoom.toggleZoom(); + } } /** @@ -1284,23 +1299,47 @@ var WebSlides = function () { /* harmony default export */ __webpack_exports__["a"] = (WebSlides); -/***/ }), -/* 6 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - /***/ }), /* 7 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__modules_webslides__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__autoslide__ = __webpack_require__(8); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__click_nav__ = __webpack_require__(10); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__grid__ = __webpack_require__(11); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__hash__ = __webpack_require__(12); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyboard__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__navigation__ = __webpack_require__(14); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__scroll__ = __webpack_require__(15); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__touch__ = __webpack_require__(16); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__video__ = __webpack_require__(17); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__youtube__ = __webpack_require__(18); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__zoom__ = __webpack_require__(19); -__webpack_require__(6); -window.WebSlides = __WEBPACK_IMPORTED_MODULE_0__modules_webslides__["a" /* default */]; + + + + + + + + + + +/* harmony default export */ __webpack_exports__["a"] = ({ + AutoSlide: __WEBPACK_IMPORTED_MODULE_0__autoslide__["a" /* default */], + ClickNav: __WEBPACK_IMPORTED_MODULE_1__click_nav__["a" /* default */], + Grid: __WEBPACK_IMPORTED_MODULE_2__grid__["a" /* default */], + Hash: __WEBPACK_IMPORTED_MODULE_3__hash__["a" /* default */], + Keyboard: __WEBPACK_IMPORTED_MODULE_4__keyboard__["a" /* default */], + Navigation: __WEBPACK_IMPORTED_MODULE_5__navigation__["a" /* default */], + Scroll: __WEBPACK_IMPORTED_MODULE_6__scroll__["a" /* default */], + Touch: __WEBPACK_IMPORTED_MODULE_7__touch__["a" /* default */], + Video: __WEBPACK_IMPORTED_MODULE_8__video__["a" /* default */], + YouTube: __WEBPACK_IMPORTED_MODULE_9__youtube__["a" /* default */], + Zoom: __WEBPACK_IMPORTED_MODULE_10__zoom__["a" /* default */] +}); /***/ }), /* 8 */ @@ -1409,6 +1448,57 @@ var AutoSlide = function () { /* 9 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +var NativeCustomEvent = window.CustomEvent; + +/** + * Check for the usage of native support for CustomEvents which is lacking + * completely on IE. + * @return {boolean} Whether it can be used or not. + */ +function canIuseNativeCustom() { + try { + var p = new NativeCustomEvent('t', { + detail: { + a: 'b' + } + }); + return 't' === p.type && 'b' === p.detail.a; + } catch (e) {} + + /* istanbul ignore next: hard to reproduce on test environment */ + return false; +} + +/** + * Lousy polyfill for the Custom Event constructor for IE. + * @param {!string} type The type of the event. + * @param {?Object} params Additional information for the event. + * @return {Event} + * @constructor + */ +/* istanbul ignore next: hard to reproduce on test environment */ +var IECustomEvent = function CustomEvent(type, params) { + var e = document.createEvent('CustomEvent'); + + if (params) { + e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); + } else { + e.initCustomEvent(type, false, false, undefined); + } + + return e; +}; + +/* istanbul ignore next: hard to reproduce on test environment */ +var WSCustomEvent = canIuseNativeCustom() ? NativeCustomEvent : IECustomEvent; + +/* harmony default export */ __webpack_exports__["a"] = (WSCustomEvent); + +/***/ }), +/* 10 */ +/***/ (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; }; }(); @@ -1462,7 +1552,7 @@ var ClickNav = function () { /* harmony default export */ __webpack_exports__["a"] = (ClickNav); /***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1532,7 +1622,7 @@ var Grid = function () { /* harmony default export */ __webpack_exports__["a"] = (Grid); /***/ }), -/* 11 */ +/* 12 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1639,7 +1729,7 @@ var Hash = function () { /* harmony default export */ __webpack_exports__["a"] = (Hash); /***/ }), -/* 12 */ +/* 13 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1736,7 +1826,7 @@ var Keyboard = function () { /* harmony default export */ __webpack_exports__["a"] = (Keyboard); /***/ }), -/* 13 */ +/* 14 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1911,48 +2001,6 @@ var Navigation = function () { /* harmony default export */ __webpack_exports__["a"] = (Navigation); -/***/ }), -/* 14 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__autoslide__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__click_nav__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__grid__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__hash__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyboard__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__navigation__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__scroll__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__touch__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__video__ = __webpack_require__(17); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__youtube__ = __webpack_require__(18); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__zoom__ = __webpack_require__(19); - - - - - - - - - - - - -/* harmony default export */ __webpack_exports__["a"] = ({ - AutoSlide: __WEBPACK_IMPORTED_MODULE_0__autoslide__["a" /* default */], - ClickNav: __WEBPACK_IMPORTED_MODULE_1__click_nav__["a" /* default */], - Grid: __WEBPACK_IMPORTED_MODULE_2__grid__["a" /* default */], - Hash: __WEBPACK_IMPORTED_MODULE_3__hash__["a" /* default */], - Keyboard: __WEBPACK_IMPORTED_MODULE_4__keyboard__["a" /* default */], - Navigation: __WEBPACK_IMPORTED_MODULE_5__navigation__["a" /* default */], - Scroll: __WEBPACK_IMPORTED_MODULE_6__scroll__["a" /* default */], - Touch: __WEBPACK_IMPORTED_MODULE_7__touch__["a" /* default */], - Video: __WEBPACK_IMPORTED_MODULE_8__video__["a" /* default */], - YouTube: __WEBPACK_IMPORTED_MODULE_9__youtube__["a" /* default */], - Zoom: __WEBPACK_IMPORTED_MODULE_10__zoom__["a" /* default */] -}); - /***/ }), /* 15 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { @@ -2390,15 +2438,15 @@ var Video = function () { video.pause(); video.currentTime = 0; - var _Slide$getSectionFrom = __WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* default */].getSectionFromEl(video), + var _Slide$getSectionFrom = __WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* default */].getSectionFromEl(video), i = _Slide$getSectionFrom.i; var slide = wsInstance.slides[i - 1]; slide.video = video; - slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].ENABLE, Video.onSectionEnabled); - slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].DISABLE, Video.onSectionDisabled); + slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].ENABLE, Video.onSectionEnabled); + slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].DISABLE, Video.onSectionDisabled); }); } } @@ -2473,7 +2521,7 @@ var Player = function () { * Slide element in which the video is located. * @type {Node} */ - this.slide = __WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* default */].getSectionFromEl(el).section; + this.slide = __WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* default */].getSectionFromEl(el).section; /** * Whether it should autoplay on load or not. * @type {boolean} @@ -2679,17 +2727,17 @@ var YouTube = function () { var player = new Player(video); if (typeof video.dataset.autoplay !== 'undefined') { - var _Slide$getSectionFrom = __WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* default */].getSectionFromEl(player.el), + var _Slide$getSectionFrom = __WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* default */].getSectionFromEl(player.el), i = _Slide$getSectionFrom.i; var slide = _this2.ws_.slides[i - 1]; slide.player = player; - slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].ENABLE, YouTube.onSlideEvent); - slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].DISABLE, YouTube.onSlideEvent); - slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].ENTER, YouTube.onSlideEvent); - slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].LEAVE, YouTube.onSlideEvent); + slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].ENABLE, YouTube.onSlideEvent); + slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].DISABLE, YouTube.onSlideEvent); + slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].ENTER, YouTube.onSlideEvent); + slide.el.addEventListener(__WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].LEAVE, YouTube.onSlideEvent); if (_this2.ws_.currentSlide_ === slide) { YouTube.onSectionEnabled(slide); @@ -2723,16 +2771,16 @@ var YouTube = function () { var slide = event.detail.slide; switch (event.type) { - case __WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].ENABLE: + case __WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].ENABLE: YouTube.onSectionEnabled(slide); break; - case __WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].DISABLE: + case __WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].DISABLE: YouTube.onSectionDisabled(slide); break; - case __WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].LEAVE: + case __WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].LEAVE: slide.player.destroy(); break; - case __WEBPACK_IMPORTED_MODULE_1__modules_slide__["b" /* Events */].ENTER: + case __WEBPACK_IMPORTED_MODULE_1__modules_slide__["a" /* Events */].ENTER: slide.player.create(); break; } @@ -2880,7 +2928,7 @@ var Zoom = function () { this.zws_.slides = [].map.call(this.ws_.slides, function (slide, i) { var s_ = slide.el.cloneNode(true); _this.zws_.grid.appendChild(s_); - return new __WEBPACK_IMPORTED_MODULE_3__modules_slide__["a" /* default */](s_, i); + return new __WEBPACK_IMPORTED_MODULE_3__modules_slide__["b" /* default */](s_, i); }); this.disable(); @@ -2950,6 +2998,7 @@ var Zoom = function () { value: function zoomIn() { var _this3 = this; + if (!this.ws_.options.showIndex) return; this.enable(); var currentId = this.ws_.currentSlide_.el.id; var zoomedCurrent = this.zws_.el.querySelector('.' + CLASSES.WRAP + '.' + CLASSES.CURRENT); @@ -2970,7 +3019,7 @@ var Zoom = function () { var wrapCSS = window.getComputedStyle(_this3.zws_.grid); var scrollingElement = document.scrollingElement || document.body; - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils_scroll_to__["a" /* default */])(actualCurrent.parentNode.offsetTop + __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(wrapCSS.paddingTop), 50, function () {}, scrollingElement); + Object(__WEBPACK_IMPORTED_MODULE_2__utils_scroll_to__["a" /* default */])(actualCurrent.parentNode.offsetTop + __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(wrapCSS.paddingTop), 50, function () {}, scrollingElement); }, 50); } @@ -2983,6 +3032,7 @@ var Zoom = function () { value: function zoomOut() { var _this4 = this; + if (!this.ws_.options.showIndex) return; this.zws_.el.classList.remove('in'); setTimeout(function () { @@ -3023,57 +3073,6 @@ var Zoom = function () { /* 20 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -var NativeCustomEvent = window.CustomEvent; - -/** - * Check for the usage of native support for CustomEvents which is lacking - * completely on IE. - * @return {boolean} Whether it can be used or not. - */ -function canIuseNativeCustom() { - try { - var p = new NativeCustomEvent('t', { - detail: { - a: 'b' - } - }); - return 't' === p.type && 'b' === p.detail.a; - } catch (e) {} - - /* istanbul ignore next: hard to reproduce on test environment */ - return false; -} - -/** - * Lousy polyfill for the Custom Event constructor for IE. - * @param {!string} type The type of the event. - * @param {?Object} params Additional information for the event. - * @return {Event} - * @constructor - */ -/* istanbul ignore next: hard to reproduce on test environment */ -var IECustomEvent = function CustomEvent(type, params) { - var e = document.createEvent('CustomEvent'); - - if (params) { - e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); - } else { - e.initCustomEvent(type, false, false, undefined); - } - - return e; -}; - -/* istanbul ignore next: hard to reproduce on test environment */ -var WSCustomEvent = canIuseNativeCustom() ? NativeCustomEvent : IECustomEvent; - -/* harmony default export */ __webpack_exports__["a"] = (WSCustomEvent); - -/***/ }), -/* 21 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - "use strict"; /** * Swing easing function. @@ -3086,5 +3085,11 @@ function swing(p) { /* harmony default export */ __webpack_exports__["a"] = ({ swing: swing }); +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + /***/ }) /******/ ]); \ No newline at end of file diff --git a/static/js/webslides.min.js b/static/js/webslides.min.js index 2ef1dbb..c7475c9 100644 --- a/static/js/webslides.min.js +++ b/static/js/webslides.min.js @@ -6,4 +6,4 @@ * URL: https://github.com/webslides/webslides#readme * Credits: @jlantunez, @LuisSacristan, @Belelros */ -!function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/static/js/",t(t.s=7)}([function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(20),o=function(){function e(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=document.createElement(e);return t&&(n.id=t),i&&(n.textContent=i),n}},{key:"once",value:function(e,t,i){var n=function n(s){s.target===e&&(e.removeEventListener(t,n),i(s))};e.addEventListener(t,n,!1)}},{key:"getTransitionEvent",value:function(e){if(a&&!e)return a;a="";for(var t=e||document.createElement("ws"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},n=Object.keys(i),s=0,o=n.length;s2&&void 0!==arguments[2]?arguments[2]:{},n=new s.a(t,{detail:i});e.dispatchEvent(n)}},{key:"toArray",value:function(e){return[].slice.call(e)}},{key:"isFocusableElement",value:function(){var e=!1;if(document.activeElement){var t="inherit"!==document.activeElement.contentEditable&&void 0!==document.activeElement.contentEditable;e=["INPUT","SELECT","OPTION","TEXTAREA"].indexOf(document.activeElement.tagName)>-1||t}return e}},{key:"parseSize",value:function(e){return Number(e.replace(/[^\d\.]/g,""))}},{key:"wrap",value:function(e,t){var i=document.createElement(t);return e.parentElement.insertBefore(i,e),i.appendChild(e),i}},{key:"after",value:function(e,t){var i=t.parentNode;i.lastChild===t?i.appendChild(e):i.insertBefore(e,t.nextSibling)}}]),e}();t.a=l},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}i.d(t,"a",function(){return l}),i.d(t,"b",function(){return r});var s=i(0),o=function(){function e(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:500,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;n?o=n:o||(o=document.getElementById("webslides"));var a=e-o.scrollTop,r=o.scrollTop;if(!t)return o.scrollTop=e,void i();!function n(l){l+=16;var u=Math.min(1,l/t),c=s.a.swing(u,l*u,e,a,t);o.scrollTop=Math.floor(r+c*a),l0&&void 0!==arguments[0]?arguments[0]:{},i=t.autoslide,s=void 0!==i&&i,o=t.changeOnClick,a=void 0!==o&&o,r=t.loop,l=void 0===r||r,c=t.minWheelDelta,d=void 0===c?40:c,h=t.navigateOnScroll,f=void 0===h||h,v=t.scrollWait,y=void 0===v?450:v,p=t.slideOffset,m=void 0===p?50:p;if(n(this,e),this.el=document.getElementById("webslides"),!this.el)throw new Error("Couldn't find the webslides container!");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.options={autoslide:s,changeOnClick:a,loop:l,minWheelDelta:d,navigateOnScroll:f,scrollWait:y,slideOffset:m},this.initialised=!1,this.removeChildren_(),this.grabSlides_(),this.createPlugins_(),this.initSlides_(),this.onInit_()}return l(e,[{key:"removeChildren_",value:function(){for(var e=this.el.childNodes,t=e.length;t--;){var i=e[t];o.a.isCandidate(i)||this.el.removeChild(i)}}},{key:"createPlugins_",value:function(){var e=this;Object.keys(c).forEach(function(t){var i=c[t];e.plugins[t]=new i(e)})}},{key:"onInit_",value:function(){this.initialised=!0,a.a.fireEvent(this.el,"ws:init"),document.documentElement.classList.add(u.READY)}},{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.currentSlideI_!==e){this.isMoving=!0;var i=!1;null!==t?i=t:this.currentSlideI_>=0&&(i=e>this.currentSlideI_);var n=this.slides[e];null===this.currentSlide_||!this.isVertical||this.plugins.touch&&this.plugins.touch.isEnabled?this.transitionToSlide_(i,n,this.onSlideChange_):this.scrollTransitionToSlide_(i,n,this.onSlideChange_)}}},{key:"scrollTransitionToSlide_",value:function(e,t,n){var s=this;this.el.style.overflow="hidden",e?t.show():(t.moveBeforeFirst(),t.show(),i.i(r.a)(this.currentSlide_.el.offsetTop,0)),i.i(r.a)(t.el.offsetTop,500,function(){s.currentSlide_.hide(),e&&s.currentSlide_.moveAfterLast(),s.el.style.overflow="auto",setTimeout(function(){n.call(s,t)},150)})}},{key:"transitionToSlide_",value:function(e,t,n){var s=this;i.i(r.a)(0,0);var o="slideInRight";e||(t.moveBeforeFirst(),o="slideInLeft"),this.currentSlide_&&(e&&this.currentSlide_.moveAfterLast(),this.currentSlide_.hide()),t.show(),this.initialised&&this.plugins.touch&&this.plugins.touch.isEnabled?(a.a.once(t.el,a.a.getAnimationEvent(),function(){t.el.classList.remove(o),n.call(s,t)}),t.el.classList.add(o)):n.call(this,t)}},{key:"onSlideChange_",value:function(e){this.currentSlide_&&this.currentSlide_.disable(),this.currentSlide_=e,this.currentSlideI_=e.i,this.currentSlide_.enable(),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;if(e>=this.maxSlide_){if(!this.options.loop)return;e=0}this.goToSlide(e,!0)}},{key:"goPrev",value:function(){var e=this.currentSlideI_-1;if(e<0){if(!this.options.loop)return;e=this.maxSlide_-1}this.goToSlide(e,!1)}},{key:"isValidIndexSlide_",value:function(e){return"number"==typeof e&&e>=0&&e=this.maxSlide_)&&(e=0),0!==e)for(var t=0;t0&&(this.interval_=setInterval(this.ws_.goNext.bind(this.ws_),e))}},{key:"stop",value:function(){this.interval_&&(clearInterval(this.interval_),this.interval_=null)}}]),e}();t.a=a},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(e,t){for(var i=0;iMath.abs(i);if(this.isGoingUp_=i<0,this.isGoingLeft_=n<0,o){if(s)return;e.preventDefault()}(Math.abs(i+t)>=this.ws_.options.minWheelDelta||Math.abs(n+t)>=this.ws_.options.minWheelDelta)&&(o&&this.isGoingLeft_||!o&&this.isGoingUp_?this.ws_.goPrev():this.ws_.goNext(),e.preventDefault())}}}]),e}();t.a=a},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(3),o=function(){function e(e,t){for(var i=0;i1&&(this.startTouches=e.getTouchCoordinates(t),this.endTouches=this.startTouches,this.isGesture=!0)}}},{key:"onMove_",value:function(t){if(!this.ws_.isDisabled()){var i=e.normalizeEventInfo(t);this.isGesture?this.endTouches=e.getTouchCoordinates(t):(this.endX_=i.x,this.endY_=i.y)}}},{key:"onStop_",value:function(){if(!this.ws_.isDisabled())if(this.isGesture){var e=Math.sqrt(Math.pow(this.startTouches[0].x-this.startTouches[1].x,2)+Math.pow(this.startTouches[0].y-this.startTouches[1].y,2)),t=Math.sqrt(Math.pow(this.endTouches[0].x-this.endTouches[1].x,2)+Math.pow(this.endTouches[0].y-this.endTouches[1].y,2));e>t&&this.ws_.toggleZoom(),this.isGesture=!1}else{var i=this.startX_-this.endX_,n=this.startY_-this.endY_;Math.abs(i)>Math.abs(n)&&(i<-this.ws_.options.slideOffset?this.ws_.goPrev():i>this.ws_.options.slideOffset&&this.ws_.goNext())}}}],[{key:"getTouchCoordinates",value:function(e){return[{x:e.touches[0].clientX,y:e.touches[0].clientY},{x:e.touches[1].clientX,y:e.touches[1].clientY}]}},{key:"normalizeEventInfo",value:function(e){var t={pageX:0,pageY:0};return void 0!==e.changedTouches?t=e.changedTouches[0]:void 0!==e.originalEvent&&void 0!==e.originalEvent.changedTouches&&(t=e.originalEvent.changedTouches[0]),{x:e.offsetX||e.layerX||t.pageX,y:e.offsetY||e.layerY||t.pageY}}}]),e}();t.a=r},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(0),o=i(1),a=function(){function e(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=document.createElement(e);return t&&(n.id=t),i&&(n.textContent=i),n}},{key:"once",value:function(e,t,i){var n=function n(s){s.target===e&&(e.removeEventListener(t,n),i(s))};e.addEventListener(t,n,!1)}},{key:"getTransitionEvent",value:function(e){if(a&&!e)return a;a="";for(var t=e||document.createElement("ws"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},n=Object.keys(i),s=0,o=n.length;s2&&void 0!==arguments[2]?arguments[2]:{},n=new s.a(t,{detail:i});e.dispatchEvent(n)}},{key:"toArray",value:function(e){return[].slice.call(e)}},{key:"isFocusableElement",value:function(){var e=!1;if(document.activeElement){var t="inherit"!==document.activeElement.contentEditable&&void 0!==document.activeElement.contentEditable;e=["INPUT","SELECT","OPTION","TEXTAREA"].indexOf(document.activeElement.tagName)>-1||t}return e}},{key:"parseSize",value:function(e){return Number(e.replace(/[^\d\.]/g,""))}},{key:"wrap",value:function(e,t){var i=document.createElement(t);return e.parentElement.insertBefore(i,e),i.appendChild(e),i}},{key:"after",value:function(e,t){var i=t.parentNode;i.lastChild===t?i.appendChild(e):i.insertBefore(e,t.nextSibling)}}]),e}();t.a=l},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}i.d(t,"b",function(){return l}),i.d(t,"a",function(){return r});var s=i(0),o=function(){function e(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:500,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;n?o=n:o||(o=document.getElementById("webslides"));var a=e-o.scrollTop,r=o.scrollTop;if(!t)return o.scrollTop=e,void i();!function n(l){l+=16;var u=Math.min(1,l/t),c=s.a.swing(u,l*u,e,a,t);o.scrollTop=Math.floor(r+c*a),l0&&void 0!==arguments[0]?arguments[0]:{},i=t.autoslide,s=void 0!==i&&i,o=t.changeOnClick,a=void 0!==o&&o,r=t.loop,l=void 0===r||r,c=t.minWheelDelta,d=void 0===c?40:c,h=t.navigateOnScroll,f=void 0===h||h,v=t.scrollWait,y=void 0===v?450:v,p=t.slideOffset,m=void 0===p?50:p,b=t.showIndex,w=void 0===b||b;if(n(this,e),this.el=document.getElementById("webslides"),!this.el)throw new Error("Couldn't find the webslides container!");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.options={autoslide:s,changeOnClick:a,loop:l,minWheelDelta:d,navigateOnScroll:f,scrollWait:y,slideOffset:m,showIndex:w},this.initialised=!1,this.removeChildren_(),this.grabSlides_(),this.createPlugins_(),this.initSlides_(),this.onInit_()}return l(e,[{key:"removeChildren_",value:function(){for(var e=this.el.childNodes,t=e.length;t--;){var i=e[t];o.b.isCandidate(i)||this.el.removeChild(i)}}},{key:"createPlugins_",value:function(){var e=this;Object.keys(c).forEach(function(t){var i=c[t];e.plugins[t]=new i(e)})}},{key:"onInit_",value:function(){this.initialised=!0,a.a.fireEvent(this.el,"ws:init"),document.documentElement.classList.add(u.READY)}},{key:"grabSlides_",value:function(){this.slides=a.a.toArray(this.el.childNodes).map(function(e,t){return new o.b(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 i=!1;null!==t?i=t:this.currentSlideI_>=0&&(i=e>this.currentSlideI_);var n=this.slides[e];null===this.currentSlide_||!this.isVertical||this.plugins.touch&&this.plugins.touch.isEnabled?this.transitionToSlide_(i,n,this.onSlideChange_):this.scrollTransitionToSlide_(i,n,this.onSlideChange_)}}},{key:"scrollTransitionToSlide_",value:function(e,t,i){var n=this;this.el.style.overflow="hidden",e?t.show():(t.moveBeforeFirst(),t.show(),Object(r.a)(this.currentSlide_.el.offsetTop,0)),Object(r.a)(t.el.offsetTop,500,function(){n.currentSlide_.hide(),e&&n.currentSlide_.moveAfterLast(),n.el.style.overflow="auto",setTimeout(function(){i.call(n,t)},150)})}},{key:"transitionToSlide_",value:function(e,t,i){var n=this;Object(r.a)(0,0);var s="slideInRight";e||(t.moveBeforeFirst(),s="slideInLeft"),this.currentSlide_&&(e&&this.currentSlide_.moveAfterLast(),this.currentSlide_.hide()),t.show(),this.initialised&&this.plugins.touch&&this.plugins.touch.isEnabled?(a.a.once(t.el,a.a.getAnimationEvent(),function(){t.el.classList.remove(s),i.call(n,t)}),t.el.classList.add(s)):i.call(this,t)}},{key:"onSlideChange_",value:function(e){this.currentSlide_&&this.currentSlide_.disable(),this.currentSlide_=e,this.currentSlideI_=e.i,this.currentSlide_.enable(),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;if(e>=this.maxSlide_){if(!this.options.loop)return;e=0}this.goToSlide(e,!0)}},{key:"goPrev",value:function(){var e=this.currentSlideI_-1;if(e<0){if(!this.options.loop)return;e=this.maxSlide_-1}this.goToSlide(e,!1)}},{key:"isValidIndexSlide_",value:function(e){return"number"==typeof e&&e>=0&&e=this.maxSlide_)&&(e=0),0!==e)for(var t=0;t0&&(this.interval_=setInterval(this.ws_.goNext.bind(this.ws_),e))}},{key:"stop",value:function(){this.interval_&&(clearInterval(this.interval_),this.interval_=null)}}]),e}();t.a=a},function(e,t,i){"use strict";var n=window.CustomEvent,s=function(e,t){var i=document.createEvent("CustomEvent");return t?i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):i.initCustomEvent(e,!1,!1,void 0),i},o=function(){try{var e=new n("t",{detail:{a:"b"}});return"t"===e.type&&"b"===e.detail.a}catch(e){}return!1}()?n:s;t.a=o},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(e,t){for(var i=0;iMath.abs(i);if(this.isGoingUp_=i<0,this.isGoingLeft_=n<0,o){if(s)return;e.preventDefault()}(Math.abs(i+t)>=this.ws_.options.minWheelDelta||Math.abs(n+t)>=this.ws_.options.minWheelDelta)&&(o&&this.isGoingLeft_||!o&&this.isGoingUp_?this.ws_.goPrev():this.ws_.goNext(),e.preventDefault())}}}]),e}();t.a=a},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(3),o=function(){function e(e,t){for(var i=0;i1&&(this.startTouches=e.getTouchCoordinates(t),this.endTouches=this.startTouches,this.isGesture=!0)}}},{key:"onMove_",value:function(t){if(!this.ws_.isDisabled()){var i=e.normalizeEventInfo(t);this.isGesture?this.endTouches=e.getTouchCoordinates(t):(this.endX_=i.x,this.endY_=i.y)}}},{key:"onStop_",value:function(){if(!this.ws_.isDisabled())if(this.isGesture){var e=Math.sqrt(Math.pow(this.startTouches[0].x-this.startTouches[1].x,2)+Math.pow(this.startTouches[0].y-this.startTouches[1].y,2)),t=Math.sqrt(Math.pow(this.endTouches[0].x-this.endTouches[1].x,2)+Math.pow(this.endTouches[0].y-this.endTouches[1].y,2));e>t&&this.ws_.toggleZoom(),this.isGesture=!1}else{var i=this.startX_-this.endX_,n=this.startY_-this.endY_;Math.abs(i)>Math.abs(n)&&(i<-this.ws_.options.slideOffset?this.ws_.goPrev():i>this.ws_.options.slideOffset&&this.ws_.goNext())}}}],[{key:"getTouchCoordinates",value:function(e){return[{x:e.touches[0].clientX,y:e.touches[0].clientY},{x:e.touches[1].clientX,y:e.touches[1].clientY}]}},{key:"normalizeEventInfo",value:function(e){var t={pageX:0,pageY:0};return void 0!==e.changedTouches?t=e.changedTouches[0]:void 0!==e.originalEvent&&void 0!==e.originalEvent.changedTouches&&(t=e.originalEvent.changedTouches[0]),{x:e.offsetX||e.layerX||t.pageX,y:e.offsetY||e.layerY||t.pageY}}}]),e}();t.a=r},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(0),o=i(1),a=function(){function e(e,t){for(var i=0;i