Skip to content
Snippets Groups Projects
reveal.js 30.3 KiB
Newer Older
  • Learn to ignore specific revisions
  • 				if( previousSlide ) {
    					indexv = ( previousSlide.querySelectorAll('section').length + 1 ) || 0;
    					indexh --;
    					slide();
    				}
    			}
    		}
    	}
    
    	/**
    	 * Same as #navigatePrev() but navigates forwards.
    	 */
    	function navigateNext() {
    		// Prioritize revealing fragments
    		if( nextFragment() === false ) {
    			availableRoutes().down ? navigateDown() : navigateRight();
    		}
    
    
    		// If auto-sliding is enabled we need to cue up 
    		// another timeout
    		cueAutoSlide();
    
    
    	/**
    	 * Toggles the slide overview mode on and off.
    	 */
    	function toggleOverview() {
    
    		if( overviewIsActive() ) {
    			deactivateOverview();
    		}
    		else {
    			activateOverview();
    		}
    	}
    
    Hakim El Hattab's avatar
    Hakim El Hattab committed
    	
    	// Expose some methods publicly
    	return {
    
    Hakim El Hattab's avatar
    Hakim El Hattab committed
    		navigateTo: navigateTo,
    		navigateLeft: navigateLeft,
    		navigateRight: navigateRight,
    		navigateUp: navigateUp,
    
    		navigatePrev: navigatePrev,
    		navigateNext: navigateNext,
    
    		toggleOverview: toggleOverview,
    
    		// Adds or removes all internal event listeners (such as keyboard)
    
    		addEventListeners: addEventListeners,
    		removeEventListeners: removeEventListeners,
    
    
    		// Returns the indices of the current slide
    		getIndices: function() {
    			return { 
    				h: indexh, 
    				v: indexv 
    			};
    		},
    
    		// Returns the previous slide element, may be null
    		getPreviousSlide: function() {
    			return previousSlide
    		},
    
    		// Returns the current slide element
    		getCurrentSlide: function() {
    			return currentSlide
    		},
    
    
    		// 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;
    		},
    
    
    		// 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 );
    			}