diff options
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js index 8d48814..f7f752f 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -646,6 +646,13 @@ var Reveal = (function(){ } /** + * Returns last element of an array + */ + function lastElem(array) { + return array.slice(-1)[0]; + } + + /** * Applies JavaScript-controlled layout rules to the * presentation. */ @@ -2045,6 +2052,26 @@ var Reveal = (function(){ return config; }, + // Returns an index (1-based) of the current fragment + getCurrentFragmentIndex : function() { + var visibleFragments; + + // vertical slides: + if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) { + visibleFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment.visible' ); + } + // Horizontal slides: + else { + visibleFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment.visible' ); + } + + if( visibleFragments.length) { + return visibleFragments.length; + } else { + return undefined; + } + }, + // Helper method, retrieves query string as a key/value hash getQueryHash: function() { var query = {}; |