diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-11-10 14:48:29 -0500 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-11-10 14:48:29 -0500 |
commit | b4815a3a831cab4775b18b9e78711d25a7531f51 (patch) | |
tree | 58037ba552ed60b26bc341c8024697bc3b38ce76 | |
parent | eac5a3a2399aa57b976d41050bf9690535c2be85 (diff) | |
download | fosdem-2018-presentation-b4815a3a831cab4775b18b9e78711d25a7531f51.tar fosdem-2018-presentation-b4815a3a831cab4775b18b9e78711d25a7531f51.tar.gz |
remember last visited vertical slide (closes #225)
-rw-r--r-- | css/reveal.css | 2 | ||||
-rw-r--r-- | index.html | 2 | ||||
-rw-r--r-- | js/reveal.js | 33 | ||||
-rw-r--r-- | js/reveal.min.js | 23 |
4 files changed, 39 insertions, 21 deletions
diff --git a/css/reveal.css b/css/reveal.css index 1b1bd08..fd4e185 100644 --- a/css/reveal.css +++ b/css/reveal.css @@ -1057,7 +1057,7 @@ body { .reveal.overview .slides section { padding: 20px 0; - max-height: 600px; + height: 600px; overflow: hidden; opacity: 1!important; visibility: visible!important; @@ -340,7 +340,7 @@ function linkify( selector ) { </div> <script src="lib/js/head.min.js"></script> - <script src="js/reveal.js"></script> + <script src="js/reveal.min.js"></script> <script> diff --git a/js/reveal.js b/js/reveal.js index 6f527d4..6f9388d 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.2 r41 + * reveal.js 2.2 r42 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -500,6 +500,11 @@ var Reveal = (function(){ for( var i = 0, len = slides.length; i < len; i++ ) { var slide = slides[ i ]; + // Don't bother update invisible slides + if( slide.style.display === 'none' ) { + continue; + } + // Vertical stacks are not centered since their section // children will be if( slide.classList.contains( 'stack' ) ) { @@ -696,6 +701,21 @@ var Reveal = (function(){ // Remember where we were at before previousSlide = currentSlide; + // Query all horizontal slides in the deck + var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ); + + // If no vertical index is specified and the upcoming slide is a + // stack, resume at its previous vertical index + if( v === undefined && horizontalSlides[ h ] && horizontalSlides[ h ].classList.contains( 'stack' ) ) { + v = parseInt( horizontalSlides[ h ].getAttribute( 'data-previous-indexv' ) || 0 ); + } + + // If we were on a vertical stack, remember what vertical index + // it was on so we can resume at the same position when returning + if( previousSlide && previousSlide.parentNode.classList.contains( 'stack' ) ) { + previousSlide.parentNode.setAttribute( 'data-previous-indexv', indexv ); + } + // Remember the state before this slide var stateBefore = state.concat(); @@ -743,9 +763,6 @@ var Reveal = (function(){ clearTimeout( writeURLTimeout ); writeURLTimeout = setTimeout( writeURL, 1500 ); - // Query all horizontal slides in the deck - var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ); - // Find the current horizontal slide and any possible vertical slides // within it var currentHorizontalSlide = horizontalSlides[ indexh ], @@ -1135,14 +1152,14 @@ var Reveal = (function(){ function navigateLeft() { // Prioritize hiding fragments if( availableRoutes().left && isOverviewActive() || previousFragment() === false ) { - slide( indexh - 1, 0 ); + slide( indexh - 1 ); } } function navigateRight() { // Prioritize revealing fragments if( availableRoutes().right && isOverviewActive() || nextFragment() === false ) { - slide( indexh + 1, 0 ); + slide( indexh + 1 ); } } @@ -1174,10 +1191,10 @@ var Reveal = (function(){ } else { // Fetch the previous horizontal slide, if there is one - var previousSlide = document.querySelector( '.reveal .slides>section.past:nth-child(' + indexh + ')' ); + var previousSlide = document.querySelector( HORIZONTAL_SLIDES_SELECTOR + '.past:nth-child(' + indexh + ')' ); if( previousSlide ) { - indexv = ( previousSlide.querySelectorAll( 'section' ).length + 1 ) || 0; + indexv = ( previousSlide.querySelectorAll( 'section' ).length + 1 ) || undefined; indexh --; slide(); } diff --git a/js/reveal.min.js b/js/reveal.min.js index d888644..5c9c797 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.2 r41 + * reveal.js 2.2 r42 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -38,7 +38,7 @@ ar.call(null,at);};}function ai(){setTimeout(function(){window.scrollTo(0,1);},0 v(au,ar);f.wrapper.dispatchEvent(au);}function Q(){if(X&&!("msPerspective" in document.body.style)){var at=document.querySelectorAll(ap+" a:not(.image)"); for(var au=0,ar=at.length;au<ar;au++){var av=at[au];if(av.textContent&&!av.querySelector("img")&&(!av.className||!av.classList.contains(av,"roll"))){av.classList.add("roll"); av.innerHTML='<span data-title="'+av.text+'">'+av.innerHTML+"</span>";}}}}function T(){if(V.center){var av=I(document.querySelectorAll(ap));var aw=-f.wrapper.offsetHeight/2; -for(var au=0,at=av.length;au<at;au++){var ar=av[au];if(ar.classList.contains("stack")){ar.style.top=0;}else{ar.style.top=Math.max(-(ar.offsetHeight/2)-20,aw)+"px"; +for(var au=0,at=av.length;au<at;au++){var ar=av[au];if(ar.style.display==="none"){continue;}if(ar.classList.contains("stack")){ar.style.top=0;}else{ar.style.top=Math.max(-(ar.offsetHeight/2)-20,aw)+"px"; }}}}function L(){if(V.overview){f.wrapper.classList.add("overview");var ar=document.querySelectorAll(m);for(var ax=0,av=ar.length;ax<av;ax++){var au=ar[ax],aB="translateZ(-2500px) translate("+((ax-n)*105)+"%, 0%)"; au.setAttribute("data-index-h",ax);au.style.display="block";au.style.WebkitTransform=aB;au.style.MozTransform=aB;au.style.msTransform=aB;au.style.OTransform=aB; au.style.transform=aB;if(!au.classList.contains("stack")){au.addEventListener("click",E,true);}var aA=au.querySelectorAll("section");for(var aw=0,at=aA.length; @@ -49,12 +49,13 @@ at.style.WebkitTransform="";at.style.MozTransform="";at.style.msTransform="";at. }a();}}function ab(ar){if(typeof ar==="boolean"){ar?L():aj();}else{O()?aj():L();}}function O(){return f.wrapper.classList.contains("overview");}function ag(){var ar=document.body; var at=ar.requestFullScreen||ar.webkitRequestFullScreen||ar.mozRequestFullScreen||ar.msRequestFullScreen;if(at){at.apply(ar);}}function c(){f.wrapper.classList.add("paused"); }function r(){f.wrapper.classList.remove("paused");}function ae(){if(al()){r();}else{c();}}function al(){return f.wrapper.classList.contains("paused"); -}function a(ay,aC){A=J;var av=aq.concat();aq.length=0;var aB=n,at=e;n=ao(m,ay===undefined?n:ay);e=ao(b,aC===undefined?e:aC);T();stateLoop:for(var aw=0,az=aq.length; -aw<az;aw++){for(var au=0;au<av.length;au++){if(av[au]===aq[aw]){av.splice(au,1);continue stateLoop;}}document.documentElement.classList.add(aq[aw]);t(aq[aw]); -}while(av.length){document.documentElement.classList.remove(av.pop());}if(O()){L();}clearTimeout(F);F=setTimeout(i,1500);var ar=document.querySelectorAll(m); -var aA=ar[n],ax=aA.querySelectorAll("section");J=ax[e]||aA;if(n!==aB||e!==at){t("slidechanged",{indexh:n,indexv:e,previousSlide:A,currentSlide:J});}else{A=null; -}if(A){A.classList.remove("present");}u();o();}function ao(av,aA){var at=I(document.querySelectorAll(av)),az=at.length;if(az){if(V.loop){aA%=az;if(aA<0){aA=az+aA; -}}aA=Math.max(Math.min(aA,az-1),0);for(var ax=0;ax<az;ax++){var ay=at[ax];if(O()===false){var ar=Math.abs((aA-ax)%(az-3))||0;ay.style.display=ar>3?"none":"block"; +}function a(ay,aC){A=J;var ar=document.querySelectorAll(m);if(aC===undefined&&ar[ay]&&ar[ay].classList.contains("stack")){aC=parseInt(ar[ay].getAttribute("data-previous-indexv")||0); +}if(A&&A.parentNode.classList.contains("stack")){A.parentNode.setAttribute("data-previous-indexv",e);}var av=aq.concat();aq.length=0;var aB=n,au=e;n=ao(m,ay===undefined?n:ay); +e=ao(b,aC===undefined?e:aC);T();stateLoop:for(var aw=0,az=aq.length;aw<az;aw++){for(var at=0;at<av.length;at++){if(av[at]===aq[aw]){av.splice(at,1);continue stateLoop; +}}document.documentElement.classList.add(aq[aw]);t(aq[aw]);}while(av.length){document.documentElement.classList.remove(av.pop());}if(O()){L();}clearTimeout(F); +F=setTimeout(i,1500);var aA=ar[n],ax=aA.querySelectorAll("section");J=ax[e]||aA;if(n!==aB||e!==au){t("slidechanged",{indexh:n,indexv:e,previousSlide:A,currentSlide:J}); +}else{A=null;}if(A){A.classList.remove("present");}u();o();}function ao(av,aA){var at=I(document.querySelectorAll(av)),az=at.length;if(az){if(V.loop){aA%=az; +if(aA<0){aA=az+aA;}}aA=Math.max(Math.min(aA,az-1),0);for(var ax=0;ax<az;ax++){var ay=at[ax];if(O()===false){var ar=Math.abs((aA-ax)%(az-3))||0;ay.style.display=ar>3?"none":"block"; }at[ax].classList.remove("past");at[ax].classList.remove("present");at[ax].classList.remove("future");if(ax<aA){at[ax].classList.add("past");}else{if(ax>aA){at[ax].classList.add("future"); }}if(ay.querySelector("section")){at[ax].classList.add("stack");}}at[aA].classList.add("present");var au=at[aA].getAttribute("data-state");if(au){aq=aq.concat(au.split(" ")); }var aw=at[aA].getAttribute("data-autoslide");if(aw){ac=parseInt(aw);}else{ac=V.autoSlide;}}else{aA=0;}return aA;}function o(){if(V.progress&&f.progress){var au=I(document.querySelectorAll(m)); @@ -74,9 +75,9 @@ 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"); 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(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+")"); -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(ac){l=setTimeout(z,ac);}}function D(){if(h().left&&O()||U()===false){a(n-1);}}function k(){if(h().right&&O()||x()===false){a(n+1);}}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(m+".past:nth-child("+n+")"); +if(ar){e=(ar.querySelectorAll("section").length+1)||undefined;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 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(); break;case 74:case 40:H();break;case 36:a(0);break;case 35:a(Number.MAX_VALUE);break;case 32:O()?aj():z();break;case 13:O()?aj():ar=false;break;case 66:case 190:ae(); |