@@ -353,17 +353,15 @@ var Reveal = (function(){
353353 createSingletonNode ( dom . wrapper , 'div' , 'pause-overlay' , null ) ;
354354
355355 // Cache references to elements
356- if ( config . controls ) {
357- dom . controls = document . querySelector ( '.reveal .controls' ) ;
356+ dom . controls = document . querySelector ( '.reveal .controls' ) ;
358357
359- // There can be multiple instances of controls throughout the page
360- dom . controlsLeft = toArray ( document . querySelectorAll ( '.navigate-left' ) ) ;
361- dom . controlsRight = toArray ( document . querySelectorAll ( '.navigate-right' ) ) ;
362- dom . controlsUp = toArray ( document . querySelectorAll ( '.navigate-up' ) ) ;
363- dom . controlsDown = toArray ( document . querySelectorAll ( '.navigate-down' ) ) ;
364- dom . controlsPrev = toArray ( document . querySelectorAll ( '.navigate-prev' ) ) ;
365- dom . controlsNext = toArray ( document . querySelectorAll ( '.navigate-next' ) ) ;
366- }
358+ // There can be multiple instances of controls throughout the page
359+ dom . controlsLeft = toArray ( document . querySelectorAll ( '.navigate-left' ) ) ;
360+ dom . controlsRight = toArray ( document . querySelectorAll ( '.navigate-right' ) ) ;
361+ dom . controlsUp = toArray ( document . querySelectorAll ( '.navigate-up' ) ) ;
362+ dom . controlsDown = toArray ( document . querySelectorAll ( '.navigate-down' ) ) ;
363+ dom . controlsPrev = toArray ( document . querySelectorAll ( '.navigate-prev' ) ) ;
364+ dom . controlsNext = toArray ( document . querySelectorAll ( '.navigate-next' ) ) ;
367365
368366 }
369367
@@ -491,9 +489,7 @@ var Reveal = (function(){
491489 dom . wrapper . setAttribute ( 'data-transition-speed' , config . transitionSpeed ) ;
492490 dom . wrapper . setAttribute ( 'data-background-transition' , config . backgroundTransition ) ;
493491
494- if ( dom . controls ) {
495- dom . controls . style . display = ( config . controls && dom . controls ) ? 'block' : 'none' ;
496- }
492+ dom . controls . style . display = ( config . controls && dom . controls ) ? 'block' : 'none' ;
497493
498494 if ( dom . progress ) {
499495 dom . progress . style . display = ( config . progress && dom . progress ) ? 'block' : 'none' ;
@@ -586,16 +582,14 @@ var Reveal = (function(){
586582 dom . progress . addEventListener ( 'click' , onProgressClicked , false ) ;
587583 }
588584
589- if ( config . controls && dom . controls ) {
590- [ 'touchstart' , 'click' ] . forEach ( function ( eventName ) {
591- dom . controlsLeft . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateLeftClicked , false ) ; } ) ;
592- dom . controlsRight . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateRightClicked , false ) ; } ) ;
593- dom . controlsUp . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateUpClicked , false ) ; } ) ;
594- dom . controlsDown . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateDownClicked , false ) ; } ) ;
595- dom . controlsPrev . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigatePrevClicked , false ) ; } ) ;
596- dom . controlsNext . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateNextClicked , false ) ; } ) ;
597- } ) ;
598- }
585+ [ 'touchstart' , 'click' ] . forEach ( function ( eventName ) {
586+ dom . controlsLeft . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateLeftClicked , false ) ; } ) ;
587+ dom . controlsRight . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateRightClicked , false ) ; } ) ;
588+ dom . controlsUp . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateUpClicked , false ) ; } ) ;
589+ dom . controlsDown . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateDownClicked , false ) ; } ) ;
590+ dom . controlsPrev . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigatePrevClicked , false ) ; } ) ;
591+ dom . controlsNext . forEach ( function ( el ) { el . addEventListener ( eventName , onNavigateNextClicked , false ) ; } ) ;
592+ } ) ;
599593
600594 }
601595
@@ -624,16 +618,14 @@ var Reveal = (function(){
624618 dom . progress . removeEventListener ( 'click' , onProgressClicked , false ) ;
625619 }
626620
627- if ( config . controls && dom . controls ) {
628- [ 'touchstart' , 'click' ] . forEach ( function ( eventName ) {
629- dom . controlsLeft . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateLeftClicked , false ) ; } ) ;
630- dom . controlsRight . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateRightClicked , false ) ; } ) ;
631- dom . controlsUp . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateUpClicked , false ) ; } ) ;
632- dom . controlsDown . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateDownClicked , false ) ; } ) ;
633- dom . controlsPrev . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigatePrevClicked , false ) ; } ) ;
634- dom . controlsNext . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateNextClicked , false ) ; } ) ;
635- } ) ;
636- }
621+ [ 'touchstart' , 'click' ] . forEach ( function ( eventName ) {
622+ dom . controlsLeft . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateLeftClicked , false ) ; } ) ;
623+ dom . controlsRight . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateRightClicked , false ) ; } ) ;
624+ dom . controlsUp . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateUpClicked , false ) ; } ) ;
625+ dom . controlsDown . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateDownClicked , false ) ; } ) ;
626+ dom . controlsPrev . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigatePrevClicked , false ) ; } ) ;
627+ dom . controlsNext . forEach ( function ( el ) { el . removeEventListener ( eventName , onNavigateNextClicked , false ) ; } ) ;
628+ } ) ;
637629
638630 }
639631
@@ -1792,50 +1784,46 @@ var Reveal = (function(){
17921784 */
17931785 function updateControls ( ) {
17941786
1795- if ( config . controls && dom . controls ) {
1796-
1797- var routes = availableRoutes ( ) ;
1798- var fragments = availableFragments ( ) ;
1799-
1800- // Remove the 'enabled' class from all directions
1801- dom . controlsLeft . concat ( dom . controlsRight )
1802- . concat ( dom . controlsUp )
1803- . concat ( dom . controlsDown )
1804- . concat ( dom . controlsPrev )
1805- . concat ( dom . controlsNext ) . forEach ( function ( node ) {
1806- node . classList . remove ( 'enabled' ) ;
1807- node . classList . remove ( 'fragmented' ) ;
1808- } ) ;
1787+ var routes = availableRoutes ( ) ;
1788+ var fragments = availableFragments ( ) ;
1789+
1790+ // Remove the 'enabled' class from all directions
1791+ dom . controlsLeft . concat ( dom . controlsRight )
1792+ . concat ( dom . controlsUp )
1793+ . concat ( dom . controlsDown )
1794+ . concat ( dom . controlsPrev )
1795+ . concat ( dom . controlsNext ) . forEach ( function ( node ) {
1796+ node . classList . remove ( 'enabled' ) ;
1797+ node . classList . remove ( 'fragmented' ) ;
1798+ } ) ;
18091799
1810- // Add the 'enabled' class to the available routes
1811- if ( routes . left ) dom . controlsLeft . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1812- if ( routes . right ) dom . controlsRight . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1813- if ( routes . up ) dom . controlsUp . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1814- if ( routes . down ) dom . controlsDown . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1800+ // Add the 'enabled' class to the available routes
1801+ if ( routes . left ) dom . controlsLeft . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1802+ if ( routes . right ) dom . controlsRight . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1803+ if ( routes . up ) dom . controlsUp . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1804+ if ( routes . down ) dom . controlsDown . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
18151805
1816- // Prev/next buttons
1817- if ( routes . left || routes . up ) dom . controlsPrev . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1818- if ( routes . right || routes . down ) dom . controlsNext . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1806+ // Prev/next buttons
1807+ if ( routes . left || routes . up ) dom . controlsPrev . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
1808+ if ( routes . right || routes . down ) dom . controlsNext . forEach ( function ( el ) { el . classList . add ( 'enabled' ) ; } ) ;
18191809
1820- // Highlight fragment directions
1821- if ( currentSlide ) {
1810+ // Highlight fragment directions
1811+ if ( currentSlide ) {
18221812
1823- // Always apply fragment decorator to prev/next buttons
1824- if ( fragments . prev ) dom . controlsPrev . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1825- if ( fragments . next ) dom . controlsNext . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1813+ // Always apply fragment decorator to prev/next buttons
1814+ if ( fragments . prev ) dom . controlsPrev . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1815+ if ( fragments . next ) dom . controlsNext . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
18261816
1827- // Apply fragment decorators to directional buttons based on
1828- // what slide axis they are in
1829- if ( isVerticalSlide ( currentSlide ) ) {
1830- if ( fragments . prev ) dom . controlsUp . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1831- if ( fragments . next ) dom . controlsDown . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1832- }
1833- else {
1834- if ( fragments . prev ) dom . controlsLeft . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1835- if ( fragments . next ) dom . controlsRight . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1836- }
1817+ // Apply fragment decorators to directional buttons based on
1818+ // what slide axis they are in
1819+ if ( isVerticalSlide ( currentSlide ) ) {
1820+ if ( fragments . prev ) dom . controlsUp . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1821+ if ( fragments . next ) dom . controlsDown . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1822+ }
1823+ else {
1824+ if ( fragments . prev ) dom . controlsLeft . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
1825+ if ( fragments . next ) dom . controlsRight . forEach ( function ( el ) { el . classList . add ( 'fragmented' , 'enabled' ) ; } ) ;
18371826 }
1838-
18391827 }
18401828
18411829 }
0 commit comments