From c0afa01e6ada174e3a9e17ff810a012fbde91796 Mon Sep 17 00:00:00 2001 From: MichiK Date: Wed, 18 Nov 2015 21:56:25 +0100 Subject: [PATCH 1/3] Add autoSlideRight option When the autoSlideRight config option is active, the auto-sliding will always navigate to the right and never down even if slides are present there. This allows hidden "bonus slides" in presentations which can be displayed as needed but won't show up automatically. --- README.md | 5 +++++ js/reveal.js | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 52dcd22..9121d71 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,11 @@ Reveal.initialize({ // Stop auto-sliding after user input autoSlideStoppable: true, + // When auto-sliding is active, do always proceed to the right + // instead of the next slide which may be below (useful for + // infinite loop presentations with hidden "bonus slides") + autoSlideRight: false, + // Enable slide navigation via mouse wheel mouseWheel: false, diff --git a/js/reveal.js b/js/reveal.js index d2b2970..476ec1c 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -103,6 +103,11 @@ // Stop auto-sliding after user input autoSlideStoppable: true, + // When auto-sliding is active, do always proceed to the right + // instead of the next slide which may be below (useful for + // infinite loop presentations with hidden "bonus slides") + autoSlideRight: false, + // Enable slide navigation via mouse wheel mouseWheel: false, @@ -3823,7 +3828,7 @@ // Prioritize revealing fragments if( nextFragment() === false ) { - if( availableRoutes().down ) { + if( availableRoutes().down && !( autoSlide && config.autoSlideRight ) ) { navigateDown(); } else if( config.rtl ) { From 4a45557b576c945aba71d0b5728c9a9c7510b699 Mon Sep 17 00:00:00 2001 From: MichiK Date: Thu, 19 Nov 2015 13:00:01 +0100 Subject: [PATCH 2/3] Add a more flexible autoSlideMethod option Auto-sliding will now use the method specified in the config if it is a function or default to navigateNext. --- README.md | 8 ++++---- js/reveal.js | 16 +++++----------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9121d71..cf60477 100644 --- a/README.md +++ b/README.md @@ -152,10 +152,8 @@ Reveal.initialize({ // Stop auto-sliding after user input autoSlideStoppable: true, - // When auto-sliding is active, do always proceed to the right - // instead of the next slide which may be below (useful for - // infinite loop presentations with hidden "bonus slides") - autoSlideRight: false, + // Use this method for navigation when auto-sliding + autoSlideMethod: Reveal.navigateNext, // Enable slide navigation via mouse wheel mouseWheel: false, @@ -302,6 +300,8 @@ You can also override the slide duration for individual slides and fragments by ``` +To override the method used for navigation when auto-sliding, you can specify the ```autoSlideMethod``` setting. To only navigate along the top layer and ignore vertical slides, set this to ```Reveal.navigateRight```. + Whenever the auto-slide mode is resumed or paused the ```autoslideresumed``` and ```autoslidepaused``` events are fired. diff --git a/js/reveal.js b/js/reveal.js index 476ec1c..db64412 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -103,11 +103,6 @@ // Stop auto-sliding after user input autoSlideStoppable: true, - // When auto-sliding is active, do always proceed to the right - // instead of the next slide which may be below (useful for - // infinite loop presentations with hidden "bonus slides") - autoSlideRight: false, - // Enable slide navigation via mouse wheel mouseWheel: false, @@ -3693,7 +3688,10 @@ // - The overview isn't active // - The presentation isn't over if( autoSlide && !autoSlidePaused && !isPaused() && !isOverview() && ( !Reveal.isLastSlide() || availableFragments().next || config.loop === true ) ) { - autoSlideTimeout = setTimeout( navigateNext, autoSlide ); + autoSlideTimeout = setTimeout( function() { + typeof config.autoSlideMethod == 'function' ? config.autoSlideMethod() : navigateNext(); + cueAutoSlide(); + }, autoSlide ); autoSlideStartTime = Date.now(); } @@ -3828,7 +3826,7 @@ // Prioritize revealing fragments if( nextFragment() === false ) { - if( availableRoutes().down && !( autoSlide && config.autoSlideRight ) ) { + if( availableRoutes().down ) { navigateDown(); } else if( config.rtl ) { @@ -3839,10 +3837,6 @@ } } - // If auto-sliding is enabled we need to cue up - // another timeout - cueAutoSlide(); - } /** From a398a02edb19ad73d0bebcd5c3bd5334bc05ff3d Mon Sep 17 00:00:00 2001 From: MichiK Date: Thu, 19 Nov 2015 13:51:22 +0100 Subject: [PATCH 3/3] Fix build error --- js/reveal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/reveal.js b/js/reveal.js index db64412..46a6295 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3689,7 +3689,7 @@ // - The presentation isn't over if( autoSlide && !autoSlidePaused && !isPaused() && !isOverview() && ( !Reveal.isLastSlide() || availableFragments().next || config.loop === true ) ) { autoSlideTimeout = setTimeout( function() { - typeof config.autoSlideMethod == 'function' ? config.autoSlideMethod() : navigateNext(); + typeof config.autoSlideMethod === 'function' ? config.autoSlideMethod() : navigateNext(); cueAutoSlide(); }, autoSlide ); autoSlideStartTime = Date.now();