Skip to content
Snippets Groups Projects
reveal.js 56 KiB
Newer Older
  • Learn to ignore specific revisions
  • 		// Toggles the "black screen" mode on/off
    		togglePause: togglePause,
    
    
    		// State checks
    		isOverview: isOverview,
    		isPaused: isPaused,
    
    
    		// Adds or removes all internal event listeners (such as keyboard)
    
    		addEventListeners: addEventListeners,
    		removeEventListeners: removeEventListeners,
    
    
    		// Returns the indices of the current, or specified, slide
    
    		// Returns the slide at the specified index, y is optional
    		getSlide: function( x, y ) {
    			var horizontalSlide = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR )[ x ];
    			var verticalSlides = horizontalSlide && horizontalSlide.querySelectorAll( 'section' );
    
    			if( typeof y !== 'undefined' ) {
    				return verticalSlides ? verticalSlides[ y ] : undefined;
    			}
    
    			return horizontalSlide;
    		},
    
    
    		// Returns the previous slide element, may be null
    		getPreviousSlide: function() {
    
    		},
    
    		// Returns the current slide element
    		getCurrentSlide: function() {
    
    		// Returns the current scale of the presentation content
    		getScale: function() {
    			return scale;
    		},
    
    
    		// Returns the current configuration object
    		getConfig: function() {
    			return config;
    		},
    
    
    		// Helper method, retrieves query string as a key/value hash
    		getQueryHash: function() {
    			var query = {};
    
    			location.search.replace( /[A-Z0-9]+?=(\w*)/gi, function(a) {
    				query[ a.split( '=' ).shift() ] = a.split( '=' ).pop();
    			} );
    
    			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
    		addEventListener: function( type, listener, useCapture ) {
    
    hakimel's avatar
    hakimel committed
    			if( 'addEventListener' in window ) {
    				( dom.wrapper || document.querySelector( '.reveal' ) ).addEventListener( type, listener, useCapture );
    			}
    
    		},
    		removeEventListener: function( type, listener, useCapture ) {
    
    hakimel's avatar
    hakimel committed
    			if( 'addEventListener' in window ) {
    				( dom.wrapper || document.querySelector( '.reveal' ) ).removeEventListener( type, listener, useCapture );
    			}
    
    Hakim El Hattab's avatar
    Hakim El Hattab committed
    	};