lca20-bt/js/reveal.min.js
2012-11-27 08:45:02 -05:00

8 lines
16 KiB
JavaScript

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