rewrote initialization code for clarity and brevity (#105)

This commit is contained in:
Hakim El Hattab 2012-08-11 20:25:55 -04:00
parent 1ba1ca1cf3
commit 49e8e0d205
3 changed files with 168 additions and 141 deletions

View File

@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<title>reveal.js - HTML5 Presentations</title>
<title>reveal.js - The HTML Presentation Framework</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
@ -21,9 +21,8 @@
<link rel="stylesheet" href="lib/css/zenburn.css">
<script>
// If the query includes print-pdf we'll use the PDF print sheet
var printStyle = window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper';
document.write( '<link rel="stylesheet" href="css/print/' + printStyle + '.css" type="text/css" media="print">' );
// If the query includes 'print-pdf' we'll use the PDF print sheet
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
@ -283,62 +282,29 @@ function linkify( selector ) {
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
head.ready( function() {
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/linear(2d)
// Fires when a slide with data-state=customevent is activated
Reveal.addEventListener( 'customevent', function() {
console.log( '"customevent" has fired' );
} );
// Fires each time a new slide is activated
Reveal.addEventListener( 'slidechanged', function( event ) {
// event.previousSlide, event.currentSlide, event.indexh, event.indexv
} );
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
transition: Reveal.getQueryHash().transition || 'default' // default/cube/page/concave/linear(2d)
});
// Load highlight.js for syntax highlighting of code samples
head.js( 'lib/js/highlight.js', function() {
hljs.initHighlightingOnLoad();
} );
} );
// Scripts that should be loaded before initializing
var scripts = [];
// If the browser doesn't support classList, load a polyfill
if( !document.body.classList ) {
head.js( 'lib/js/classList.js' );
}
// Load markdown parser if there are slides defined using markdown
if( document.querySelector( '[data-markdown]' ) ) {
scripts.push( 'lib/js/showdown.js' );
scripts.push( 'lib/js/data-markdown.js' );
}
scripts.push( 'js/reveal.min.js' );
// If we're runnning the notes server we need to include some additional JS
// TODO Is there a better way to determine if we're running the notes server?
if( window.location.host === 'localhost:1947' ) {
scripts.push( 'socket.io/socket.io.js' );
scripts.push( 'plugin/speakernotes/client.js' );
}
// Load the scripts and, when completed, initialize reveal.js
head.js.apply( null, scripts );
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } },
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'socket.io/socket.io.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
{ src: 'plugin/speakernotes/client.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
]
});
</script>

View File

