ClickHouse/doc/presentations/tbd/shower/shower.min.js

8 lines
36 KiB
JavaScript
Raw Normal View History

2017-02-18 05:28:18 +00:00
/**
* Core for Shower HTML presentation engine
* shower-core v2.0.7, https://github.com/shower/core
* @copyright 20102016 Vadim Makeev, http://pepelsbey.net/
* @license MIT
*/
!function(a){var b,c={NOT_RESOLVED:"NOT_RESOLVED",IN_RESOLVING:"IN_RESOLVING",RESOLVED:"RESOLVED"},d=function(){var l={trackCircularDependencies:!0,allowMultipleDeclarations:!0},m={},n=!1,o=[],p=function(a,d,e){e||(e=d,d=[]);var f=m[a];f||(f=m[a]={name:a,decl:b}),f.decl={name:a,prev:f.decl,fn:e,state:c.NOT_RESOLVED,deps:d,dependents:[],exports:b}},q=function(b,c,d){"string"==typeof b&&(b=[b]),n||(n=!0,k(v)),o.push({deps:b,cb:function(b,f){f?(d||e)(f):c.apply(a,b)}})},r=function(a){var b=m[a];return b?c[b.decl.state]:"NOT_DEFINED"},s=function(a){return!!m[a]},t=function(a){for(var b in a)a.hasOwnProperty(b)&&(l[b]=a[b])},u=function(){var a,b={};for(var c in m)m.hasOwnProperty(c)&&(a=m[c],(b[a.decl.state]||(b[a.decl.state]=[])).push(c));return b},v=function(){n=!1,w()},w=function(){var a,b=o,c=0;for(o=[];a=b[c++];)x(null,a.deps,[],a.cb)},x=function(a,b,c,d){var e=b.length;e||d([]);for(var g,h,i=[],j=function(a,b){if(b)return void d(null,b);if(!--e){for(var c,f=[],g=0;c=i[g++];)f.push(c.exports);d(f)}},k=0,l=e;k<l;){if(g=b[k++],"string"==typeof g){if(!m[g])return void d(null,f(g,a));h=m[g].decl}else h=g;i.push(h),y(h,c,j)}},y=function(b,d,e){if(b.state===c.RESOLVED)return void e(b.exports);if(b.state===c.IN_RESOLVING)return void(l.trackCircularDependencies&&j(b,d)?e(null,g(b,d)):b.dependents.push(e));if(b.dependents.push(e),b.prev&&!l.allowMultipleDeclarations)return void A(b,i(b));l.trackCircularDependencies&&(d=d.slice()).push(b);var f=!1,k=b.prev?b.deps.concat([b.prev]):b.deps;b.state=c.IN_RESOLVING,x(b,k,d,function(c,d){return d?void A(b,d):(c.unshift(function(a,c){return f?void e(null,h(b)):(f=!0,void(c?A(b,c):z(b,a)))}),void b.fn.apply({name:b.name,deps:b.deps,global:a},c))})},z=function(a,d){a.exports=d,a.state=c.RESOLVED;for(var e,f=0;e=a.dependents[f++];)e(d);a.dependents=b},A=function(a,b){a.state=c.NOT_RESOLVED;for(var d,e=0;d=a.dependents[e++];)d(null,b);a.dependents=[]};return{create:d,define:p,require:q,getState:r,isDefined:s,setOptions:t,getStat:u}},e=function(a){k(function(){throw a})},f=function(a,b){return Error(b?'Module "'+b.name+'": can\'t resolve dependence "'+a+'"':'Required module "'+a+"\" can't be resolved")},g=function(a,b){for(var c,d=[],e=0;c=b[e++];)d.push(c.name);return d.push(a.name),Error('Circular dependence has been detected: "'+d.join(" -> ")+'"')},h=function(a){return Error('Declaration of module "'+a.name+'" has already been provided')},i=function(a){return Error('Multiple declarations of module "'+a.name+'" have been detected')},j=function(a,b){for(var c,d=0;c=b[d++];)if(a===c)return!0;return!1},k=function(){var b=[],c=function(a){return 1===b.push(a)},d=function(){var a=b,c=0,d=b.length;for(b=[];c<d;)a[c++]()};if("object"==typeof process&&process.nextTick)return function(a){c(a)&&process.nextTick(d)};if(a.setImmediate)return function(b){c(b)&&a.setImmediate(d)};if(a.postMessage&&!a.opera){var e=!0;if(a.attachEvent){var f=function(){e=!1};a.attachEvent("onmessage",f),a.postMessage("__checkAsync","*"),a.detachEvent("onmessage",f)}if(e){var g="__modules"+ +new Date,h=function(a){a.data===g&&(a.stopPropagation&&a.stopPropagation(),d())};return a.addEventListener?a.addEventListener("message",h,!0):a.attachEvent("onmessage",h),function(b){c(b)&&a.postMessage(g,"*")}}}var i=a.document;if("onreadystatechange"in i.createElement("script")){var j=i.getElementsByTagName("head")[0],k=function(){var a=i.createElement("script");a.onreadystatechange=function(){a.parentNode.removeChild(a),a=a.onreadystatechange=null,d()},j.appendChild(a)};return function(a){c(a)&&k()}}return function(a){c(a)&&setTimeout(d,0)}}();"object"==typeof exports?module.exports=d():a.modules=d()}("undefined"!=typeof window?window:global),function(a){function b(a,b){return a.dataset?a.dataset[b]:a.getAttribute("data-"+b)}var c=["debug-mode","slides-selector","hotkeys"];a.shower={modules:modules.create(),options:a.showerOptions||{}},document.addEventListener("DOMContentLoaded",function(){a.shower.modules.require("shower.defaultOptions",function(d){var e=a.hasOwnProperty("showerOptions"),f=a.shower.options,g=f.shower_selector||d.c
this._element&&(this._setupListeners(),this._element.setAttribute("role","progressbar"),this._element.setAttribute("aria-valuemin","0"),this._element.setAttribute("aria-valuemax","100"),this.updateProgress())}b(c.prototype,{destroy:function(){this._clearListeners(),this._shower=null},updateProgress:function(){var a=this._shower.getSlidesCount(),b=this._shower.player.getCurrentSlideIndex(),c=100/(a-1)*b;this._element&&(this._element.style.width=c.toFixed(2)+"%",this._element.setAttribute("aria-valuenow",c.toFixed()),this._element.setAttribute("aria-valuetext","Slideshow Progress: "+c.toFixed()+"%"))},_setupListeners:function(){var a=this._shower;this._showerListeners=a.events.group().on("destroy",this.destroy,this),this._playerListeners=a.player.events.group().on("activate",this._onSlideChange,this)},_clearListeners:function(){this._showerListeners&&this._showerListeners.offAll(),this._playerListeners&&this._playerListeners.offAll()},_onSlideChange:function(){this.updateProgress()}}),a(c)}),shower.modules.require(["shower"],function(a){a.plugins.add("shower-progress")}),shower.modules.define("shower-timer",["shower","Emitter","util.extend"],function(a,b,c,d){function e(a){this.events=new c,this._shower=a,this._timer=null,this._showerListeners=null,this._playerListeners=null,this._pluginsListeners=null,this._setupListeners()}var f="shower-next";d(e.prototype,{destroy:function(){this._clearTimer(),this._clearListeners(),this._shower=null},run:function(a){this._initTimer(a)},stop:function(){this._clearTimer()},_setupListeners:function(){var a=this._shower;this.events.on("next",this._onNext,this),this._showerListeners=a.events.group().on("destroy",this.destroy,this),this._playerListeners=a.player.events.group().on("keydown",this._clearTimer,this).on("activate",this._onSlideActivate,this),this._nextPlugin=b.plugins.get(f,a),this._nextPlugin||(this._pluginsListeners=a.plugins.events.group().on("pluginadd",function(b){b.get("name")===f&&(this._nextPlugin=a.plugins.get(f),this._pluginsListeners.offAll())},this)),a.player.getCurrentSlideIndex()!=-1&&this._onSlideActivate()},_clearListeners:function(){this._showerListeners.offAll(),this._playerListeners.offAll()},_onSlideActivate:function(){this._clearTimer();var a=this._shower.player.getCurrentSlide();if(this._shower.container.isSlideMode()&&a.state.get("visited")<2){var b=a.layout.getData("timing");b&&/^(\d{1,2}:)?\d{1,3}$/.test(b)&&(b.indexOf(":")!==-1?(b=b.split(":"),b=1e3*(60*parseInt(b[0],10)+parseInt(b[1],10))):b=1e3*parseInt(b,10),0!==b&&this._initTimer(b))}},_initTimer:function(a){var b=this.events,c=(this._shower,this._nextPlugin);c&&c.getLength()&&c.getLength()!=c.getComplete()&&(a/=c.getLength()+1),this._timer=setInterval(function(){b.emit("next")},a)},_clearTimer:function(){this._timer&&(clearInterval(this._timer),this._timer=null)},_onNext:function(){this._clearTimer(),this._shower.player.next()}}),a(e)}),shower.modules.require(["shower"],function(a){a.plugins.add("shower-timer")}),shower.modules.define("shower-touch",["util.extend"],function(a,b){function c(a,b){b=b||{},this._shower=a,this._setupListeners()}var d=["VIDEO","AUDIO","A","BUTTON","INPUT"];b(c.prototype,{destroy:function(){this._clearListeners(),this._shower=null},_setupListeners:function(){var a=this._shower;this._showerListeners=a.events.group().on("add",this._onSlideAdd,this),this._bindedTouchStart=this._onTouchStart.bind(this),this._bindedTouchMove=this._onTouchMove.bind(this),this._shower.getSlides().forEach(this._addTouchStartListener,this),document.addEventListener("touchmove",this._bindedTouchMove,!0)},_clearListeners:function(){this._showerListeners.offAll(),this._shower.getSlides().forEach(this._removeTouchStartListener,this),document.removeEventListener("touchmove",this._bindedTouchMove,!1)},_onSlideAdd:function(a){var b=a.get("slide");this._addTouchStartListener(b)},_addTouchStartListener:function(a){var b=a.layout.getElement();b.addEventListener("touchstart",this._bindedTouchStart,!1)},_removeTouchStartListener:function(a){var b=a.layout.getElement();b.removeEventListener("touchstart",this._