Skip to content

Commit

Permalink
revise readURL to handle one-based indices
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Apr 16, 2018
1 parent 531d1e8 commit 2a57223
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit 2a57223

Please sign in to comment.