diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-12-19 10:52:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-19 10:52:15 +0100 |
commit | 6ef565c9fb85d0b20132475d7abce4b4c963d8c5 (patch) | |
tree | 35de4ae3a5b295221a457df9012ff96dafe17071 /js | |
parent | 7eb74ac3358e538dd2bf61fbb11e8af94af39c21 (diff) | |
parent | fd6245bb281d6e4bf278628f6fe63a2d15be0993 (diff) | |
download | perl-software-in-gnu-guix-6ef565c9fb85d0b20132475d7abce4b4c963d8c5.tar perl-software-in-gnu-guix-6ef565c9fb85d0b20132475d7abce4b4c963d8c5.tar.gz |
Merge pull request #2286 from asottile/hash_without_history_2211
Add new 'hash: true' option which uses replaceState for url
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 59854b7..afbc35a 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, @@ -4137,18 +4140,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()); + } } } |