mirror of
https://github.com/wezm/wezm.net.git
synced 2024-11-14 19:38:00 +00:00
9 lines
No EOL
30 KiB
JavaScript
9 lines
No EOL
30 KiB
JavaScript
/*!
|
|
* Name: WebSlides
|
|
* Version: 1.4.2
|
|
* Date: 2017-09-12
|
|
* Description: Making HTML presentations easy
|
|
* 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.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=5)}([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(9),o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a="",r="",l=function(){function e(){n(this,e)}return o(e,null,[{key:"createNode",value:function(e){var t=arguments.length>1&&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;s<o&&!a;s++){var r=n[s];void 0!==t.style[r]&&(a=i[r])}return a}},{key:"getAnimationEvent",value:function(e){if(r&&!e)return r;r="animationend";for(var t=e||document.createElement("ws"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"},n=Object.keys(i),s=0,o=n.length;s<o;s++){var a=n[s];if(void 0!==t.style[a]){r=i[a];break}}return r}},{key:"hide",value:function(e){e.style.display="none"}},{key:"show",value:function(e){e.style.display=""}},{key:"isVisible",value:function(e){return null!==e.offsetParent}},{key:"fireEvent",value:function(e,t){var i=arguments.length>2&&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;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a={SLIDE:"slide",CURRENT:"current"},r={ENTER:"dom:enter",LEAVE:"dom:leave",ENABLE:"slide:enable",DISABLE:"slide:disable"},l=function(){function e(t,i){n(this,e),this.el=t,this.parent=t.parentNode,this.i=i,this.el.id="section-"+(i+1),this.el.classList.add(a.SLIDE),this.hide()}return o(e,[{key:"hide",value:function(){s.a.hide(this.el),this.el.classList.remove(a.CURRENT)}},{key:"show",value:function(){s.a.show(this.el),this.el.classList.add(a.CURRENT)}},{key:"moveAfterLast",value:function(){var e=this.parent.childNodes[this.parent.childElementCount-1];this.fire_(r.LEAVE),this.parent.insertBefore(this.el,e.nextSibling),this.fire_(r.ENTER)}},{key:"moveBeforeFirst",value:function(){var e=this.parent.childNodes[0];this.fire_(r.LEAVE),this.parent.insertBefore(this.el,e),this.fire_(r.ENTER)}},{key:"enable",value:function(){this.fire_(r.ENABLE)}},{key:"disable",value:function(){this.fire_(r.DISABLE)}},{key:"fire_",value:function(e){s.a.fireEvent(this.el,e,{slide:this})}}],[{key:"isCandidate",value:function(e){return 1===e.nodeType&&"SECTION"===e.tagName}},{key:"getSectionFromEl",value:function(e){for(var t=e,i=null,n=null;t.parentElement&&!t.classList.contains(a.SLIDE);)t=t.parentElement;return t.classList.contains(a.SLIDE)&&(i=t,n=parseInt(i.id.replace("section-",""),10)),{section:i,i:n}}}]),e}()},function(e,t,i){"use strict";var n={ENTER:13,SPACE:32,RE_PAGE:33,AV_PAGE:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PLUS:[107,171,187],MINUS:[109,173,189],ESCAPE:27,F:70};t.a=n},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;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),o=window.navigator.userAgent,a=function(){function e(){n(this,e)}return s(e,null,[{key:"isAndroid",value:function(){return!!o.match(/Android/i)}},{key:"isBlackBerry",value:function(){return!!o.match(/BlackBerry/i)}},{key:"isiOS",value:function(){return!!o.match(/iPad|iPhone|iPod/i)}},{key:"isOpera",value:function(){return!!o.match(/Opera Mini/i)}},{key:"isWindows",value:function(){return!!o.match(/IEMobile/i)}},{key:"isWindowsPhone",value:function(){return!!o.match(/Windows Phone/i)}},{key:"isAny",value:function(){return e.isAndroid()||e.isBlackBerry()||e.isiOS()||e.isOpera()||e.isWindows()||e.isWindowsPhone()}}]),e}();t.a=a},function(e,t,i){"use strict";function n(e){var t=arguments.length>1&&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;o=n||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),l<t?setTimeout(function(){return n(l)},16):i()}(0)}t.a=n;var s=i(20),o=document.getElementById("webslides")},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(6);i(21),window.WebSlides=n.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(7),o=i(1),a=i(0),r=i(4),l=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u={VERTICAL:"vertical",READY:"ws-ready",DISABLED:"disabled"},c={autoslide:s.a.AutoSlide,clickNav:s.a.ClickNav,grid:s.a.Grid,hash:s.a.Hash,keyboard:s.a.Keyboard,nav:s.a.Navigation,scroll:s.a.Scroll,touch:s.a.Touch,video:s.a.Video,youtube:s.a.YouTube,zoom:s.a.Zoom},d=function(){function e(){var t=arguments.length>0&&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_}},{key:"initSlides_",value:function(){var e=this.plugins.hash.constructor.getSlideNumber();if((null===e||e>=this.maxSlide_)&&(e=0),0!==e)for(var t=0;t<e;)this.slides[t].moveAfterLast(),t++;this.goToSlide(e)}},{key:"toggleZoom",value:function(){this.options.showIndex&&this.plugins.zoom.toggleZoom()}},{key:"disable",value:function(){this.el.classList.add(u.DISABLED),this.plugins.autoslide&&!1!==this.plugins.autoslide.time&&this.plugins.autoslide.stop()}},{key:"enable",value:function(){this.el.classList.remove(u.DISABLED),this.plugins.autoslide&&!1!==this.plugins.autoslide.time&&this.plugins.autoslide.play()}},{key:"isDisabled",value:function(){return this.el.classList.contains(u.DISABLED)}},{key:"fullscreen",value:function(){var e=document.documentElement;document.fullscreen||document.webkitIsFullScreen||document.mozFullScreen||document.msFullScreenElement?(document.exitFullScreen||document.webkitCancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen).call(document):(e.requestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen).call(e)}}],[{key:"registerPlugin",value:function(e,t){c[e]=t}}]),e}();t.a=d},function(e,t,i){"use strict";var n=i(8),s=i(10),o=i(11),a=i(12),r=i(13),l=i(14),u=i(15),c=i(16),d=i(17),h=i(18),f=i(19);t.a={AutoSlide:n.a,ClickNav:s.a,Grid:o.a,Hash:a.a,Keyboard:r.a,Navigation:l.a,Scroll:u.a,Touch:c.a,Video:d.a,YouTube:h.a,Zoom:f.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(0),o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=function(){function e(t){n(this,e),this.ws_=t,this.interval_=null,this.time=this.ws_.options.autoslide,this.time&&(s.a.once(t.el,"ws:init",this.play.bind(this)),document.body.addEventListener("focus",this.onFocus.bind(this)))}return o(e,[{key:"onFocus",value:function(){s.a.isFocusableElement()?this.stop():null===this.interval_&&this.play()}},{key:"play",value:function(e){"number"!=typeof e&&(e=this.time),this.time=e,!this.interval_&&"number"==typeof e&&e>0&&(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;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),o=["INPUT","SELECT","OPTION","BUTTON","A","TEXTAREA"],a=function(){function e(t){n(this,e),this.ws_=t,t.options.changeOnClick&&this.ws_.el.addEventListener("click",this.onClick_.bind(this))}return s(e,[{key:"onClick_",value:function(e){o.indexOf(e.target.tagName)<0&&void 0===e.target.dataset.preventNav&&this.ws_.goNext()}}]),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(2),o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAgMAAACdGdVrAAAACVBMVEUAAAAtXsUtXcPDDPUWAAAAA3RSTlMAZmHzZFkxAAAAFklEQVQI12MAA9bBR3ExhAJB1iooBQBGwgVEs/QtuAAAAABJRU5ErkJggg==",r=function(){function e(t){n(this,e),this.ws_=t;var i="body.baseline {\n background: url("+a+") left top .8rem/.8rem;\n }",s=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",o.styleSheet?o.styleSheet.cssText=i:o.appendChild(document.createTextNode(i)),s.appendChild(o),document.addEventListener("keydown",this.onKeyPress_.bind(this),!1)}return o(e,[{key:"onKeyPress_",value:function(e){e.which===s.a.ENTER&&document.body.classList.toggle("baseline")}}]),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=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),o=/#slide=(\d+)/,a=function(){function e(t){n(this,e),this.ws_=t,t.el.addEventListener("ws:slide-change",e.onSlideChange_),window.addEventListener("hashchange",this.onHashChange_.bind(this),!1)}return s(e,[{key:"onHashChange_",value:function(){var t=e.getSlideNumber();null!==t&&this.ws_.goToSlide(t)}}],[{key:"onSlideChange_",value:function(t){e.setSlideNumber(t.detail.currentSlide)}},{key:"getSlideNumber",value:function(){var e=document.location.hash.match(o),t=0;return Array.isArray(e)&&(t=parseInt(e[1],10)),"number"!=typeof t||t<0||!Array.isArray(e)?t=null:t--,t}},{key:"setSlideNumber",value:function(t){e.getSlideNumber()!==t-1&&history.pushState({slideI:t-1},"Slide "+t,"#slide="+t)}}]),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(2),o=i(0),a=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=function(){function e(t){n(this,e),this.ws_=t,document.addEventListener("keydown",this.onKeyPress_.bind(this),!1)}return a(e,[{key:"onKeyPress_",value:function(e){var t=void 0,i=void 0;if(!o.a.isFocusableElement()&&!this.ws_.isDisabled()){switch(e.which){case s.a.AV_PAGE:case s.a.SPACE:t=this.ws_.goNext;break;case s.a.RE_PAGE:t=this.ws_.goPrev;break;case s.a.HOME:t=this.ws_.goToSlide,i=0;break;case s.a.END:t=this.ws_.goToSlide,i=this.ws_.maxSlide_-1;break;case s.a.DOWN:t=this.ws_.isVertical?this.ws_.goNext:null;break;case s.a.UP:t=this.ws_.isVertical?this.ws_.goPrev:null;break;case s.a.LEFT:t=this.ws_.isVertical?null:this.ws_.goPrev;break;case s.a.RIGHT:t=this.ws_.isVertical?null:this.ws_.goNext;break;case s.a.F:t=this.ws_.fullscreen}t&&(t.call(this.ws_,i),e.preventDefault())}}}]),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=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a={NAV:"navigation",NEXT:"next",PREV:"previous",COUNTER:"counter"},r={VERTICAL:{NEXT:"↓",PREV:"↑"},HORIZONTAL:{NEXT:"→",PREV:"←"}},l=function(){function e(t){n(this,e);var i=t.isVertical?r.VERTICAL:r.HORIZONTAL;this.el=s.a.createNode("div","navigation"),this.next=e.createArrow(a.NEXT,i.NEXT),this.prev=e.createArrow(a.PREV,i.PREV),this.counter=e.createCounter(a.COUNTER,t),this.ws_=t,this.el.appendChild(this.next),this.el.appendChild(this.prev),this.el.appendChild(this.counter),this.ws_.el.appendChild(this.el),this.bindEvents_()}return o(e,[{key:"bindEvents_",value:function(){this.ws_.el.addEventListener("ws:slide-change",this.onSlideChanged_.bind(this)),this.next.addEventListener("click",this.onButtonClicked_.bind(this)),this.prev.addEventListener("click",this.onButtonClicked_.bind(this)),this.counter.addEventListener("click",this.onButtonClicked_.bind(this))}},{key:"updateCounter",value:function(e,t){this.ws_.options.showIndex?this.counter.childNodes[0].textContent=e+" / "+t:this.counter.textContent=e+" / "+t}},{key:"onSlideChanged_",value:function(e){this.updateCounter(e.detail.currentSlide,e.detail.slides)}},{key:"onButtonClicked_",value:function(e){e.preventDefault(),e.target===this.next?this.ws_.goNext():e.target===this.prev?this.ws_.goPrev():this.ws_.toggleZoom()}}],[{key:"createArrow",value:function(e,t){var i=s.a.createNode("a",e,t);return i.href="#",i.title="Arrow Keys",i}},{key:"createCounter",value:function(e,t){var i=s.a.createNode("span",e);if(t.options.showIndex){var n=document.createElement("a");n.href="#",n.title="View all slides",i.appendChild(n)}return i}}]),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")}var s=i(3),o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=function(){function e(t){n(this,e),this.ws_=t,this.scrollContainer_=t.el,this.isGoingUp_=!1,this.isGoingLeft_=!1,this.timeout_=null,this.ws_.options.navigateOnScroll&&(s.a.isAny()||(this.scrollContainer_.addEventListener("wheel",this.onMouseWheel_.bind(this)),t.isVertical||t.el.addEventListener("ws:slide-change",this.onSlideChange_.bind(this))))}return o(e,[{key:"onSlideChange_",value:function(){var e=this;this.timeout_=setTimeout(function(){e.timeout_=null},this.ws_.options.scrollWait)}},{key:"onMouseWheel_",value:function(e){if(!this.ws_.isDisabled()){if(this.ws_.isMoving||this.timeout_)return void e.preventDefault();var t=e.deltaMode*this.ws_.options.minWheelDelta,i=e.deltaY,n=e.deltaX,s=this.ws_.isVertical,o=Math.abs(n)>Math.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;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a={touch:{START:"touchstart",MOVE:"touchmove",END:"touchend"},pointer:{START:"pointerdown",MOVE:"pointermove",END:"pointerup"}},r=function(){function e(t){n(this,e),this.ws_=t,this.startX_=0,this.startY_=0,this.endX_=0,this.endY_=0,this.isEnabled=!1,this.isGesture=!1,this.startTouches=[],this.endTouches=[];var i=void 0;s.a.isAny()&&(i=window.PointerEvent&&(s.a.isWindows()||s.a.isWindowsPhone())?a.pointer:a.touch,this.isEnabled=!0,document.addEventListener(i.START,this.onStart_.bind(this),!1),document.addEventListener(i.MOVE,this.onMove_.bind(this),!1),document.addEventListener(i.END,this.onStop_.bind(this),!1))}return o(e,[{key:"onStart_",value:function(t){if(!this.ws_.isDisabled()){var i=e.normalizeEventInfo(t);1===t.touches.length?(this.startX_=i.x,this.startY_=i.y,this.endX_=i.x,this.endY_=i.y):t.touches.length>1&&(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<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=function(){function e(t){n(this,e),this.ws_=t;var i=s.a.toArray(this.ws_.el.querySelectorAll("video"));i.length&&i.forEach(function(i){if(i.hasAttribute("autoplay")){i.removeAttribute("autoplay"),i.pause(),i.currentTime=0;var n=o.b.getSectionFromEl(i),s=n.i,a=t.slides[s-1];a.video=i,a.el.addEventListener(o.a.ENABLE,e.onSectionEnabled),a.el.addEventListener(o.a.DISABLE,e.onSectionDisabled)}})}return a(e,null,[{key:"onSectionEnabled",value:function(e){e.detail.slide.video.play()}},{key:"onSectionDisabled",value:function(e){e.detail.slide.video.pause()}}]),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<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=function(){function e(t){n(this,e),this.ready=!1,this.onReadyCb=null,this.slide=o.b.getSectionFromEl(t).section,this.autoplay=void 0!==t.dataset.autoplay,this.isMuted=void 0!==t.dataset.mute,this.options={videoId:t.dataset.youtubeId,playerVars:this.getPlayerVars(t),events:{onReady:this.onPlayerReady.bind(this)}},this.el=t,this.timeout=null,this.create()}return a(e,[{key:"destroy",value:function(){this.currentTime=this.player.getCurrentTime(),this.player.destroy(),this.player=null,this.el=this.slide.querySelector("[data-youtube]"),this.ready=!1}},{key:"create",value:function(){this.player=new YT.Player(this.el,this.options),this.el=this.player.getIframe()}},{key:"onPlayerReady",value:function(){this.ready=!0,this.currentTime&&(this.player.seekTo(this.currentTime,!0),this.player.pauseVideo(),this.currentTime=null),this.timeout&&1!==this.player.getPlayerState()&&this.play(),this.onReadyCb&&(this.onReadyCb(),this.onReadyCb=null)}},{key:"play",value:function(){var e=this;this.ready?(this.timeout=setTimeout(function(){e.timeout=null},1e3),this.isMuted?this.player.mute():this.player.unMute(),this.player.playVideo()):this.onReadyCb=this.play}},{key:"pause",value:function(){this.player&&this.player.pauseVideo&&1===this.player.getPlayerState()&&this.player.pauseVideo()}},{key:"getPlayerVars",value:function(e){var t={modestbranding:1,rel:0,origin:window.location.origin};return this.slide.classList.contains("fullscreen")&&(t.disablekb=1),void 0!==e.dataset.noControls&&(t.controls=0,t.showinfo=0),void 0!==e.dataset.loop&&(t.loop=1,t.playlist=e.dataset.youtubeId),t}}]),e}(),l=function(){function e(t){n(this,e),this.ws_=t,this.videos=s.a.toArray(this.ws_.el.querySelectorAll("[data-youtube]")),this.videos.length&&this.inject()}return a(e,[{key:"onYTReady",value:function(){var t=this;this.videos.forEach(function(i){var n=new r(i);if(void 0!==i.dataset.autoplay){var s=o.b.getSectionFromEl(n.el),a=s.i,l=t.ws_.slides[a-1];l.player=n,l.el.addEventListener(o.a.ENABLE,e.onSlideEvent),l.el.addEventListener(o.a.DISABLE,e.onSlideEvent),l.el.addEventListener(o.a.ENTER,e.onSlideEvent),l.el.addEventListener(o.a.LEAVE,e.onSlideEvent),t.ws_.currentSlide_===l&&e.onSectionEnabled(l)}})}},{key:"inject",value:function(){window.onYouTubeIframeAPIReady=this.onYTReady.bind(this);var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}}],[{key:"onSlideEvent",value:function(t){var i=t.detail.slide;switch(t.type){case o.a.ENABLE:e.onSectionEnabled(i);break;case o.a.DISABLE:e.onSectionDisabled(i);break;case o.a.LEAVE:i.player.destroy();break;case o.a.ENTER:i.player.create()}}},{key:"onSectionEnabled",value:function(e){e.player.autoplay&&e.player.play()}},{key:"onSectionDisabled",value:function(e){e.player.pause()}}]),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")}var s=i(0),o=i(2),a=i(4),r=i(1),l=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u={ZOOM:"grid",DIV:"column",WRAP:"wrap-zoom",WRAP_CONTAINER:"wrap",CURRENT:"current",SLIDE:"slide",ZOOM_ENABLED:"ws-ready-zoom"},c=function(){function e(t){n(this,e),this.ws_=t,this.zws_={},this.isZoomed_=!1,this.preBuildZoom_(),document.body.addEventListener("keydown",this.onKeyDown.bind(this))}return l(e,[{key:"onKeyDown",value:function(e){!this.isZoomed_&&o.a.MINUS.some(function(t){return t===e.which})?this.zoomIn():this.isZoomed_&&(o.a.PLUS.some(function(t){return t===e.which})||e.which===o.a.ESCAPE)&&this.zoomOut()}},{key:"preBuildZoom_",value:function(){var e=this;this.zws_.el=this.ws_.el.cloneNode(),this.zws_.el.id="webslides-zoomed",this.zws_.wrap=s.a.createNode("div"),this.zws_.wrap.className=u.WRAP_CONTAINER,this.zws_.el.appendChild(this.zws_.wrap),this.zws_.grid=s.a.createNode("div"),this.zws_.grid.className=u.ZOOM,this.zws_.wrap.appendChild(this.zws_.grid),this.zws_.el.addEventListener("click",function(){return e.toggleZoom()}),this.zws_.slides=[].map.call(this.ws_.slides,function(t,i){var n=t.el.cloneNode(!0);return e.zws_.grid.appendChild(n),new r.b(n,i)}),this.disable(),s.a.after(this.zws_.el,this.ws_.el),this.zws_.slides.forEach(function(t){return e.createSlideBlock_(t)})}},{key:"createSlideBlock_",value:function(e){var t=this,i=s.a.wrap(e.el,"div");i.className=u.WRAP,i.setAttribute("id","zoomed-"+e.el.getAttribute("id"));var n=s.a.wrap(i,"div");n.className=u.DIV;var o=s.a.createNode("div");o.className="zoom-layer",o.addEventListener("click",function(i){i.stopPropagation(),t.zoomOut(),t.ws_.goToSlide(e.i)}),i.appendChild(o);var a=s.a.createNode("p","",""+(e.i+1));a.className="text-slide-number",n.appendChild(a)}},{key:"toggleZoom",value:function(){this.isZoomed_?this.zoomOut():this.zoomIn()}},{key:"zoomIn",value:function(){var e=this;if(this.ws_.options.showIndex){this.enable();var t=this.ws_.currentSlide_.el.id,i=this.zws_.el.querySelector("."+u.WRAP+"."+u.CURRENT);i&&i.classList.remove(u.CURRENT);var n=this.zws_.el.querySelector("#zoomed-"+t);n.classList.add(u.CURRENT),this.isZoomed_=!0,document.documentElement.classList.add(u.ZOOM_ENABLED),setTimeout(function(){e.ws_.disable(),e.zws_.el.classList.add("in");var t=window.getComputedStyle(e.zws_.grid),i=document.body;Object(a.a)(n.parentNode.offsetTop+s.a.parseSize(t.paddingTop),50,function(){},i)},50)}}},{key:"zoomOut",value:function(){var e=this;this.ws_.options.showIndex&&(this.zws_.el.classList.remove("in"),setTimeout(function(){e.ws_.enable(),e.disable(),e.isZoomed_=!1,document.documentElement.classList.remove(u.ZOOM_ENABLED)},400))}},{key:"disable",value:function(){this.zws_.el.classList.add("disabled")}},{key:"enable",value:function(){this.zws_.el.classList.remove("disabled")}}]),e}();t.a=c},function(e,t,i){"use strict";function n(e){return.5-Math.cos(e*Math.PI)/2}t.a={swing:n}},function(e,t){}]); |