Selaa lähdekoodia

Merge branch 'slidenum' of https://github.com/malcomio/reveal.js into dev

Hakim El Hattab 7 vuotta sitten
vanhempi
commit
8f7e4bfd41
2 muutettua tiedostoa jossa 21 lisäystä ja 2 poistoa
  1. 6 1
      README.md
  2. 15 1
      js/reveal.js

+ 6 - 1
README.md

@@ -754,7 +754,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
@@ -767,6 +767,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({ showSlideNumber: 'notes' });
+
 ```
 
 

+ 15 - 1
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,
@@ -981,7 +984,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();