From a1e73b78ef6ec05599794e7cfd0b91bd7a10eb88 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Fri, 21 Sep 2012 09:27:31 -0400 Subject: [PATCH] code comments, remove needless nodelist > array conversion --- js/reveal.js | 11 +++++++++-- js/reveal.min.js | 14 +++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 75525da..78413f3 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -535,11 +535,12 @@ var Reveal = (function(){ */ function activateOverview() { + // Only proceed if enabled in config if( config.overview ) { dom.wrapper.classList.add( 'overview' ); - var horizontalSlides = Array.prototype.slice.call( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); + var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ); for( var i = 0, len1 = horizontalSlides.length; i < len1; i++ ) { var hslide = horizontalSlides[i], @@ -558,7 +559,7 @@ var Reveal = (function(){ hslide.addEventListener( 'click', onOverviewSlideClicked, true ); } - var verticalSlides = Array.prototype.slice.call( hslide.querySelectorAll( 'section' ) ); + var verticalSlides = hslide.querySelectorAll( 'section' ); for( var j = 0, len2 = verticalSlides.length; j < len2; j++ ) { var vslide = verticalSlides[j], @@ -589,10 +590,12 @@ var Reveal = (function(){ */ function deactivateOverview() { + // Only proceed if enabled in config if( config.overview ) { dom.wrapper.classList.remove( 'overview' ); + // Select all slides var slides = Array.prototype.slice.call( document.querySelectorAll( '.reveal .slides section' ) ); for( var i = 0, len = slides.length; i < len; i++ ) { @@ -833,6 +836,7 @@ var Reveal = (function(){ node.classList.remove( 'enabled' ); } ); + // Add the 'enabled' class to the available routes if( routes.left ) dom.controlsLeft.classList.add( 'enabled' ); if( routes.right ) dom.controlsRight.classList.add( 'enabled' ); if( routes.up ) dom.controlsUp.classList.add( 'enabled' ); @@ -985,6 +989,9 @@ var Reveal = (function(){ return false; } + /** + * Cues a new automated slide if enabled in the config. + */ function cueAutoSlide() { clearTimeout( autoSlideTimeout ); diff --git a/js/reveal.min.js b/js/reveal.min.js index 621ce87..fb55ef7 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -34,15 +34,15 @@ if(ad>V.threshold&&Math.abs(ad)>Math.abs(ac)){V.handled=true;y();}else{if(ad<-V. r();}else{if(ac<-V.threshold){V.handled=true;C();}}}}}}ah.preventDefault();}}function R(ac){V.handled=false;}function m(ac){clearTimeout(w);w=setTimeout(function(){var ad=ac.detail||-ac.wheelDelta; if(ad>0){u();}else{T();}},100);}function t(ac){G();}function I(){if(O&&!("msPerspective" in document.body.style)){var ad=document.querySelectorAll(".reveal .slides section a:not(.image)"); for(var ae=0,ac=ad.length;ae'+af.innerHTML+"";}}}}function F(){if(M.overview){d.wrapper.classList.add("overview");var ac=Array.prototype.slice.call(document.querySelectorAll(j)); +af.innerHTML=''+af.innerHTML+"";}}}}function F(){if(M.overview){d.wrapper.classList.add("overview");var ac=document.querySelectorAll(j); for(var ah=0,af=ac.length;ah3?"none":"block";}ah[ag].classList.remove("past");ah[ag].classList.remove("present");ah[ag].classList.remove("future");if(agaf){ah[ag].classList.add("future");}}if(ac.querySelector("section")){ah[ag].classList.add("stack");}}ah[af].classList.add("present");var ae=ah[af].getAttribute("data-state");