Skip to content

Commit

Permalink
prevent linked slide numbers from changing color
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Apr 16, 2018
1 parent f713d9d commit 531d1e8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 33 deletions.
3 changes: 3 additions & 0 deletions css/reveal.css
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@ body {
background-color: rgba(0, 0, 0, 0.4);
padding: 5px; }

.reveal .slide-number a {
color: currentColor; }

.reveal .slide-number-delimiter {
margin: 0 3px; }

Expand Down
4 changes: 4 additions & 0 deletions css/reveal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ $controlsArrowAngleActive: 36deg;
padding: 5px;
}

.reveal .slide-number a {
color: currentColor;
}

.reveal .slide-number-delimiter {
margin: 0 3px;
}
Expand Down
67 changes: 34 additions & 33 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

// Display the page number of the current slide
slideNumber: false,

// Use 1 based indexing for # links to match slide number (default is zero
// based)
hashOneBasedIndex: false,
Expand Down Expand Up @@ -1259,7 +1259,7 @@
document.removeEventListener( 'keypress', onDocumentKeyPress, false );
window.removeEventListener( 'hashchange', onWindowHashChange, false );
window.removeEventListener( 'resize', onWindowResize, false );

dom.wrapper.removeEventListener( 'pointerdown', onPointerDown, false );
dom.wrapper.removeEventListener( 'pointermove', onPointerMove, false );
dom.wrapper.removeEventListener( 'pointerup', onPointerUp, false );
Expand Down Expand Up @@ -2255,41 +2255,41 @@
return overview;

}

/**
* Return a hash URL that will resolve to the current slide location.
*/

function locationHash() {

var url = '/';

// Attempt to create a named link based on the slide's ID
var url = '/';

// Attempt to create a named link based on the slide's ID
var id = currentSlide ? currentSlide.getAttribute( 'id' ) : null;
if( id ) {
id = encodeURIComponent( id );
}

var indexf;
if( config.fragmentInURL ) {
indexf = getIndices().f;
}

// If the current slide has an ID, use that as a named link,
// but we don't support named links with a fragment index
if( typeof id === 'string' && id.length && indexf === undefined ) {
url = '/' + id;
}
// 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);
if( indexf !== undefined ) url += '/' + indexf;
}

return url;
}

if( id ) {
id = encodeURIComponent( id );
}

var indexf;
if( config.fragmentInURL ) {
indexf = getIndices().f;
}

// If the current slide has an ID, use that as a named link,
// but we don't support named links with a fragment index
if( typeof id === 'string' && id.length && indexf === undefined ) {
url = '/' + id;
}
// 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);
if( indexf !== undefined ) url += '/' + indexf;
}

return url;

}

/**
* Checks if the current or specified slide is vertical
* (nested within another slide).
Expand Down Expand Up @@ -3009,6 +3009,7 @@
* @return {string} HTML string fragment
*/
function formatSlideNumber( a, delimiter, b ) {

var url = '#' + locationHash();
if( typeof b === 'number' && !isNaN( b ) ) {
return '<a href="' + url + '">' +
Expand Down Expand Up @@ -3839,10 +3840,10 @@
}
else {
// Read the index components of the hash

var h = parseInt( bits[0], 10 ) || 0 - config.hashOneBasedIndex,
v = parseInt( bits[1], 10 ) || 0 - config.hashOneBasedIndex,
f;

if( config.fragmentInURL ) {
f = parseInt( bits[2], 10 );
if( isNaN( f ) ) {
Expand All @@ -3856,7 +3857,7 @@
}

}

/**
* Updates the page URL (hash) to reflect the current
* state.
Expand Down

0 comments on commit 531d1e8

Please sign in to comment.