controls are not necessary

no need to include the controls in html
This commit is contained in:
danielmitd 2012-06-10 11:42:42 +02:00
parent 5d979fdf4a
commit 5fba807843

View File

@ -87,11 +87,14 @@ var Reveal = (function(){
dom.wrapper = document.querySelector( '.reveal' ); dom.wrapper = document.querySelector( '.reveal' );
dom.progress = document.querySelector( '.reveal .progress' ); dom.progress = document.querySelector( '.reveal .progress' );
dom.progressbar = document.querySelector( '.reveal .progress span' ); dom.progressbar = document.querySelector( '.reveal .progress span' );
dom.controls = document.querySelector( '.reveal .controls' );
dom.controlsLeft = document.querySelector( '.reveal .controls .left' ); if (config.controls) {
dom.controlsRight = document.querySelector( '.reveal .controls .right' ); dom.controls = document.querySelector( '.reveal .controls' );
dom.controlsUp = document.querySelector( '.reveal .controls .up' ); dom.controlsLeft = document.querySelector( '.reveal .controls .left' );
dom.controlsDown = document.querySelector( '.reveal .controls .down' ); dom.controlsRight = document.querySelector( '.reveal .controls .right' );
dom.controlsUp = document.querySelector( '.reveal .controls .up' );
dom.controlsDown = document.querySelector( '.reveal .controls .down' );
}
addEventListeners(); addEventListeners();
@ -123,7 +126,7 @@ var Reveal = (function(){
config.transition = 'linear'; config.transition = 'linear';
} }
if( config.controls ) { if( config.controls && dom.controls ) {
dom.controls.style.display = 'block'; dom.controls.style.display = 'block';
} }
@ -156,11 +159,13 @@ var Reveal = (function(){
document.addEventListener( 'touchmove', onDocumentTouchMove, false ); document.addEventListener( 'touchmove', onDocumentTouchMove, false );
document.addEventListener( 'touchend', onDocumentTouchEnd, false ); document.addEventListener( 'touchend', onDocumentTouchEnd, false );
window.addEventListener( 'hashchange', onWindowHashChange, false ); window.addEventListener( 'hashchange', onWindowHashChange, false );
dom.controlsLeft.addEventListener( 'click', preventAndForward( navigateLeft ), false ); if (dom.controls) {
dom.controlsRight.addEventListener( 'click', preventAndForward( navigateRight ), false ); dom.controlsLeft.addEventListener( 'click', preventAndForward( navigateLeft ), false );
dom.controlsUp.addEventListener( 'click', preventAndForward( navigateUp ), false ); dom.controlsRight.addEventListener( 'click', preventAndForward( navigateRight ), false );
dom.controlsDown.addEventListener( 'click', preventAndForward( navigateDown ), false ); dom.controlsUp.addEventListener( 'click', preventAndForward( navigateUp ), false );
dom.controlsDown.addEventListener( 'click', preventAndForward( navigateDown ), false );
}
} }
function removeEventListeners() { function removeEventListeners() {
@ -170,10 +175,12 @@ var Reveal = (function(){
document.removeEventListener( 'touchend', onDocumentTouchEnd, false ); document.removeEventListener( 'touchend', onDocumentTouchEnd, false );
window.removeEventListener( 'hashchange', onWindowHashChange, false ); window.removeEventListener( 'hashchange', onWindowHashChange, false );
dom.controlsLeft.removeEventListener( 'click', preventAndForward( navigateLeft ), false ); if (dom.controls) {
dom.controlsRight.removeEventListener( 'click', preventAndForward( navigateRight ), false ); dom.controlsLeft.removeEventListener( 'click', preventAndForward( navigateLeft ), false );
dom.controlsUp.removeEventListener( 'click', preventAndForward( navigateUp ), false ); dom.controlsRight.removeEventListener( 'click', preventAndForward( navigateRight ), false );
dom.controlsDown.removeEventListener( 'click', preventAndForward( navigateDown ), false ); dom.controlsUp.removeEventListener( 'click', preventAndForward( navigateUp ), false );
dom.controlsDown.removeEventListener( 'click', preventAndForward( navigateDown ), false );
}
} }
/** /**
@ -692,6 +699,8 @@ var Reveal = (function(){
* Updates the state and link pointers of the controls. * Updates the state and link pointers of the controls.
*/ */
function updateControls() { function updateControls() {
if (!dom.controls) return;
var routes = availableRoutes(); var routes = availableRoutes();
// Remove the 'enabled' class from all directions // Remove the 'enabled' class from all directions