diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-05-24 10:05:16 +0200 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-05-24 10:05:16 +0200 |
commit | 0388c96e6075657ee0aa0d7885c989bcea982320 (patch) | |
tree | 67ffdbb334a043fc6ffa04f7c2f4e78c5d5add6f /js | |
parent | 53c56510ed732b664fe955f24699b91b93eb0d12 (diff) | |
download | perl-software-in-gnu-guix-0388c96e6075657ee0aa0d7885c989bcea982320.tar perl-software-in-gnu-guix-0388c96e6075657ee0aa0d7885c989bcea982320.tar.gz |
'showNotes' does nothing when there are no notes
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/js/reveal.js b/js/reveal.js index 1f4ad1e..997337b 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1051,12 +1051,8 @@ } if( config.showNotes ) { - dom.wrapper.classList.add( 'show-notes' ); dom.speakerNotes.setAttribute( 'data-layout', typeof config.showNotes === 'string' ? config.showNotes : 'inline' ); } - else { - dom.wrapper.classList.remove( 'show-notes' ); - } if( config.mouseWheel ) { document.addEventListener( 'DOMMouseScroll', onDocumentMouseScroll, false ); // FF @@ -2489,6 +2485,7 @@ updateSlideNumber(); updateSlidesVisibility(); updateBackground( true ); + updateNotesVisibility(); updateNotes(); formatEmbeddedContent(); @@ -2795,6 +2792,33 @@ } /** + * Updates the visibility of the speaker notes sidebar that + * is used to share annotated slides. The notes sidebar is + * only visible if showNotes is true and there are notes on + * one or more slides in the deck. + */ + function updateNotesVisibility() { + + if( config.showNotes && hasNotes() ) { + dom.wrapper.classList.add( 'show-notes' ); + } + else { + dom.wrapper.classList.remove( 'show-notes' ); + } + + } + + /** + * Checks if there are speaker notes for ANY slide in the + * presentation. + */ + function hasNotes() { + + return dom.slides.querySelectorAll( '[data-notes], aside.notes' ).length > 0; + + } + + /** * Updates the progress bar to reflect the current slide. */ function updateProgress() { |