diff --git a/README.md b/README.md index f2ee48be..d3c22286 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ document.addEventListener( 'someState', function() { ## History #### 1.3 (master) +- Revised keyboard shortcuts, including ESC for overview, N for next, P for previous. Thanks [mahemoff](https://github.com/mahemoff) #### 1.2 @@ -151,4 +152,4 @@ document.addEventListener( 'someState', function() { MIT licensed -Copyright (C) 2011 Hakim El Hattab, http://hakim.se \ No newline at end of file +Copyright (C) 2012 Hakim El Hattab, http://hakim.se \ No newline at end of file diff --git a/index.html b/index.html index 22b159a3..69d598f3 100644 --- a/index.html +++ b/index.html @@ -82,7 +82,7 @@

Holistic Overview

- Press SPACE to enter the slide overview! + Press ESC to enter the slide overview!

diff --git a/js/reveal.js b/js/reveal.js index 4ba8a7be..237386dc 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3,7 +3,7 @@ * http://lab.hakim.se/reveal-js * MIT licensed * - * Copyright (C) 2011 Hakim El Hattab, http://hakim.se + * Copyright (C) 2012 Hakim El Hattab, http://hakim.se */ var Reveal = (function(){ @@ -37,7 +37,8 @@ var Reveal = (function(){ supports3DTransforms = document.body.style['perspectiveProperty'] !== undefined || document.body.style['WebkitPerspective'] !== undefined || document.body.style['MozPerspective'] !== undefined || - document.body.style['msPerspective'] !== undefined, + document.body.style['msPerspective'] !== undefined || + document.body.style['OPerspective'] !== undefined, supports2DTransforms = document.body.style['transformProperty'] !== undefined || document.body.style['WebkitTransform'] !== undefined || @@ -155,22 +156,31 @@ var Reveal = (function(){ // FFT: Use document.querySelector( ':focus' ) === null // instead of checking contentEditable? - if ( event.target.contentEditable != 'inherit' || - event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; + // Disregard the event if the target is editable or a + // modifier is present + if ( event.target.contentEditable != 'inherit' || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; var triggered = false; + switch( event.keyCode ) { - case 80: case 33: navigatePrev(); triggered = true; break; // prev for wireless presenter (PgUp) - case 78: case 32: case 34: navigateNext(); triggered = true; break; // next for wireless presenter (PgDn, Space) - case 72: case 37: navigateLeft(); triggered = true; break; // h, left - case 76: case 39: navigateRight(); triggered = true; break; // l, right - case 75: case 38: navigateUp(); triggered = true; break; // k, up - case 74: case 40: navigateDown(); triggered = true; break; // j, down + // p, page up + case 80: case 33: navigatePrev(); triggered = true; break; + // n, page down, space + case 78: case 32: case 34: navigateNext(); triggered = true; break; + // h, left + case 72: case 37: navigateLeft(); triggered = true; break; + // l, right + case 76: case 39: navigateRight(); triggered = true; break; + // k, up + case 75: case 38: navigateUp(); triggered = true; break; + // j, down + case 74: case 40: navigateDown(); triggered = true; break; } - if (triggered) return event.preventDefault() - - if ( event.keyCode === 27 && supports3DTransforms ) { + if( triggered ) { + event.preventDefault(); + } + else if ( event.keyCode === 27 && supports3DTransforms ) { if( overviewIsActive() ) { deactivateOverview(); } diff --git a/js/reveal.min.js b/js/reveal.min.js index 955891cd..749bdcdc 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -3,9 +3,9 @@ * http://lab.hakim.se/reveal-js * MIT licensed * - * Copyright (C) 2011 Hakim El Hattab, http://hakim.se + * 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,E={controls:false,progress:false,history:false,transition:"default",theme:"default",mouseWheel:true,rollingLinks:true},K=[],d={},F=document.body.style.perspectiveProperty!==undefined||document.body.style.WebkitPerspective!==undefined||document.body.style.MozPerspective!==undefined||document.body.style.msPerspective!==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,t=0,w=0; +var Reveal=(function(){var i="#reveal .slides>section",a="#reveal .slides>section.present>section",j=0,c=0,E={controls:false,progress:false,history:false,transition:"default",theme:"default",mouseWheel:true,rollingLinks:true},K=[],d={},F=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,t=0,w=0; function g(M){if(!k&&!F){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"); @@ -13,10 +13,11 @@ document.addEventListener("keydown",J,false);document.addEventListener("touchsta d.controlsRight.addEventListener("click",m(h),false);d.controlsUp.addEventListener("click",m(p),false);d.controlsDown.addEventListener("click",m(y),false); o(E,M);if(F===false){E.transition="linear";}if(E.controls){d.controls.style.display="block";}if(E.progress){d.progress.style.display="block";}if(E.transition!=="default"){d.wrapper.classList.add(E.transition); }if(E.theme!=="default"){d.wrapper.classList.add(E.theme);}if(E.mouseWheel){document.addEventListener("DOMMouseScroll",l,false);document.addEventListener("mousewheel",l,false); -}if(E.rollingLinks){B();}A();}function o(N,M){for(var O in M){N[O]=M[O];}}function m(M){return function(N){N.preventDefault();M.call();};}function J(M){if(M.target.contentEditable==="inherit"){if(M.keyCode>=33&&M.keyCode<=40){switch(M.keyCode){case 33:G(); -break;case 34:s();break;case 37:v();break;case 39:h();break;case 38:p();break;case 40:y();break;}M.preventDefault();}else{if(M.keyCode===32&&F){if(H()){I(); -}else{z();}M.preventDefault();}}}}function u(P){if(P.touches.length===1){if(P.target.tagName.toLowerCase()==="a"||P.target.tagName.toLowerCase()==="img"){return; -}P.preventDefault();var N={x:P.touches[0].clientX,y:P.touches[0].clientY};var M=window.innerWidth*0.3;var O=window.innerHeight*0.3;if(N.xwindow.innerWidth-M){h(); +}if(E.rollingLinks){B();}A();}function o(N,M){for(var O in M){N[O]=M[O];}}function m(M){return function(N){N.preventDefault();M.call();};}function J(N){if(N.target.contentEditable!="inherit"||N.shiftKey||N.altKey||N.ctrlKey||N.metaKey){return; +}var M=false;switch(N.keyCode){case 80:case 33:G();M=true;break;case 78:case 32:case 34:s();M=true;break;case 72:case 37:v();M=true;break;case 76:case 39:h(); +M=true;break;case 75:case 38:p();M=true;break;case 74:case 40:y();M=true;break;}if(M){N.preventDefault();}else{if(N.keyCode===27&&F){if(H()){I();}else{z(); +}N.preventDefault();}}}function u(P){if(P.touches.length===1){if(P.target.tagName.toLowerCase()==="a"||P.target.tagName.toLowerCase()==="img"){return;}P.preventDefault(); +var N={x:P.touches[0].clientX,y:P.touches[0].clientY};var M=window.innerWidth*0.3;var O=window.innerHeight*0.3;if(N.xwindow.innerWidth-M){h(); }else{if(N.ywindow.innerHeight-O){y();}}}}b();}}function l(M){clearTimeout(t);t=setTimeout(function(){var N=M.detail||-M.wheelDelta; if(N>0){s();}else{G();}},100);}function r(M){A();}function B(){if(F){var N=document.querySelectorAll("#reveal .slides section a:not(.image)");for(var O=0,M=N.length; O'+P.innerHTML+"";