From ebfb49674308e51b1089e0451afc74d678482a09 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Mon, 16 Jun 2014 18:46:38 +0200 Subject: config option for disabling the help overlay --- js/reveal.js | 60 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 26 deletions(-) (limited to 'js/reveal.js') 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 ); + closeOverlay(); - var html = '

Keyboard Shortcuts


'; + dom.overlay = document.createElement( 'div' ); + dom.overlay.classList.add( 'overlay' ); + dom.overlay.classList.add( 'overlay-help' ); + dom.wrapper.appendChild( dom.overlay ); - html += ''; - for( var key in keyboardShortcuts ) { - html += ''; - } + var html = '

Keyboard Shortcuts


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