enable up/down arrows to step through fragments (closes #233)

This commit is contained in:
Hakim El Hattab 2012-11-10 14:04:11 -05:00
parent fa3d0c899c
commit eac5a3a239
2 changed files with 8 additions and 8 deletions

View file

@ -1,5 +1,5 @@
/*! /*!
* reveal.js 2.2 r40 * reveal.js 2.2 r41
* http://lab.hakim.se/reveal-js * http://lab.hakim.se/reveal-js
* MIT licensed * MIT licensed
* *
@ -1134,28 +1134,28 @@ var Reveal = (function(){
function navigateLeft() { function navigateLeft() {
// Prioritize hiding fragments // Prioritize hiding fragments
if( availableRoutes().left && ( isOverviewActive() || previousFragment() === false ) ) { if( availableRoutes().left && isOverviewActive() || previousFragment() === false ) {
slide( indexh - 1, 0 ); slide( indexh - 1, 0 );
} }
} }
function navigateRight() { function navigateRight() {
// Prioritize revealing fragments // Prioritize revealing fragments
if( availableRoutes().right && ( isOverviewActive() || nextFragment() === false ) ) { if( availableRoutes().right && isOverviewActive() || nextFragment() === false ) {
slide( indexh + 1, 0 ); slide( indexh + 1, 0 );
} }
} }
function navigateUp() { function navigateUp() {
// Prioritize hiding fragments // Prioritize hiding fragments
if( availableRoutes().up && ( isOverviewActive() || previousFragment() === false ) ) { if( availableRoutes().up && isOverviewActive() || previousFragment() === false ) {
slide( indexh, indexv - 1 ); slide( indexh, indexv - 1 );
} }
} }
function navigateDown() { function navigateDown() {
// Prioritize revealing fragments // Prioritize revealing fragments
if( availableRoutes().down && ( isOverviewActive() || nextFragment() === false ) ) { if( availableRoutes().down && isOverviewActive() || nextFragment() === false ) {
slide( indexh, indexv + 1 ); slide( indexh, indexv + 1 );
} }
} }

6
js/reveal.min.js vendored
View file

@ -1,5 +1,5 @@
/*! /*!
* reveal.js 2.2 r40 * reveal.js 2.2 r41
* http://lab.hakim.se/reveal-js * http://lab.hakim.se/reveal-js
* MIT licensed * MIT licensed
* *
@ -74,8 +74,8 @@ t("fragmentshown",{fragment:at[0]});return true;}}else{var ar=document.querySele
t("fragmentshown",{fragment:ar[0]});return true;}}return false;}function U(){if(document.querySelector(b+".present")){var at=document.querySelectorAll(b+".present .fragment.visible"); t("fragmentshown",{fragment:ar[0]});return true;}}return false;}function U(){if(document.querySelector(b+".present")){var at=document.querySelectorAll(b+".present .fragment.visible");
if(at.length){at[at.length-1].classList.remove("visible");t("fragmenthidden",{fragment:at[at.length-1]});return true;}}else{var ar=document.querySelectorAll(m+".present .fragment.visible"); if(at.length){at[at.length-1].classList.remove("visible");t("fragmenthidden",{fragment:at[at.length-1]});return true;}}else{var ar=document.querySelectorAll(m+".present .fragment.visible");
if(ar.length){ar[ar.length-1].classList.remove("visible");t("fragmenthidden",{fragment:ar[ar.length-1]});return true;}}return false;}function R(){clearTimeout(l); if(ar.length){ar[ar.length-1].classList.remove("visible");t("fragmenthidden",{fragment:ar[ar.length-1]});return true;}}return false;}function R(){clearTimeout(l);
if(ac){l=setTimeout(z,ac);}}function D(){if(h().left&&(O()||U()===false)){a(n-1,0);}}function k(){if(h().right&&(O()||x()===false)){a(n+1,0);}}function w(){if(h().up&&(O()||U()===false)){a(n,e-1); if(ac){l=setTimeout(z,ac);}}function D(){if(h().left&&O()||U()===false){a(n-1,0);}}function k(){if(h().right&&O()||x()===false){a(n+1,0);}}function w(){if(h().up&&O()||U()===false){a(n,e-1);
}}function H(){if(h().down&&(O()||x()===false)){a(n,e+1);}}function ad(){if(U()===false){if(h().up){w();}else{var ar=document.querySelector(".reveal .slides>section.past:nth-child("+n+")"); }}function H(){if(h().down&&O()||x()===false){a(n,e+1);}}function ad(){if(U()===false){if(h().up){w();}else{var ar=document.querySelector(".reveal .slides>section.past:nth-child("+n+")");
if(ar){e=(ar.querySelectorAll("section").length+1)||0;n--;a();}}}}function z(){if(x()===false){h().down?H():k();}R();}function am(au){var at=document.activeElement; if(ar){e=(ar.querySelectorAll("section").length+1)||0;n--;a();}}}}function z(){if(x()===false){h().down?H():k();}R();}function am(au){var at=document.activeElement;
var av=!!(document.activeElement&&(document.activeElement.type||document.activeElement.href||document.activeElement.contentEditable!=="inherit"));if(av||au.shiftKey||au.altKey||au.ctrlKey||au.metaKey){return; var av=!!(document.activeElement&&(document.activeElement.type||document.activeElement.href||document.activeElement.contentEditable!=="inherit"));if(av||au.shiftKey||au.altKey||au.ctrlKey||au.metaKey){return;
}var ar=true;switch(au.keyCode){case 80:case 33:ad();break;case 78:case 34:z();break;case 72:case 37:D();break;case 76:case 39:k();break;case 75:case 38:w(); }var ar=true;switch(au.keyCode){case 80:case 33:ad();break;case 78:case 34:z();break;case 72:case 37:D();break;case 76:case 39:k();break;case 75:case 38:w();