enable controls by default

edit
Hakim El Hattab 2012-06-18 15:16:05 -04:00
parent 91b7df3e23
commit 1f17bdd5c4
2 changed files with 18 additions and 16 deletions

View File

@ -18,7 +18,7 @@ var Reveal = (function(){
// Configurations options, can be overridden at initialization time // Configurations options, can be overridden at initialization time
config = { config = {
controls: false, controls: true,
progress: false, progress: false,
history: false, history: false,
loop: false, loop: false,

32
js/reveal.min.js vendored
View File

@ -5,21 +5,22 @@
* *
* Copyright (C) 2012 Hakim El Hattab, http://hakim.se * Copyright (C) 2012 Hakim El Hattab, http://hakim.se
*/ */
var Reveal=(function(){var j=".reveal .slides>section",a=".reveal .slides>section.present>section",e=!!("ontouchstart" in window),k=0,c=0,H={controls:false,progress:false,history:false,loop:false,mouseWheel:true,rollingLinks:true,transition:"default",theme:"default"},T=[],d={},J=document.body.style.WebkitPerspective!==undefined||document.body.style.MozPerspective!==undefined||document.body.style.msPerspective!==undefined||document.body.style.OPerspective!==undefined||document.body.style.perspective!==undefined,l=document.body.style.WebkitTransform!==undefined||document.body.style.MozTransform!==undefined||document.body.style.msTransform!==undefined||document.body.style.OTransform!==undefined||document.body.style.transform!==undefined,x=!!document.body.classList; var Reveal=(function(){var j=".reveal .slides>section",a=".reveal .slides>section.present>section",e=!!("ontouchstart" in window),k=0,c=0,H={controls:true,progress:false,history:false,loop:false,mouseWheel:true,rollingLinks:true,transition:"default",theme:"default"},T=[],d={},J=document.body.style.WebkitPerspective!==undefined||document.body.style.MozPerspective!==undefined||document.body.style.msPerspective!==undefined||document.body.style.OPerspective!==undefined||document.body.style.perspective!==undefined,l=document.body.style.WebkitTransform!==undefined||document.body.style.MozTransform!==undefined||document.body.style.msTransform!==undefined||document.body.style.OTransform!==undefined||document.body.style.transform!==undefined,x=!!document.body.classList;
mouseWheelTimeout=0,writeURLTimeout=0,touch={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40};function h(V){if((!l&&!J)||!x){document.body.setAttribute("class","no-transforms"); mouseWheelTimeout=0,writeURLTimeout=0,touch={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40};function h(V){if((!l&&!J)||!x){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"); 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"); if(H.controls){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");z();q(H,V);C();D();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll"; d.controlsUp=document.querySelector(".reveal .controls .up");d.controlsDown=document.querySelector(".reveal .controls .down");}z();q(H,V);C();D();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll";
document.body.style.height="120%";window.addEventListener("load",P,false);window.addEventListener("orientationchange",P,false);}}function C(){if(J===false){H.transition="linear"; document.body.style.height="120%";window.addEventListener("load",P,false);window.addEventListener("orientationchange",P,false);}}function C(){if(J===false){H.transition="linear";
}if(H.controls){d.controls.style.display="block";}if(H.progress){d.progress.style.display="block";}if(H.transition!=="default"){d.wrapper.classList.add(H.transition); }if(H.controls&&d.controls){d.controls.style.display="block";}if(H.progress){d.progress.style.display="block";}if(H.transition!=="default"){d.wrapper.classList.add(H.transition);
}if(H.theme!=="default"){d.wrapper.classList.add(H.theme);}if(H.mouseWheel){document.addEventListener("DOMMouseScroll",m,false);document.addEventListener("mousewheel",m,false); }if(H.theme!=="default"){d.wrapper.classList.add(H.theme);}if(H.mouseWheel){document.addEventListener("DOMMouseScroll",m,false);document.addEventListener("mousewheel",m,false);
}if(H.rollingLinks){E();}}function z(){document.addEventListener("keydown",S,false);document.addEventListener("touchstart",v,false);document.addEventListener("touchmove",R,false); }if(H.rollingLinks){E();}}function z(){document.addEventListener("keydown",S,false);document.addEventListener("touchstart",v,false);document.addEventListener("touchmove",R,false);
document.addEventListener("touchend",L,false);window.addEventListener("hashchange",t,false);d.controlsLeft.addEventListener("click",n(w),false);d.controlsRight.addEventListener("click",n(i),false); document.addEventListener("touchend",L,false);window.addEventListener("hashchange",t,false);if(H.controls&&d.controls){d.controlsLeft.addEventListener("click",n(w),false);
d.controlsUp.addEventListener("click",n(r),false);d.controlsDown.addEventListener("click",n(A),false);}function K(){document.removeEventListener("keydown",S,false); d.controlsRight.addEventListener("click",n(i),false);d.controlsUp.addEventListener("click",n(r),false);d.controlsDown.addEventListener("click",n(A),false);
document.removeEventListener("touchstart",v,false);document.removeEventListener("touchmove",R,false);document.removeEventListener("touchend",L,false);window.removeEventListener("hashchange",t,false); }}function K(){document.removeEventListener("keydown",S,false);document.removeEventListener("touchstart",v,false);document.removeEventListener("touchmove",R,false);
d.controlsLeft.removeEventListener("click",n(w),false);d.controlsRight.removeEventListener("click",n(i),false);d.controlsUp.removeEventListener("click",n(r),false); document.removeEventListener("touchend",L,false);window.removeEventListener("hashchange",t,false);if(H.controls&&d.controls){d.controlsLeft.removeEventListener("click",n(w),false);
d.controlsDown.removeEventListener("click",n(A),false);}function q(W,V){for(var X in V){W[X]=V[X];}}function I(X,V){var Y=X.x-V.x,W=X.y-V.y;return Math.sqrt(Y*Y+W*W); d.controlsRight.removeEventListener("click",n(i),false);d.controlsUp.removeEventListener("click",n(r),false);d.controlsDown.removeEventListener("click",n(A),false);
}function n(V){return function(W){W.preventDefault();V.call();};}function P(){setTimeout(function(){window.scrollTo(0,1);},0);}function S(W){if(W.target.contentEditable!="inherit"||W.shiftKey||W.altKey||W.ctrlKey||W.metaKey){return; }}function q(W,V){for(var X in V){W[X]=V[X];}}function I(X,V){var Y=X.x-V.x,W=X.y-V.y;return Math.sqrt(Y*Y+W*W);}function n(V){return function(W){W.preventDefault();
V.call();};}function P(){setTimeout(function(){window.scrollTo(0,1);},0);}function S(W){if(W.target.contentEditable!="inherit"||W.shiftKey||W.altKey||W.ctrlKey||W.metaKey){return;
}var V=false;switch(W.keyCode){case 80:case 33:N();V=true;break;case 78:case 34:u();V=true;break;case 72:case 37:w();V=true;break;case 76:case 39:i();V=true; }var V=false;switch(W.keyCode){case 80:case 33:N();V=true;break;case 78:case 34:u();V=true;break;case 72:case 37:w();V=true;break;case 76:case 39:i();V=true;
break;case 75:case 38:r();V=true;break;case 74:case 40:A();V=true;break;case 36:F(0);V=true;break;case 35:F(Number.MAX_VALUE);V=true;break;case 32:O()?Q():u(); break;case 75:case 38:r();V=true;break;case 74:case 40:A();V=true;break;case 36:F(0);V=true;break;case 35:F(Number.MAX_VALUE);V=true;break;case 32:O()?Q():u();
V=true;break;case 13:if(O()){Q();V=true;}break;}if(V){W.preventDefault();}else{if(W.keyCode===27&&J){if(O()){Q();}else{B();}W.preventDefault();}}}function v(V){touch.startX=V.touches[0].clientX; V=true;break;case 13:if(O()){Q();V=true;}break;}if(V){W.preventDefault();}else{if(W.keyCode===27&&J){if(O()){Q();}else{B();}W.preventDefault();}}}function v(V){touch.startX=V.touches[0].clientX;
@ -42,11 +43,12 @@ c=this.getAttribute("data-index-v");b();}}function U(W,Y){var aa=Array.prototype
if(Y<0){Y=ab+Y;}}Y=Math.max(Math.min(Y,ab-1),0);for(var Z=0;Z<ab;Z++){var V=aa[Z];if(O()===false){var ac=Math.abs((Y-Z)%(ab-3))||0;V.style.display=ac>3?"none":"block"; if(Y<0){Y=ab+Y;}}Y=Math.max(Math.min(Y,ab-1),0);for(var Z=0;Z<ab;Z++){var V=aa[Z];if(O()===false){var ac=Math.abs((Y-Z)%(ab-3))||0;V.style.display=ac>3?"none":"block";
}aa[Z].classList.remove("past");aa[Z].classList.remove("present");aa[Z].classList.remove("future");if(Z<Y){aa[Z].classList.add("past");}else{if(Z>Y){aa[Z].classList.add("future"); }aa[Z].classList.remove("past");aa[Z].classList.remove("present");aa[Z].classList.remove("future");if(Z<Y){aa[Z].classList.add("past");}else{if(Z>Y){aa[Z].classList.add("future");
}}if(V.querySelector("section")){aa[Z].classList.add("stack");}}aa[Y].classList.add("present");var X=aa[Y].getAttribute("data-state");if(X){T=T.concat(X.split(" ")); }}if(V.querySelector("section")){aa[Z].classList.add("stack");}}aa[Y].classList.add("present");var X=aa[Y].getAttribute("data-state");if(X){T=T.concat(X.split(" "));
}}else{Y=0;}return Y;}function b(Z,ad){var X=T.concat();T.length=0;var ab=k,V=c;k=U(j,Z===undefined?k:Z);c=U(a,ad===undefined?c:ad);stateLoop:for(var Y=0,aa=T.length; }}else{Y=0;}return Y;}function b(ab,ag){var Y=T.concat();T.length=0;var af=k,W=c;k=U(j,ab===undefined?k:ab);c=U(a,ag===undefined?c:ag);stateLoop:for(var Z=0,ad=T.length;
Y<aa;Y++){for(var W=0;W<X.length;W++){if(X[W]===T[Y]){X.splice(W,1);continue stateLoop;}}document.documentElement.classList.add(T[Y]);o(T[Y]);}while(X.length){document.documentElement.classList.remove(X.pop()); Z<ad;Z++){for(var X=0;X<Y.length;X++){if(Y[X]===T[Z]){Y.splice(X,1);continue stateLoop;}}document.documentElement.classList.add(T[Z]);o(T[Z]);}while(Y.length){document.documentElement.classList.remove(Y.pop());
}if(H.progress){d.progressbar.style.width=(k/(document.querySelectorAll(j).length-1))*window.innerWidth+"px";}if(O()){B();}p();clearTimeout(writeURLTimeout); }if(H.progress){d.progressbar.style.width=(k/(document.querySelectorAll(j).length-1))*window.innerWidth+"px";}if(O()){B();}p();clearTimeout(writeURLTimeout);
writeURLTimeout=setTimeout(g,1500);if(k!==ab||c!==V){var ac=document.querySelectorAll(j);slidesv=document.querySelectorAll(a);o("slidechanged",{indexh:k,indexv:c,slide:slidesv.length?slidesv[c]:ac[k]}); writeURLTimeout=setTimeout(g,1500);if(k!==af||c!==W){var V=document.querySelectorAll(j);var aa=V[af],ae=V[k];var ac=aa.querySelectorAll("section");currentVerticalSlides=ae.querySelectorAll("section");
}}function p(){var V=f();[d.controlsLeft,d.controlsRight,d.controlsUp,d.controlsDown].forEach(function(W){W.classList.remove("enabled");});if(V.left){d.controlsLeft.classList.add("enabled"); o("slidechanged",{indexh:k,indexv:c,previousSlide:ac[W]||aa,currentSlide:currentVerticalSlides[c]||ae});}}function p(){if(!H.controls||!d.controls){return;
}var V=f();[d.controlsLeft,d.controlsRight,d.controlsUp,d.controlsDown].forEach(function(W){W.classList.remove("enabled");});if(V.left){d.controlsLeft.classList.add("enabled");
}if(V.right){d.controlsRight.classList.add("enabled");}if(V.up){d.controlsUp.classList.add("enabled");}if(V.down){d.controlsDown.classList.add("enabled"); }if(V.right){d.controlsRight.classList.add("enabled");}if(V.up){d.controlsUp.classList.add("enabled");}if(V.down){d.controlsDown.classList.add("enabled");
}}function f(){var V=document.querySelectorAll(j);var W=document.querySelectorAll(a);return{left:k>0,right:k<V.length-1,up:c>0,down:c<W.length-1};}function D(){var V=window.location.hash.slice(2).split("/"); }}function f(){var V=document.querySelectorAll(j);var W=document.querySelectorAll(a);return{left:k>0,right:k<V.length-1,up:c>0,down:c<W.length-1};}function D(){var V=window.location.hash.slice(2).split("/");
k=parseInt(V[0])||0;c=parseInt(V[1])||0;F(k,c);}function g(){if(H.history){var V="/";if(k>0||c>0){V+=k;}if(c>0){V+="/"+c;}window.location.hash=V;}}function o(W,V){var X=document.createEvent("HTMLEvents",1,2); k=parseInt(V[0])||0;c=parseInt(V[1])||0;F(k,c);}function g(){if(H.history){var V="/";if(k>0||c>0){V+=k;}if(c>0){V+="/"+c;}window.location.hash=V;}}function o(W,V){var X=document.createEvent("HTMLEvents",1,2);
@ -57,5 +59,5 @@ if(W.length){W[W.length-1].classList.remove("visible");o("fragmenthidden",{fragm
if(V.length){V[V.length-1].classList.remove("visible");o("fragmenthidden",{fragment:V[0]});return true;}}return false;}function F(W,V){b(W,V);}function w(){if(O()||G()===false){b(k-1,0); if(V.length){V[V.length-1].classList.remove("visible");o("fragmenthidden",{fragment:V[0]});return true;}}return false;}function F(W,V){b(W,V);}function w(){if(O()||G()===false){b(k-1,0);
}}function i(){if(O()||s()===false){b(k+1,0);}}function r(){if(O()||G()===false){b(k,c-1);}}function A(){if(O()||s()===false){b(k,c+1);}}function N(){if(G()===false){if(f().up){r(); }}function i(){if(O()||s()===false){b(k+1,0);}}function r(){if(O()||G()===false){b(k,c-1);}}function A(){if(O()||s()===false){b(k,c+1);}}function N(){if(G()===false){if(f().up){r();
}else{var V=document.querySelector(".reveal .slides>section.past:nth-child("+k+")");if(V){c=(V.querySelectorAll("section").length+1)||0;k--;b();}}}}function u(){if(s()===false){f().down?A():i(); }else{var V=document.querySelector(".reveal .slides>section.past:nth-child("+k+")");if(V){c=(V.querySelectorAll("section").length+1)||0;k--;b();}}}}function u(){if(s()===false){f().down?A():i();
}}function M(){if(O()){Q();}else{B();}}return{initialize:h,navigateTo:F,navigateLeft:w,navigateRight:i,navigateUp:r,navigateDown:A,toggleOverview:M,addEventListeners:z,removeEventListeners:K,addEventListener:function(W,X,V){(d.wrapper||document.querySelector(".reveal")).addEventListener(W,X,V); }}function M(){if(O()){Q();}else{B();}}return{initialize:h,navigateTo:F,navigateLeft:w,navigateRight:i,navigateUp:r,navigateDown:A,navigatePrev:N,navigateNext:u,toggleOverview:M,addEventListeners:z,removeEventListeners:K,addEventListener:function(W,X,V){(d.wrapper||document.querySelector(".reveal")).addEventListener(W,X,V);
},removeEventListener:function(W,X,V){(d.wrapper||document.querySelector(".reveal")).removeEventListener(W,X,V);}};})(); },removeEventListener:function(W,X,V){(d.wrapper||document.querySelector(".reveal")).removeEventListener(W,X,V);}};})();