diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-09-09 14:09:37 +0200 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-09-09 14:09:37 +0200 |
commit | 2ad4065500875f1878ab35c039054e8609b9aaa6 (patch) | |
tree | d90c96815ba0626276b7f03a5f63e060d12a03dc /js/reveal.js | |
parent | 5e3bbdeecff0d74d56c2c05f491e1dacfa539059 (diff) | |
download | fosdem-2018-presentation-2ad4065500875f1878ab35c039054e8609b9aaa6.tar fosdem-2018-presentation-2ad4065500875f1878ab35c039054e8609b9aaa6.tar.gz |
ability to share presentation with speaker notes #304
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js index ad7eaa0..a19e486 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -92,6 +92,9 @@ // Flags if it should be possible to pause the presentation (blackout) pause: true, + // Flags if speaker notes should be visible to all viewers + showNotes: false, + // Number of milliseconds between automatically proceeding to the // next slide, disabled when set to 0, this value can be overwritten // by using a data-autoslide attribute on your slides @@ -465,6 +468,9 @@ // Slide number dom.slideNumber = createSingletonNode( dom.wrapper, 'div', 'slide-number', '' ); + // Element containing notes that are visible to the audience + dom.speakerNotes = createSingletonNode( dom.wrapper, 'div', 'speaker-notes', null ); + // Overlay graphic which is displayed during the paused mode createSingletonNode( dom.wrapper, 'div', 'pause-overlay', null ); @@ -856,6 +862,13 @@ resume(); } + if( config.showNotes ) { + dom.speakerNotes.classList.add( 'visible' ); + } + else { + dom.speakerNotes.classList.remove( 'visible' ); + } + if( config.mouseWheel ) { document.addEventListener( 'DOMMouseScroll', onDocumentMouseScroll, false ); // FF document.addEventListener( 'mousewheel', onDocumentMouseScroll, false ); @@ -2161,6 +2174,7 @@ updateBackground(); updateParallax(); updateSlideNumber(); + updateNotes(); // Update the URL hash writeURL(); @@ -2202,6 +2216,7 @@ updateBackground( true ); updateSlideNumber(); updateSlidesVisibility(); + updateNotes(); formatEmbeddedContent(); startEmbeddedContent( currentSlide ); @@ -2451,6 +2466,37 @@ } /** + * Pick up notes from the current slide and display tham + * to the viewer. + * + * @see `showNotes` config value + */ + function updateNotes() { + + if( config.showNotes && dom.speakerNotes && currentSlide ) { + + var notes = ''; + + // Notes can be specified via the data-notes attribute... + if( currentSlide.hasAttribute( 'data-notes' ) ) { + notes = currentSlide.getAttribute( 'data-notes' ); + } + + // ... or using an <aside class="notes"> element + if( !notes ) { + var notesElement = currentSlide.querySelector( 'aside.notes' ); + if( notesElement ) { + notes = notesElement.innerHTML; + } + } + + dom.speakerNotes.innerHTML = notes; + + } + + } + + /** * Updates the progress bar to reflect the current slide. */ function updateProgress() { |