1
0
Fork 0
why-cant-we-deploy-today/js/reveal.min.js

8 lines
17 KiB
JavaScript

/*!
* reveal.js 2.3 (2013-01-28, 18:56)
* http://lab.hakim.se/reveal-js
* MIT licensed
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
var Reveal=function(){"use strict";function w(e){if(!p&&!h){document.body.setAttribute("class","no-transforms");return}window.addEventListener("load",H,!1),L(i,e),S(),x()}function E(){c.theme=document.querySelector("#theme"),c.wrapper=document.querySelector(".reveal"),c.slides=document.querySelector(".reveal .slides");if(!c.wrapper.querySelector(".progress")&&i.progress){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="<span></span>",c.wrapper.appendChild(e)}if(!c.wrapper.querySelector(".controls")&&i.controls){var t=document.createElement("aside");t.classList.add("controls"),t.innerHTML='<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>',c.wrapper.appendChild(t)}if(!c.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),c.wrapper.appendChild(n)}if(!c.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),c.wrapper.appendChild(r)}c.progress=document.querySelector(".reveal .progress"),c.progressbar=document.querySelector(".reveal .progress span"),i.controls&&(c.controls=document.querySelector(".reveal .controls"),c.controlsLeft=A(document.querySelectorAll(".navigate-left")),c.controlsRight=A(document.querySelectorAll(".navigate-right")),c.controlsUp=A(document.querySelectorAll(".navigate-up")),c.controlsDown=A(document.querySelectorAll(".navigate-down")),c.controlsPrev=A(document.querySelectorAll(".navigate-prev")),c.controlsNext=A(document.querySelectorAll(".navigate-next")))}function S(){navigator.userAgent.match(/(iphone|ipod)/i)&&(document.documentElement.style.overflow="scroll",document.body.style.height="120%",window.addEventListener("load",_,!1),window.addEventListener("orientationchange",_,!1))}function x(){function o(){t.length&&head.js.apply(null,t),T()}var e=[],t=[];for(var n=0,r=i.dependencies.length;n<r;n++){var s=i.dependencies[n];if(!s.condition||s.condition())s.async?t.push(s.src):e.push(s.src),typeof s.callback=="function"&&head.ready(s.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],s.callback)}e.length?(head.ready(o),head.js.apply(null,e)):o()}function T(){E(),C(),N(),H(),Y(),rt(),setTimeout(function(){D("ready",{indexh:o,indexv:u,currentSlide:f})},1)}function N(){h===!1&&(i.transition="linear"),i.controls&&c.controls&&(c.controls.style.display="block"),i.progress&&c.progress&&(c.progress.style.display="block"),i.transition!=="default"&&c.wrapper.classList.add(i.transition),i.rtl&&c.wrapper.classList.add("rtl"),i.center&&c.wrapper.classList.add("center"),i.mouseWheel&&(document.addEventListener("DOMMouseScroll",dt,!1),document.addEventListener("mousewheel",dt,!1)),i.rollingLinks&&P();if(i.theme&&c.theme){var e=c.theme.getAttribute("href"),t=/[^\/]*?(?=\.css)/,n=e.match(t)[0];i.theme!==n&&(e=e.replace(t,i.theme),c.theme.setAttribute("href",e))}}function C(){window.addEventListener("hashchange",mt,!1),window.addEventListener("resize",gt,!1),i.touch&&(document.addEventListener("touchstart",ct,!1),document.addEventListener("touchmove",ht,!1),document.addEventListener("touchend",pt,!1)),i.keyboard&&document.addEventListener("keydown",lt,!1),i.progress&&c.progress&&c.progress.addEventListener("click",M(vt),!1);if(i.controls&&c.controls){var e="ontouchstart"in window?"touchstart":"click";c.controlsLeft.forEach(function(t){t.addEventListener(e,M(it),!1)}),c.controlsRight.forEach(function(t){t.addEventListener(e,M(st),!1)}),c.controlsUp.forEach(function(t){t.addEventListener(e,M(ot),!1)}),c.controlsDown.forEach(function(t){t.addEventListener(e,M(ut),!1)}),c.controlsPrev.forEach(function(t){t.addEventListener(e,M(at),!1)}),c.controlsNext.forEach(function(t){t.addEventListener(e,M(ft),!1)})}}function k(){document.removeEventListener("keydown",lt,!1),window.removeEventListener("hashchange",mt,!1),window.removeEventListener("resize",gt,!1),i.touch&&(document.removeEventListener("touchstart",ct,!1),document.removeEventListener("touchmove",ht,!1),document.removeEventListener("touchend",pt,!1)),i.progress&&c.progress&&c.progress.removeEventListener("click",M(vt),!1);if(i.controls&&c.controls){var e="ontouchstart"in window?"touchstart":"click";c.controlsLeft.forEach(function(t){t.removeEventListener(e,M(it),!1)}),c.controlsRight.forEach(function(t){t.removeEventListener(e,M(st),!1)}),c.controlsUp.forEach(function(t){t.removeEventListener(e,M(ot),!1)}),c.controlsDown.forEach(function(t){t.removeEventListener(e,M(ut),!1)}),c.controlsPrev.forEach(function(t){t.removeEventListener(e,M(at),!1)}),c.controlsNext.forEach(function(t){t.removeEventListener(e,M(ft),!1)})}}function L(e,t){for(var n in t)e[n]=t[n]}function A(e){return Array.prototype.slice.call(e)}function O(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function M(e){return function(t){t.preventDefault(),e.call(null,t)}}function _(){setTimeout(function(){window.scrollTo(0,1)},0)}function D(e,t){var n=document.createEvent("HTMLEvents",1,2);n.initEvent(e,!0,!0),L(n,t),c.wrapper.dispatchEvent(n)}function P(){if(h&&!("msPerspective"in document.body.style)){var t=document.querySelectorAll(e+" a:not(.image)");for(var n=0,r=t.length;n<r;n++){var i=t[n];if(i.textContent&&!i.querySelector("*")&&(!i.className||!i.classList.contains(i,"roll"))){var s=document.createElement("span");s.setAttribute("data-title",i.text),s.innerHTML=i.innerHTML,i.classList.add("roll"),i.innerHTML="",i.appendChild(s)}}}}function H(){var t=c.wrapper.offsetWidth,n=c.wrapper.offsetHeight,r=i.width,s=i.height;typeof r=="string"&&/%$/.test(r)&&(r=parseInt(r,10)/100*t),typeof s=="string"&&/%$/.test(s)&&(s=parseInt(s,10)/100*n),c.slides.style.width=r+"px",c.slides.style.height=s+"px",t-=n*i.padding*2,n-=n*i.padding*2;var o=Math.min(t/r,n/s);if(typeof c.slides.style.zoom!="undefined")c.slides.style.zoom=o;else{var u="translate(-50%, -50%) scale("+o+") translate(50%, 50%)";c.slides.style.WebkitTransform=u,c.slides.style.MozTransform=u,c.slides.style.msTransform=u,c.slides.style.OTransform=u,c.slides.style.transform=u}if(i.center){var a=A(document.querySelectorAll(e)),f=-s/2;for(var l=0,h=a.length;l<h;l++){var p=a[l];if(p.style.display==="none")continue;p.classList.contains("stack")?p.style.top=0:p.style.top=Math.max(-(p.offsetHeight/2)-20,f)+"px"}}}function B(e,t){e&&e.setAttribute("data-previous-indexv",t||0)}function j(e){return e&&e.classList.contains("stack")?parseInt(e.getAttribute("data-previous-indexv")||0,10):0}function F(){if(i.overview){var e=c.wrapper.classList.contains("overview");c.wrapper.classList.add("overview"),c.wrapper.classList.remove("exit-overview"),clearTimeout(g),clearTimeout(y),g=setTimeout(function(){var n=document.querySelectorAll(t);for(var r=0,i=n.length;r<i;r++){var s=n[r],a="translateZ(-2500px) translate("+(r-o)*105+"%, 0%)";s.setAttribute("data-index-h",r),s.style.display="block",s.style.WebkitTransform=a,s.style.MozTransform=a,s.style.msTransform=a,s.style.OTransform=a,s.style.transform=a;if(s.classList.contains("stack")){var l=s.querySelectorAll("section");for(var c=0,h=l.length;c<h;c++){var p=r===o?u:j(s),d=l[c],v="translate(0%, "+(c-p)*105+"%)";d.setAttribute("data-index-h",r),d.setAttribute("data-index-v",c),d.style.display="block",d.style.WebkitTransform=v,d.style.MozTransform=v,d.style.msTransform=v,d.style.OTransform=v,d.style.transform=v,d.addEventListener("click",yt,!0)}}else s.addEventListener("click",yt,!0)}H(),e||D("overviewshown",{indexh:o,indexv:u,currentSlide:f})},10)}}function I(){if(i.overview){clearTimeout(g),clearTimeout(y),c.wrapper.classList.remove("overview"),c.wrapper.classList.add("exit-overview"),y=setTimeout(function(){c.wrapper.classList.remove("exit-overview")},10);var t=A(document.querySelectorAll(e));for(var n=0,r=t.length;n<r;n++){var s=t[n];s.style.display="",s.style.WebkitTransform="",s.style.MozTransform="",s.style.msTransform="",s.style.OTransform="",s.style.transform="",s.removeEventListener("click",yt,!0)}$(o,u),D("overviewhidden",{indexh:o,indexv:u,currentSlide:f})}}function q(e){typeof e=="boolean"?e?F():I():R()?I():F()}function R(){return c.wrapper.classList.contains("overview")}function U(){var e=document.body,t=e.requestFullScreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullScreen;t&&t.apply(e)}function z(){c.wrapper.classList.add("paused")}function W(){c.wrapper.classList.remove("paused")}function X(){V()?W():z()}function V(){return c.wrapper.classList.contains("paused")}function $(e,i,s){a=f;var c=document.querySelectorAll(t);i===undefined&&(i=j(c[e])),a&&a.parentNode&&a.parentNode.classList.contains("stack")&&B(a.parentNode,u);var h=l.concat();l.length=0;var p=o,d=u;o=J(t,e===undefined?o:e),u=J(n,i===undefined?u:i),H();e:for(var v=0,m=l.length;v<m;v++){for(var g=0;g<h.length;g++)if(h[g]===l[v]){h.splice(g,1);continue e}document.documentElement.classList.add(l[v]),D(l[v])}while(h.length)document.documentElement.classList.remove(h.pop());R()&&F(),Z(1500);var y=c[o],b=y.querySelectorAll("section");f=b[u]||y;if(typeof s!="undefined"){var w=f.querySelectorAll(".fragment");A(w).forEach(function(e,t){t<s?e.classList.add("visible"):e.classList.remove("visible")})}o!==p||u!==d?D("slidechanged",{indexh:o,indexv:u,previousSlide:a,currentSlide:f}):a=null,a&&(a.classList.remove("present"),document.querySelector(r).classList.contains("present")&&setTimeout(function(){var e=A(document.querySelectorAll(t+".stack")),n;for(n in e)e[n]&&B(e[n],0)},0)),Q(),K()}function J(e,t){var n=A(document.querySelectorAll(e)),r=n.length;if(r){i.loop&&(t%=r,t<0&&(t=r+t)),t=Math.max(Math.min(t,r-1),0);for(var o=0;o<r;o++){var u=n[o];if(R()===!1){var a=Math.abs((t-o)%(r-3))||0;u.style.display=a>3?"none":"block"}n[o].classList.remove("past"),n[o].classList.remove("present"),n[o].classList.remove("future"),o<t?n[o].classList.add("past"):o>t&&n[o].classList.add("future"),u.querySelector("section")&&n[o].classList.add("stack")}n[t].classList.add("present");var f=n[t].getAttribute("data-state");f&&(l=l.concat(f.split(" ")));var c=n[t].getAttribute("data-autoslide");c?s=parseInt(c,10):s=i.autoSlide}else t=0;return t}function K(){if(i.progress&&c.progress){var n=A(document.querySelectorAll(t)),r=document.querySelectorAll(e+":not(.stack)").length,s=0;e:for(var o=0;o<n.length;o++){var u=n[o],a=A(u.querySelectorAll("section"));for(var f=0;f<a.length;f++){if(a[f].classList.contains("present"))break e;s++}if(u.classList.contains("present"))break;u.classList.contains("stack")===!1&&s++}c.progressbar.style.width=s/(r-1)*window.innerWidth+"px"}}function Q(){if(i.controls&&c.controls){var e=G();c.controlsLeft.concat(c.controlsRight).concat(c.controlsUp).concat(c.controlsDown).concat(c.controlsPrev).concat(c.controlsNext).forEach(function(e){e.classList.remove("enabled")}),e.left&&c.controlsLeft.forEach(function(e){e.classList.add("enabled")}),e.right&&c.controlsRight.forEach(function(e){e.classList.add("enabled")}),e.up&&c.controlsUp.forEach(function(e){e.classList.add("enabled")}),e.down&&c.controlsDown.forEach(function(e){e.classList.add("enabled")}),(e.left||e.up)&&c.controlsPrev.forEach(function(e){e.classList.add("enabled")}),(e.right||e.down)&&c.controlsNext.forEach(function(e){e.classList.add("enabled")})}}function G(){var e=document.querySelectorAll(t),r=document.querySelectorAll(n);return{left:o>0,right:o<e.length-1,up:u>0,down:u<r.length-1}}function Y(){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 i=Reveal.getIndices(r);$(i.h,i.v)}else $(o,u)}else{var s=parseInt(t[0],10)||0,a=parseInt(t[1],10)||0;$(s,a)}}function Z(e){if(i.history){clearTimeout(m);if(typeof e=="number")m=setTimeout(Z,e);else{var t="/";if(f&&typeof f.getAttribute("id")=="string")t="/"+f.getAttribute("id");else{if(o>0||u>0)t+=o;u>0&&(t+="/"+u)}window.location.hash=t}}}function et(e){var n=o,r=u;if(e){var i=!!e.parentNode.nodeName.match(/section/gi),s=i?e.parentNode:e,a=A(document.querySelectorAll(t));n=Math.max(a.indexOf(s),0),i&&(r=Math.max(A(e.parentNode.querySelectorAll("section")).indexOf(e),0))}return{h:n,v:r}}function tt(){if(document.querySelector(n+".present")){var e=document.querySelectorAll(n+".present .fragment:not(.visible)");if(e.length)return e[0].classList.add("visible"),D("fragmentshown",{fragment:e[0]}),!0}else{var r=document.querySelectorAll(t+".present .fragment:not(.visible)");if(r.length)return r[0].classList.add("visible"),D("fragmentshown",{fragment:r[0]}),!0}return!1}function nt(){if(document.querySelector(n+".present")){var e=document.querySelectorAll(n+".present .fragment.visible");if(e.length)return e[e.length-1].classList.remove("visible"),D("fragmenthidden",{fragment:e[e.length-1]}),!0}else{var r=document.querySelectorAll(t+".present .fragment.visible");if(r.length)return r[r.length-1].classList.remove("visible"),D("fragmenthidden",{fragment:r[r.length-1]}),!0}return!1}function rt(){clearTimeout(v),s&&(v=setTimeout(ft,s))}function it(){(G().left&&R()||nt()===!1)&&$(o-1)}function st(){(G().right&&R()||tt()===!1)&&$(o+1)}function ot(){(G().up&&R()||nt()===!1)&&$(o,u-1)}function ut(){(G().down&&R()||tt()===!1)&&$(o,u+1)}function at(){if(nt()===!1)if(G().up)ot();else{var e=document.querySelector(t+".past:nth-child("+o+")");e&&(u=e.querySelectorAll("section").length+1||undefined,o--,$())}}function ft(){tt()===!1&&(G().down?ut():st()),rt()}function lt(e){var t=document.activeElement,n=!(!document.activeElement||!document.activeElement.type&&!document.activeElement.href&&document.activeElement.contentEditable==="inherit");if(n||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey)return;var r=!0;switch(e.keyCode){case 80:case 33:at();break;case 78:case 34:ft();break;case 72:case 37:it();break;case 76:case 39:st();break;case 75:case 38:ot();break;case 74:case 40:ut();break;case 36:$(0);break;case 35:$(Number.MAX_VALUE);break;case 32:R()?I():ft();break;case 13:R()?I():r=!1;break;case 66:case 190:case 191:X();break;case 70:U();break;default:r=!1}r?e.preventDefault():e.keyCode===27&&h&&(q(),e.preventDefault()),rt()}function ct(e){b.startX=e.touches[0].clientX,b.startY=e.touches[0].clientY,b.startCount=e.touches.length,e.touches.length===2&&i.overview&&(b.startSpan=O({x:e.touches[1].clientX,y:e.touches[1].clientY},{x:b.startX,y:b.startY}))}function ht(e){if(!b.handled){var t=e.touches[0].clientX,n=e.touches[0].clientY;if(e.touches.length===2&&b.startCount===2&&i.overview){var r=O({x:e.touches[1].clientX,y:e.touches[1].clientY},{x:b.startX,y:b.startY});Math.abs(b.startSpan-r)>b.threshold&&(b.handled=!0,r<b.startSpan?F():I()),e.preventDefault()}else if(e.touches.length===1&&b.startCount!==2){var s=t-b.startX,o=n-b.startY;s>b.threshold&&Math.abs(s)>Math.abs(o)?(b.handled=!0,it()):s<-b.threshold&&Math.abs(s)>Math.abs(o)?(b.handled=!0,st()):o>b.threshold?(b.handled=!0,ot()):o<-b.threshold&&(b.handled=!0,ut()),e.preventDefault()}}else navigator.userAgent.match(/android/gi)&&e.preventDefault()}function pt(e){b.handled=!1}function dt(e){clearTimeout(d),d=setTimeout(function(){var t=e.detail||-e.wheelDelta;t>0?ft():at()},100)}function vt(e){var n=A(document.querySelectorAll(t)).length,r=Math.floor(e.clientX/c.wrapper.offsetWidth*n);$(r)}function mt(e){Y()}function gt(e){H()}function yt(e){if(R()){e.preventDefault(),I();var t=e.target;while(t&&!t.nodeName.match(/section/gi))t=t.parentNode;if(t.nodeName.match(/section/gi)){var n=parseInt(t.getAttribute("data-index-h"),10),r=parseInt(t.getAttribute("data-index-v"),10);$(n,r)}}}var e=".reveal .slides section",t=".reveal .slides>section",n=".reveal .slides>section.present>section",r=".reveal .slides>section:first-child",i={width:1024,height:768,padding:.1,controls:!0,progress:!0,history:!1,keyboard:!0,overview:!0,center:!0,touch:!0,loop:!1,rtl:!1,autoSlide:0,mouseWheel:!1,rollingLinks:!0,theme:null,transition:"default",dependencies:[]},s=i.autoSlide,o=0,u=0,a,f,l=[],c={},h="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,p="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,d=0,v=0,m=0,g=0,y=0,b={startX:0,startY:0,startSpan:0,startCount:0,handled:!1,threshold:80};return{initialize:w,slide:$,left:it,right:st,up:ot,down:ut,prev:at,next:ft,prevFragment:nt,nextFragment:tt,navigateTo:$,navigateLeft:it,navigateRight:st,navigateUp:ot,navigateDown:ut,navigatePrev:at,navigateNext:ft,layout:H,toggleOverview:q,togglePause:X,addEventListeners:C,removeEventListeners:k,getIndices:et,getPreviousSlide:function(){return a},getCurrentSlide:function(){return f},getQueryHash:function(){var e={};return location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(t){e[t.split("=").shift()]=t.split("=").pop()}),e},addEventListener:function(e,t,n){"addEventListener"in window&&(c.wrapper||document.querySelector(".reveal")).addEventListener(e,t,n)},removeEventListener:function(e,t,n){"addEventListener"in window&&(c.wrapper||document.querySelector(".reveal")).removeEventListener(e,t,n)}}}();