allow custom slide numbering functions
This commit is contained in:
parent
aa8be6829c
commit
43d1c71107
10
js/reveal.js
10
js/reveal.js
@ -3257,15 +3257,21 @@
|
||||
* "h/v": horizontal / vertical slide number
|
||||
* "c": flattened slide number
|
||||
* "c/t": flattened slide number / total slides
|
||||
*
|
||||
* Alternatively, config.slideNumber can be a function returning a
|
||||
* three-element array with arguments to formatSlideNumber().
|
||||
*/
|
||||
function updateSlideNumber() {
|
||||
|
||||
// Update slide number if enabled
|
||||
if( config.slideNumber && dom.slideNumber ) {
|
||||
|
||||
var value = [];
|
||||
var value;
|
||||
var format = 'h.v';
|
||||
|
||||
if ( typeof config.slideNumber === 'function' ) {
|
||||
value = config.slideNumber();
|
||||
} else {
|
||||
// Check if a custom number format is available
|
||||
if( typeof config.slideNumber === 'string' ) {
|
||||
format = config.slideNumber;
|
||||
@ -3277,6 +3283,7 @@
|
||||
format = 'c';
|
||||
}
|
||||
|
||||
value = [];
|
||||
switch( format ) {
|
||||
case 'c':
|
||||
value.push( getSlidePastCount() + 1 );
|
||||
@ -3292,6 +3299,7 @@
|
||||
value.push( indexh + 1 );
|
||||
if( isVerticalSlide() ) value.push( '.', indexv + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
dom.slideNumber.innerHTML = formatSlideNumber( value[0], value[1], value[2] );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user