added isFirstSlide/isLastSlide api methods

This commit is contained in:
Hakim El Hattab 2013-02-13 18:00:53 -05:00
parent 24a59a53fd
commit e1872c9115
2 changed files with 17 additions and 28 deletions

View File

@ -1529,25 +1529,7 @@ var Reveal = (function(){
} }
/**
*
* @return {Boolean} true if current slide is first slide,
* false otherwise
*/
function firstSlide(){
return (document.querySelector(SLIDES_SELECTOR + '.past') == null ? true : false);
}
/**
*
* @return {Boolean} true if current slide is last slide,
* false otherwise
*/
function lastSlide(){
return (document.querySelector(SLIDES_SELECTOR + '.future') == null ? true : false);
}
// --------------------------------------------------------------------// // --------------------------------------------------------------------//
// ----------------------------- EVENTS -------------------------------// // ----------------------------- EVENTS -------------------------------//
// --------------------------------------------------------------------// // --------------------------------------------------------------------//
@ -1898,14 +1880,6 @@ var Reveal = (function(){
return scale; return scale;
}, },
isFirstSlide: function(){
return firstSlide();
},
isLastSlide: function(){
return lastSlide();
},
// Helper method, retrieves query string as a key/value hash // Helper method, retrieves query string as a key/value hash
getQueryHash: function() { getQueryHash: function() {
var query = {}; var query = {};
@ -1917,6 +1891,21 @@ var Reveal = (function(){
return query; return query;
}, },
// Returns true if we're currently on the first slide
isFirstSlide: function() {
return document.querySelector( SLIDES_SELECTOR + '.past' ) == null ? true : false;
},
// Returns true if we're currently on the last slide
isLastSlide: function() {
if( currentSlide && currentSlide.classList.contains( '.stack' ) ) {
return currentSlide.querySelector( SLIDES_SELECTOR + '.future' ) == null ? true : false;
}
else {
return document.querySelector( SLIDES_SELECTOR + '.future' ) == null ? true : false;
}
},
// Forward event binding to the reveal DOM element // Forward event binding to the reveal DOM element
addEventListener: function( type, listener, useCapture ) { addEventListener: function( type, listener, useCapture ) {
if( 'addEventListener' in window ) { if( 'addEventListener' in window ) {

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long