Skip to content

Commit

Permalink
add new getSlides() API
Browse files Browse the repository at this point in the history
This can be used by plugins which are concerned with helping the
presenter with their pace.
  • Loading branch information
aspiers committed Apr 20, 2017
1 parent 40912ac commit ef9cbbb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,11 @@ Reveal.getScale();
Reveal.getPreviousSlide();
Reveal.getCurrentSlide();

Reveal.getIndices(); // { h: 0, v: 0 } }
Reveal.getIndices(); // { h: 0, v: 0 } }
Reveal.getPastSlideCount();
Reveal.getProgress(); // (0 == first slide, 1 == last slide)
Reveal.getTotalSlides(); // total number of slides
Reveal.getProgress(); // (0 == first slide, 1 == last slide)
Reveal.getSlides(); // Array of all slides
Reveal.getTotalSlides(); // total number of slides

// Returns the speaker notes for the current slide
Reveal.getSlideNotes();
Expand Down
14 changes: 13 additions & 1 deletion js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3673,14 +3673,23 @@

}

/**
* Retrieves all slides in this presentation.
*/
function getSlides() {

return toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' ));

}

/**
* Retrieves the total number of slides in this presentation.
*
* @return {number}
*/
function getTotalSlides() {

return dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' ).length;
return getSlides().length;

}

Expand Down Expand Up @@ -4984,6 +4993,9 @@
// Returns the indices of the current, or specified, slide
getIndices: getIndices,

// Returns an Array of all slides
getSlides: getSlides,

// Returns the total number of slides
getTotalSlides: getTotalSlides,

Expand Down

0 comments on commit ef9cbbb

Please sign in to comment.