From 04b9e444d97b31c1c5b867c02fe58b59a80386f4 Mon Sep 17 00:00:00 2001 From: Guillaume Turri Date: Sun, 28 Jul 2013 22:41:55 +0200 Subject: [PATCH 1/4] Minor refactoring Removed some code duplication --- js/reveal.js | 61 ++++++++++++++++++++++-------------------------- js/reveal.min.js | 4 ++-- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 033fe31..4666642 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -193,49 +193,26 @@ var Reveal = (function(){ dom.slides = document.querySelector( '.reveal .slides' ); // Background element - if( !document.querySelector( '.reveal .backgrounds' ) ) { - dom.background = document.createElement( 'div' ); - dom.background.classList.add( 'backgrounds' ); - dom.wrapper.appendChild( dom.background ); - } + dom.background = initializeNode(dom.wrapper, 'div', 'backgrounds', null); // Progress bar - if( !dom.wrapper.querySelector( '.progress' ) ) { - var progressElement = document.createElement( 'div' ); - progressElement.classList.add( 'progress' ); - progressElement.innerHTML = ''; - dom.wrapper.appendChild( progressElement ); - } + dom.progress = initializeNode(dom.wrapper, 'div', 'progress', ''); + dom.progressbar = dom.progress.querySelector('span'); // Arrow controls - if( !dom.wrapper.querySelector( '.controls' ) ) { - var controlsElement = document.createElement( 'aside' ); - controlsElement.classList.add( 'controls' ); - controlsElement.innerHTML = '' + - '' + - '' + - ''; - dom.wrapper.appendChild( controlsElement ); - } + initializeNode(dom.wrapper, 'aside', 'controls', + '' + + '' + + '' + + ''); // State background element [DEPRECATED] - if( !dom.wrapper.querySelector( '.state-background' ) ) { - var stateBackgroundElement = document.createElement( 'div' ); - stateBackgroundElement.classList.add( 'state-background' ); - dom.wrapper.appendChild( stateBackgroundElement ); - } + initializeNode(dom.wrapper, 'div', 'state-background', null); // Overlay graphic which is displayed during the paused mode - if( !dom.wrapper.querySelector( '.pause-overlay' ) ) { - var pausedElement = document.createElement( 'div' ); - pausedElement.classList.add( 'pause-overlay' ); - dom.wrapper.appendChild( pausedElement ); - } + initializeNode(dom.wrapper, 'div', 'pause-overlay', null); // Cache references to elements - dom.progress = document.querySelector( '.reveal .progress' ); - dom.progressbar = document.querySelector( '.reveal .progress span' ); - if ( config.controls ) { dom.controls = document.querySelector( '.reveal .controls' ); @@ -250,6 +227,24 @@ var Reveal = (function(){ } + function initializeNode(container, tagname, classname, innerHTML){ + var node = container.querySelector('.' + classname); + if( !node ){ + node = buildNode(tagname, classname, innerHTML); + container.appendChild(node); + } + return node; + } + + function buildNode(tagname, classname, innerHTML){ + var node = document.createElement(tagname); + node.classList.add(classname); + if(innerHTML !== null){ + node.innerHTML = innerHTML; + } + return node; + } + /** * Creates the slide background elements and appends them * to the background container. One element is created per diff --git a/js/reveal.min.js b/js/reveal.min.js index e9d124f..93f2f97 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -1,8 +1,8 @@ /*! - * reveal.js 2.5.0 (2013-06-22, 19:21) + * reveal.js 2.5.0 (2013-07-29, 14:30) * http://lab.hakim.se/reveal-js * MIT licensed * * Copyright (C) 2013 Hakim El Hattab, http://hakim.se */ -var Reveal=function(){"use strict";function e(e){return zt||Yt?(window.addEventListener("load",k,!1),l(Pt,e),r(),o(),void 0):(document.body.setAttribute("class","no-transforms"),void 0)}function t(){if(Ot.theme=document.querySelector("#theme"),Ot.wrapper=document.querySelector(".reveal"),Ot.slides=document.querySelector(".reveal .slides"),document.querySelector(".reveal .backgrounds")||(Ot.background=document.createElement("div"),Ot.background.classList.add("backgrounds"),Ot.wrapper.appendChild(Ot.background)),!Ot.wrapper.querySelector(".progress")){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="",Ot.wrapper.appendChild(e)}if(!Ot.wrapper.querySelector(".controls")){var t=document.createElement("aside");t.classList.add("controls"),t.innerHTML='',Ot.wrapper.appendChild(t)}if(!Ot.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),Ot.wrapper.appendChild(n)}if(!Ot.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),Ot.wrapper.appendChild(r)}Ot.progress=document.querySelector(".reveal .progress"),Ot.progressbar=document.querySelector(".reveal .progress span"),Pt.controls&&(Ot.controls=document.querySelector(".reveal .controls"),Ot.controlsLeft=d(document.querySelectorAll(".navigate-left")),Ot.controlsRight=d(document.querySelectorAll(".navigate-right")),Ot.controlsUp=d(document.querySelectorAll(".navigate-up")),Ot.controlsDown=d(document.querySelectorAll(".navigate-down")),Ot.controlsPrev=d(document.querySelectorAll(".navigate-prev")),Ot.controlsNext=d(document.querySelectorAll(".navigate-next")))}function n(){function e(e,t){var n={background:e.getAttribute("data-background"),backgroundSize:e.getAttribute("data-background-size"),backgroundImage:e.getAttribute("data-background-image"),backgroundColor:e.getAttribute("data-background-color"),backgroundRepeat:e.getAttribute("data-background-repeat"),backgroundPosition:e.getAttribute("data-background-position"),backgroundTransition:e.getAttribute("data-background-transition")},r=document.createElement("div");return r.className="slide-background",n.background&&(/^(http|file|\/\/)/gi.test(n.background)||/\.(png|jpg|jpeg|gif|bmp)$/gi.test(n.background)?r.style.backgroundImage="url("+n.background+")":r.style.background=n.background),n.backgroundSize&&(r.style.backgroundSize=n.backgroundSize),n.backgroundImage&&(r.style.backgroundImage='url("'+n.backgroundImage+'")'),n.backgroundColor&&(r.style.backgroundColor=n.backgroundColor),n.backgroundRepeat&&(r.style.backgroundRepeat=n.backgroundRepeat),n.backgroundPosition&&(r.style.backgroundPosition=n.backgroundPosition),n.backgroundTransition&&r.setAttribute("data-background-transition",n.backgroundTransition),t.appendChild(r),r}v()&&document.body.classList.add("print-pdf"),Ot.background.innerHTML="",Ot.background.classList.add("no-transition"),d(document.querySelectorAll(xt)).forEach(function(t){var n;n=v()?e(t,t):e(t,Ot.background),d(t.querySelectorAll("section")).forEach(function(t){v()?e(t,t):e(t,n)})})}function r(){/iphone|ipod|android/gi.test(navigator.userAgent)&&!/crios/gi.test(navigator.userAgent)&&(window.addEventListener("load",p,!1),window.addEventListener("orientationchange",p,!1))}function o(){function e(){n.length&&head.js.apply(null,n),a()}for(var t=[],n=[],r=0,o=Pt.dependencies.length;o>r;r++){var i=Pt.dependencies[r];(!i.condition||i.condition())&&(i.async?n.push(i.src):t.push(i.src),"function"==typeof i.callback&&head.ready(i.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],i.callback))}t.length?(head.ready(e),head.js.apply(null,t)):e()}function a(){t(),i(),K(),setTimeout(function(){m("ready",{indexh:Dt,indexv:Ct,currentSlide:At})},1)}function i(e){if(Ot.wrapper.classList.remove(Pt.transition),"object"==typeof e&&l(Pt,e),Yt===!1&&(Pt.transition="linear"),Ot.wrapper.classList.add(Pt.transition),Ot.wrapper.setAttribute("data-transition-speed",Pt.transitionSpeed),Ot.wrapper.setAttribute("data-background-transition",Pt.backgroundTransition),Ot.controls&&(Ot.controls.style.display=Pt.controls&&Ot.controls?"block":"none"),Ot.progress&&(Ot.progress.style.display=Pt.progress&&Ot.progress?"block":"none"),Pt.rtl?Ot.wrapper.classList.add("rtl"):Ot.wrapper.classList.remove("rtl"),Pt.center?Ot.wrapper.classList.add("center"):Ot.wrapper.classList.remove("center"),Pt.mouseWheel?(document.addEventListener("DOMMouseScroll",ft,!1),document.addEventListener("mousewheel",ft,!1)):(document.removeEventListener("DOMMouseScroll",ft,!1),document.removeEventListener("mousewheel",ft,!1)),Pt.rollingLinks?g():h(),Pt.previewLinks?y():(b(),y("[data-preview-link]")),Pt.theme&&Ot.theme){var t=Ot.theme.getAttribute("href"),n=/[^\/]*?(?=\.css)/,r=t.match(n)[0];Pt.theme!==r&&(t=t.replace(n,Pt.theme),Ot.theme.setAttribute("href",t))}Y()}function s(){Ft=!0,window.addEventListener("hashchange",wt,!1),window.addEventListener("resize",Lt,!1),Pt.touch&&(Ot.wrapper.addEventListener("touchstart",it,!1),Ot.wrapper.addEventListener("touchmove",st,!1),Ot.wrapper.addEventListener("touchend",ct,!1),window.navigator.msPointerEnabled&&(Ot.wrapper.addEventListener("MSPointerDown",lt,!1),Ot.wrapper.addEventListener("MSPointerMove",dt,!1),Ot.wrapper.addEventListener("MSPointerUp",ut,!1))),Pt.keyboard&&document.addEventListener("keydown",at,!1),Pt.progress&&Ot.progress&&Ot.progress.addEventListener("click",vt,!1),Pt.controls&&Ot.controls&&["touchstart","click"].forEach(function(e){Ot.controlsLeft.forEach(function(t){t.addEventListener(e,pt,!1)}),Ot.controlsRight.forEach(function(t){t.addEventListener(e,mt,!1)}),Ot.controlsUp.forEach(function(t){t.addEventListener(e,gt,!1)}),Ot.controlsDown.forEach(function(t){t.addEventListener(e,ht,!1)}),Ot.controlsPrev.forEach(function(t){t.addEventListener(e,yt,!1)}),Ot.controlsNext.forEach(function(t){t.addEventListener(e,bt,!1)})})}function c(){Ft=!1,document.removeEventListener("keydown",at,!1),window.removeEventListener("hashchange",wt,!1),window.removeEventListener("resize",Lt,!1),Ot.wrapper.removeEventListener("touchstart",it,!1),Ot.wrapper.removeEventListener("touchmove",st,!1),Ot.wrapper.removeEventListener("touchend",ct,!1),window.navigator.msPointerEnabled&&(Ot.wrapper.removeEventListener("MSPointerDown",lt,!1),Ot.wrapper.removeEventListener("MSPointerMove",dt,!1),Ot.wrapper.removeEventListener("MSPointerUp",ut,!1)),Pt.progress&&Ot.progress&&Ot.progress.removeEventListener("click",vt,!1),Pt.controls&&Ot.controls&&["touchstart","click"].forEach(function(e){Ot.controlsLeft.forEach(function(t){t.removeEventListener(e,pt,!1)}),Ot.controlsRight.forEach(function(t){t.removeEventListener(e,mt,!1)}),Ot.controlsUp.forEach(function(t){t.removeEventListener(e,gt,!1)}),Ot.controlsDown.forEach(function(t){t.removeEventListener(e,ht,!1)}),Ot.controlsPrev.forEach(function(t){t.removeEventListener(e,yt,!1)}),Ot.controlsNext.forEach(function(t){t.removeEventListener(e,bt,!1)})})}function l(e,t){for(var n in t)e[n]=t[n]}function d(e){return Array.prototype.slice.call(e)}function u(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function f(e){var t=0;if(e){var n=0;d(e.childNodes).forEach(function(e){"number"==typeof e.offsetTop&&e.style&&("absolute"===e.style.position&&(n+=1),t=Math.max(t,e.offsetTop+e.offsetHeight))}),0===n&&(t=e.offsetHeight)}return t}function v(){return/print-pdf/gi.test(window.location.search)}function p(){0===window.orientation?(document.documentElement.style.overflow="scroll",document.body.style.height="120%"):(document.documentElement.style.overflow="",document.body.style.height="100%"),setTimeout(function(){window.scrollTo(0,1)},10)}function m(e,t){var n=document.createEvent("HTMLEvents",1,2);n.initEvent(e,!0,!0),l(n,t),Ot.wrapper.dispatchEvent(n)}function g(){if(Yt&&!("msPerspective"in document.body.style))for(var e=document.querySelectorAll(qt+" a:not(.image)"),t=0,n=e.length;n>t;t++){var r=e[t];if(!(!r.textContent||r.querySelector("*")||r.className&&r.classList.contains(r,"roll"))){var o=document.createElement("span");o.setAttribute("data-title",r.text),o.innerHTML=r.innerHTML,r.classList.add("roll"),r.innerHTML="",r.appendChild(o)}}}function h(){for(var e=document.querySelectorAll(qt+" a.roll"),t=0,n=e.length;n>t;t++){var r=e[t],o=r.querySelector("span");o&&(r.classList.remove("roll"),r.innerHTML=o.innerHTML)}}function y(e){var t=d(document.querySelectorAll(e?e:"a"));t.forEach(function(e){/^(http|www)/gi.test(e.getAttribute("href"))&&e.addEventListener("click",kt,!1)})}function b(){var e=d(document.querySelectorAll("a"));e.forEach(function(e){/^(http|www)/gi.test(e.getAttribute("href"))&&e.removeEventListener("click",kt,!1)})}function w(e){L(),Ot.preview=document.createElement("div"),Ot.preview.classList.add("preview-link-overlay"),Ot.wrapper.appendChild(Ot.preview),Ot.preview.innerHTML=["
",'','',"
",'
','
','',"
"].join(""),Ot.preview.querySelector("iframe").addEventListener("load",function(){Ot.preview.classList.add("loaded")},!1),Ot.preview.querySelector(".close").addEventListener("click",function(e){L(),e.preventDefault()},!1),Ot.preview.querySelector(".external").addEventListener("click",function(){L()},!1),setTimeout(function(){Ot.preview.classList.add("visible")},1)}function L(){Ot.preview&&(Ot.preview.setAttribute("src",""),Ot.preview.parentNode.removeChild(Ot.preview),Ot.preview=null)}function E(e){var t=d(e);return t.forEach(function(e,t){e.hasAttribute("data-fragment-index")||e.setAttribute("data-fragment-index",t)}),t.sort(function(e,t){return e.getAttribute("data-fragment-index")-t.getAttribute("data-fragment-index")}),t}function k(){if(Ot.wrapper&&!v()){var e=Ot.wrapper.offsetWidth,t=Ot.wrapper.offsetHeight;e-=t*Pt.margin,t-=t*Pt.margin;var n=Pt.width,r=Pt.height;if("string"==typeof n&&/%$/.test(n)&&(n=parseInt(n,10)/100*e),"string"==typeof r&&/%$/.test(r)&&(r=parseInt(r,10)/100*t),Ot.slides.style.width=n+"px",Ot.slides.style.height=r+"px",It=Math.min(e/n,t/r),It=Math.max(It,Pt.minScale),It=Math.min(It,Pt.maxScale),void 0===Ot.slides.style.zoom||navigator.userAgent.match(/(iphone|ipod|ipad|android)/gi)){var o="translate(-50%, -50%) scale("+It+") translate(50%, 50%)";Ot.slides.style.WebkitTransform=o,Ot.slides.style.MozTransform=o,Ot.slides.style.msTransform=o,Ot.slides.style.OTransform=o,Ot.slides.style.transform=o}else Ot.slides.style.zoom=It;for(var a=d(document.querySelectorAll(qt)),i=0,s=a.length;s>i;i++){var c=a[i];"none"!==c.style.display&&(c.style.top=Pt.center?c.classList.contains("stack")?0:Math.max(-(f(c)/2)-20,-r/2)+"px":"")}H()}}function S(e,t){"object"==typeof e&&"function"==typeof e.setAttribute&&e.setAttribute("data-previous-indexv",t||0)}function A(e){if("object"==typeof e&&"function"==typeof e.setAttribute&&e.classList.contains("stack")){var t=e.hasAttribute("data-start-indexv")?"data-start-indexv":"data-previous-indexv";return parseInt(e.getAttribute(t)||0,10)}return 0}function q(){if(Pt.overview){G();var e=Ot.wrapper.classList.contains("overview");Ot.wrapper.classList.add("overview"),Ot.wrapper.classList.remove("exit-overview"),clearTimeout(Ut),clearTimeout(jt),Ut=setTimeout(function(){for(var t=document.querySelectorAll(xt),n=0,r=t.length;r>n;n++){var o=t[n],a=Pt.rtl?-105:105,i="translateZ(-2500px) translate("+(n-Dt)*a+"%, 0%)";if(o.setAttribute("data-index-h",n),o.style.display="block",o.style.WebkitTransform=i,o.style.MozTransform=i,o.style.msTransform=i,o.style.OTransform=i,o.style.transform=i,o.classList.contains("stack"))for(var s=o.querySelectorAll("section"),c=0,l=s.length;l>c;c++){var d=n===Dt?Ct:A(o),u=s[c],f="translate(0%, "+105*(c-d)+"%)";u.setAttribute("data-index-h",n),u.setAttribute("data-index-v",c),u.style.display="block",u.style.WebkitTransform=f,u.style.MozTransform=f,u.style.msTransform=f,u.style.OTransform=f,u.style.transform=f,u.addEventListener("click",Et,!0)}else o.addEventListener("click",Et,!0)}k(),e||m("overviewshown",{indexh:Dt,indexv:Ct,currentSlide:At})},10)}}function x(){if(Pt.overview){clearTimeout(Ut),clearTimeout(jt),Ot.wrapper.classList.remove("overview"),Ot.wrapper.classList.add("exit-overview"),jt=setTimeout(function(){Ot.wrapper.classList.remove("exit-overview")},10);for(var e=d(document.querySelectorAll(qt)),t=0,n=e.length;n>t;t++){var r=e[t];r.style.display="",r.style.WebkitTransform="",r.style.MozTransform="",r.style.msTransform="",r.style.OTransform="",r.style.transform="",r.removeEventListener("click",Et,!0)}O(Dt,Ct),B(),m("overviewhidden",{indexh:Dt,indexv:Ct,currentSlide:At})}}function T(e){"boolean"==typeof e?e?q():x():M()?x():q()}function M(){return Ot.wrapper.classList.contains("overview")}function P(e){return e=e?e:At,e&&!!e.parentNode.nodeName.match(/section/i)}function N(){var e=document.body,t=e.requestFullScreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullScreen;t&&t.apply(e)}function D(){var e=Ot.wrapper.classList.contains("paused");G(),Ot.wrapper.classList.add("paused"),e===!1&&m("paused")}function C(){var e=Ot.wrapper.classList.contains("paused");Ot.wrapper.classList.remove("paused"),B(),e&&m("resumed")}function R(){I()?C():D()}function I(){return Ot.wrapper.classList.contains("paused")}function O(e,t,n,r){St=At;var o=document.querySelectorAll(xt);void 0===t&&(t=A(o[e])),St&&St.parentNode&&St.parentNode.classList.contains("stack")&&S(St.parentNode,Ct);var a=Rt.concat();Rt.length=0;var i=Dt,s=Ct;Dt=z(xt,void 0===e?Dt:e),Ct=z(Tt,void 0===t?Ct:t),k();e:for(var c=0,l=Rt.length;l>c;c++){for(var u=0;a.length>u;u++)if(a[u]===Rt[c]){a.splice(u,1);continue e}document.documentElement.classList.add(Rt[c]),m(Rt[c])}for(;a.length;)document.documentElement.classList.remove(a.pop());M()&&q(),$(1500);var f=o[Dt],v=f.querySelectorAll("section");if(At=v[Ct]||f,n!==void 0){var p=E(At.querySelectorAll(".fragment"));d(p).forEach(function(e,t){n>t?e.classList.add("visible"):e.classList.remove("visible")})}var g=Dt!==i||Ct!==s;g?m("slidechanged",{indexh:Dt,indexv:Ct,previousSlide:St,currentSlide:At,origin:r}):St=null,St&&(St.classList.remove("present"),document.querySelector(Mt).classList.contains("present")&&setTimeout(function(){var e,t=d(document.querySelectorAll(xt+".stack"));for(e in t)t[e]&&S(t[e],0)},0)),g&&(_(St),F(At)),X(),H(),W()}function Y(){c(),s(),k(),Nt=Pt.autoSlide,B(),n(),X(),H(),W()}function z(e,t){var n=d(document.querySelectorAll(e)),r=n.length;if(r){Pt.loop&&(t%=r,0>t&&(t=r+t)),t=Math.max(Math.min(t,r-1),0);for(var o=0;r>o;o++){var a=n[o];if(M()===!1){var i=Math.abs((t-o)%(r-3))||0;a.style.display=i>3?"none":"block"}var s=Pt.rtl&&!P(a);a.classList.remove("past"),a.classList.remove("present"),a.classList.remove("future"),a.setAttribute("hidden",""),t>o?a.classList.add(s?"future":"past"):o>t&&a.classList.add(s?"past":"future"),a.querySelector("section")&&a.classList.add("stack")}n[t].classList.add("present"),n[t].removeAttribute("hidden");var c=n[t].getAttribute("data-state");c&&(Rt=Rt.concat(c.split(" ")));var l=n[t].getAttribute("data-autoslide");Nt=l?parseInt(l,10):Pt.autoSlide}else t=0;return t}function H(){if(Pt.progress&&Ot.progress){var e=d(document.querySelectorAll(xt)),t=document.querySelectorAll(qt+":not(.stack)").length,n=0;e:for(var r=0;e.length>r;r++){for(var o=e[r],a=d(o.querySelectorAll("section")),i=0;a.length>i;i++){if(a[i].classList.contains("present"))break e;n++}if(o.classList.contains("present"))break;o.classList.contains("stack")===!1&&n++}Ot.progressbar.style.width=n/(t-1)*window.innerWidth+"px"}}function X(){if(Pt.controls&&Ot.controls){var e=U(),t=j();Ot.controlsLeft.concat(Ot.controlsRight).concat(Ot.controlsUp).concat(Ot.controlsDown).concat(Ot.controlsPrev).concat(Ot.controlsNext).forEach(function(e){e.classList.remove("enabled"),e.classList.remove("fragmented")}),e.left&&Ot.controlsLeft.forEach(function(e){e.classList.add("enabled")}),e.right&&Ot.controlsRight.forEach(function(e){e.classList.add("enabled")}),e.up&&Ot.controlsUp.forEach(function(e){e.classList.add("enabled")}),e.down&&Ot.controlsDown.forEach(function(e){e.classList.add("enabled")}),(e.left||e.up)&&Ot.controlsPrev.forEach(function(e){e.classList.add("enabled")}),(e.right||e.down)&&Ot.controlsNext.forEach(function(e){e.classList.add("enabled")}),At&&(t.prev&&Ot.controlsPrev.forEach(function(e){e.classList.add("fragmented","enabled")}),t.next&&Ot.controlsNext.forEach(function(e){e.classList.add("fragmented","enabled")}),P(At)?(t.prev&&Ot.controlsUp.forEach(function(e){e.classList.add("fragmented","enabled")}),t.next&&Ot.controlsDown.forEach(function(e){e.classList.add("fragmented","enabled")})):(t.prev&&Ot.controlsLeft.forEach(function(e){e.classList.add("fragmented","enabled")}),t.next&&Ot.controlsRight.forEach(function(e){e.classList.add("fragmented","enabled")})))}}function W(){d(Ot.background.childNodes).forEach(function(e,t){var n=Pt.rtl?"future":"past",r=Pt.rtl?"past":"future";e.className="slide-background "+(Dt>t?n:t>Dt?r:"present"),d(e.childNodes).forEach(function(e,t){e.className="slide-background "+(Ct>t?"past":t>Ct?"future":"present")})}),setTimeout(function(){Ot.background.classList.remove("no-transition")},1)}function U(){var e=document.querySelectorAll(xt),t=document.querySelectorAll(Tt),n={left:Dt>0||Pt.loop,right:e.length-1>Dt||Pt.loop,up:Ct>0,down:t.length-1>Ct};if(Pt.rtl){var r=n.left;n.left=n.right,n.right=r}return n}function j(){if(At&&Pt.fragments){var e=At.querySelectorAll(".fragment"),t=At.querySelectorAll(".fragment:not(.visible)");return{prev:e.length-t.length>0,next:!!t.length}}return{prev:!1,next:!1}}function F(e){e&&(d(e.querySelectorAll("video, audio")).forEach(function(e){e.hasAttribute("data-autoplay")&&e.play()}),d(e.querySelectorAll('iframe[src*="youtube.com/embed/"]')).forEach(function(e){e.hasAttribute("data-autoplay")&&e.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*")}))}function _(e){e&&(d(e.querySelectorAll("video, audio")).forEach(function(e){e.hasAttribute("data-ignore")||e.pause()}),d(e.querySelectorAll('iframe[src*="youtube.com/embed/"]')).forEach(function(e){e.hasAttribute("data-ignore")||"function"!=typeof e.contentWindow.postMessage||e.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}))}function K(){var e=window.location.hash,t=e.slice(2).split("/"),n=e.replace(/#|\//gi,"");if(isNaN(parseInt(t[0],10))&&n.length){var r=document.querySelector("#"+n);if(r){var o=Reveal.getIndices(r);O(o.h,o.v)}else O(Dt,Ct)}else{var a=parseInt(t[0],10)||0,i=parseInt(t[1],10)||0;O(a,i)}}function $(e){if(Pt.history)if(clearTimeout(Wt),"number"==typeof e)Wt=setTimeout($,e);else{var t="/";At&&"string"==typeof At.getAttribute("id")?t="/"+At.getAttribute("id"):((Dt>0||Ct>0)&&(t+=Dt),Ct>0&&(t+="/"+Ct)),window.location.hash=t}}function V(e){var t,n=Dt,r=Ct;if(e){var o=P(e),a=o?e.parentNode:e,i=d(document.querySelectorAll(xt));n=Math.max(i.indexOf(a),0),o&&(r=Math.max(d(e.parentNode.querySelectorAll("section")).indexOf(e),0))}if(!e&&At){var s=At.querySelectorAll(".fragment.visible");s.length&&(t=s.length)}return{h:n,v:r,f:t}}function Z(){if(At&&Pt.fragments){var e=E(At.querySelectorAll(".fragment:not(.visible)"));if(e.length){var t=e[0].getAttribute("data-fragment-index");return e=At.querySelectorAll('.fragment[data-fragment-index="'+t+'"]'),d(e).forEach(function(e){e.classList.add("visible"),m("fragmentshown",{fragment:e})}),X(),!0}}return!1}function Q(){if(At&&Pt.fragments){var e=E(At.querySelectorAll(".fragment.visible"));if(e.length){var t=e[e.length-1].getAttribute("data-fragment-index");return e=At.querySelectorAll('.fragment[data-fragment-index="'+t+'"]'),d(e).forEach(function(e){e.classList.remove("visible"),m("fragmenthidden",{fragment:e})}),X(),!0}}return!1}function B(){clearTimeout(Xt),!Nt||I()||M()||(Xt=setTimeout(ot,Nt))}function G(){clearTimeout(Xt)}function J(){Pt.rtl?(M()||Z()===!1)&&U().left&&O(Dt+1):(M()||Q()===!1)&&U().left&&O(Dt-1)}function et(){Pt.rtl?(M()||Q()===!1)&&U().right&&O(Dt-1):(M()||Z()===!1)&&U().right&&O(Dt+1)}function tt(){(M()||Q()===!1)&&U().up&&O(Dt,Ct-1)}function nt(){(M()||Z()===!1)&&U().down&&O(Dt,Ct+1)}function rt(){if(Q()===!1)if(U().up)tt();else{var e=document.querySelector(xt+".past:nth-child("+Dt+")");if(e){var t=e.querySelectorAll("section").length-1||void 0,n=Dt-1;O(n,t)}}}function ot(){Z()===!1&&(U().down?nt():et()),B()}function at(e){document.activeElement;var t=!(!document.activeElement||!document.activeElement.type&&!document.activeElement.href&&"inherit"===document.activeElement.contentEditable);if(!(t||e.shiftKey&&32!==e.keyCode||e.altKey||e.ctrlKey||e.metaKey)){if(I()&&-1===[66,190,191].indexOf(e.keyCode))return!1;var n=!1;if("object"==typeof Pt.keyboard)for(var r in Pt.keyboard)if(parseInt(r,10)===e.keyCode){var o=Pt.keyboard[r];"function"==typeof o?o.apply(null,[e]):"string"==typeof o&&"function"==typeof Reveal[o]&&Reveal[o].call(),n=!0}if(n===!1)switch(n=!0,e.keyCode){case 80:case 33:rt();break;case 78:case 34:ot();break;case 72:case 37:J();break;case 76:case 39:et();break;case 75:case 38:tt();break;case 74:case 40:nt();break;case 36:O(0);break;case 35:O(Number.MAX_VALUE);break;case 32:M()?x():e.shiftKey?rt():ot();break;case 13:M()?x():n=!1;break;case 66:case 190:case 191:R();break;case 70:N();break;default:n=!1}n?e.preventDefault():27===e.keyCode&&Yt&&(T(),e.preventDefault()),B()}}function it(e){_t.startX=e.touches[0].clientX,_t.startY=e.touches[0].clientY,_t.startCount=e.touches.length,2===e.touches.length&&Pt.overview&&(_t.startSpan=u({x:e.touches[1].clientX,y:e.touches[1].clientY},{x:_t.startX,y:_t.startY}))}function st(e){if(_t.handled)navigator.userAgent.match(/android/gi)&&e.preventDefault();else{var t=e.touches[0].clientX,n=e.touches[0].clientY;if(2===e.touches.length&&2===_t.startCount&&Pt.overview){var r=u({x:e.touches[1].clientX,y:e.touches[1].clientY},{x:_t.startX,y:_t.startY});Math.abs(_t.startSpan-r)>_t.threshold&&(_t.handled=!0,_t.startSpan>r?q():x()),e.preventDefault()}else if(1===e.touches.length&&2!==_t.startCount){var o=t-_t.startX,a=n-_t.startY;o>_t.threshold&&Math.abs(o)>Math.abs(a)?(_t.handled=!0,J()):-_t.threshold>o&&Math.abs(o)>Math.abs(a)?(_t.handled=!0,et()):a>_t.threshold?(_t.handled=!0,tt()):-_t.threshold>a&&(_t.handled=!0,nt()),e.preventDefault()}}}function ct(){_t.handled=!1}function lt(e){e.pointerType===e.MSPOINTER_TYPE_TOUCH&&(e.touches=[{clientX:e.clientX,clientY:e.clientY}],it(e))}function dt(e){e.pointerType===e.MSPOINTER_TYPE_TOUCH&&(e.touches=[{clientX:e.clientX,clientY:e.clientY}],st(e))}function ut(e){e.pointerType===e.MSPOINTER_TYPE_TOUCH&&(e.touches=[{clientX:e.clientX,clientY:e.clientY}],ct(e))}function ft(e){if(Date.now()-Ht>600){Ht=Date.now();var t=e.detail||-e.wheelDelta;t>0?ot():rt()}}function vt(e){e.preventDefault();var t=d(document.querySelectorAll(xt)).length,n=Math.floor(e.clientX/Ot.wrapper.offsetWidth*t);O(n)}function pt(e){e.preventDefault(),J()}function mt(e){e.preventDefault(),et()}function gt(e){e.preventDefault(),tt()}function ht(e){e.preventDefault(),nt()}function yt(e){e.preventDefault(),rt()}function bt(e){e.preventDefault(),ot()}function wt(){K()}function Lt(){k()}function Et(e){if(Ft&&M()){e.preventDefault();for(var t=e.target;t&&!t.nodeName.match(/section/gi);)t=t.parentNode;if(t&&!t.classList.contains("disabled")&&(x(),t.nodeName.match(/section/gi))){var n=parseInt(t.getAttribute("data-index-h"),10),r=parseInt(t.getAttribute("data-index-v"),10);O(n,r)}}}function kt(e){var t=e.target.getAttribute("href");t&&(w(t),e.preventDefault())}var St,At,qt=".reveal .slides section",xt=".reveal .slides>section",Tt=".reveal .slides>section.present>section",Mt=".reveal .slides>section:first-child",Pt={width:960,height:700,margin:.1,minScale:.2,maxScale:1,controls:!0,progress:!0,history:!1,keyboard:!0,overview:!0,center:!0,touch:!0,loop:!1,rtl:!1,fragments:!0,autoSlide:0,mouseWheel:!1,rollingLinks:!0,previewLinks:!1,theme:null,transition:"default",transitionSpeed:"default",backgroundTransition:"default",dependencies:[]},Nt=0,Dt=0,Ct=0,Rt=[],It=1,Ot={},Yt="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,zt="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,Ht=0,Xt=0,Wt=0,Ut=0,jt=0,Ft=!1,_t={startX:0,startY:0,startSpan:0,startCount:0,handled:!1,threshold:80};return{initialize:e,configure:i,sync:Y,slide:O,left:J,right:et,up:tt,down:nt,prev:rt,next:ot,prevFragment:Q,nextFragment:Z,navigateTo:O,navigateLeft:J,navigateRight:et,navigateUp:tt,navigateDown:nt,navigatePrev:rt,navigateNext:ot,layout:k,availableRoutes:U,availableFragments:j,toggleOverview:T,togglePause:R,isOverview:M,isPaused:I,addEventListeners:s,removeEventListeners:c,getIndices:V,getSlide:function(e,t){var n=document.querySelectorAll(xt)[e],r=n&&n.querySelectorAll("section");return t!==void 0?r?r[t]:void 0:n},getPreviousSlide:function(){return St},getCurrentSlide:function(){return At},getScale:function(){return It},getConfig:function(){return Pt},getQueryHash:function(){var e={};return location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(t){e[t.split("=").shift()]=t.split("=").pop()}),e},isFirstSlide:function(){return null==document.querySelector(qt+".past")?!0:!1},isLastSlide:function(){return At&&At.classList.contains(".stack")?null==At.querySelector(qt+".future")?!0:!1:null==document.querySelector(qt+".future")?!0:!1},addEventListener:function(e,t,n){"addEventListener"in window&&(Ot.wrapper||document.querySelector(".reveal")).addEventListener(e,t,n)},removeEventListener:function(e,t,n){"addEventListener"in window&&(Ot.wrapper||document.querySelector(".reveal")).removeEventListener(e,t,n)}}}(); \ No newline at end of file +var Reveal=function(){"use strict";function e(e){return Ht||Xt?(window.addEventListener("load",A,!1),u(Dt,e),a(),i(),void 0):(document.body.setAttribute("class","no-transforms"),void 0)}function t(){zt.theme=document.querySelector("#theme"),zt.wrapper=document.querySelector(".reveal"),zt.slides=document.querySelector(".reveal .slides"),zt.background=n(zt.wrapper,"div","backgrounds",null),zt.progress=n(zt.wrapper,"div","progress",""),zt.progressbar=zt.progress.querySelector("span"),n(zt.wrapper,"aside","controls",''),n(zt.wrapper,"div","state-background",null),n(zt.wrapper,"div","pause-overlay",null),Dt.controls&&(zt.controls=document.querySelector(".reveal .controls"),zt.controlsLeft=f(document.querySelectorAll(".navigate-left")),zt.controlsRight=f(document.querySelectorAll(".navigate-right")),zt.controlsUp=f(document.querySelectorAll(".navigate-up")),zt.controlsDown=f(document.querySelectorAll(".navigate-down")),zt.controlsPrev=f(document.querySelectorAll(".navigate-prev")),zt.controlsNext=f(document.querySelectorAll(".navigate-next")))}function n(e,t,n,o){var a=e.querySelector("."+n);return a||(a=r(t,n,o),e.appendChild(a)),a}function r(e,t,n){var r=document.createElement(e);return r.classList.add(t),null!==n&&(r.innerHTML=n),r}function o(){function e(e,t){var n={background:e.getAttribute("data-background"),backgroundSize:e.getAttribute("data-background-size"),backgroundImage:e.getAttribute("data-background-image"),backgroundColor:e.getAttribute("data-background-color"),backgroundRepeat:e.getAttribute("data-background-repeat"),backgroundPosition:e.getAttribute("data-background-position"),backgroundTransition:e.getAttribute("data-background-transition")},r=document.createElement("div");return r.className="slide-background",n.background&&(/^(http|file|\/\/)/gi.test(n.background)||/\.(png|jpg|jpeg|gif|bmp)$/gi.test(n.background)?r.style.backgroundImage="url("+n.background+")":r.style.background=n.background),n.backgroundSize&&(r.style.backgroundSize=n.backgroundSize),n.backgroundImage&&(r.style.backgroundImage='url("'+n.backgroundImage+'")'),n.backgroundColor&&(r.style.backgroundColor=n.backgroundColor),n.backgroundRepeat&&(r.style.backgroundRepeat=n.backgroundRepeat),n.backgroundPosition&&(r.style.backgroundPosition=n.backgroundPosition),n.backgroundTransition&&r.setAttribute("data-background-transition",n.backgroundTransition),t.appendChild(r),r}m()&&document.body.classList.add("print-pdf"),zt.background.innerHTML="",zt.background.classList.add("no-transition"),f(document.querySelectorAll(Mt)).forEach(function(t){var n;n=m()?e(t,t):e(t,zt.background),f(t.querySelectorAll("section")).forEach(function(t){m()?e(t,t):e(t,n)})})}function a(){/iphone|ipod|android/gi.test(navigator.userAgent)&&!/crios/gi.test(navigator.userAgent)&&(window.addEventListener("load",g,!1),window.addEventListener("orientationchange",g,!1))}function i(){function e(){n.length&&head.js.apply(null,n),s()}for(var t=[],n=[],r=0,o=Dt.dependencies.length;o>r;r++){var a=Dt.dependencies[r];(!a.condition||a.condition())&&(a.async?n.push(a.src):t.push(a.src),"function"==typeof a.callback&&head.ready(a.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],a.callback))}t.length?(head.ready(e),head.js.apply(null,t)):e()}function s(){t(),c(),V(),setTimeout(function(){h("ready",{indexh:Rt,indexv:It,currentSlide:xt})},1)}function c(e){if(zt.wrapper.classList.remove(Dt.transition),"object"==typeof e&&u(Dt,e),Xt===!1&&(Dt.transition="linear"),zt.wrapper.classList.add(Dt.transition),zt.wrapper.setAttribute("data-transition-speed",Dt.transitionSpeed),zt.wrapper.setAttribute("data-background-transition",Dt.backgroundTransition),zt.controls&&(zt.controls.style.display=Dt.controls&&zt.controls?"block":"none"),zt.progress&&(zt.progress.style.display=Dt.progress&&zt.progress?"block":"none"),Dt.rtl?zt.wrapper.classList.add("rtl"):zt.wrapper.classList.remove("rtl"),Dt.center?zt.wrapper.classList.add("center"):zt.wrapper.classList.remove("center"),Dt.mouseWheel?(document.addEventListener("DOMMouseScroll",pt,!1),document.addEventListener("mousewheel",pt,!1)):(document.removeEventListener("DOMMouseScroll",pt,!1),document.removeEventListener("mousewheel",pt,!1)),Dt.rollingLinks?y():b(),Dt.previewLinks?w():(L(),w("[data-preview-link]")),Dt.theme&&zt.theme){var t=zt.theme.getAttribute("href"),n=/[^\/]*?(?=\.css)/,r=t.match(n)[0];Dt.theme!==r&&(t=t.replace(n,Dt.theme),zt.theme.setAttribute("href",t))}X()}function l(){Kt=!0,window.addEventListener("hashchange",Et,!1),window.addEventListener("resize",kt,!1),Dt.touch&&(zt.wrapper.addEventListener("touchstart",ct,!1),zt.wrapper.addEventListener("touchmove",lt,!1),zt.wrapper.addEventListener("touchend",dt,!1),window.navigator.msPointerEnabled&&(zt.wrapper.addEventListener("MSPointerDown",ut,!1),zt.wrapper.addEventListener("MSPointerMove",ft,!1),zt.wrapper.addEventListener("MSPointerUp",vt,!1))),Dt.keyboard&&document.addEventListener("keydown",st,!1),Dt.progress&&zt.progress&&zt.progress.addEventListener("click",mt,!1),Dt.controls&&zt.controls&&["touchstart","click"].forEach(function(e){zt.controlsLeft.forEach(function(t){t.addEventListener(e,gt,!1)}),zt.controlsRight.forEach(function(t){t.addEventListener(e,ht,!1)}),zt.controlsUp.forEach(function(t){t.addEventListener(e,yt,!1)}),zt.controlsDown.forEach(function(t){t.addEventListener(e,bt,!1)}),zt.controlsPrev.forEach(function(t){t.addEventListener(e,wt,!1)}),zt.controlsNext.forEach(function(t){t.addEventListener(e,Lt,!1)})})}function d(){Kt=!1,document.removeEventListener("keydown",st,!1),window.removeEventListener("hashchange",Et,!1),window.removeEventListener("resize",kt,!1),zt.wrapper.removeEventListener("touchstart",ct,!1),zt.wrapper.removeEventListener("touchmove",lt,!1),zt.wrapper.removeEventListener("touchend",dt,!1),window.navigator.msPointerEnabled&&(zt.wrapper.removeEventListener("MSPointerDown",ut,!1),zt.wrapper.removeEventListener("MSPointerMove",ft,!1),zt.wrapper.removeEventListener("MSPointerUp",vt,!1)),Dt.progress&&zt.progress&&zt.progress.removeEventListener("click",mt,!1),Dt.controls&&zt.controls&&["touchstart","click"].forEach(function(e){zt.controlsLeft.forEach(function(t){t.removeEventListener(e,gt,!1)}),zt.controlsRight.forEach(function(t){t.removeEventListener(e,ht,!1)}),zt.controlsUp.forEach(function(t){t.removeEventListener(e,yt,!1)}),zt.controlsDown.forEach(function(t){t.removeEventListener(e,bt,!1)}),zt.controlsPrev.forEach(function(t){t.removeEventListener(e,wt,!1)}),zt.controlsNext.forEach(function(t){t.removeEventListener(e,Lt,!1)})})}function u(e,t){for(var n in t)e[n]=t[n]}function f(e){return Array.prototype.slice.call(e)}function v(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function p(e){var t=0;if(e){var n=0;f(e.childNodes).forEach(function(e){"number"==typeof e.offsetTop&&e.style&&("absolute"===e.style.position&&(n+=1),t=Math.max(t,e.offsetTop+e.offsetHeight))}),0===n&&(t=e.offsetHeight)}return t}function m(){return/print-pdf/gi.test(window.location.search)}function g(){0===window.orientation?(document.documentElement.style.overflow="scroll",document.body.style.height="120%"):(document.documentElement.style.overflow="",document.body.style.height="100%"),setTimeout(function(){window.scrollTo(0,1)},10)}function h(e,t){var n=document.createEvent("HTMLEvents",1,2);n.initEvent(e,!0,!0),u(n,t),zt.wrapper.dispatchEvent(n)}function y(){if(Xt&&!("msPerspective"in document.body.style))for(var e=document.querySelectorAll(Tt+" a:not(.image)"),t=0,n=e.length;n>t;t++){var r=e[t];if(!(!r.textContent||r.querySelector("*")||r.className&&r.classList.contains(r,"roll"))){var o=document.createElement("span");o.setAttribute("data-title",r.text),o.innerHTML=r.innerHTML,r.classList.add("roll"),r.innerHTML="",r.appendChild(o)}}}function b(){for(var e=document.querySelectorAll(Tt+" a.roll"),t=0,n=e.length;n>t;t++){var r=e[t],o=r.querySelector("span");o&&(r.classList.remove("roll"),r.innerHTML=o.innerHTML)}}function w(e){var t=f(document.querySelectorAll(e?e:"a"));t.forEach(function(e){/^(http|www)/gi.test(e.getAttribute("href"))&&e.addEventListener("click",At,!1)})}function L(){var e=f(document.querySelectorAll("a"));e.forEach(function(e){/^(http|www)/gi.test(e.getAttribute("href"))&&e.removeEventListener("click",At,!1)})}function E(e){k(),zt.preview=document.createElement("div"),zt.preview.classList.add("preview-link-overlay"),zt.wrapper.appendChild(zt.preview),zt.preview.innerHTML=["
",'','',"
",'
','
','',"
"].join(""),zt.preview.querySelector("iframe").addEventListener("load",function(){zt.preview.classList.add("loaded")},!1),zt.preview.querySelector(".close").addEventListener("click",function(e){k(),e.preventDefault()},!1),zt.preview.querySelector(".external").addEventListener("click",function(){k()},!1),setTimeout(function(){zt.preview.classList.add("visible")},1)}function k(){zt.preview&&(zt.preview.setAttribute("src",""),zt.preview.parentNode.removeChild(zt.preview),zt.preview=null)}function S(e){var t=f(e);return t.forEach(function(e,t){e.hasAttribute("data-fragment-index")||e.setAttribute("data-fragment-index",t)}),t.sort(function(e,t){return e.getAttribute("data-fragment-index")-t.getAttribute("data-fragment-index")}),t}function A(){if(zt.wrapper&&!m()){var e=zt.wrapper.offsetWidth,t=zt.wrapper.offsetHeight;e-=t*Dt.margin,t-=t*Dt.margin;var n=Dt.width,r=Dt.height;if("string"==typeof n&&/%$/.test(n)&&(n=parseInt(n,10)/100*e),"string"==typeof r&&/%$/.test(r)&&(r=parseInt(r,10)/100*t),zt.slides.style.width=n+"px",zt.slides.style.height=r+"px",Yt=Math.min(e/n,t/r),Yt=Math.max(Yt,Dt.minScale),Yt=Math.min(Yt,Dt.maxScale),void 0===zt.slides.style.zoom||navigator.userAgent.match(/(iphone|ipod|ipad|android)/gi)){var o="translate(-50%, -50%) scale("+Yt+") translate(50%, 50%)";zt.slides.style.WebkitTransform=o,zt.slides.style.MozTransform=o,zt.slides.style.msTransform=o,zt.slides.style.OTransform=o,zt.slides.style.transform=o}else zt.slides.style.zoom=Yt;for(var a=f(document.querySelectorAll(Tt)),i=0,s=a.length;s>i;i++){var c=a[i];"none"!==c.style.display&&(c.style.top=Dt.center?c.classList.contains("stack")?0:Math.max(-(p(c)/2)-20,-r/2)+"px":"")}W()}}function q(e,t){"object"==typeof e&&"function"==typeof e.setAttribute&&e.setAttribute("data-previous-indexv",t||0)}function x(e){if("object"==typeof e&&"function"==typeof e.setAttribute&&e.classList.contains("stack")){var t=e.hasAttribute("data-start-indexv")?"data-start-indexv":"data-previous-indexv";return parseInt(e.getAttribute(t)||0,10)}return 0}function T(){if(Dt.overview){et();var e=zt.wrapper.classList.contains("overview");zt.wrapper.classList.add("overview"),zt.wrapper.classList.remove("exit-overview"),clearTimeout(Ft),clearTimeout(_t),Ft=setTimeout(function(){for(var t=document.querySelectorAll(Mt),n=0,r=t.length;r>n;n++){var o=t[n],a=Dt.rtl?-105:105,i="translateZ(-2500px) translate("+(n-Rt)*a+"%, 0%)";if(o.setAttribute("data-index-h",n),o.style.display="block",o.style.WebkitTransform=i,o.style.MozTransform=i,o.style.msTransform=i,o.style.OTransform=i,o.style.transform=i,o.classList.contains("stack"))for(var s=o.querySelectorAll("section"),c=0,l=s.length;l>c;c++){var d=n===Rt?It:x(o),u=s[c],f="translate(0%, "+105*(c-d)+"%)";u.setAttribute("data-index-h",n),u.setAttribute("data-index-v",c),u.style.display="block",u.style.WebkitTransform=f,u.style.MozTransform=f,u.style.msTransform=f,u.style.OTransform=f,u.style.transform=f,u.addEventListener("click",St,!0)}else o.addEventListener("click",St,!0)}A(),e||h("overviewshown",{indexh:Rt,indexv:It,currentSlide:xt})},10)}}function M(){if(Dt.overview){clearTimeout(Ft),clearTimeout(_t),zt.wrapper.classList.remove("overview"),zt.wrapper.classList.add("exit-overview"),_t=setTimeout(function(){zt.wrapper.classList.remove("exit-overview")},10);for(var e=f(document.querySelectorAll(Tt)),t=0,n=e.length;n>t;t++){var r=e[t];r.style.display="",r.style.WebkitTransform="",r.style.MozTransform="",r.style.msTransform="",r.style.OTransform="",r.style.transform="",r.removeEventListener("click",St,!0)}z(Rt,It),J(),h("overviewhidden",{indexh:Rt,indexv:It,currentSlide:xt})}}function P(e){"boolean"==typeof e?e?T():M():N()?M():T()}function N(){return zt.wrapper.classList.contains("overview")}function D(e){return e=e?e:xt,e&&!!e.parentNode.nodeName.match(/section/i)}function C(){var e=document.body,t=e.requestFullScreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullScreen;t&&t.apply(e)}function R(){var e=zt.wrapper.classList.contains("paused");et(),zt.wrapper.classList.add("paused"),e===!1&&h("paused")}function I(){var e=zt.wrapper.classList.contains("paused");zt.wrapper.classList.remove("paused"),J(),e&&h("resumed")}function O(){Y()?I():R()}function Y(){return zt.wrapper.classList.contains("paused")}function z(e,t,n,r){qt=xt;var o=document.querySelectorAll(Mt);void 0===t&&(t=x(o[e])),qt&&qt.parentNode&&qt.parentNode.classList.contains("stack")&&q(qt.parentNode,It);var a=Ot.concat();Ot.length=0;var i=Rt,s=It;Rt=H(Mt,void 0===e?Rt:e),It=H(Pt,void 0===t?It:t),A();e:for(var c=0,l=Ot.length;l>c;c++){for(var d=0;a.length>d;d++)if(a[d]===Ot[c]){a.splice(d,1);continue e}document.documentElement.classList.add(Ot[c]),h(Ot[c])}for(;a.length;)document.documentElement.classList.remove(a.pop());N()&&T(),Z(1500);var u=o[Rt],v=u.querySelectorAll("section");if(xt=v[It]||u,n!==void 0){var p=S(xt.querySelectorAll(".fragment"));f(p).forEach(function(e,t){n>t?e.classList.add("visible"):e.classList.remove("visible")})}var m=Rt!==i||It!==s;m?h("slidechanged",{indexh:Rt,indexv:It,previousSlide:qt,currentSlide:xt,origin:r}):qt=null,qt&&(qt.classList.remove("present"),document.querySelector(Nt).classList.contains("present")&&setTimeout(function(){var e,t=f(document.querySelectorAll(Mt+".stack"));for(e in t)t[e]&&q(t[e],0)},0)),m&&($(qt),K(xt)),U(),W(),j()}function X(){d(),l(),A(),Ct=Dt.autoSlide,J(),o(),U(),W(),j()}function H(e,t){var n=f(document.querySelectorAll(e)),r=n.length;if(r){Dt.loop&&(t%=r,0>t&&(t=r+t)),t=Math.max(Math.min(t,r-1),0);for(var o=0;r>o;o++){var a=n[o];if(N()===!1){var i=Math.abs((t-o)%(r-3))||0;a.style.display=i>3?"none":"block"}var s=Dt.rtl&&!D(a);a.classList.remove("past"),a.classList.remove("present"),a.classList.remove("future"),a.setAttribute("hidden",""),t>o?a.classList.add(s?"future":"past"):o>t&&a.classList.add(s?"past":"future"),a.querySelector("section")&&a.classList.add("stack")}n[t].classList.add("present"),n[t].removeAttribute("hidden");var c=n[t].getAttribute("data-state");c&&(Ot=Ot.concat(c.split(" ")));var l=n[t].getAttribute("data-autoslide");Ct=l?parseInt(l,10):Dt.autoSlide}else t=0;return t}function W(){if(Dt.progress&&zt.progress){var e=f(document.querySelectorAll(Mt)),t=document.querySelectorAll(Tt+":not(.stack)").length,n=0;e:for(var r=0;e.length>r;r++){for(var o=e[r],a=f(o.querySelectorAll("section")),i=0;a.length>i;i++){if(a[i].classList.contains("present"))break e;n++}if(o.classList.contains("present"))break;o.classList.contains("stack")===!1&&n++}zt.progressbar.style.width=n/(t-1)*window.innerWidth+"px"}}function U(){if(Dt.controls&&zt.controls){var e=F(),t=_();zt.controlsLeft.concat(zt.controlsRight).concat(zt.controlsUp).concat(zt.controlsDown).concat(zt.controlsPrev).concat(zt.controlsNext).forEach(function(e){e.classList.remove("enabled"),e.classList.remove("fragmented")}),e.left&&zt.controlsLeft.forEach(function(e){e.classList.add("enabled")}),e.right&&zt.controlsRight.forEach(function(e){e.classList.add("enabled")}),e.up&&zt.controlsUp.forEach(function(e){e.classList.add("enabled")}),e.down&&zt.controlsDown.forEach(function(e){e.classList.add("enabled")}),(e.left||e.up)&&zt.controlsPrev.forEach(function(e){e.classList.add("enabled")}),(e.right||e.down)&&zt.controlsNext.forEach(function(e){e.classList.add("enabled")}),xt&&(t.prev&&zt.controlsPrev.forEach(function(e){e.classList.add("fragmented","enabled")}),t.next&&zt.controlsNext.forEach(function(e){e.classList.add("fragmented","enabled")}),D(xt)?(t.prev&&zt.controlsUp.forEach(function(e){e.classList.add("fragmented","enabled")}),t.next&&zt.controlsDown.forEach(function(e){e.classList.add("fragmented","enabled")})):(t.prev&&zt.controlsLeft.forEach(function(e){e.classList.add("fragmented","enabled")}),t.next&&zt.controlsRight.forEach(function(e){e.classList.add("fragmented","enabled")})))}}function j(){f(zt.background.childNodes).forEach(function(e,t){var n=Dt.rtl?"future":"past",r=Dt.rtl?"past":"future";e.className="slide-background "+(Rt>t?n:t>Rt?r:"present"),f(e.childNodes).forEach(function(e,t){e.className="slide-background "+(It>t?"past":t>It?"future":"present")})}),setTimeout(function(){zt.background.classList.remove("no-transition")},1)}function F(){var e=document.querySelectorAll(Mt),t=document.querySelectorAll(Pt),n={left:Rt>0||Dt.loop,right:e.length-1>Rt||Dt.loop,up:It>0,down:t.length-1>It};if(Dt.rtl){var r=n.left;n.left=n.right,n.right=r}return n}function _(){if(xt&&Dt.fragments){var e=xt.querySelectorAll(".fragment"),t=xt.querySelectorAll(".fragment:not(.visible)");return{prev:e.length-t.length>0,next:!!t.length}}return{prev:!1,next:!1}}function K(e){e&&(f(e.querySelectorAll("video, audio")).forEach(function(e){e.hasAttribute("data-autoplay")&&e.play()}),f(e.querySelectorAll('iframe[src*="youtube.com/embed/"]')).forEach(function(e){e.hasAttribute("data-autoplay")&&e.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*")}))}function $(e){e&&(f(e.querySelectorAll("video, audio")).forEach(function(e){e.hasAttribute("data-ignore")||e.pause()}),f(e.querySelectorAll('iframe[src*="youtube.com/embed/"]')).forEach(function(e){e.hasAttribute("data-ignore")||"function"!=typeof e.contentWindow.postMessage||e.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}))}function V(){var e=window.location.hash,t=e.slice(2).split("/"),n=e.replace(/#|\//gi,"");if(isNaN(parseInt(t[0],10))&&n.length){var r=document.querySelector("#"+n);if(r){var o=Reveal.getIndices(r);z(o.h,o.v)}else z(Rt,It)}else{var a=parseInt(t[0],10)||0,i=parseInt(t[1],10)||0;z(a,i)}}function Z(e){if(Dt.history)if(clearTimeout(jt),"number"==typeof e)jt=setTimeout(Z,e);else{var t="/";xt&&"string"==typeof xt.getAttribute("id")?t="/"+xt.getAttribute("id"):((Rt>0||It>0)&&(t+=Rt),It>0&&(t+="/"+It)),window.location.hash=t}}function Q(e){var t,n=Rt,r=It;if(e){var o=D(e),a=o?e.parentNode:e,i=f(document.querySelectorAll(Mt));n=Math.max(i.indexOf(a),0),o&&(r=Math.max(f(e.parentNode.querySelectorAll("section")).indexOf(e),0))}if(!e&&xt){var s=xt.querySelectorAll(".fragment.visible");s.length&&(t=s.length)}return{h:n,v:r,f:t}}function B(){if(xt&&Dt.fragments){var e=S(xt.querySelectorAll(".fragment:not(.visible)"));if(e.length){var t=e[0].getAttribute("data-fragment-index");return e=xt.querySelectorAll('.fragment[data-fragment-index="'+t+'"]'),f(e).forEach(function(e){e.classList.add("visible")}),h("fragmentshown",{fragment:e[0],fragments:e}),U(),!0}}return!1}function G(){if(xt&&Dt.fragments){var e=S(xt.querySelectorAll(".fragment.visible"));if(e.length){var t=e[e.length-1].getAttribute("data-fragment-index");return e=xt.querySelectorAll('.fragment[data-fragment-index="'+t+'"]'),f(e).forEach(function(e){e.classList.remove("visible")}),h("fragmenthidden",{fragment:e[0],fragments:e}),U(),!0}}return!1}function J(){clearTimeout(Ut),!Ct||Y()||N()||(Ut=setTimeout(it,Ct))}function et(){clearTimeout(Ut)}function tt(){Dt.rtl?(N()||B()===!1)&&F().left&&z(Rt+1):(N()||G()===!1)&&F().left&&z(Rt-1)}function nt(){Dt.rtl?(N()||G()===!1)&&F().right&&z(Rt-1):(N()||B()===!1)&&F().right&&z(Rt+1)}function rt(){(N()||G()===!1)&&F().up&&z(Rt,It-1)}function ot(){(N()||B()===!1)&&F().down&&z(Rt,It+1)}function at(){if(G()===!1)if(F().up)rt();else{var e=document.querySelector(Mt+".past:nth-child("+Rt+")");if(e){var t=e.querySelectorAll("section").length-1||void 0,n=Rt-1;z(n,t)}}}function it(){B()===!1&&(F().down?ot():nt()),J()}function st(e){document.activeElement;var t=!(!document.activeElement||!document.activeElement.type&&!document.activeElement.href&&"inherit"===document.activeElement.contentEditable);if(!(t||e.shiftKey&&32!==e.keyCode||e.altKey||e.ctrlKey||e.metaKey)){if(Y()&&-1===[66,190,191].indexOf(e.keyCode))return!1;var n=!1;if("object"==typeof Dt.keyboard)for(var r in Dt.keyboard)if(parseInt(r,10)===e.keyCode){var o=Dt.keyboard[r];"function"==typeof o?o.apply(null,[e]):"string"==typeof o&&"function"==typeof Reveal[o]&&Reveal[o].call(),n=!0}if(n===!1)switch(n=!0,e.keyCode){case 80:case 33:at();break;case 78:case 34:it();break;case 72:case 37:tt();break;case 76:case 39:nt();break;case 75:case 38:rt();break;case 74:case 40:ot();break;case 36:z(0);break;case 35:z(Number.MAX_VALUE);break;case 32:N()?M():e.shiftKey?at():it();break;case 13:N()?M():n=!1;break;case 66:case 190:case 191:O();break;case 70:C();break;default:n=!1}n?e.preventDefault():27===e.keyCode&&Xt&&(P(),e.preventDefault()),J()}}function ct(e){$t.startX=e.touches[0].clientX,$t.startY=e.touches[0].clientY,$t.startCount=e.touches.length,2===e.touches.length&&Dt.overview&&($t.startSpan=v({x:e.touches[1].clientX,y:e.touches[1].clientY},{x:$t.startX,y:$t.startY}))}function lt(e){if($t.handled)navigator.userAgent.match(/android/gi)&&e.preventDefault();else{var t=e.touches[0].clientX,n=e.touches[0].clientY;if(2===e.touches.length&&2===$t.startCount&&Dt.overview){var r=v({x:e.touches[1].clientX,y:e.touches[1].clientY},{x:$t.startX,y:$t.startY});Math.abs($t.startSpan-r)>$t.threshold&&($t.handled=!0,$t.startSpan>r?T():M()),e.preventDefault()}else if(1===e.touches.length&&2!==$t.startCount){var o=t-$t.startX,a=n-$t.startY;o>$t.threshold&&Math.abs(o)>Math.abs(a)?($t.handled=!0,tt()):-$t.threshold>o&&Math.abs(o)>Math.abs(a)?($t.handled=!0,nt()):a>$t.threshold?($t.handled=!0,rt()):-$t.threshold>a&&($t.handled=!0,ot()),e.preventDefault()}}}function dt(){$t.handled=!1}function ut(e){e.pointerType===e.MSPOINTER_TYPE_TOUCH&&(e.touches=[{clientX:e.clientX,clientY:e.clientY}],ct(e))}function ft(e){e.pointerType===e.MSPOINTER_TYPE_TOUCH&&(e.touches=[{clientX:e.clientX,clientY:e.clientY}],lt(e))}function vt(e){e.pointerType===e.MSPOINTER_TYPE_TOUCH&&(e.touches=[{clientX:e.clientX,clientY:e.clientY}],dt(e))}function pt(e){if(Date.now()-Wt>600){Wt=Date.now();var t=e.detail||-e.wheelDelta;t>0?it():at()}}function mt(e){e.preventDefault();var t=f(document.querySelectorAll(Mt)).length,n=Math.floor(e.clientX/zt.wrapper.offsetWidth*t);z(n)}function gt(e){e.preventDefault(),tt()}function ht(e){e.preventDefault(),nt()}function yt(e){e.preventDefault(),rt()}function bt(e){e.preventDefault(),ot()}function wt(e){e.preventDefault(),at()}function Lt(e){e.preventDefault(),it()}function Et(){V()}function kt(){A()}function St(e){if(Kt&&N()){e.preventDefault();for(var t=e.target;t&&!t.nodeName.match(/section/gi);)t=t.parentNode;if(t&&!t.classList.contains("disabled")&&(M(),t.nodeName.match(/section/gi))){var n=parseInt(t.getAttribute("data-index-h"),10),r=parseInt(t.getAttribute("data-index-v"),10);z(n,r)}}}function At(e){var t=e.target.getAttribute("href");t&&(E(t),e.preventDefault())}var qt,xt,Tt=".reveal .slides section",Mt=".reveal .slides>section",Pt=".reveal .slides>section.present>section",Nt=".reveal .slides>section:first-child",Dt={width:960,height:700,margin:.1,minScale:.2,maxScale:1,controls:!0,progress:!0,history:!1,keyboard:!0,overview:!0,center:!0,touch:!0,loop:!1,rtl:!1,fragments:!0,autoSlide:0,mouseWheel:!1,rollingLinks:!0,previewLinks:!1,theme:null,transition:"default",transitionSpeed:"default",backgroundTransition:"default",dependencies:[]},Ct=0,Rt=0,It=0,Ot=[],Yt=1,zt={},Xt="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,Ht="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,Wt=0,Ut=0,jt=0,Ft=0,_t=0,Kt=!1,$t={startX:0,startY:0,startSpan:0,startCount:0,handled:!1,threshold:80};return{initialize:e,configure:c,sync:X,slide:z,left:tt,right:nt,up:rt,down:ot,prev:at,next:it,prevFragment:G,nextFragment:B,navigateTo:z,navigateLeft:tt,navigateRight:nt,navigateUp:rt,navigateDown:ot,navigatePrev:at,navigateNext:it,layout:A,availableRoutes:F,availableFragments:_,toggleOverview:P,togglePause:O,isOverview:N,isPaused:Y,addEventListeners:l,removeEventListeners:d,getIndices:Q,getSlide:function(e,t){var n=document.querySelectorAll(Mt)[e],r=n&&n.querySelectorAll("section");return t!==void 0?r?r[t]:void 0:n},getPreviousSlide:function(){return qt},getCurrentSlide:function(){return xt},getScale:function(){return Yt},getConfig:function(){return Dt},getQueryHash:function(){var e={};return location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(t){e[t.split("=").shift()]=t.split("=").pop()}),e},isFirstSlide:function(){return null==document.querySelector(Tt+".past")?!0:!1},isLastSlide:function(){return xt&&xt.classList.contains(".stack")?null==xt.querySelector(Tt+".future")?!0:!1:null==document.querySelector(Tt+".future")?!0:!1},addEventListener:function(e,t,n){"addEventListener"in window&&(zt.wrapper||document.querySelector(".reveal")).addEventListener(e,t,n)},removeEventListener:function(e,t,n){"addEventListener"in window&&(zt.wrapper||document.querySelector(".reveal")).removeEventListener(e,t,n)}}}(); \ No newline at end of file From e18ffa8779a0161f067a171b230a06b8952758db Mon Sep 17 00:00:00 2001 From: Guillaume Turri Date: Sun, 11 Aug 2013 16:25:43 +0200 Subject: [PATCH 2/4] Use more explicit name --- js/reveal.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 4666642..d5461e8 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -193,24 +193,24 @@ var Reveal = (function(){ dom.slides = document.querySelector( '.reveal .slides' ); // Background element - dom.background = initializeNode(dom.wrapper, 'div', 'backgrounds', null); + dom.background = createSingletonNode(dom.wrapper, 'div', 'backgrounds', null); // Progress bar - dom.progress = initializeNode(dom.wrapper, 'div', 'progress', ''); + dom.progress = createSingletonNode(dom.wrapper, 'div', 'progress', ''); dom.progressbar = dom.progress.querySelector('span'); // Arrow controls - initializeNode(dom.wrapper, 'aside', 'controls', + createSingletonNode(dom.wrapper, 'aside', 'controls', '' + '' + '' + ''); // State background element [DEPRECATED] - initializeNode(dom.wrapper, 'div', 'state-background', null); + createSingletonNode(dom.wrapper, 'div', 'state-background', null); // Overlay graphic which is displayed during the paused mode - initializeNode(dom.wrapper, 'div', 'pause-overlay', null); + createSingletonNode(dom.wrapper, 'div', 'pause-overlay', null); // Cache references to elements if ( config.controls ) { @@ -227,7 +227,7 @@ var Reveal = (function(){ } - function initializeNode(container, tagname, classname, innerHTML){ + function createSingletonNode(container, tagname, classname, innerHTML){ var node = container.querySelector('.' + classname); if( !node ){ node = buildNode(tagname, classname, innerHTML); From 644ae56f4f86d5c3247764f17de6541cb7eb168f Mon Sep 17 00:00:00 2001 From: Guillaume Turri Date: Sun, 11 Aug 2013 16:30:08 +0200 Subject: [PATCH 3/4] inlined method used only once --- js/reveal.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index d5461e8..5baacfb 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -230,21 +230,16 @@ var Reveal = (function(){ function createSingletonNode(container, tagname, classname, innerHTML){ var node = container.querySelector('.' + classname); if( !node ){ - node = buildNode(tagname, classname, innerHTML); + node = document.createElement(tagname); + node.classList.add(classname); + if(innerHTML !== null){ + node.innerHTML = innerHTML; + } container.appendChild(node); } return node; } - function buildNode(tagname, classname, innerHTML){ - var node = document.createElement(tagname); - node.classList.add(classname); - if(innerHTML !== null){ - node.innerHTML = innerHTML; - } - return node; - } - /** * Creates the slide background elements and appends them * to the background container. One element is created per From 48f5ba936703a731392ead9ed910a6c7b21d898c Mon Sep 17 00:00:00 2001 From: Guillaume Turri Date: Sun, 11 Aug 2013 16:34:04 +0200 Subject: [PATCH 4/4] Formatting --- js/reveal.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 5baacfb..b6210b1 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -193,24 +193,24 @@ var Reveal = (function(){ dom.slides = document.querySelector( '.reveal .slides' ); // Background element - dom.background = createSingletonNode(dom.wrapper, 'div', 'backgrounds', null); + dom.background = createSingletonNode( dom.wrapper, 'div', 'backgrounds', null ); // Progress bar - dom.progress = createSingletonNode(dom.wrapper, 'div', 'progress', ''); - dom.progressbar = dom.progress.querySelector('span'); + dom.progress = createSingletonNode( dom.wrapper, 'div', 'progress', '' ); + dom.progressbar = dom.progress.querySelector( 'span' ); // Arrow controls - createSingletonNode(dom.wrapper, 'aside', 'controls', + createSingletonNode( dom.wrapper, 'aside', 'controls', '' + '' + '' + - ''); + '' ); // State background element [DEPRECATED] - createSingletonNode(dom.wrapper, 'div', 'state-background', null); + createSingletonNode( dom.wrapper, 'div', 'state-background', null ); // Overlay graphic which is displayed during the paused mode - createSingletonNode(dom.wrapper, 'div', 'pause-overlay', null); + createSingletonNode( dom.wrapper, 'div', 'pause-overlay', null ); // Cache references to elements if ( config.controls ) { @@ -227,17 +227,19 @@ var Reveal = (function(){ } - function createSingletonNode(container, tagname, classname, innerHTML){ - var node = container.querySelector('.' + classname); + function createSingletonNode( container, tagname, classname, innerHTML ){ + + var node = container.querySelector( '.' + classname ); if( !node ){ - node = document.createElement(tagname); - node.classList.add(classname); - if(innerHTML !== null){ + node = document.createElement( tagname ); + node.classList.add( classname ); + if( innerHTML !== null ){ node.innerHTML = innerHTML; } - container.appendChild(node); + container.appendChild( node ); } return node; + } /**