From ce53e63b5b725243f1745971f632d4b46763a344 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Fri, 1 Feb 2019 10:15:10 +0100 Subject: [PATCH] documentation for #2315 --- README.md | 6 ++++++ js/reveal.js | 39 ++++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index b8ad6a0..53183ad 100644 --- a/README.md +++ b/README.md @@ -937,6 +937,12 @@ Reveal.configure({ slideNumber: true }); // "c/t": flattened slide number / total slides Reveal.configure({ slideNumber: 'c/t' }); +// You can provide a function to fully customize the number: +Reveal.configure({ slideNumber: function() { + // Ignore numbering of vertical slides + return [ Reveal.getIndices().h ]; +}}); + // Control which views the slide number displays on using the "showSlideNumber" value: // "all": show on all views (default) // "speaker": only show slide numbers on speaker notes view diff --git a/js/reveal.js b/js/reveal.js index 8feb45d..237c0c4 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -67,18 +67,31 @@ progress: true, // Display the page number of the current slide + // - true: Show slide number + // - false: Hide slide number + // + // Can optionally be set as a string that specifies the number formatting: + // - "h.v": Horizontal . vertical slide number (default) + // - "h/v": Horizontal / vertical slide number + // - "c": Flattened slide number + // - "c/t": Flattened slide number / total slides + // + // Alternatively, you can provide a function that returns the slide + // number for the current slide. The function needs to return an array + // with one string [slideNumber] or three strings [n1,delimiter,n2]. + // See #formatSlideNumber(). slideNumber: false, - // Use 1 based indexing for # links to match slide number (default is zero - // based) - hashOneBasedIndex: false, - - // Controls which contexts the slide number should appear in + // Can be used to limit the contexts in which the slide number appears // - "all": Always show the slide number // - "print": Only when printing to PDF // - "speaker": Only in the speaker view showSlideNumber: 'all', + // Use 1 based indexing for # links to match slide number (default is zero + // based) + hashOneBasedIndex: false, + // Add the current slide number to the URL hash so that reloading the // page/copying the URL will return you to the same slide hash: false, @@ -3262,16 +3275,7 @@ /** - * Updates the slide number div to reflect the current slide. - * - * The following slide number formats are available: - * "h.v": horizontal . vertical slide number (default) - * "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(). + * Updates the slide number to match the current slide. */ function updateSlideNumber() { @@ -3281,9 +3285,10 @@ var value; var format = 'h.v'; - if ( typeof config.slideNumber === 'function' ) { + if( typeof config.slideNumber === 'function' ) { value = config.slideNumber(); - } else { + } + else { // Check if a custom number format is available if( typeof config.slideNumber === 'string' ) { format = config.slideNumber;