|
@ -353,17 +353,15 @@ var Reveal = (function(){ |
|
|
createSingletonNode( dom.wrapper, 'div', 'pause-overlay', null ); |
|
|
createSingletonNode( dom.wrapper, 'div', 'pause-overlay', null ); |
|
|
|
|
|
|
|
|
// Cache references to elements
|
|
|
// Cache references to elements
|
|
|
if ( config.controls ) { |
|
|
dom.controls = document.querySelector( '.reveal .controls' ); |
|
|
dom.controls = document.querySelector( '.reveal .controls' ); |
|
|
|
|
|
|
|
|
|
|
|
// There can be multiple instances of controls throughout the page
|
|
|
// There can be multiple instances of controls throughout the page
|
|
|
dom.controlsLeft = toArray( document.querySelectorAll( '.navigate-left' ) ); |
|
|
dom.controlsLeft = toArray( document.querySelectorAll( '.navigate-left' ) ); |
|
|
dom.controlsRight = toArray( document.querySelectorAll( '.navigate-right' ) ); |
|
|
dom.controlsRight = toArray( document.querySelectorAll( '.navigate-right' ) ); |
|
|
dom.controlsUp = toArray( document.querySelectorAll( '.navigate-up' ) ); |
|
|
dom.controlsUp = toArray( document.querySelectorAll( '.navigate-up' ) ); |
|
|
dom.controlsDown = toArray( document.querySelectorAll( '.navigate-down' ) ); |
|
|
dom.controlsDown = toArray( document.querySelectorAll( '.navigate-down' ) ); |
|
|
dom.controlsPrev = toArray( document.querySelectorAll( '.navigate-prev' ) ); |
|
|
dom.controlsPrev = toArray( document.querySelectorAll( '.navigate-prev' ) ); |
|
|
dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) ); |
|
|
dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) ); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -491,9 +489,7 @@ var Reveal = (function(){ |
|
|
dom.wrapper.setAttribute( 'data-transition-speed', config.transitionSpeed ); |
|
|
dom.wrapper.setAttribute( 'data-transition-speed', config.transitionSpeed ); |
|
|
dom.wrapper.setAttribute( 'data-background-transition', config.backgroundTransition ); |
|
|
dom.wrapper.setAttribute( 'data-background-transition', config.backgroundTransition ); |
|
|
|
|
|
|
|
|
if( dom.controls ) { |
|
|
dom.controls.style.display = ( config.controls && dom.controls ) ? 'block' : 'none'; |
|
|
dom.controls.style.display = ( config.controls && dom.controls ) ? 'block' : 'none'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( dom.progress ) { |
|
|
if( dom.progress ) { |
|
|
dom.progress.style.display = ( config.progress && dom.progress ) ? 'block' : 'none'; |
|
|
dom.progress.style.display = ( config.progress && dom.progress ) ? 'block' : 'none'; |
|
@ -586,16 +582,14 @@ var Reveal = (function(){ |
|
|
dom.progress.addEventListener( 'click', onProgressClicked, false ); |
|
|
dom.progress.addEventListener( 'click', onProgressClicked, false ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ( config.controls && dom.controls ) { |
|
|
[ 'touchstart', 'click' ].forEach( function( eventName ) { |
|
|
[ 'touchstart', 'click' ].forEach( function( eventName ) { |
|
|
dom.controlsLeft.forEach( function( el ) { el.addEventListener( eventName, onNavigateLeftClicked, false ); } ); |
|
|
dom.controlsLeft.forEach( function( el ) { el.addEventListener( eventName, onNavigateLeftClicked, false ); } ); |
|
|
dom.controlsRight.forEach( function( el ) { el.addEventListener( eventName, onNavigateRightClicked, false ); } ); |
|
|
dom.controlsRight.forEach( function( el ) { el.addEventListener( eventName, onNavigateRightClicked, false ); } ); |
|
|
dom.controlsUp.forEach( function( el ) { el.addEventListener( eventName, onNavigateUpClicked, false ); } ); |
|
|
dom.controlsUp.forEach( function( el ) { el.addEventListener( eventName, onNavigateUpClicked, false ); } ); |
|
|
dom.controlsDown.forEach( function( el ) { el.addEventListener( eventName, onNavigateDownClicked, false ); } ); |
|
|
dom.controlsDown.forEach( function( el ) { el.addEventListener( eventName, onNavigateDownClicked, false ); } ); |
|
|
dom.controlsPrev.forEach( function( el ) { el.addEventListener( eventName, onNavigatePrevClicked, false ); } ); |
|
|
dom.controlsPrev.forEach( function( el ) { el.addEventListener( eventName, onNavigatePrevClicked, false ); } ); |
|
|
dom.controlsNext.forEach( function( el ) { el.addEventListener( eventName, onNavigateNextClicked, false ); } ); |
|
|
dom.controlsNext.forEach( function( el ) { el.addEventListener( eventName, onNavigateNextClicked, false ); } ); |
|
|
} ); |
|
|
} ); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -624,16 +618,14 @@ var Reveal = (function(){ |
|
|
dom.progress.removeEventListener( 'click', onProgressClicked, false ); |
|
|
dom.progress.removeEventListener( 'click', onProgressClicked, false ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ( config.controls && dom.controls ) { |
|
|
[ 'touchstart', 'click' ].forEach( function( eventName ) { |
|
|
[ 'touchstart', 'click' ].forEach( function( eventName ) { |
|
|
dom.controlsLeft.forEach( function( el ) { el.removeEventListener( eventName, onNavigateLeftClicked, false ); } ); |
|
|
dom.controlsLeft.forEach( function( el ) { el.removeEventListener( eventName, onNavigateLeftClicked, false ); } ); |
|
|
dom.controlsRight.forEach( function( el ) { el.removeEventListener( eventName, onNavigateRightClicked, false ); } ); |
|
|
dom.controlsRight.forEach( function( el ) { el.removeEventListener( eventName, onNavigateRightClicked, false ); } ); |
|
|
dom.controlsUp.forEach( function( el ) { el.removeEventListener( eventName, onNavigateUpClicked, false ); } ); |
|
|
dom.controlsUp.forEach( function( el ) { el.removeEventListener( eventName, onNavigateUpClicked, false ); } ); |
|
|
dom.controlsDown.forEach( function( el ) { el.removeEventListener( eventName, onNavigateDownClicked, false ); } ); |
|
|
dom.controlsDown.forEach( function( el ) { el.removeEventListener( eventName, onNavigateDownClicked, false ); } ); |
|
|
dom.controlsPrev.forEach( function( el ) { el.removeEventListener( eventName, onNavigatePrevClicked, false ); } ); |
|
|
dom.controlsPrev.forEach( function( el ) { el.removeEventListener( eventName, onNavigatePrevClicked, false ); } ); |
|
|
dom.controlsNext.forEach( function( el ) { el.removeEventListener( eventName, onNavigateNextClicked, false ); } ); |
|
|
dom.controlsNext.forEach( function( el ) { el.removeEventListener( eventName, onNavigateNextClicked, false ); } ); |
|
|
} ); |
|
|
} ); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1792,50 +1784,46 @@ var Reveal = (function(){ |
|
|
*/ |
|
|
*/ |
|
|
function updateControls() { |
|
|
function updateControls() { |
|
|
|
|
|
|
|
|
if ( config.controls && dom.controls ) { |
|
|
var routes = availableRoutes(); |
|
|
|
|
|
var fragments = availableFragments(); |
|
|
var routes = availableRoutes(); |
|
|
|
|
|
var fragments = availableFragments(); |
|
|
// Remove the 'enabled' class from all directions
|
|
|
|
|
|
dom.controlsLeft.concat( dom.controlsRight ) |
|
|
// Remove the 'enabled' class from all directions
|
|
|
.concat( dom.controlsUp ) |
|
|
dom.controlsLeft.concat( dom.controlsRight ) |
|
|
.concat( dom.controlsDown ) |
|
|
.concat( dom.controlsUp ) |
|
|
.concat( dom.controlsPrev ) |
|
|
.concat( dom.controlsDown ) |
|
|
.concat( dom.controlsNext ).forEach( function( node ) { |
|
|
.concat( dom.controlsPrev ) |
|
|
node.classList.remove( 'enabled' ); |
|
|
.concat( dom.controlsNext ).forEach( function( node ) { |
|
|
node.classList.remove( 'fragmented' ); |
|
|
node.classList.remove( 'enabled' ); |
|
|
} ); |
|
|
node.classList.remove( 'fragmented' ); |
|
|
|
|
|
} ); |
|
|
|
|
|
|
|
|
|
|
|
// Add the 'enabled' class to the available routes
|
|
|
// Add the 'enabled' class to the available routes
|
|
|
if( routes.left ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.left ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.right ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.right ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.up ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.up ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.down ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.down ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
|
|
|
|
|
|
// Prev/next buttons
|
|
|
// Prev/next buttons
|
|
|
if( routes.left || routes.up ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.left || routes.up ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.right || routes.down ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
if( routes.right || routes.down ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'enabled' ); } ); |
|
|
|
|
|
|
|
|
// Highlight fragment directions
|
|
|
// Highlight fragment directions
|
|
|
if( currentSlide ) { |
|
|
if( currentSlide ) { |
|
|
|
|
|
|
|
|
// Always apply fragment decorator to prev/next buttons
|
|
|
// Always apply fragment decorator to prev/next buttons
|
|
|
if( fragments.prev ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
if( fragments.prev ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
if( fragments.next ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
if( fragments.next ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
|
|
|
|
|
|
// Apply fragment decorators to directional buttons based on
|
|
|
// Apply fragment decorators to directional buttons based on
|
|
|
// what slide axis they are in
|
|
|
// what slide axis they are in
|
|
|
if( isVerticalSlide( currentSlide ) ) { |
|
|
if( isVerticalSlide( currentSlide ) ) { |
|
|
if( fragments.prev ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
if( fragments.prev ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
if( fragments.next ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
if( fragments.next ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
if( fragments.prev ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
if( fragments.prev ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
if( fragments.next ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
if( fragments.next ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|