@ -1,5 +1,5 @@
/*!
* reveal.js 2.0 r17
* reveal.js 2.0 r18
* http://lab.hakim.se/reveal-js
* MIT licensed
*
@ -40,7 +40,10 @@ var Reveal = (function(){
rollingLinks: true,
// Transition style
transition: 'default' // default/cube/page/concave/linear(2d)
transition: 'default', // default/cube/page/concave/linear(2d),
// Script dependencies to load
dependencies: []
},
// The horizontal and verical index of the currently active slide
@ -71,9 +74,6 @@ var Reveal = (function(){
'msTransform' in document.body.style ||
'OTransform' in document.body.style ||
'transform' in document.body.style,
// Detect support for elem.classList
supportsClassList = !!document.body.classList;
// Throttles mouse wheel navigation
mouseWheelTimeout = 0,
@ -96,12 +96,10 @@ var Reveal = (function(){
/**
* Starts up the slideshow by applying configuration
* options and binding various events.
* Starts up the presentation if the client is capable.
*/
function initialize( options ) {
if( ( !supports2DTransforms && !supports3DTransforms ) || !supportsClassList ) {
if( ( !supports2DTransforms && !supports3DTransforms ) ) {
document.body.setAttribute( 'class', 'no-transforms' );
// If the browser doesn't support core features we won't be
@ -109,11 +107,14 @@ var Reveal = (function(){
return;
}
// Copy options over to our config object
extend( config, options );
// Cache references to DOM elements
dom.wrapper = document.querySelector( '.reveal' );
dom.progress = document.querySelector( '.reveal .progress' );
dom.progressbar = document.querySelector( '.reveal .progress span' );
if ( config.controls ) {
dom.controls = document.querySelector( '.reveal .controls' );
dom.controlsLeft = document.querySelector( '.reveal .controls .left' );
@ -121,21 +122,9 @@ var Reveal = (function(){
dom.controlsUp = document.querySelector( '.reveal .controls .up' );
dom.controlsDown = document.querySelector( '.reveal .controls .down' );
}
// Copy options over to our config object
extend( config, options );
// Subscribe to input
addEventListeners();
// Updates the presentation to match the current configuration values
configure();
// Read the initial hash
readURL();
// Start auto-sliding if it's enabled
cueAutoSlide();
// Loads the dependencies and continues to #start() once done
load();
// Set up hiding of the browser address bar
if( navigator.userAgent.match( /(iphone|ipod|android)/i ) ) {
@ -150,6 +139,76 @@ var Reveal = (function(){
}
/**
* Loads the dependencies of reveal.js. Dependencies are
* defined via the configuration option 'dependencies'
* and will be loaded prior to starting/binding reveal.js.
* Some dependencies may have an 'async' flag, if so they
* will load after reveal.js has been started up.
*/
function load() {
var scripts = [],
scriptsAsync = [];
for( var i = 0, len = config.dependencies.length; i < len; i++ ) {
var s = config.dependencies[i];
// Load if there's no condition or the condition is truthy
if( !s.condition || s.condition() ) {
if( s.async ) {
scriptsAsync.push( s.src );
}
else {
scripts.push( s.src );
}
// Extension may contain callback functions
if( typeof s.callback === 'function' ) {
head.ready( s.src.match( /([\w\d_-]*)\.?[^\\\/]*$/i )[0], s.callback );
}
}
}
// Called once synchronous scritps finish loading
function proceed() {
// Load asynchronous scripts
head.js.apply( null, scriptsAsync );
start();
}
if( scripts.length ) {
head.ready( proceed );
// Load synchronous scripts
head.js.apply( null, scripts );
}
else {
proceed();
}
}
/**
* Starts up reveal.js by binding input events and navigating
* to the current URL deeplink if there is one.
*/
function start() {
// Subscribe to input
addEventListeners();
// Updates the presentation to match the current configuration values
configure();
// Read the initial hash
readURL();
// Start auto-sliding if it's enabled
cueAutoSlide();
}
/**
* Applies the configuration settings from the config object.
*/
function configure() {
if( supports3DTransforms === false ) {
config.transition = 'linear';

122
js/reveal.min.js vendored
View File

@ -1,66 +1,68 @@
/*!
* reveal.js 2.0 r17
* reveal.js 2.0 r18
* http://lab.hakim.se/reveal-js
* MIT licensed
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
var Reveal=(function(){var j=".reveal .slides>section",a=".reveal .slides>section.present>section",e=!!("ontouchstart" in window),K={controls:true,progress:true,history:false,keyboard:true,loop:false,autoSlide:0,mouseWheel:true,rollingLinks:true,transition:"default"},k=0,c=0,v,C,W=[],d={},M="WebkitPerspective" in document.body.style||"MozPerspective" in document.body.style||"msPerspective" in document.body.style||"OPerspective" in document.body.style||"perspective" in document.body.style,l="WebkitTransform" in document.body.style||"MozTransform" in document.body.style||"msTransform" in document.body.style||"OTransform" in document.body.style||"transform" in document.body.style,y=!!document.body.classList;
mouseWheelTimeout=0,autoSlideTimeout=0,writeURLTimeout=0,touch={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40};function h(Y){if((!l&&!M)||!y){document.body.setAttribute("class","no-transforms");
return;}d.wrapper=document.querySelector(".reveal");d.progress=document.querySelector(".reveal .progress");d.progressbar=document.querySelector(".reveal .progress span");
if(K.controls){d.controls=document.querySelector(".reveal .controls");d.controlsLeft=document.querySelector(".reveal .controls .left");d.controlsRight=document.querySelector(".reveal .controls .right");
d.controlsUp=document.querySelector(".reveal .controls .up");d.controlsDown=document.querySelector(".reveal .controls .down");}q(K,Y);A();F();E();H();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll";
document.body.style.height="120%";window.addEventListener("load",S,false);window.addEventListener("orientationchange",S,false);}}function F(){if(M===false){K.transition="linear";
}if(K.controls&&d.controls){d.controls.style.display="block";}if(K.progress&&d.progress){d.progress.style.display="block";}if(K.transition!=="default"){d.wrapper.classList.add(K.transition);
}if(K.mouseWheel){document.addEventListener("DOMMouseScroll",m,false);document.addEventListener("mousewheel",m,false);}if(K.rollingLinks){G();}}function A(){document.addEventListener("touchstart",w,false);
document.addEventListener("touchmove",U,false);document.addEventListener("touchend",O,false);window.addEventListener("hashchange",t,false);if(K.keyboard){document.addEventListener("keydown",V,false);
}if(K.controls&&d.controls){d.controlsLeft.addEventListener("click",n(x),false);d.controlsRight.addEventListener("click",n(i),false);d.controlsUp.addEventListener("click",n(r),false);
d.controlsDown.addEventListener("click",n(B),false);}}function N(){document.removeEventListener("keydown",V,false);document.removeEventListener("touchstart",w,false);
document.removeEventListener("touchmove",U,false);document.removeEventListener("touchend",O,false);window.removeEventListener("hashchange",t,false);if(K.controls&&d.controls){d.controlsLeft.removeEventListener("click",n(x),false);
d.controlsRight.removeEventListener("click",n(i),false);d.controlsUp.removeEventListener("click",n(r),false);d.controlsDown.removeEventListener("click",n(B),false);
}}function q(Z,Y){for(var aa in Y){Z[aa]=Y[aa];}}function L(aa,Y){var ab=aa.x-Y.x,Z=aa.y-Y.y;return Math.sqrt(ab*ab+Z*Z);}function n(Y){return function(Z){Z.preventDefault();
Y.call();};}function S(){setTimeout(function(){window.scrollTo(0,1);},0);}function V(Z){if(Z.target.contentEditable!="inherit"||Z.shiftKey||Z.altKey||Z.ctrlKey||Z.metaKey){return;
}var Y=false;switch(Z.keyCode){case 80:case 33:Q();Y=true;break;case 78:case 34:u();Y=true;break;case 72:case 37:x();Y=true;break;case 76:case 39:i();Y=true;
break;case 75:case 38:r();Y=true;break;case 74:case 40:B();Y=true;break;case 36:I(0);Y=true;break;case 35:I(Number.MAX_VALUE);Y=true;break;case 32:R()?T():u();
Y=true;break;case 13:if(R()){T();Y=true;}break;}if(Y){Z.preventDefault();}else{if(Z.keyCode===27&&M){P();Z.preventDefault();}}H();}function w(Y){touch.startX=Y.touches[0].clientX;
touch.startY=Y.touches[0].clientY;touch.startCount=Y.touches.length;if(Y.touches.length===2){touch.startSpan=L({x:Y.touches[1].clientX,y:Y.touches[1].clientY},{x:touch.startX,y:touch.startY});
}}function U(ad){if(!touch.handled){var ab=ad.touches[0].clientX;var aa=ad.touches[0].clientY;if(ad.touches.length===2&&touch.startCount===2){var ac=L({x:ad.touches[1].clientX,y:ad.touches[1].clientY},{x:touch.startX,y:touch.startY});
if(Math.abs(touch.startSpan-ac)>touch.threshold){touch.handled=true;if(ac<touch.startSpan){D();}else{T();}}}else{if(ad.touches.length===1){var Z=ab-touch.startX,Y=aa-touch.startY;
if(Z>touch.threshold&&Math.abs(Z)>Math.abs(Y)){touch.handled=true;x();}else{if(Z<-touch.threshold&&Math.abs(Z)>Math.abs(Y)){touch.handled=true;i();}else{if(Y>touch.threshold){touch.handled=true;
r();}else{if(Y<-touch.threshold){touch.handled=true;B();}}}}}}ad.preventDefault();}}function O(Y){touch.handled=false;}function m(Y){clearTimeout(mouseWheelTimeout);
mouseWheelTimeout=setTimeout(function(){var Z=Y.detail||-Y.wheelDelta;if(Z>0){u();}else{Q();}},100);}function t(Y){E();}function G(){if(M&&!("msPerspective" in document.body.style)){var Z=document.querySelectorAll(".reveal .slides section a:not(.image)");
for(var aa=0,Y=Z.length;aa<Y;aa++){var ab=Z[aa];if(ab.textContent&&!ab.querySelector("img")&&(!ab.className||!ab.classList.contains(ab,"roll"))){ab.classList.add("roll");
ab.innerHTML='<span data-title="'+ab.text+'">'+ab.innerHTML+"</span>";}}}}function D(){d.wrapper.classList.add("overview");var Y=Array.prototype.slice.call(document.querySelectorAll(j));
for(var ad=0,ab=Y.length;ad<ab;ad++){var aa=Y[ad],ah="translateZ(-2500px) translate("+((ad-k)*105)+"%, 0%)";aa.setAttribute("data-index-h",ad);aa.style.display="block";
aa.style.WebkitTransform=ah;aa.style.MozTransform=ah;aa.style.msTransform=ah;aa.style.OTransform=ah;aa.style.transform=ah;if(!aa.classList.contains("stack")){aa.addEventListener("click",z,true);
}var ag=Array.prototype.slice.call(aa.querySelectorAll("section"));for(var ac=0,Z=ag.length;ac<Z;ac++){var af=ag[ac],ae="translate(0%, "+((ac-c)*105)+"%)";
af.setAttribute("data-index-h",ad);af.setAttribute("data-index-v",ac);af.style.display="block";af.style.WebkitTransform=ae;af.style.MozTransform=ae;af.style.msTransform=ae;
af.style.OTransform=ae;af.style.transform=ae;af.addEventListener("click",z,true);}}}function T(){d.wrapper.classList.remove("overview");var ab=Array.prototype.slice.call(document.querySelectorAll(".reveal .slides section"));
for(var aa=0,Y=ab.length;aa<Y;aa++){var Z=ab[aa];Z.style.WebkitTransform="";Z.style.MozTransform="";Z.style.msTransform="";Z.style.OTransform="";Z.style.transform="";
Z.removeEventListener("click",z);}b();}function R(){return d.wrapper.classList.contains("overview");}function z(Y){if(R()){Y.preventDefault();T();k=this.getAttribute("data-index-h");
c=this.getAttribute("data-index-v");b();}}function X(Z,ab){var ad=Array.prototype.slice.call(document.querySelectorAll(Z)),ae=ad.length;if(ae){if(K.loop){ab%=ae;
if(ab<0){ab=ae+ab;}}ab=Math.max(Math.min(ab,ae-1),0);for(var ac=0;ac<ae;ac++){var Y=ad[ac];if(R()===false){var af=Math.abs((ab-ac)%(ae-3))||0;Y.style.display=af>3?"none":"block";
}ad[ac].classList.remove("past");ad[ac].classList.remove("present");ad[ac].classList.remove("future");if(ac<ab){ad[ac].classList.add("past");}else{if(ac>ab){ad[ac].classList.add("future");
}}if(Y.querySelector("section")){ad[ac].classList.add("stack");}}ad[ab].classList.add("present");var aa=ad[ab].getAttribute("data-state");if(aa){W=W.concat(aa.split(" "));
}}else{ab=0;}return ab;}function b(ae,ai){v=C;var ab=W.concat();W.length=0;var ah=k,Z=c;k=X(j,ae===undefined?k:ae);c=X(a,ai===undefined?c:ai);stateLoop:for(var ac=0,af=W.length;
ac<af;ac++){for(var aa=0;aa<ab.length;aa++){if(ab[aa]===W[ac]){ab.splice(aa,1);continue stateLoop;}}document.documentElement.classList.add(W[ac]);o(W[ac]);
}while(ab.length){document.documentElement.classList.remove(ab.pop());}if(K.progress&&d.progress){d.progressbar.style.width=(k/(document.querySelectorAll(j).length-1))*window.innerWidth+"px";
}if(R()){D();}p();clearTimeout(writeURLTimeout);writeURLTimeout=setTimeout(g,1500);var Y=document.querySelectorAll(j);var ag=Y[k],ad=ag.querySelectorAll("section");
C=ad[c]||ag;if(k!==ah||c!==Z){o("slidechanged",{indexh:k,indexv:c,previousSlide:v,currentSlide:C});}else{v=null;}if(v){v.classList.remove("present");}}function p(){if(!K.controls||!d.controls){return;
}var Y=f();[d.controlsLeft,d.controlsRight,d.controlsUp,d.controlsDown].forEach(function(Z){Z.classList.remove("enabled");});if(Y.left){d.controlsLeft.classList.add("enabled");
}if(Y.right){d.controlsRight.classList.add("enabled");}if(Y.up){d.controlsUp.classList.add("enabled");}if(Y.down){d.controlsDown.classList.add("enabled");
}}function f(){var Y=document.querySelectorAll(j);var Z=document.querySelectorAll(a);return{left:k>0,right:k<Y.length-1,up:c>0,down:c<Z.length-1};}function E(){var aa=window.location.hash.slice(2).split("/");
var Z=parseInt(aa[0])||0;var Y=parseInt(aa[1])||0;I(Z,Y);}function g(){if(K.history){var Y="/";if(k>0||c>0){Y+=k;}if(c>0){Y+="/"+c;}window.location.hash=Y;
}}function o(Z,Y){var aa=document.createEvent("HTMLEvents",1,2);aa.initEvent(Z,true,true);q(aa,Y);d.wrapper.dispatchEvent(aa);}function s(){if(document.querySelector(a+".present")){var Z=document.querySelectorAll(a+".present .fragment:not(.visible)");
if(Z.length){Z[0].classList.add("visible");o("fragmentshown",{fragment:Z[0]});return true;}}else{var Y=document.querySelectorAll(j+".present .fragment:not(.visible)");
if(Y.length){Y[0].classList.add("visible");o("fragmentshown",{fragment:Y[0]});return true;}}return false;}function J(){if(document.querySelector(a+".present")){var Z=document.querySelectorAll(a+".present .fragment.visible");
if(Z.length){Z[Z.length-1].classList.remove("visible");o("fragmenthidden",{fragment:Z[Z.length-1]});return true;}}else{var Y=document.querySelectorAll(j+".present .fragment.visible");
if(Y.length){Y[Y.length-1].classList.remove("visible");o("fragmenthidden",{fragment:Y[Y.length-1]});return true;}}return false;}function H(){clearTimeout(autoSlideTimeout);
if(K.autoSlide){autoSlideTimeout=setTimeout(u,K.autoSlide);}}function I(Z,Y){b(Z,Y);}function x(){if(R()||J()===false){b(k-1,0);}}function i(){if(R()||s()===false){b(k+1,0);
}}function r(){if(R()||J()===false){b(k,c-1);}}function B(){if(R()||s()===false){b(k,c+1);}}function Q(){if(J()===false){if(f().up){r();}else{var Y=document.querySelector(".reveal .slides>section.past:nth-child("+k+")");
if(Y){c=(Y.querySelectorAll("section").length+1)||0;k--;b();}}}}function u(){if(s()===false){f().down?B():i();}H();}function P(){if(R()){T();}else{D();
}}return{initialize:h,navigateTo:I,navigateLeft:x,navigateRight:i,navigateUp:r,navigateDown:B,navigatePrev:Q,navigateNext:u,toggleOverview:P,addEventListeners:A,removeEventListeners:N,getIndices:function(){return{h:k,v:c};
},getPreviousSlide:function(){return v;},getCurrentSlide:function(){return C;},getQueryHash:function(){var Y={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(Z){Y[Z.split("=").shift()]=Z.split("=").pop();
});return Y;},addEventListener:function(Z,aa,Y){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).addEventListener(Z,aa,Y);
}},removeEventListener:function(Z,aa,Y){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).removeEventListener(Z,aa,Y);}}};
})();
var Reveal=(function(){var k=".reveal .slides>section",b=".reveal .slides>section.present>section",e=!!("ontouchstart" in window),N={controls:true,progress:true,history:false,keyboard:true,loop:false,autoSlide:0,mouseWheel:true,rollingLinks:true,transition:"default",dependencies:[]},l=0,c=0,w,E,ac=[],d={},P="WebkitPerspective" in document.body.style||"MozPerspective" in document.body.style||"msPerspective" in document.body.style||"OPerspective" in document.body.style||"perspective" in document.body.style,m="WebkitTransform" in document.body.style||"MozTransform" in document.body.style||"msTransform" in document.body.style||"OTransform" in document.body.style||"transform" in document.body.style,x=0,j=0,B=0,W={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40};
function h(ad){if((!m&&!P)){document.body.setAttribute("class","no-transforms");return;}r(N,ad);d.wrapper=document.querySelector(".reveal");d.progress=document.querySelector(".reveal .progress");
d.progressbar=document.querySelector(".reveal .progress span");if(N.controls){d.controls=document.querySelector(".reveal .controls");d.controlsLeft=document.querySelector(".reveal .controls .left");
d.controlsRight=document.querySelector(".reveal .controls .right");d.controlsUp=document.querySelector(".reveal .controls .up");d.controlsDown=document.querySelector(".reveal .controls .down");
}R();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll";document.body.style.height="120%";window.addEventListener("load",X,false);
window.addEventListener("orientationchange",X,false);}}function R(){var ae=[],ai=[];for(var af=0,ad=N.dependencies.length;af<ad;af++){var ag=N.dependencies[af];
if(!ag.condition||ag.condition()){if(ag.async){ai.push(ag.src);}else{ae.push(ag.src);}if(typeof ag.callback==="function"){head.ready(ag.src.match(/([\w\d_-]*)\.?[^\\\/]*$/i)[0],ag.callback);
}}}function ah(){head.js.apply(null,ai);F();}if(ae.length){head.ready(ah);head.js.apply(null,ae);}else{ah();}}function F(){C();I();H();K();}function I(){if(P===false){N.transition="linear";
}if(N.controls&&d.controls){d.controls.style.display="block";}if(N.progress&&d.progress){d.progress.style.display="block";}if(N.transition!=="default"){d.wrapper.classList.add(N.transition);
}if(N.mouseWheel){document.addEventListener("DOMMouseScroll",n,false);document.addEventListener("mousewheel",n,false);}if(N.rollingLinks){J();}}function C(){document.addEventListener("touchstart",y,false);
document.addEventListener("touchmove",Z,false);document.addEventListener("touchend",S,false);window.addEventListener("hashchange",u,false);if(N.keyboard){document.addEventListener("keydown",aa,false);
}if(N.controls&&d.controls){d.controlsLeft.addEventListener("click",o(z),false);d.controlsRight.addEventListener("click",o(i),false);d.controlsUp.addEventListener("click",o(s),false);
d.controlsDown.addEventListener("click",o(D),false);}}function Q(){document.removeEventListener("keydown",aa,false);document.removeEventListener("touchstart",y,false);
document.removeEventListener("touchmove",Z,false);document.removeEventListener("touchend",S,false);window.removeEventListener("hashchange",u,false);if(N.controls&&d.controls){d.controlsLeft.removeEventListener("click",o(z),false);
d.controlsRight.removeEventListener("click",o(i),false);d.controlsUp.removeEventListener("click",o(s),false);d.controlsDown.removeEventListener("click",o(D),false);
}}function r(ae,ad){for(var af in ad){ae[af]=ad[af];}}function O(af,ad){var ag=af.x-ad.x,ae=af.y-ad.y;return Math.sqrt(ag*ag+ae*ae);}function o(ad){return function(ae){ae.preventDefault();
ad.call();};}function X(){setTimeout(function(){window.scrollTo(0,1);},0);}function aa(ae){if(ae.target.contentEditable!="inherit"||ae.shiftKey||ae.altKey||ae.ctrlKey||ae.metaKey){return;
}var ad=false;switch(ae.keyCode){case 80:case 33:U();ad=true;break;case 78:case 34:v();ad=true;break;case 72:case 37:z();ad=true;break;case 76:case 39:i();
ad=true;break;case 75:case 38:s();ad=true;break;case 74:case 40:D();ad=true;break;case 36:L(0);ad=true;break;case 35:L(Number.MAX_VALUE);ad=true;break;
case 32:V()?Y():v();ad=true;break;case 13:if(V()){Y();ad=true;}break;}if(ad){ae.preventDefault();}else{if(ae.keyCode===27&&P){T();ae.preventDefault();}}K();
}function y(ad){W.startX=ad.touches[0].clientX;W.startY=ad.touches[0].clientY;W.startCount=ad.touches.length;if(ad.touches.length===2){W.startSpan=O({x:ad.touches[1].clientX,y:ad.touches[1].clientY},{x:W.startX,y:W.startY});
}}function Z(ai){if(!W.handled){var ag=ai.touches[0].clientX;var af=ai.touches[0].clientY;if(ai.touches.length===2&&W.startCount===2){var ah=O({x:ai.touches[1].clientX,y:ai.touches[1].clientY},{x:W.startX,y:W.startY});
if(Math.abs(W.startSpan-ah)>W.threshold){W.handled=true;if(ah<W.startSpan){G();}else{Y();}}}else{if(ai.touches.length===1){var ae=ag-W.startX,ad=af-W.startY;
if(ae>W.threshold&&Math.abs(ae)>Math.abs(ad)){W.handled=true;z();}else{if(ae<-W.threshold&&Math.abs(ae)>Math.abs(ad)){W.handled=true;i();}else{if(ad>W.threshold){W.handled=true;
s();}else{if(ad<-W.threshold){W.handled=true;D();}}}}}}ai.preventDefault();}}function S(ad){W.handled=false;}function n(ad){clearTimeout(x);x=setTimeout(function(){var ae=ad.detail||-ad.wheelDelta;
if(ae>0){v();}else{U();}},100);}function u(ad){H();}function J(){if(P&&!("msPerspective" in document.body.style)){var ae=document.querySelectorAll(".reveal .slides section a:not(.image)");
for(var af=0,ad=ae.length;af<ad;af++){var ag=ae[af];if(ag.textContent&&!ag.querySelector("img")&&(!ag.className||!ag.classList.contains(ag,"roll"))){ag.classList.add("roll");
ag.innerHTML='<span data-title="'+ag.text+'">'+ag.innerHTML+"</span>";}}}}function G(){d.wrapper.classList.add("overview");var ad=Array.prototype.slice.call(document.querySelectorAll(k));
for(var ai=0,ag=ad.length;ai<ag;ai++){var af=ad[ai],am="translateZ(-2500px) translate("+((ai-l)*105)+"%, 0%)";af.setAttribute("data-index-h",ai);af.style.display="block";
af.style.WebkitTransform=am;af.style.MozTransform=am;af.style.msTransform=am;af.style.OTransform=am;af.style.transform=am;if(!af.classList.contains("stack")){af.addEventListener("click",A,true);
}var al=Array.prototype.slice.call(af.querySelectorAll("section"));for(var ah=0,ae=al.length;ah<ae;ah++){var ak=al[ah],aj="translate(0%, "+((ah-c)*105)+"%)";
ak.setAttribute("data-index-h",ai);ak.setAttribute("data-index-v",ah);ak.style.display="block";ak.style.WebkitTransform=aj;ak.style.MozTransform=aj;ak.style.msTransform=aj;
ak.style.OTransform=aj;ak.style.transform=aj;ak.addEventListener("click",A,true);}}}function Y(){d.wrapper.classList.remove("overview");var ag=Array.prototype.slice.call(document.querySelectorAll(".reveal .slides section"));
for(var af=0,ad=ag.length;af<ad;af++){var ae=ag[af];ae.style.WebkitTransform="";ae.style.MozTransform="";ae.style.msTransform="";ae.style.OTransform="";
ae.style.transform="";ae.removeEventListener("click",A);}a();}function V(){return d.wrapper.classList.contains("overview");}function A(ad){if(V()){ad.preventDefault();
Y();l=this.getAttribute("data-index-h");c=this.getAttribute("data-index-v");a();}}function ab(ae,ag){var ai=Array.prototype.slice.call(document.querySelectorAll(ae)),aj=ai.length;
if(aj){if(N.loop){ag%=aj;if(ag<0){ag=aj+ag;}}ag=Math.max(Math.min(ag,aj-1),0);for(var ah=0;ah<aj;ah++){var ad=ai[ah];if(V()===false){var ak=Math.abs((ag-ah)%(aj-3))||0;
ad.style.display=ak>3?"none":"block";}ai[ah].classList.remove("past");ai[ah].classList.remove("present");ai[ah].classList.remove("future");if(ah<ag){ai[ah].classList.add("past");
}else{if(ah>ag){ai[ah].classList.add("future");}}if(ad.querySelector("section")){ai[ah].classList.add("stack");}}ai[ag].classList.add("present");var af=ai[ag].getAttribute("data-state");
if(af){ac=ac.concat(af.split(" "));}}else{ag=0;}return ag;}function a(aj,an){w=E;var ag=ac.concat();ac.length=0;var am=l,ae=c;l=ab(k,aj===undefined?l:aj);
c=ab(b,an===undefined?c:an);stateLoop:for(var ah=0,ak=ac.length;ah<ak;ah++){for(var af=0;af<ag.length;af++){if(ag[af]===ac[ah]){ag.splice(af,1);continue stateLoop;
}}document.documentElement.classList.add(ac[ah]);p(ac[ah]);}while(ag.length){document.documentElement.classList.remove(ag.pop());}if(N.progress&&d.progress){d.progressbar.style.width=(l/(document.querySelectorAll(k).length-1))*window.innerWidth+"px";
}if(V()){G();}q();clearTimeout(B);B=setTimeout(g,1500);var ad=document.querySelectorAll(k);var al=ad[l],ai=al.querySelectorAll("section");E=ai[c]||al;if(l!==am||c!==ae){p("slidechanged",{indexh:l,indexv:c,previousSlide:w,currentSlide:E});
}else{w=null;}if(w){w.classList.remove("present");}}function q(){if(!N.controls||!d.controls){return;}var ad=f();[d.controlsLeft,d.controlsRight,d.controlsUp,d.controlsDown].forEach(function(ae){ae.classList.remove("enabled");
});if(ad.left){d.controlsLeft.classList.add("enabled");}if(ad.right){d.controlsRight.classList.add("enabled");}if(ad.up){d.controlsUp.classList.add("enabled");
}if(ad.down){d.controlsDown.classList.add("enabled");}}function f(){var ad=document.querySelectorAll(k);var ae=document.querySelectorAll(b);return{left:l>0,right:l<ad.length-1,up:c>0,down:c<ae.length-1};
}function H(){var af=window.location.hash.slice(2).split("/");var ae=parseInt(af[0])||0;var ad=parseInt(af[1])||0;L(ae,ad);}function g(){if(N.history){var ad="/";
if(l>0||c>0){ad+=l;}if(c>0){ad+="/"+c;}window.location.hash=ad;}}function p(ae,ad){var af=document.createEvent("HTMLEvents",1,2);af.initEvent(ae,true,true);
r(af,ad);d.wrapper.dispatchEvent(af);}function t(){if(document.querySelector(b+".present")){var ae=document.querySelectorAll(b+".present .fragment:not(.visible)");
if(ae.length){ae[0].classList.add("visible");p("fragmentshown",{fragment:ae[0]});return true;}}else{var ad=document.querySelectorAll(k+".present .fragment:not(.visible)");
if(ad.length){ad[0].classList.add("visible");p("fragmentshown",{fragment:ad[0]});return true;}}return false;}function M(){if(document.querySelector(b+".present")){var ae=document.querySelectorAll(b+".present .fragment.visible");
if(ae.length){ae[ae.length-1].classList.remove("visible");p("fragmenthidden",{fragment:ae[ae.length-1]});return true;}}else{var ad=document.querySelectorAll(k+".present .fragment.visible");
if(ad.length){ad[ad.length-1].classList.remove("visible");p("fragmenthidden",{fragment:ad[ad.length-1]});return true;}}return false;}function K(){clearTimeout(j);
if(N.autoSlide){j=setTimeout(v,N.autoSlide);}}function L(ae,ad){a(ae,ad);}function z(){if(V()||M()===false){a(l-1,0);}}function i(){if(V()||t()===false){a(l+1,0);
}}function s(){if(V()||M()===false){a(l,c-1);}}function D(){if(V()||t()===false){a(l,c+1);}}function U(){if(M()===false){if(f().up){s();}else{var ad=document.querySelector(".reveal .slides>section.past:nth-child("+l+")");
if(ad){c=(ad.querySelectorAll("section").length+1)||0;l--;a();}}}}function v(){if(t()===false){f().down?D():i();}K();}function T(){if(V()){Y();}else{G();
}}return{initialize:h,navigateTo:L,navigateLeft:z,navigateRight:i,navigateUp:s,navigateDown:D,navigatePrev:U,navigateNext:v,toggleOverview:T,addEventListeners:C,removeEventListeners:Q,getIndices:function(){return{h:l,v:c};
},getPreviousSlide:function(){return w;},getCurrentSlide:function(){return E;},getQueryHash:function(){var ad={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(ae){ad[ae.split("=").shift()]=ae.split("=").pop();
});return ad;},addEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).addEventListener(ae,af,ad);
}},removeEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).removeEventListener(ae,af,ad);
}}};})();