From ebfb49674308e51b1089e0451afc74d678482a09 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Mon, 16 Jun 2014 18:46:38 +0200 Subject: [PATCH] config option for disabling the help overlay --- js/reveal.js | 68 +++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index a49493c..75e88e4 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -85,6 +85,10 @@ // i.e. contained within a limited portion of the screen embedded: false, + // Flags if we should show a help overlay when the questionmark + // key is pressed + help: true, + // Number of milliseconds between automatically proceeding to the // next slide, disabled when set to 0, this value can be overwritten // by using a data-autoslide attribute on your slides @@ -1278,39 +1282,43 @@ */ function showHelp() { - closeOverlay(); + if( config.help ) { - dom.overlay = document.createElement( 'div' ); - dom.overlay.classList.add( 'overlay' ); - dom.overlay.classList.add( 'overlay-help' ); - dom.wrapper.appendChild( dom.overlay ); - - var html = '

Keyboard Shortcuts


'; - - html += ''; - for( var key in keyboardShortcuts ) { - html += ''; - } - - html += '
KEYACTION
' + key + '' + keyboardShortcuts[ key ] + '
'; - - dom.overlay.innerHTML = [ - '
', - '', - '
', - '
', - '
'+ html +'
', - '
' - ].join(''); - - dom.overlay.querySelector( '.close' ).addEventListener( 'click', function( event ) { closeOverlay(); - event.preventDefault(); - }, false ); - setTimeout( function() { - dom.overlay.classList.add( 'visible' ); - }, 1 ); + dom.overlay = document.createElement( 'div' ); + dom.overlay.classList.add( 'overlay' ); + dom.overlay.classList.add( 'overlay-help' ); + dom.wrapper.appendChild( dom.overlay ); + + var html = '

Keyboard Shortcuts


'; + + html += ''; + for( var key in keyboardShortcuts ) { + html += ''; + } + + html += '
KEYACTION
' + key + '' + keyboardShortcuts[ key ] + '
'; + + dom.overlay.innerHTML = [ + '
', + '', + '
', + '
', + '
'+ html +'
', + '
' + ].join(''); + + dom.overlay.querySelector( '.close' ).addEventListener( 'click', function( event ) { + closeOverlay(); + event.preventDefault(); + }, false ); + + setTimeout( function() { + dom.overlay.classList.add( 'visible' ); + }, 1 ); + + } }