diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2019-03-21 09:13:28 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2019-03-21 09:13:28 +0100 |
commit | b8de5e02d21de9389b82d90effd65b1fcd8b5799 (patch) | |
tree | 9f279c3acae40203136f6c199fb4556834aa8d9d | |
parent | ae556d0844826ea76f3b45e41005c7bae4cc06bc (diff) | |
download | perl-software-in-gnu-guix-b8de5e02d21de9389b82d90effd65b1fcd8b5799.tar perl-software-in-gnu-guix-b8de5e02d21de9389b82d90effd65b1fcd8b5799.tar.gz |
make #2350 work using replaceState
-rw-r--r-- | js/reveal.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/js/reveal.js b/js/reveal.js index f03c5cc..65866cc 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -4290,19 +4290,24 @@ writeURLTimeout = setTimeout( writeURL, delay ); } else if( currentSlide ) { + // If we're configured to push to history OR the history + // API is not avaialble. if( config.history || !window.history ) { window.location.hash = locationHash(); } + // If we're configured to refelct the current slide in the + // URL without pushing to history. else if( config.hash ) { - window.history.replaceState(null, null, '#' + locationHash()); + window.history.replaceState( null, null, '#' + locationHash() ); + } + // If history and hash are both disabled, a hash may still + // be added to the URL by clicking on a href with a hash + // target. Counter this by always removing the hash. + else { + window.history.replaceState( null, null, window.location.pathname + window.location.search ); } - else { - window.location.hash = ''; - } } - - } /** * Retrieves the h/v location and fragment of the current, |