diff options
author | Anthony Sottile <asottile@umich.edu> | 2018-12-02 16:46:00 -0800 |
---|---|---|
committer | Anthony Sottile <asottile@umich.edu> | 2018-12-02 16:49:06 -0800 |
commit | fd6245bb281d6e4bf278628f6fe63a2d15be0993 (patch) | |
tree | 0bbf3bee2e6a2ed0e9f5eb02d99a03a1e540e200 /js | |
parent | 87d6af2cb430be1b3170d7b8d5ade43b7222eb04 (diff) | |
download | perl-software-in-gnu-guix-fd6245bb281d6e4bf278628f6fe63a2d15be0993.tar perl-software-in-gnu-guix-fd6245bb281d6e4bf278628f6fe63a2d15be0993.tar.gz |
Add new 'hash: true' option which uses replaceState for url
Resolves #2211
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/js/reveal.js b/js/reveal.js index 637ea63..c9f3b3b 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -76,9 +76,12 @@ // Determine which displays to show the slide number on showSlideNumber: 'all', - // Push each slide change to the browser history + // Push each slide change to the browser history. Implies `hash: true` history: false, + // Change the hash when changing slides -- impacts browser history with `history: true` + hash: false, + // Enable keyboard shortcuts for navigation keyboard: true, @@ -4114,18 +4117,20 @@ */ function writeURL( delay ) { - if( config.history ) { - - // Make sure there's never more than one timeout running - clearTimeout( writeURLTimeout ); + // Make sure there's never more than one timeout running + clearTimeout( writeURLTimeout ); - // If a delay is specified, timeout this call - if( typeof delay === 'number' ) { - writeURLTimeout = setTimeout( writeURL, delay ); - } - else if( currentSlide ) { + // If a delay is specified, timeout this call + if( typeof delay === 'number' ) { + writeURLTimeout = setTimeout( writeURL, delay ); + } + else if( currentSlide ) { + if ( config.history ) { window.location.hash = locationHash(); } + else if ( config.hash ) { + window.history.replaceState(null, null, '#' + locationHash()); + } } } |