| @@ -152,6 +152,9 @@ Reveal.initialize({ | |||||||
| 	// Change the presentation direction to be RTL | 	// Change the presentation direction to be RTL | ||||||
| 	rtl: false, | 	rtl: false, | ||||||
|  |  | ||||||
|  | 	// Randomizes the order of slides each time the presentation loads | ||||||
|  | 	shuffle: false, | ||||||
|  |  | ||||||
| 	// Turns fragments on and off globally | 	// Turns fragments on and off globally | ||||||
| 	fragments: true, | 	fragments: true, | ||||||
|  |  | ||||||
| @@ -382,6 +385,9 @@ Reveal.next(); | |||||||
| Reveal.prevFragment(); | Reveal.prevFragment(); | ||||||
| Reveal.nextFragment(); | Reveal.nextFragment(); | ||||||
|  |  | ||||||
|  | // Randomize the order of slides | ||||||
|  | Reveal.shuffle(); | ||||||
|  |  | ||||||
| // Toggle presentation states, optionally pass true/false to force on/off | // Toggle presentation states, optionally pass true/false to force on/off | ||||||
| Reveal.toggleOverview(); | Reveal.toggleOverview(); | ||||||
| Reveal.togglePause(); | Reveal.togglePause(); | ||||||
|   | |||||||
							
								
								
									
										27
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -81,6 +81,9 @@ | |||||||
| 			// Change the presentation direction to be RTL | 			// Change the presentation direction to be RTL | ||||||
| 			rtl: false, | 			rtl: false, | ||||||
|  |  | ||||||
|  | 			// Randomizes the order of slides each time the presentation loads | ||||||
|  | 			shuffle: false, | ||||||
|  |  | ||||||
| 			// Turns fragments on and off globally | 			// Turns fragments on and off globally | ||||||
| 			fragments: true, | 			fragments: true, | ||||||
|  |  | ||||||
| @@ -898,6 +901,10 @@ | |||||||
| 		dom.progress.style.display = config.progress ? 'block' : 'none'; | 		dom.progress.style.display = config.progress ? 'block' : 'none'; | ||||||
| 		dom.slideNumber.style.display = config.slideNumber && !isPrintingPDF() ? 'block' : 'none'; | 		dom.slideNumber.style.display = config.slideNumber && !isPrintingPDF() ? 'block' : 'none'; | ||||||
|  |  | ||||||
|  | 		if( config.shuffle ) { | ||||||
|  | 			shuffle(); | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		if( config.rtl ) { | 		if( config.rtl ) { | ||||||
| 			dom.wrapper.classList.add( 'rtl' ); | 			dom.wrapper.classList.add( 'rtl' ); | ||||||
| 		} | 		} | ||||||
| @@ -2329,6 +2336,23 @@ | |||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Randomly shuffles all slides in the deck. | ||||||
|  | 	 */ | ||||||
|  | 	function shuffle() { | ||||||
|  |  | ||||||
|  | 		var slides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); | ||||||
|  |  | ||||||
|  | 		slides.forEach( function( slide ) { | ||||||
|  |  | ||||||
|  | 			// Insert this slide next to another random slide. This may | ||||||
|  | 			// cause the slide to insert before itself but that's fine. | ||||||
|  | 			dom.slides.insertBefore( slide, slides[ Math.floor( Math.random() * slides.length ) ] ); | ||||||
|  |  | ||||||
|  | 		} ); | ||||||
|  |  | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Updates one dimension of slides by showing the slide | 	 * Updates one dimension of slides by showing the slide | ||||||
| 	 * with the specified index. | 	 * with the specified index. | ||||||
| @@ -4579,6 +4603,9 @@ | |||||||
| 		// Forces an update in slide layout | 		// Forces an update in slide layout | ||||||
| 		layout: layout, | 		layout: layout, | ||||||
|  |  | ||||||
|  | 		// Randomizes the order of slides | ||||||
|  | 		shuffle: shuffle, | ||||||
|  |  | ||||||
| 		// Returns an object with the available routes as booleans (left/right/top/bottom) | 		// Returns an object with the available routes as booleans (left/right/top/bottom) | ||||||
| 		availableRoutes: availableRoutes, | 		availableRoutes: availableRoutes, | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user