tubestats-presentation/js/reveal.min.js

8 lines
18 KiB
JavaScript

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