diff --git a/js/reveal.js b/js/reveal.js index 03bd833d..e2c86b33 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -204,7 +204,7 @@ export default function( revealElement, options ) { */ function load() { - var scripts = [], + let scripts = [], scriptsToLoad = 0; config.dependencies.forEach( s => { @@ -224,7 +224,7 @@ export default function( revealElement, options ) { // Load synchronous scripts scripts.forEach( s => { - loadScript( s.src, function() { + loadScript( s.src, () => { if( typeof s.callback === 'function' ) s.callback(); @@ -541,14 +541,14 @@ export default function( revealElement, options ) { */ function setupPDF() { - var slideSize = getComputedSlideSize( window.innerWidth, window.innerHeight ); + let slideSize = getComputedSlideSize( window.innerWidth, window.innerHeight ); // Dimensions of the PDF pages - var pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ), + let pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ), pageHeight = Math.floor( slideSize.height * ( 1 + config.margin ) ); // Dimensions of slides within the pages - var slideWidth = slideSize.width, + let slideWidth = slideSize.width, slideHeight = slideSize.height; // Let the browser know what page size we want to print @@ -565,7 +565,7 @@ export default function( revealElement, options ) { layoutSlideContents( slideWidth, slideHeight ); // Compute slide numbers now, before we start duplicating slides - var doingSlideNumbers = config.slideNumber && /all|print/i.test( config.showSlideNumber ); + let doingSlideNumbers = config.slideNumber && /all|print/i.test( config.showSlideNumber ); toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) { slide.setAttribute( 'data-slide-number', getSlideNumber( slide ) ); } ); @@ -577,11 +577,11 @@ export default function( revealElement, options ) { // children will be if( slide.classList.contains( 'stack' ) === false ) { // Center the slide inside of the page, giving the slide some margin - var left = ( pageWidth - slideWidth ) / 2, + let left = ( pageWidth - slideWidth ) / 2, top = ( pageHeight - slideHeight ) / 2; - var contentHeight = slide.scrollHeight; - var numberOfPages = Math.max( Math.ceil( contentHeight / pageHeight ), 1 ); + let contentHeight = slide.scrollHeight; + let numberOfPages = Math.max( Math.ceil( contentHeight / pageHeight ), 1 ); // Adhere to configured pages per slide limit numberOfPages = Math.min( numberOfPages, config.pdfMaxPagesPerSlide ); @@ -593,7 +593,7 @@ export default function( revealElement, options ) { // Wrap the slide in a page element and hide its overflow // so that no page ever flows onto another - var page = document.createElement( 'div' ); + let page = document.createElement( 'div' ); page.className = 'pdf-page'; page.style.height = ( ( pageHeight + config.pdfPageHeightOffset ) * numberOfPages ) + 'px'; slide.parentNode.insertBefore( page, slide ); @@ -612,12 +612,12 @@ export default function( revealElement, options ) { if( config.showNotes ) { // Are there notes for this slide? - var notes = getSlideNotes( slide ); + let notes = getSlideNotes( slide ); if( notes ) { - var notesSpacing = 8; - var notesLayout = typeof config.showNotes === 'string' ? config.showNotes : 'inline'; - var notesElement = document.createElement( 'div' ); + let notesSpacing = 8; + let notesLayout = typeof config.showNotes === 'string' ? config.showNotes : 'inline'; + let notesElement = document.createElement( 'div' ); notesElement.classList.add( 'speaker-notes' ); notesElement.classList.add( 'speaker-notes-pdf' ); notesElement.setAttribute( 'data-layout', notesLayout ); @@ -639,7 +639,7 @@ export default function( revealElement, options ) { // Inject slide numbers if `slideNumbers` are enabled if( doingSlideNumbers ) { - var numberElement = document.createElement( 'div' ); + let numberElement = document.createElement( 'div' ); numberElement.classList.add( 'slide-number' ); numberElement.classList.add( 'slide-number-pdf' ); numberElement.innerHTML = slide.getAttribute( 'data-slide-number' ); @@ -652,10 +652,10 @@ export default function( revealElement, options ) { // Each fragment 'group' is an array containing one or more // fragments. Multiple fragments that appear at the same time // are part of the same group. - var fragmentGroups = sortFragments( page.querySelectorAll( '.fragment' ), true ); + let fragmentGroups = sortFragments( page.querySelectorAll( '.fragment' ), true ); - var previousFragmentStep; - var previousPage; + let previousFragmentStep; + let previousPage; fragmentGroups.forEach( function( fragments ) { @@ -672,7 +672,7 @@ export default function( revealElement, options ) { } ); // Create a separate page for the current fragment state - var clonedPage = page.cloneNode( true ); + let clonedPage = page.cloneNode( true ); page.parentNode.insertBefore( clonedPage, ( previousPage || page ).nextSibling ); previousFragmentStep = fragments; @@ -983,7 +983,7 @@ export default function( revealElement, options ) { if( POST_MESSAGE_METHOD_BLACKLIST.test( data.method ) === false ) { - var result = Reveal[data.method].apply( Reveal, data.args ); + const result = Reveal[data.method].apply( Reveal, data.args ); // Dispatch a postMessage event with the returned value from // our method invocation for getter functions @@ -1095,7 +1095,7 @@ export default function( revealElement, options ) { } // Reset all auto animated elements - toArray( dom.slides.querySelectorAll( '[data-auto-animate]:not([data-auto-animate=""])' ) ).forEach( function( element ) { + toArray( dom.slides.querySelectorAll( '[data-auto-animate]:not([data-auto-animate=""])' ) ).forEach( element => { element.dataset.autoAnimate = ''; } ); @@ -1231,13 +1231,13 @@ export default function( revealElement, options ) { pointerEvents = [ 'touchstart' ]; } - pointerEvents.forEach( function( eventName ) { - dom.controlsLeft.forEach( function( el ) { el.addEventListener( eventName, onNavigateLeftClicked, false ); } ); - dom.controlsRight.forEach( function( el ) { el.addEventListener( eventName, onNavigateRightClicked, false ); } ); - dom.controlsUp.forEach( function( el ) { el.addEventListener( eventName, onNavigateUpClicked, false ); } ); - dom.controlsDown.forEach( function( el ) { el.addEventListener( eventName, onNavigateDownClicked, false ); } ); - dom.controlsPrev.forEach( function( el ) { el.addEventListener( eventName, onNavigatePrevClicked, false ); } ); - dom.controlsNext.forEach( function( el ) { el.addEventListener( eventName, onNavigateNextClicked, false ); } ); + pointerEvents.forEach( eventName => { + dom.controlsLeft.forEach( el => el.addEventListener( eventName, onNavigateLeftClicked, false ) ); + dom.controlsRight.forEach( el => el.addEventListener( eventName, onNavigateRightClicked, false ) ); + dom.controlsUp.forEach( el => el.addEventListener( eventName, onNavigateUpClicked, false ) ); + dom.controlsDown.forEach( el => el.addEventListener( eventName, onNavigateDownClicked, false ) ); + dom.controlsPrev.forEach( el => el.addEventListener( eventName, onNavigatePrevClicked, false ) ); + dom.controlsNext.forEach( el => el.addEventListener( eventName, onNavigateNextClicked, false ) ); } ); } @@ -1272,13 +1272,13 @@ export default function( revealElement, options ) { dom.progress.removeEventListener( 'click', onProgressClicked, false ); } - [ 'touchstart', 'click' ].forEach( function( eventName ) { - dom.controlsLeft.forEach( function( el ) { el.removeEventListener( eventName, onNavigateLeftClicked, false ); } ); - dom.controlsRight.forEach( function( el ) { el.removeEventListener( eventName, onNavigateRightClicked, false ); } ); - dom.controlsUp.forEach( function( el ) { el.removeEventListener( eventName, onNavigateUpClicked, false ); } ); - dom.controlsDown.forEach( function( el ) { el.removeEventListener( eventName, onNavigateDownClicked, false ); } ); - dom.controlsPrev.forEach( function( el ) { el.removeEventListener( eventName, onNavigatePrevClicked, false ); } ); - dom.controlsNext.forEach( function( el ) { el.removeEventListener( eventName, onNavigateNextClicked, false ); } ); + [ 'touchstart', 'click' ].forEach( eventName => { + dom.controlsLeft.forEach( el => el.removeEventListener( eventName, onNavigateLeftClicked, false ) ); + dom.controlsRight.forEach( el => el.removeEventListener( eventName, onNavigateRightClicked, false ) ); + dom.controlsUp.forEach( el => el.removeEventListener( eventName, onNavigateUpClicked, false ) ); + dom.controlsDown.forEach( el => el.removeEventListener( eventName, onNavigateDownClicked, false ) ); + dom.controlsPrev.forEach( el => el.removeEventListener( eventName, onNavigatePrevClicked, false ) ); + dom.controlsNext.forEach( el => el.removeEventListener( eventName, onNavigateNextClicked, false ) ); } ); } @@ -1576,12 +1576,12 @@ export default function( revealElement, options ) { let html = '
Keyboard Shortcuts
KEY | ACTION | '; - for( var key in keyboardShortcuts ) { + for( let key in keyboardShortcuts ) { html += `
---|---|
${key} | ${keyboardShortcuts[ key ]} |
${registeredKeyBindings[binding].key} | ${registeredKeyBindings[binding].description} |