From ef9cbbbbb92560f1ffd41dce23a584474922fe16 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sat, 16 Apr 2016 15:12:22 +0100 Subject: add new getSlides() API This can be used by plugins which are concerned with helping the presenter with their pace. --- js/reveal.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/reveal.js b/js/reveal.js index 2856f00..1f288b9 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3673,6 +3673,15 @@ } + /** + * 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. * @@ -3680,7 +3689,7 @@ */ function getTotalSlides() { - return dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' ).length; + return getSlides().length; } @@ -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, -- cgit v1.2.3