fa23-si/js/reveal.min.js

49 lines
8.2 KiB
JavaScript

/*!
* reveal.js 1.3
* http://lab.hakim.se/reveal-js
* MIT licensed
*
* Copyright (C) 2012 Hakim El Hattab, http://hakim.se
*/
var Reveal=(function(){var i="#reveal .slides>section",a="#reveal .slides>section.present>section",j=0,c=0,F={controls:false,progress:false,history:false,loop:false,mouseWheel:true,rollingLinks:true,transition:"default",theme:"default"},L=[],d={},G=document.body.style.perspectiveProperty!==undefined||document.body.style.WebkitPerspective!==undefined||document.body.style.MozPerspective!==undefined||document.body.style.msPerspective!==undefined||document.body.style.OPerspective!==undefined,k=document.body.style.transformProperty!==undefined||document.body.style.WebkitTransform!==undefined||document.body.style.MozTransform!==undefined||document.body.style.msTransform!==undefined||document.body.style.OTransform!==undefined,u=0,x=0;
function g(N){if(!k&&!G){document.body.setAttribute("class","no-transforms");return;}d.wrapper=document.querySelector("#reveal");d.progress=document.querySelector("#reveal .progress");
d.progressbar=document.querySelector("#reveal .progress span");d.controls=document.querySelector("#reveal .controls");d.controlsLeft=document.querySelector("#reveal .controls .left");
d.controlsRight=document.querySelector("#reveal .controls .right");d.controlsUp=document.querySelector("#reveal .controls .up");d.controlsDown=document.querySelector("#reveal .controls .down");
document.addEventListener("keydown",K,false);document.addEventListener("touchstart",v,false);window.addEventListener("hashchange",s,false);d.controlsLeft.addEventListener("click",m(w),false);
d.controlsRight.addEventListener("click",m(h),false);d.controlsUp.addEventListener("click",m(q),false);d.controlsDown.addEventListener("click",m(z),false);
p(F,N);if(G===false){F.transition="linear";}if(F.controls){d.controls.style.display="block";}if(F.progress){d.progress.style.display="block";}if(F.transition!=="default"){d.wrapper.classList.add(F.transition);
}if(F.theme!=="default"){d.wrapper.classList.add(F.theme);}if(F.mouseWheel){document.addEventListener("DOMMouseScroll",l,false);document.addEventListener("mousewheel",l,false);
}if(F.rollingLinks){C();}B();}function p(O,N){for(var P in N){O[P]=N[P];}}function m(N){return function(O){O.preventDefault();N.call();};}function K(O){if(O.target.contentEditable!="inherit"||O.shiftKey||O.altKey||O.ctrlKey||O.metaKey){return;
}var N=false;switch(O.keyCode){case 80:case 33:H();N=true;break;case 78:case 32:case 34:t();N=true;break;case 72:case 37:w();N=true;break;case 76:case 39:h();
N=true;break;case 75:case 38:q();N=true;break;case 74:case 40:z();N=true;break;}if(N){O.preventDefault();}else{if(O.keyCode===27&&G){if(I()){J();}else{A();
}O.preventDefault();}}}function v(Q){if(Q.touches.length===1){if(Q.target.tagName.toLowerCase()==="a"||Q.target.tagName.toLowerCase()==="img"){return;}Q.preventDefault();
var O={x:Q.touches[0].clientX,y:Q.touches[0].clientY};var N=window.innerWidth*0.3;var P=window.innerHeight*0.3;if(O.x<N){w();}else{if(O.x>window.innerWidth-N){h();
}else{if(O.y<P){q();}else{if(O.y>window.innerHeight-P){z();}}}}b();}}function l(N){clearTimeout(u);u=setTimeout(function(){var O=N.detail||-N.wheelDelta;
if(O>0){t();}else{H();}},100);}function s(N){B();}function C(){if(G){var O=document.querySelectorAll("#reveal .slides section a:not(.image)");for(var P=0,N=O.length;
P<N;P++){var Q=O[P];if(Q.textContent&&!Q.querySelector("img")&&(!Q.className||!Q.classList.contains(Q,"roll"))){Q.classList.add("roll");Q.innerHTML='<span data-title="'+Q.text+'">'+Q.innerHTML+"</span>";
}}}}function A(){d.wrapper.classList.add("overview");var N=Array.prototype.slice.call(document.querySelectorAll(i));for(var S=0,Q=N.length;S<Q;S++){var P=N[S],W="translateZ(-2500px) translate("+((S-j)*105)+"%, 0%)";
P.setAttribute("data-index-h",S);P.style.display="block";P.style.WebkitTransform=W;P.style.MozTransform=W;P.style.msTransform=W;P.style.OTransform=W;P.style.transform=W;
if(!P.classList.contains("stack")){P.addEventListener("click",y,true);}var V=Array.prototype.slice.call(P.querySelectorAll("section"));for(var R=0,O=V.length;
R<O;R++){var U=V[R],T="translate(0%, "+((R-c)*105)+"%)";U.setAttribute("data-index-h",S);U.setAttribute("data-index-v",R);U.style.display="block";U.style.WebkitTransform=T;
U.style.MozTransform=T;U.style.msTransform=T;U.style.OTransform=T;U.style.transform=T;U.addEventListener("click",y,true);}}}function J(){d.wrapper.classList.remove("overview");
var Q=Array.prototype.slice.call(document.querySelectorAll("#reveal .slides section"));for(var P=0,N=Q.length;P<N;P++){var O=Q[P];O.style.WebkitTransform="";
O.style.MozTransform="";O.style.msTransform="";O.style.OTransform="";O.style.transform="";O.removeEventListener("click",y);}b();}function I(){return d.wrapper.classList.contains("overview");
}function y(N){if(I()){N.preventDefault();J();j=this.getAttribute("data-index-h");c=this.getAttribute("data-index-v");b();}}function M(O,Q){var S=Array.prototype.slice.call(document.querySelectorAll(O)),T=S.length;
if(T){if(F.loop){Q%=T;if(Q<0){Q=T+Q;}}Q=Math.max(Math.min(Q,T-1),0);for(var R=0;R<T;R++){var N=S[R];if(I()===false){var U=Math.abs((Q-R)%(T-3))||0;N.style.display=U>3?"none":"block";
}S[R].classList.remove("past");S[R].classList.remove("present");S[R].classList.remove("future");if(R<Q){S[R].classList.add("past");}else{if(R>Q){S[R].classList.add("future");
}}if(N.querySelector("section")){S[R].classList.add("stack");}}S[Q].classList.add("present");var P=S[Q].getAttribute("data-state");if(P){L=L.concat(P.split(" "));
}}else{Q=0;}return Q;}function b(){var Q=L.concat();L.length=0;j=M(i,j);c=M(a,c);stateLoop:for(var P=0,N=L.length;P<N;P++){for(var O=0;O<Q.length;O++){if(Q[O]===L[P]){Q.splice(O,1);
continue stateLoop;}}document.documentElement.classList.add(L[P]);n(L[P]);}while(Q.length){document.documentElement.classList.remove(Q.pop());}if(F.progress){d.progressbar.style.width=(j/(document.querySelectorAll(i).length-1))*window.innerWidth+"px";
}if(I()){A();}o();clearTimeout(x);x=setTimeout(f,1500);n("slidechanged",{indexh:j,indexv:c});}function o(){var N=e();[d.controlsLeft,d.controlsRight,d.controlsUp,d.controlsDown].forEach(function(O){O.classList.remove("enabled");
});if(N.left){d.controlsLeft.classList.add("enabled");}if(N.right){d.controlsRight.classList.add("enabled");}if(N.up){d.controlsUp.classList.add("enabled");
}if(N.down){d.controlsDown.classList.add("enabled");}}function e(){var N=document.querySelectorAll(i);var O=document.querySelectorAll(a);return{left:j>0,right:j<N.length-1,up:c>0,down:c<O.length-1};
}function B(){var N=window.location.hash.slice(2).split("/");j=parseInt(N[0])||0;c=parseInt(N[1])||0;D(j,c);}function f(){if(F.history){var N="/";if(j>0||c>0){N+=j;
}if(c>0){N+="/"+c;}window.location.hash=N;}}function n(O,N){var P=document.createEvent("HTMLEvents",1,2);P.initEvent(O,true,true);p(P,N);d.wrapper.dispatchEvent(P);
}function r(){if(document.querySelector(a+".present")){var O=document.querySelectorAll(a+".present .fragment:not(.visible)");if(O.length){O[0].classList.add("visible");
return true;}}else{var N=document.querySelectorAll(i+".present .fragment:not(.visible)");if(N.length){N[0].classList.add("visible");return true;}}return false;
}function E(){if(document.querySelector(a+".present")){var O=document.querySelectorAll(a+".present .fragment.visible");if(O.length){O[O.length-1].classList.remove("visible");
return true;}}else{var N=document.querySelectorAll(i+".present .fragment.visible");if(N.length){N[N.length-1].classList.remove("visible");return true;}}return false;
}function D(O,N){j=O===undefined?j:O;c=N===undefined?c:N;b();}function w(){if(I()||E()===false){j--;c=0;b();}}function h(){if(I()||r()===false){j++;c=0;
b();}}function q(){if(I()||E()===false){c--;b();}}function z(){if(I()||r()===false){c++;b();}}function H(){if(E()===false){if(e().up){q();}else{var N=document.querySelector("#reveal .slides>section.past:nth-child("+j+")");
if(N){c=(N.querySelectorAll("section").length+1)||0;j--;b();}}}}function t(){if(r()===false){e().down?z():h();}}return{initialize:g,navigateTo:D,navigateLeft:w,navigateRight:h,navigateUp:q,navigateDown:z,addEventListener:function(O,P,N){(d.wrapper||document.querySelector("#reveal")).addEventListener(O,P,N);
},removeEventListener:function(O,P,N){(d.wrapper||document.querySelector("#reveal")).removeEventListener(O,P,N);}};})();