docs/source/_static/presentations/js/reveal.js
/**
	 * Handler for the document level 'keydown' event.
	 */
Handler for the document level 'keydown' event.
Handler for the document level ' keydown ' event .
function onDocumentKeyDown( event ) {
		onUserInput( event );
		var activeElement = document.activeElement;
		var hasFocus = !!( document.activeElement && ( document.activeElement.type || document.activeElement.href || document.activeElement.contentEditable !== 'inherit' ) );
		if( hasFocus || (event.shiftKey && event.keyCode !== 32) || event.altKey || event.ctrlKey || event.metaKey ) return;
		if( isPaused() && [66,190,191].indexOf( event.keyCode ) === -1 ) {
			return false;
		}
		var triggered = false;
		if( typeof config.keyboard === 'object' ) {
			for( var key in config.keyboard ) {
				if( parseInt( key, 10 ) === event.keyCode ) {
					var value = config.keyboard[ key ];
					if( typeof value === 'function' ) {
						value.apply( null, [ event ] );
					}
					else if( typeof value === 'string' && typeof Reveal[ value ] === 'function' ) {
						Reveal[ value ].call();
					}
					triggered = true;
				}
			}
		}
		if( triggered === false ) {
			triggered = true;
			switch( event.keyCode ) {
				case 80: case 33: navigatePrev(); break;
				case 78: case 34: navigateNext(); break;
				case 72: case 37: navigateLeft(); break;
				case 76: case 39: navigateRight(); break;
				case 75: case 38: navigateUp(); break;
				case 74: case 40: navigateDown(); break;
				case 36: slide( 0 ); break;
				case 35: slide( Number.MAX_VALUE ); break;
				case 32: isOverview() ? deactivateOverview() : event.shiftKey ? navigatePrev() : navigateNext(); break;
				case 13: isOverview() ? deactivateOverview() : triggered = false; break;
				case 66: case 190: case 191: togglePause(); break;
				case 70: enterFullscreen(); break;
				default:
					triggered = false;
			}
		}
		if( triggered ) {
			event.preventDefault();
		}
		else if ( ( event.keyCode === 27 || event.keyCode === 79 ) && features.transforms3d ) {
			if( dom.preview ) {
				closePreview();
			}
			else {
				toggleOverview();
			}
			event.preventDefault();
		}
		cueAutoSlide();
	}
function onDocumentKeyDown ( event ) { onUserInput ( event ) ; var activeElement = document . activeElement ; var hasFocus = ! ! ( document . activeElement && ( document . activeElement . type || document . activeElement . href || document . activeElement . contentEditable !== 'inherit' ) ) ; if ( hasFocus || ( event . shiftKey && event . keyCode !== 32 ) || event . altKey || event . ctrlKey || event . metaKey ) return ; if ( isPaused ( ) && [ 66 , 190 , 191 ] . indexOf ( event . keyCode ) === - 1 ) { return false ; } var triggered = false ; if ( typeof config . keyboard === 'object' ) { for ( var key in config . keyboard ) { if ( parseInt ( key , 10 ) === event . keyCode ) { var value = config . keyboard [ key ] ; if ( typeof value === 'function' ) { value . apply ( null , [ event ] ) ; } else if ( typeof value === 'string' && typeof Reveal [ value ] === 'function' ) { Reveal [ value ] . call ( ) ; } triggered = true ; } } } if ( triggered === false ) { triggered = true ; switch ( event . keyCode ) { case 80 : case 33 : navigatePrev ( ) ; break ; case 78 : case 34 : navigateNext ( ) ; break ; case 72 : case 37 : navigateLeft ( ) ; break ; case 76 : case 39 : navigateRight ( ) ; break ; case 75 : case 38 : navigateUp ( ) ; break ; case 74 : case 40 : navigateDown ( ) ; break ; case 36 : slide ( 0 ) ; break ; case 35 : slide ( Number . MAX_VALUE ) ; break ; case 32 : isOverview ( ) ? deactivateOverview ( ) : event . shiftKey ? navigatePrev ( ) : navigateNext ( ) ; break ; case 13 : isOverview ( ) ? deactivateOverview ( ) : triggered = false ; break ; case 66 : case 190 : case 191 : togglePause ( ) ; break ; case 70 : enterFullscreen ( ) ; break ; default : triggered = false ; } } if ( triggered ) { event . preventDefault ( ) ; } else if ( ( event . keyCode === 27 || event . keyCode === 79 ) && features . transforms3d ) { if ( dom . preview ) { closePreview ( ) ; } else { toggleOverview ( ) ; } event . preventDefault ( ) ; } cueAutoSlide ( ) ; }
Handler for the document level 'keydown' event.
Handler for the document level ' keydown ' event .
// Check if there's a focused element that could be using // the keyboard // Disregard the event if there's a focused element or a // keyboard modifier key is present // While paused only allow "unpausing" keyboard events (b and .) // 1. User defined key bindings // Check if this binding matches the pressed key // Callback function // String shortcuts to reveal.js API // 2. System defined key bindings // Assume true and try to prove false // p, page up // n, page down // h, left // l, right // k, up // j, down // home // end // space // return // b, period, Logitech presenter tools "black screen" button // f // If the input resulted in a triggered action we should prevent // the browsers default behavior // ESC or O key // If auto-sliding is enabled we need to cue up // another timeout