aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2018-04-16 09:58:03 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2018-04-16 09:58:03 +0200
commit2a57223939cde0680b37cc333e67f42130f73984 (patch)
tree4061dad4fa31ca46cd045a0bd636841225b50b7e
parent531d1e8791ea6b19834426bca603a3784ba71708 (diff)
downloadperl-software-in-gnu-guix-2a57223939cde0680b37cc333e67f42130f73984.tar
perl-software-in-gnu-guix-2a57223939cde0680b37cc333e67f42130f73984.tar.gz
revise readURL to handle one-based indices
-rw-r--r--js/reveal.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 477a1ea..ebdeb9f 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2281,8 +2281,9 @@
}
// Otherwise use the /h/v index
else {
- if( indexh > 0 || indexv > 0 || indexf !== undefined ) url += indexh + config.hashOneBasedIndex;
- if( indexv > 0 || indexf !== undefined ) url += '/' + (indexv + config.hashOneBasedIndex);
+ var hashIndexBase = config.hashOneBasedIndex ? 1 : 0;
+ if( indexh > 0 || indexv > 0 || indexf !== undefined ) url += indexh + hashIndexBase;
+ if( indexv > 0 || indexf !== undefined ) url += '/' + (indexv + hashIndexBase );
if( indexf !== undefined ) url += '/' + indexf;
}
@@ -3839,9 +3840,11 @@
}
}
else {
+ var hashIndexBase = config.hashOneBasedIndex ? 1 : 0;
+
// Read the index components of the hash
- var h = parseInt( bits[0], 10 ) || 0 - config.hashOneBasedIndex,
- v = parseInt( bits[1], 10 ) || 0 - config.hashOneBasedIndex,
+ var h = ( parseInt( bits[0], 10 ) - hashIndexBase ) || 0,
+ v = ( parseInt( bits[1], 10 ) - hashIndexBase ) || 0,
f;
if( config.fragmentInURL ) {