Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added toggleHelp function #1816

Merged
merged 2 commits into from
Feb 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,29 @@

}

/**
* Open or close help overlay window.
*
* @param {Boolean} [override] Flag which overrides the
* toggle logic and forcibly sets the desired state. True means
* help is open, false means it's closed.
*/
function toggleHelp( override ){

if( typeof override === 'boolean' ) {
override ? showHelp( true ) : closeOverlay();
}
else {
if( dom.overlay ) {
closeOverlay();
}
else {
showHelp( true );
}
}
}


/**
* Opens an overlay window with help material.
*/
Expand Down Expand Up @@ -4113,12 +4136,7 @@

// Check if the pressed key is question mark
if( event.shiftKey && event.charCode === 63 ) {
if( dom.overlay ) {
closeOverlay();
}
else {
showHelp( true );
}
toggleHelp();
}

}
Expand Down Expand Up @@ -4818,6 +4836,7 @@

// Shows a help overlay with keyboard shortcuts
showHelp: showHelp,
toggleHelp: toggleHelp,

// Forces an update in slide layout
layout: layout,
Expand Down