diff --git a/.eslintrc b/.eslintrc index 39c58f0..f9df343 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,7 +8,7 @@ }, "rules": { "no-cond-assign": 0, - "no-console": 2, + "no-console": 0, "no-constant-condition": 2, "no-control-regex": 2, "no-debugger": 2, diff --git a/src/js/plugins/keyboard.js b/src/js/plugins/keyboard.js index 1d38a6a..2527be6 100644 --- a/src/js/plugins/keyboard.js +++ b/src/js/plugins/keyboard.js @@ -29,7 +29,7 @@ export default class Keyboard { let method; let argument; - if (DOM.isFocusableElement()) { + if (DOM.isFocusableElement() || !DOM.isVisible(this.ws_.el)) { return; } diff --git a/src/js/plugins/scroll.js b/src/js/plugins/scroll.js index b909683..e5e27fe 100644 --- a/src/js/plugins/scroll.js +++ b/src/js/plugins/scroll.js @@ -1,3 +1,4 @@ +import DOM from '../utils/dom'; import MobileDetector from '../utils/mobile-detector'; @@ -71,6 +72,10 @@ export default class Scroll { * @private */ onMouseWheel_(event) { + if (!DOM.isVisible(this.ws_.el)) { + return; + } + if (this.ws_.isMoving || this.timeout_) { event.preventDefault(); return; diff --git a/src/js/plugins/touch.js b/src/js/plugins/touch.js index 2b60e4c..d3ce532 100644 --- a/src/js/plugins/touch.js +++ b/src/js/plugins/touch.js @@ -1,3 +1,4 @@ +import DOM from '../utils/dom'; import MobileDetector from '../utils/mobile-detector'; const EVENTS = { @@ -88,6 +89,10 @@ export default class Touch { * @private */ onStart_(event) { + if (!DOM.isVisible(this.ws_.el)) { + return; + } + const info = Touch.normalizeEventInfo(event); this.startX_ = info.x; @@ -102,6 +107,10 @@ export default class Touch { * @private */ onMove_(event) { + if (!DOM.isVisible(this.ws_.el)) { + return; + } + const info = Touch.normalizeEventInfo(event); this.endX_ = info.x; @@ -113,6 +122,10 @@ export default class Touch { * @private */ onStop_() { + if (!DOM.isVisible(this.ws_.el)) { + return; + } + const diffX = this.startX_ - this.endX_; const diffY = this.startY_ - this.endY_; diff --git a/src/js/plugins/zoom.js b/src/js/plugins/zoom.js index ef76a4a..8a6246a 100644 --- a/src/js/plugins/zoom.js +++ b/src/js/plugins/zoom.js @@ -39,14 +39,15 @@ export default class Zoom { this.isZoomed_ = false; this.preBuildZoom_(); - document.addEventListener('keydown', this.onKeyDown.bind(this)); + document.body.addEventListener('keydown', this.onKeyDown.bind(this)); + window.addEventListener('resize', this.onWindowResize.bind(this)); } /** * On key down handler. Will decide if Zoom in or out * @param {Event} event Key down event */ - onKeyDown( event ) { + onKeyDown(event) { if ( !this.isZoomed_ && Keys.MINUS.includes( event.which ) ) { this.zoomIn(); } else if ( this.isZoomed_ && Keys.PLUS.includes( event.which ) ) { @@ -79,27 +80,45 @@ export default class Zoom { wrap.className = CLASSES.WRAP; const div = DOM.wrap(wrap, 'div'); div.className = CLASSES.DIV; + // Adding some layer for controling click events + const divLayer = document.createElement('div'); + divLayer.className = 'zoom-layer'; + divLayer.addEventListener('click', e => { + this.zoomOut(); + this.ws_.goToSlide(elem.i); + }); + wrap.appendChild(divLayer); - // Calculates the margins in relation to window width - const divCSS = window.getComputedStyle(div); - const marginW = DOM.parseSize(divCSS.paddingLeft) - + DOM.parseSize(divCSS.paddingRight); - const marginH = DOM.parseSize(divCSS.paddingTop) - + DOM.parseSize(divCSS.paddingBottom); - - // Sets element size: window size - relative margins - const scale = divCSS.width.includes('%') ? - 100 / DOM.parseSize(divCSS.width) : - window.innerWidth / DOM.parseSize(divCSS.width); - elem.el.style.width = `${window.innerWidth - marginW * scale}px`; - elem.el.style.height = `${window.innerHeight - marginH * scale}px`; - - // Because of flexbox, wrap height is required - const slideCSS = window.getComputedStyle(elem.el); - wrap.style.height = `${DOM.parseSize(slideCSS.height) / scale}px`; + this.setSizes_(div, wrap, elem); }); } + /** + * Sets layers size + * @param {Element} div flexbox element + * @param {Element} wrap wrapping element + * @param {Element} elem slide element + */ + setSizes_(div, wrap, elem) { + // Calculates the margins in relation to window width + const divCSS = window.getComputedStyle(div); + const marginW = DOM.parseSize(divCSS.paddingLeft) + + DOM.parseSize(divCSS.paddingRight); + const marginH = DOM.parseSize(divCSS.paddingTop) + + DOM.parseSize(divCSS.paddingBottom); + + // Sets element size: window size - relative margins + const scale = divCSS.width.includes('%') ? + 100 / DOM.parseSize(divCSS.width) : + window.innerWidth / DOM.parseSize(divCSS.width); + elem.el.style.width = `${window.innerWidth - marginW * scale}px`; + elem.el.style.height = `${window.innerHeight - marginH * scale}px`; + + // Because of flexbox, wrap height is required + const slideCSS = window.getComputedStyle(elem.el); + wrap.style.height = `${DOM.parseSize(slideCSS.height) / scale}px`; + } + /** * Zoom In the slider, scales the slides and uses a grid layout to show them */ @@ -107,6 +126,7 @@ export default class Zoom { DOM.hide(this.ws_.el); DOM.show(this.zws_.el); this.isZoomed_ = true; + document.body.style.overflow = 'auto'; } /** @@ -116,6 +136,19 @@ export default class Zoom { DOM.hide(this.zws_.el); DOM.show(this.ws_.el); this.isZoomed_ = false; + document.body.style.overflow = ''; + } + + /** + * When windows resize it is necessary to recalculate layers sizes + * @param {Event} ev + */ + onWindowResize(ev) { + this.zws_.slides.forEach( elem => { + const wrap = elem.el.parentElement; + const div = wrap.parentElement; + this.setSizes_(div, wrap, elem); + }); } } diff --git a/src/js/utils/dom.js b/src/js/utils/dom.js index ae3487f..df0b609 100644 --- a/src/js/utils/dom.js +++ b/src/js/utils/dom.js @@ -121,6 +121,16 @@ export default class DOM { el.style.display = ''; } + /** + * Checks if the element is visible.This is only intended + * to be used in conjunction with DOM.hide and DOM.show + * @param {Element} el Element to check. + * @return {boolean} + */ + static isVisible(el) { + return el.style.display == ''; + } + /** * Fires a custom event on the given target. * @param {Element} target The target of the event. diff --git a/static/css/base.css b/static/css/base.css index 1909c04..a6d1ccf 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -49,6 +49,7 @@ 14. Forms 15. Safari Bug (flex-wrap) 16. Print + 17. Zoom ----------------------------------------------------------------------------------- */ @@ -315,7 +316,6 @@ html.ws-ready body { #webslides { height: 100vh; overflow-x: hidden; - overflow-y: scroll; -webkit-overflow-scrolling: touch; } /* -- Hide scrollbar, but still being able to scroll -- */ @@ -3192,3 +3192,37 @@ Solution: stackoverflow.com/questions/34250282/flexbox-safari-bug-flex-wrap display: none; } } + + +/*========================================= +16. ZOOM +=========================================== */ + +#webslides-zoomed.grid { + background: #ccc; +} + +#webslides-zoomed.grid > .column { + position: relative; +} +#webslides-zoomed.grid > .column > .wrap-zoom { + position: relative; + background: #fff; +} +#webslides-zoomed.grid > .column { + width: 25%; +} +#webslides-zoomed.grid > .column > .wrap-zoom > .slide { + transform: scale(0.25) translate(-150%, -150vh); + display: flex !important; + position: absolute; + top: 0; + left: 0; + clip: rect(0px auto auto 0); +} +#webslides-zoomed.grid > .column > .wrap-zoom > .zoom-layer { + position: absolute; + background: transparent; + width: 100%; + height: 100%; +} diff --git a/static/js/webslides.js b/static/js/webslides.js index 46191ea..efe2016 100644 --- a/static/js/webslides.js +++ b/static/js/webslides.js @@ -1,7 +1,7 @@ /*! * Name: WebSlides * Version: 1.2.1 - * Date: 2017-04-01 + * Date: 2017-04-05 * Description: Making HTML presentations easy * URL: https://github.com/webslides/webslides#readme * Credits: @jlantunez, @LuisSacristan, @Belelros @@ -231,6 +231,19 @@ var DOM = function () { el.style.display = ''; } + /** + * Checks if the element is visible.This is only intended + * to be used in conjunction with DOM.hide and DOM.show + * @param {Element} el Element to check. + * @return {boolean} + */ + + }, { + key: 'isVisible', + value: function isVisible(el) { + return el.style.display == ''; + } + /** * Fires a custom event on the given target. * @param {Element} target The target of the event. @@ -1531,7 +1544,7 @@ var Keyboard = function () { var method = void 0; var argument = void 0; - if (__WEBPACK_IMPORTED_MODULE_1__utils_dom__["a" /* default */].isFocusableElement()) { + if (__WEBPACK_IMPORTED_MODULE_1__utils_dom__["a" /* default */].isFocusableElement() || !__WEBPACK_IMPORTED_MODULE_1__utils_dom__["a" /* default */].isVisible(this.ws_.el)) { return; } @@ -1778,13 +1791,15 @@ var Navigation = function () { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__ = __webpack_require__(3); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_dom__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_mobile_detector__ = __webpack_require__(3); 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"); } } + /** * Scroll plugin. */ @@ -1827,7 +1842,7 @@ var Scroll = function () { */ this.timeout_ = null; - if (!__WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__["a" /* default */].isAny()) { + if (!__WEBPACK_IMPORTED_MODULE_1__utils_mobile_detector__["a" /* default */].isAny()) { this.scrollContainer_.addEventListener('wheel', this.onMouseWheel_.bind(this)); if (!wsInstance.isVertical) { @@ -1863,6 +1878,10 @@ var Scroll = function () { }, { key: 'onMouseWheel_', value: function onMouseWheel_(event) { + if (!__WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].isVisible(this.ws_.el)) { + return; + } + if (this.ws_.isMoving || this.timeout_) { event.preventDefault(); return; @@ -1909,13 +1928,15 @@ var Scroll = function () { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__ = __webpack_require__(3); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_dom__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_mobile_detector__ = __webpack_require__(3); 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 EVENTS = { touch: { START: 'touchstart', @@ -1984,9 +2005,9 @@ var Touch = function () { var events = void 0; - if (__WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__["a" /* default */].isAny()) { + if (__WEBPACK_IMPORTED_MODULE_1__utils_mobile_detector__["a" /* default */].isAny()) { // Likely IE - if (window.PointerEvent && (__WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__["a" /* default */].isWindows() || __WEBPACK_IMPORTED_MODULE_0__utils_mobile_detector__["a" /* default */].isWindowsPhone())) { + if (window.PointerEvent && (__WEBPACK_IMPORTED_MODULE_1__utils_mobile_detector__["a" /* default */].isWindows() || __WEBPACK_IMPORTED_MODULE_1__utils_mobile_detector__["a" /* default */].isWindowsPhone())) { events = EVENTS.pointer; } else { events = EVENTS.touch; @@ -2010,6 +2031,10 @@ var Touch = function () { _createClass(Touch, [{ key: 'onStart_', value: function onStart_(event) { + if (!__WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].isVisible(this.ws_.el)) { + return; + } + var info = Touch.normalizeEventInfo(event); this.startX_ = info.x; @@ -2027,6 +2052,10 @@ var Touch = function () { }, { key: 'onMove_', value: function onMove_(event) { + if (!__WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].isVisible(this.ws_.el)) { + return; + } + var info = Touch.normalizeEventInfo(event); this.endX_ = info.x; @@ -2041,6 +2070,10 @@ var Touch = function () { }, { key: 'onStop_', value: function onStop_() { + if (!__WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].isVisible(this.ws_.el)) { + return; + } + var diffX = this.startX_ - this.endX_; var diffY = this.startY_ - this.endY_; @@ -2436,7 +2469,8 @@ var Zoom = function () { this.isZoomed_ = false; this.preBuildZoom_(); - document.addEventListener('keydown', this.onKeyDown.bind(this)); + document.body.addEventListener('keydown', this.onKeyDown.bind(this)); + window.addEventListener('resize', this.onWindowResize.bind(this)); } /** @@ -2484,24 +2518,44 @@ var Zoom = function () { wrap.className = CLASSES.WRAP; var div = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].wrap(wrap, 'div'); div.className = CLASSES.DIV; + // Adding some layer for controling click events + var divLayer = document.createElement('div'); + divLayer.className = 'zoom-layer'; + divLayer.addEventListener('click', function (e) { + _this.zoomOut(); + _this.ws_.goToSlide(elem.i); + }); + wrap.appendChild(divLayer); - // Calculates the margins in relation to window width - var divCSS = window.getComputedStyle(div); - var marginW = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.paddingLeft) + __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.paddingRight); - var marginH = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.paddingTop) + __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.paddingBottom); - - // Sets element size: window size - relative margins - console.log(window.innerWidth, divCSS.width); - var scale = divCSS.width.includes('%') ? 100 / __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.width) : window.innerWidth / __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.width); - elem.el.style.width = window.innerWidth - marginW * scale + 'px'; - elem.el.style.height = window.innerHeight - marginH * scale + 'px'; - - // Because of flexbox, wrap height is required - var slideCSS = window.getComputedStyle(elem.el); - wrap.style.height = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(slideCSS.height) / scale + 'px'; + _this.setSizes_(div, wrap, elem); }); } + /** + * Sets layers size + * @param {Element} div flexbox element + * @param {Element} wrap wrapping element + * @param {Element} elem slide element + */ + + }, { + key: 'setSizes_', + value: function setSizes_(div, wrap, elem) { + // Calculates the margins in relation to window width + var divCSS = window.getComputedStyle(div); + var marginW = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.paddingLeft) + __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.paddingRight); + var marginH = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.paddingTop) + __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.paddingBottom); + + // Sets element size: window size - relative margins + var scale = divCSS.width.includes('%') ? 100 / __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.width) : window.innerWidth / __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(divCSS.width); + elem.el.style.width = window.innerWidth - marginW * scale + 'px'; + elem.el.style.height = window.innerHeight - marginH * scale + 'px'; + + // Because of flexbox, wrap height is required + var slideCSS = window.getComputedStyle(elem.el); + wrap.style.height = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].parseSize(slideCSS.height) / scale + 'px'; + } + /** * Zoom In the slider, scales the slides and uses a grid layout to show them */ @@ -2512,6 +2566,7 @@ var Zoom = function () { __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].hide(this.ws_.el); __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].show(this.zws_.el); this.isZoomed_ = true; + document.body.style.overflow = 'auto'; } /** @@ -2524,6 +2579,24 @@ var Zoom = function () { __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].hide(this.zws_.el); __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].show(this.ws_.el); this.isZoomed_ = false; + document.body.style.overflow = ''; + } + + /** + * When windows resize it is necessary to recalculate layers sizes + * @param {Event} ev + */ + + }, { + key: 'onWindowResize', + value: function onWindowResize(ev) { + var _this2 = this; + + this.zws_.slides.forEach(function (elem) { + var wrap = elem.el.parentElement; + var div = wrap.parentElement; + _this2.setSizes_(div, wrap, elem); + }); } }]); diff --git a/static/js/webslides.min.js b/static/js/webslides.min.js index 70edc04..81facfd 100644 --- a/static/js/webslides.min.js +++ b/static/js/webslides.min.js @@ -1,9 +1,9 @@ /*! * Name: WebSlides * Version: 1.2.1 - * Date: 2017-04-01 + * Date: 2017-04-05 * Description: Making HTML presentations easy * URL: https://github.com/webslides/webslides#readme * Credits: @jlantunez, @LuisSacristan, @Belelros */ -!function(e){function t(i){if(n[i])return n[i].exports;var a=n[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};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=5)}([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 a=n(18),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:"once",value:function(e,t,n){var i=function i(a){a.target===e&&(e.removeEventListener(t,i),n(a))};e.addEventListener(t,i,!1)}},{key:"getTransitionEvent",value:function(){if(r)return r;for(var e=document.createElement("ws"),t={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},n=Object.keys(t),i=0,a=n.length;i2&&void 0!==arguments[2]?arguments[2]:{},i=new a.a(t,{detail:n});e.dispatchEvent(i)}},{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;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,n){var e=document.createElement(n);return t.parentElement.insertBefore(e,t),e.appendChild(t),e}},{key:"after",value:function(e,t){var n=t.parentNode;n.lastChild==t?n.appendChild(e):n.insertBefore(e,t.nextSibling)}}]),e}();t.a=l},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 a=n(0),o=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.autoslide,a=void 0!==n&&n,o=t.changeOnClick,r=void 0!==o&&o,s=t.loop,l=void 0===s||s,c=t.minWheelDelta,h=void 0===c?40:c,d=t.scrollWait,f=void 0===d?450:d,v=t.slideOffset,y=void 0===v?50:v;if(i(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:a,changeOnClick:r,loop:l,minWheelDelta:h,scrollWait:f,slideOffset:y},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 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(){this.initialised=!0,r.a.fireEvent(this.el,"ws:init"),document.documentElement.classList.add(u.READY)}},{key:"grabSlides_",value:function(){this.slides=r.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 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 a=this;this.el.style.overflow="hidden",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(){a.currentSlide_.hide(),e&&a.currentSlide_.moveAfterLast(),a.el.style.overflow="auto",setTimeout(function(){i.call(a,t)},150)})}},{key:"transitionToSlide_",value:function(e,t,i){var a=this;n.i(s.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?(r.a.once(t.el,r.a.getAnimationEvent(),function(){t.el.classList.remove(o),i.call(a,t)}),t.el.classList.add(o)):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,r.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 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=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 a=function(){function e(e,t){for(var n=0;nMath.abs(t);if(this.isGoingUp_=t<0,this.isGoingLeft_=n<0,a){if(i)return;e.preventDefault()}(Math.abs(t)>=this.ws_.options.minWheelDelta||Math.abs(n)>=this.ws_.options.minWheelDelta)&&(a&&this.isGoingLeft_||!a&&this.isGoingUp_?this.ws_.goPrev():this.ws_.goNext(),e.preventDefault())}}]),e}();t.a=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 a=n(3),o=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={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=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 a=n(0),o=n(1),r=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=e-o.scrollTop,r=o.scrollTop;if(!t)return o.scrollTop=e,void n();!function s(l){l+=16;var u=Math.min(1,l/t),c=a.a.swing(u,l*u,e,i,t);o.scrollTop=Math.floor(r+c*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:"once",value:function(e,t,n){var i=function i(a){a.target===e&&(e.removeEventListener(t,i),n(a))};e.addEventListener(t,i,!1)}},{key:"getTransitionEvent",value:function(){if(s)return s;for(var e=document.createElement("ws"),t={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},n=Object.keys(t),i=0,a=n.length;i2&&void 0!==arguments[2]?arguments[2]:{},i=new a.a(t,{detail:n});e.dispatchEvent(i)}},{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;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,n){var e=document.createElement(n);return t.parentElement.insertBefore(e,t),e.appendChild(t),e}},{key:"after",value:function(e,t){var n=t.parentNode;n.lastChild==t?n.appendChild(e):n.insertBefore(e,t.nextSibling)}}]),e}();t.a=l},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 a=n(0),o=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.autoslide,a=void 0!==n&&n,o=t.changeOnClick,s=void 0!==o&&o,r=t.loop,l=void 0===r||r,c=t.minWheelDelta,h=void 0===c?40:c,d=t.scrollWait,f=void 0===d?450:d,v=t.slideOffset,y=void 0===v?50:v;if(i(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:a,changeOnClick:s,loop:l,minWheelDelta:h,scrollWait:f,slideOffset:y},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 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(){this.initialised=!0,s.a.fireEvent(this.el,"ws:init"),document.documentElement.classList.add(u.READY)}},{key:"grabSlides_",value:function(){this.slides=s.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 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 a=this;this.el.style.overflow="hidden",e?t.show():(t.moveBeforeFirst(),t.show(),n.i(r.a)(this.currentSlide_.el.offsetTop,0)),n.i(r.a)(t.el.offsetTop,500,function(){a.currentSlide_.hide(),e&&a.currentSlide_.moveAfterLast(),a.el.style.overflow="auto",setTimeout(function(){i.call(a,t)},150)})}},{key:"transitionToSlide_",value:function(e,t,i){var a=this;n.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?(s.a.once(t.el,s.a.getAnimationEvent(),function(){t.el.classList.remove(o),i.call(a,t)}),t.el.classList.add(o)):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,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;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 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=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 a=function(){function e(e,t){for(var n=0;nMath.abs(t);if(this.isGoingUp_=t<0,this.isGoingLeft_=n<0,o){if(i)return;e.preventDefault()}(Math.abs(t)>=this.ws_.options.minWheelDelta||Math.abs(n)>=this.ws_.options.minWheelDelta)&&(o&&this.isGoingLeft_||!o&&this.isGoingUp_?this.ws_.goPrev():this.ws_.goNext(),e.preventDefault())}}}]),e}();t.a=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 a=n(0),o=n(3),s=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={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=l},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 a=n(0),o=n(1),s=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=e-o.scrollTop,s=o.scrollTop;if(!t)return o.scrollTop=e,void n();!function r(l){l+=16;var u=Math.min(1,l/t),c=a.a.swing(u,l*u,e,i,t);o.scrollTop=Math.floor(s+c*i),l .column { + width: 25%; +} #webslides-zoomed.grid > .column > .wrap-zoom > .slide { transform: scale(0.25) translate(-150%, -150vh); display: flex !important; - position: absolute; - top: 0; - left: 0; - clip: rect(0px auto auto 0); -} - - - - -.enorme { - position: absolute; - top: 0; - left: 0; - font-size: 500px; + position: absolute; + top: 0; + left: 0; + clip: rect(0px auto auto 0); +} +#webslides-zoomed.grid > .column > .wrap-zoom > .zoom-layer { + position: absolute; + background: transparent; + width: 100%; + height: 100%; }