fa20-bt/js/reveal.min.js

8 lines
15 KiB
JavaScript

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