1
0
Fork 0

code comments, remove needless nodelist > array conversion

This commit is contained in:
Hakim El Hattab 2012-09-21 09:27:31 -04:00
parent edb2051529
commit a1e73b78ef
2 changed files with 16 additions and 9 deletions

View File

@ -535,11 +535,12 @@ var Reveal = (function(){
*/ */
function activateOverview() { function activateOverview() {
// Only proceed if enabled in config
if( config.overview ) { if( config.overview ) {
dom.wrapper.classList.add( '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++ ) { for( var i = 0, len1 = horizontalSlides.length; i < len1; i++ ) {
var hslide = horizontalSlides[i], var hslide = horizontalSlides[i],
@ -558,7 +559,7 @@ var Reveal = (function(){
hslide.addEventListener( 'click', onOverviewSlideClicked, true ); 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++ ) { for( var j = 0, len2 = verticalSlides.length; j < len2; j++ ) {
var vslide = verticalSlides[j], var vslide = verticalSlides[j],
@ -589,10 +590,12 @@ var Reveal = (function(){
*/ */
function deactivateOverview() { function deactivateOverview() {
// Only proceed if enabled in config
if( config.overview ) { if( config.overview ) {
dom.wrapper.classList.remove( 'overview' ); dom.wrapper.classList.remove( 'overview' );
// Select all slides
var slides = Array.prototype.slice.call( document.querySelectorAll( '.reveal .slides section' ) ); var slides = Array.prototype.slice.call( document.querySelectorAll( '.reveal .slides section' ) );
for( var i = 0, len = slides.length; i < len; i++ ) { for( var i = 0, len = slides.length; i < len; i++ ) {
@ -833,6 +836,7 @@ var Reveal = (function(){
node.classList.remove( 'enabled' ); node.classList.remove( 'enabled' );
} ); } );
// Add the 'enabled' class to the available routes
if( routes.left ) dom.controlsLeft.classList.add( 'enabled' ); if( routes.left ) dom.controlsLeft.classList.add( 'enabled' );
if( routes.right ) dom.controlsRight.classList.add( 'enabled' ); if( routes.right ) dom.controlsRight.classList.add( 'enabled' );
if( routes.up ) dom.controlsUp.classList.add( 'enabled' ); if( routes.up ) dom.controlsUp.classList.add( 'enabled' );
@ -985,6 +989,9 @@ var Reveal = (function(){
return false; return false;
} }
/**
* Cues a new automated slide if enabled in the config.
*/
function cueAutoSlide() { function cueAutoSlide() {
clearTimeout( autoSlideTimeout ); clearTimeout( autoSlideTimeout );

14
js/reveal.min.js vendored
View File

@ -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; 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)"); 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<ac;ae++){var af=ad[ae];if(af.textContent&&!af.querySelector("img")&&(!af.className||!af.classList.contains(af,"roll"))){af.classList.add("roll"); for(var ae=0,ac=ad.length;ae<ac;ae++){var af=ad[ae];if(af.textContent&&!af.querySelector("img")&&(!af.className||!af.classList.contains(af,"roll"))){af.classList.add("roll");
af.innerHTML='<span data-title="'+af.text+'">'+af.innerHTML+"</span>";}}}}function F(){if(M.overview){d.wrapper.classList.add("overview");var ac=Array.prototype.slice.call(document.querySelectorAll(j)); af.innerHTML='<span data-title="'+af.text+'">'+af.innerHTML+"</span>";}}}}function F(){if(M.overview){d.wrapper.classList.add("overview");var ac=document.querySelectorAll(j);
for(var ah=0,af=ac.length;ah<af;ah++){var ae=ac[ah],al="translateZ(-2500px) translate("+((ah-k)*105)+"%, 0%)";ae.setAttribute("data-index-h",ah);ae.style.display="block"; for(var ah=0,af=ac.length;ah<af;ah++){var ae=ac[ah],al="translateZ(-2500px) translate("+((ah-k)*105)+"%, 0%)";ae.setAttribute("data-index-h",ah);ae.style.display="block";
ae.style.WebkitTransform=al;ae.style.MozTransform=al;ae.style.msTransform=al;ae.style.OTransform=al;ae.style.transform=al;if(!ae.classList.contains("stack")){ae.addEventListener("click",z,true); ae.style.WebkitTransform=al;ae.style.MozTransform=al;ae.style.msTransform=al;ae.style.OTransform=al;ae.style.transform=al;if(!ae.classList.contains("stack")){ae.addEventListener("click",z,true);
}var ak=Array.prototype.slice.call(ae.querySelectorAll("section"));for(var ag=0,ad=ak.length;ag<ad;ag++){var aj=ak[ag],ai="translate(0%, "+((ag-(ah===k?c:0))*105)+"%)"; }var ak=ae.querySelectorAll("section");for(var ag=0,ad=ak.length;ag<ad;ag++){var aj=ak[ag],ai="translate(0%, "+((ag-(ah===k?c:0))*105)+"%)";aj.setAttribute("data-index-h",ah);
aj.setAttribute("data-index-h",ah);aj.setAttribute("data-index-v",ag);aj.style.display="block";aj.style.WebkitTransform=ai;aj.style.MozTransform=ai;aj.style.msTransform=ai; aj.setAttribute("data-index-v",ag);aj.style.display="block";aj.style.WebkitTransform=ai;aj.style.MozTransform=ai;aj.style.msTransform=ai;aj.style.OTransform=ai;
aj.style.OTransform=ai;aj.style.transform=ai;aj.addEventListener("click",z,true);}}}}function X(){if(M.overview){d.wrapper.classList.remove("overview"); aj.style.transform=ai;aj.addEventListener("click",z,true);}}}}function X(){if(M.overview){d.wrapper.classList.remove("overview");var af=Array.prototype.slice.call(document.querySelectorAll(".reveal .slides section"));
var af=Array.prototype.slice.call(document.querySelectorAll(".reveal .slides section"));for(var ae=0,ac=af.length;ae<ac;ae++){var ad=af[ae];ad.style.WebkitTransform=""; for(var ae=0,ac=af.length;ae<ac;ae++){var ad=af[ae];ad.style.WebkitTransform="";ad.style.MozTransform="";ad.style.msTransform="";ad.style.OTransform="";
ad.style.MozTransform="";ad.style.msTransform="";ad.style.OTransform="";ad.style.transform="";ad.removeEventListener("click",z);}a();}}function U(){return d.wrapper.classList.contains("overview"); ad.style.transform="";ad.removeEventListener("click",z);}a();}}function U(){return d.wrapper.classList.contains("overview");}function z(ac){if(U()){ac.preventDefault();
}function z(ac){if(U()){ac.preventDefault();X();k=this.getAttribute("data-index-h");c=this.getAttribute("data-index-v");a();}}function aa(ad,af){var ah=Array.prototype.slice.call(document.querySelectorAll(ad)),ai=ah.length; X();k=this.getAttribute("data-index-h");c=this.getAttribute("data-index-v");a();}}function aa(ad,af){var ah=Array.prototype.slice.call(document.querySelectorAll(ad)),ai=ah.length;
if(ai){if(M.loop){af%=ai;if(af<0){af=ai+af;}}af=Math.max(Math.min(af,ai-1),0);for(var ag=0;ag<ai;ag++){var ac=ah[ag];if(U()===false){var aj=Math.abs((af-ag)%(ai-3))||0; if(ai){if(M.loop){af%=ai;if(af<0){af=ai+af;}}af=Math.max(Math.min(af,ai-1),0);for(var ag=0;ag<ai;ag++){var ac=ah[ag];if(U()===false){var aj=Math.abs((af-ag)%(ai-3))||0;
ac.style.display=aj>3?"none":"block";}ah[ag].classList.remove("past");ah[ag].classList.remove("present");ah[ag].classList.remove("future");if(ag<af){ah[ag].classList.add("past"); ac.style.display=aj>3?"none":"block";}ah[ag].classList.remove("past");ah[ag].classList.remove("present");ah[ag].classList.remove("future");if(ag<af){ah[ag].classList.add("past");
}else{if(ag>af){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"); }else{if(ag>af){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");