From da23d682c63a4f3ee04a42ae70222950b2888daa Mon Sep 17 00:00:00 2001 From: Malcolm Young Date: Fri, 17 Feb 2017 15:08:57 +0000 Subject: allow configuration of which view slide number appears on - fixes #1791 --- README.md | 7 ++++++- js/reveal.js | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76ca321..3d52092 100644 --- a/README.md +++ b/README.md @@ -749,7 +749,7 @@ By default, Reveal is configured with [highlight.js](https://highlightjs.org/) f ``` ### Slide number -If you would like to display the page number of the current slide you can do so using the ```slideNumber``` configuration value. +If you would like to display the page number of the current slide you can do so using the ```slideNumber``` and ```showSlideNumber``` configuration values. ```javascript // Shows the slide number using default formatting @@ -762,6 +762,11 @@ Reveal.configure({ slideNumber: true }); // "c/t": flattened slide number / total slides Reveal.configure({ slideNumber: 'c/t' }); +// Control which views the slide number displays on using the "showSlideNumber" value. +// "all": show on all views (default) +// "notes": only show slide numbers on speaker notes view +Reveal.configure({ slideNumberFormat: 'notes' }); + ``` diff --git a/js/reveal.js b/js/reveal.js index 9251dc0..574c943 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -57,6 +57,9 @@ // Display the page number of the current slide slideNumber: false, + + // Determine which displays to show the slide number on + showSlideNumber: 'all', // Push each slide change to the browser history history: false, @@ -977,7 +980,18 @@ dom.controls.style.display = config.controls ? 'block' : 'none'; dom.progress.style.display = config.progress ? 'block' : 'none'; - dom.slideNumber.style.display = config.slideNumber && !isPrintingPDF() ? 'block' : 'none'; + + var slideNumberDisplay = 'none'; + if (config.slideNumber && !isPrintingPDF()) { + if (config.showSlideNumber === 'all') { + slideNumberDisplay = 'block'; + } + else if (config.showSlideNumber === 'notes' && isSpeakerNotes()) { + slideNumberDisplay = 'block'; + } + } + + dom.slideNumber.style.display = slideNumberDisplay; if( config.shuffle ) { shuffle(); -- cgit v1.2.3 From 95bca847d6d000fc745660852c70ae5d3c63e9d0 Mon Sep 17 00:00:00 2001 From: Malcolm Young Date: Fri, 17 Feb 2017 15:19:15 +0000 Subject: correct config name in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d52092..9a76b93 100644 --- a/README.md +++ b/README.md @@ -765,7 +765,7 @@ Reveal.configure({ slideNumber: 'c/t' }); // Control which views the slide number displays on using the "showSlideNumber" value. // "all": show on all views (default) // "notes": only show slide numbers on speaker notes view -Reveal.configure({ slideNumberFormat: 'notes' }); +Reveal.configure({ showSlideNumber: 'notes' }); ``` -- cgit v1.2.3