|
2475 | 2475 |
|
2476 | 2476 | if( config.showNotes && dom.speakerNotes && currentSlide && !isPrintingPDF() ) { |
2477 | 2477 |
|
2478 | | - var notes = ''; |
2479 | | - |
2480 | | - // Notes can be specified via the data-notes attribute... |
2481 | | - if( currentSlide.hasAttribute( 'data-notes' ) ) { |
2482 | | - notes = currentSlide.getAttribute( 'data-notes' ); |
2483 | | - } |
2484 | | - |
2485 | | - // ... or using an <aside class="notes"> element |
2486 | | - if( !notes ) { |
2487 | | - var notesElement = currentSlide.querySelector( 'aside.notes' ); |
2488 | | - if( notesElement ) { |
2489 | | - notes = notesElement.innerHTML; |
2490 | | - } |
2491 | | - } |
2492 | | - |
2493 | | - dom.speakerNotes.innerHTML = notes; |
| 2478 | + dom.speakerNotes.innerHTML = getSlideNotes() || ''; |
2494 | 2479 |
|
2495 | 2480 | } |
2496 | 2481 |
|
|
3335 | 3320 |
|
3336 | 3321 | } |
3337 | 3322 |
|
| 3323 | + /** |
| 3324 | + * Retrieves the speaker notes from a slide. Notes can be |
| 3325 | + * defined in two ways: |
| 3326 | + * 1. As a data-notes attribute on the slide <section> |
| 3327 | + * 2. As an <aside class="notes"> inside of the slide |
| 3328 | + */ |
| 3329 | + function getSlideNotes( slide ) { |
| 3330 | + |
| 3331 | + // Default to the current slide |
| 3332 | + slide = slide || currentSlide; |
| 3333 | + |
| 3334 | + // Notes can be specified via the data-notes attribute... |
| 3335 | + if( slide.hasAttribute( 'data-notes' ) ) { |
| 3336 | + return slide.getAttribute( 'data-notes' ); |
| 3337 | + } |
| 3338 | + |
| 3339 | + // ... or using an <aside class="notes"> element |
| 3340 | + var notesElement = slide.querySelector( 'aside.notes' ); |
| 3341 | + if( notesElement ) { |
| 3342 | + return notesElement.innerHTML; |
| 3343 | + } |
| 3344 | + |
| 3345 | + return null; |
| 3346 | + |
| 3347 | + } |
| 3348 | + |
3338 | 3349 | /** |
3339 | 3350 | * Retrieves the current state of the presentation as |
3340 | 3351 | * an object. This state can then be restored at any |
|
4486 | 4497 | // Returns the slide background element at the specified index |
4487 | 4498 | getSlideBackground: getSlideBackground, |
4488 | 4499 |
|
| 4500 | + // Returns the speaker notes string for a slide, or null |
| 4501 | + getSlideNotes: getSlideNotes, |
| 4502 | + |
4489 | 4503 | // Returns the previous slide element, may be null |
4490 | 4504 | getPreviousSlide: function() { |
4491 | 4505 | return previousSlide; |
|
0 commit comments