From: Hakim El Hattab Date: Sat, 13 Oct 2012 16:04:33 +0000 (-0400) Subject: ability to define autoSlide duration per slide X-Git-Tag: 2.1.0~39 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=421b78aafb2e2c00af4d771c988347964675ef42;p=reveal.js.git ability to define autoSlide duration per slide --- diff --git a/README.md b/README.md index 1ed9898..f63249f 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Reveal.initialize({ // Number of milliseconds between automatically proceeding to the // next slide, disabled when set to 0, this value can be overwritten - // by using a data-autoSlide attribute on your slides + // by using a data-duration attribute on your slides autoSlide: 0, // Enable slide navigation via mouse wheel diff --git a/js/reveal.js b/js/reveal.js index 56f5578..aaad7c3 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.1 r31 + * reveal.js 2.1 r32 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -34,7 +34,7 @@ var Reveal = (function(){ // Number of milliseconds between automatically proceeding to the // next slide, disabled when set to 0, this value can be overwritten - // by using a data-autoSlide attribute on your slides + // by using a data-duration attribute on your slides autoSlide: 0, // Enable slide navigation via mouse wheel @@ -53,7 +53,7 @@ var Reveal = (function(){ dependencies: [] }, - // stores if the next slide should be shown automatically + // Stores if the next slide should be shown automatically // after n milliseconds autoSlide = config.autoSlide, @@ -845,11 +845,11 @@ var Reveal = (function(){ state = state.concat( slideState.split( ' ' ) ); } - // if this slide has a autoSlide attribtue associated use this as autoSlide value - // otherwise use the global configured time - var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' ); + // If this slide has a data-duration attribtue associated use this as + // autoSlide value otherwise use the global configured time + var slideAutoSlide = slides[index].getAttribute( 'data-duration' ); if( slideAutoSlide ) { - autoSlide = parseInt(slideAutoSlide); + autoSlide = parseInt( slideAutoSlide ); } else { autoSlide = config.autoSlide } diff --git a/js/reveal.min.js b/js/reveal.min.js index 5568ab3..a193f7b 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -1,78 +1,79 @@ /*! - * reveal.js 2.1 r31 + * reveal.js 2.1 r32 * http://lab.hakim.se/reveal-js * MIT licensed * * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se */ -var Reveal=(function(){var l=".reveal .slides>section",b=".reveal .slides>section.present>section",R={controls:true,progress:true,history:false,keyboard:true,overview:true,loop:false,autoSlide:0,mouseWheel:true,rollingLinks:true,theme:null,transition:"default",dependencies:[]},m=0,e=0,y,G,ah=[],f={},T="WebkitPerspective" in document.body.style||"MozPerspective" in document.body.style||"msPerspective" in document.body.style||"OPerspective" in document.body.style||"perspective" in document.body.style,n="WebkitTransform" in document.body.style||"MozTransform" in document.body.style||"msTransform" in document.body.style||"OTransform" in document.body.style||"transform" in document.body.style,z=0,k=0,C=0,aa={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40}; -function i(ai){if((!n&&!T)){document.body.setAttribute("class","no-transforms");return;}t(R,ai);P();d();V();}function P(){f.theme=document.querySelector("#theme"); -f.wrapper=document.querySelector(".reveal");if(!f.wrapper.querySelector(".progress")&&R.progress){var al=document.createElement("div");al.classList.add("progress"); -al.innerHTML="";f.wrapper.appendChild(al);}if(!f.wrapper.querySelector(".controls")&&R.controls){var ak=document.createElement("aside");ak.classList.add("controls"); -ak.innerHTML=''; -f.wrapper.appendChild(ak);}if(!f.wrapper.querySelector(".state-background")){var aj=document.createElement("div");aj.classList.add("state-background"); -f.wrapper.appendChild(aj);}if(!f.wrapper.querySelector(".pause-overlay")){var ai=document.createElement("div");ai.classList.add("pause-overlay");f.wrapper.appendChild(ai); +var Reveal=(function(){var l=".reveal .slides>section",b=".reveal .slides>section.present>section",R={controls:true,progress:true,history:false,keyboard:true,overview:true,loop:false,autoSlide:0,mouseWheel:true,rollingLinks:true,theme:null,transition:"default",dependencies:[]},Y=R.autoSlide,m=0,e=0,y,G,ai=[],f={},T="WebkitPerspective" in document.body.style||"MozPerspective" in document.body.style||"msPerspective" in document.body.style||"OPerspective" in document.body.style||"perspective" in document.body.style,n="WebkitTransform" in document.body.style||"MozTransform" in document.body.style||"msTransform" in document.body.style||"OTransform" in document.body.style||"transform" in document.body.style,z=0,k=0,D=0,ab={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40}; +function i(aj){if((!n&&!T)){document.body.setAttribute("class","no-transforms");return;}t(R,aj);P();d();V();}function P(){f.theme=document.querySelector("#theme"); +f.wrapper=document.querySelector(".reveal");if(!f.wrapper.querySelector(".progress")&&R.progress){var am=document.createElement("div");am.classList.add("progress"); +am.innerHTML="";f.wrapper.appendChild(am);}if(!f.wrapper.querySelector(".controls")&&R.controls){var al=document.createElement("aside");al.classList.add("controls"); +al.innerHTML=''; +f.wrapper.appendChild(al);}if(!f.wrapper.querySelector(".state-background")){var ak=document.createElement("div");ak.classList.add("state-background"); +f.wrapper.appendChild(ak);}if(!f.wrapper.querySelector(".pause-overlay")){var aj=document.createElement("div");aj.classList.add("pause-overlay");f.wrapper.appendChild(aj); }f.progress=document.querySelector(".reveal .progress");f.progressbar=document.querySelector(".reveal .progress span");if(R.controls){f.controls=document.querySelector(".reveal .controls"); f.controlsLeft=document.querySelector(".reveal .controls .left");f.controlsRight=document.querySelector(".reveal .controls .right");f.controlsUp=document.querySelector(".reveal .controls .up"); f.controlsDown=document.querySelector(".reveal .controls .down");}}function d(){if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll"; -document.body.style.height="120%";window.addEventListener("load",ab,false);window.addEventListener("orientationchange",ab,false);}}function V(){var aj=[],an=[]; -for(var ak=0,ai=R.dependencies.length;akaa.threshold){aa.handled=true;if(amaa.threshold&&Math.abs(aj)>Math.abs(ai)){aa.handled=true;B();}else{if(aj<-aa.threshold&&Math.abs(aj)>Math.abs(ai)){aa.handled=true;j();}else{if(ai>aa.threshold){aa.handled=true; -u();}else{if(ai<-aa.threshold){aa.handled=true;F();}}}}}}an.preventDefault();}else{if(navigator.userAgent.match(/android/gi)){an.preventDefault();}}}function W(ai){aa.handled=false; -}function p(ai){clearTimeout(z);z=setTimeout(function(){var aj=ai.detail||-ai.wheelDelta;if(aj>0){x();}else{Y();}},100);}function w(ai){J();}function D(ai){if(L()){ai.preventDefault(); -ac();m=this.getAttribute("data-index-h");e=this.getAttribute("data-index-v");a();}}function M(){if(T&&!("msPerspective" in document.body.style)){var aj=document.querySelectorAll(".reveal .slides section a:not(.image)"); -for(var ak=0,ai=aj.length;ak'+al.innerHTML+"";}}}}function I(){if(R.overview){f.wrapper.classList.add("overview");var ai=document.querySelectorAll(l); -for(var an=0,al=ai.length;an3?"none":"block";}an[am].classList.remove("past"); -an[am].classList.remove("present");an[am].classList.remove("future");if(amal){an[am].classList.add("future"); -}}if(ai.querySelector("section")){an[am].classList.add("stack");}}an[al].classList.add("present");var ak=an[al].getAttribute("data-state");if(ak){ah=ah.concat(ak.split(" ")); -}}else{al=0;}return al;}function a(ao,at){y=G;var al=ah.concat();ah.length=0;var ar=m,aj=e;m=ag(l,ao===undefined?m:ao);e=ag(b,at===undefined?e:at);stateLoop:for(var am=0,ap=ah.length; -am0,right:m0,down:e0||e>0){ai+=m;}if(e>0){ai+="/"+e;}window.location.hash=ai;}}function v(){if(document.querySelector(b+".present")){var aj=document.querySelectorAll(b+".present .fragment:not(.visible)"); -if(aj.length){aj[0].classList.add("visible");r("fragmentshown",{fragment:aj[0]});return true;}}else{var ai=document.querySelectorAll(l+".present .fragment:not(.visible)"); -if(ai.length){ai[0].classList.add("visible");r("fragmentshown",{fragment:ai[0]});return true;}}return false;}function Q(){if(document.querySelector(b+".present")){var aj=document.querySelectorAll(b+".present .fragment.visible"); -if(aj.length){aj[aj.length-1].classList.remove("visible");r("fragmenthidden",{fragment:aj[aj.length-1]});return true;}}else{var ai=document.querySelectorAll(l+".present .fragment.visible"); -if(ai.length){ai[ai.length-1].classList.remove("visible");r("fragmenthidden",{fragment:ai[ai.length-1]});return true;}}return false;}function N(){clearTimeout(k); -if(R.autoSlide){k=setTimeout(x,R.autoSlide);}}function O(aj,ai){a(aj,ai);}function B(){if(L()||Q()===false){a(m-1,0);}}function j(){if(L()||v()===false){a(m+1,0); -}}function u(){if(L()||Q()===false){a(m,e-1);}}function F(){if(L()||v()===false){a(m,e+1);}}function Y(){if(Q()===false){if(g().up){u();}else{var ai=document.querySelector(".reveal .slides>section.past:nth-child("+m+")"); -if(ai){e=(ai.querySelectorAll("section").length+1)||0;m--;a();}}}}function x(){if(v()===false){g().down?F():j();}N();}return{initialize:i,navigateTo:O,navigateLeft:B,navigateRight:j,navigateUp:u,navigateDown:F,navigatePrev:Y,navigateNext:x,toggleOverview:X,addEventListeners:E,removeEventListeners:U,getIndices:function(ai){var am=m,ak=e; -if(ai){var an=!!ai.parentNode.nodeName.match(/section/gi);var al=an?ai.parentNode:ai;var aj=Array.prototype.slice.call(document.querySelectorAll(l));am=Math.max(aj.indexOf(al),0); -if(an){ak=Math.max(Array.prototype.slice.call(ai.parentNode.children).indexOf(ai),0);}}return{h:am,v:ak};},getPreviousSlide:function(){return y;},getCurrentSlide:function(){return G; -},getQueryHash:function(){var ai={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(aj){ai[aj.split("=").shift()]=aj.split("=").pop();});return ai; -},addEventListener:function(aj,ak,ai){if("addEventListener" in window){(f.wrapper||document.querySelector(".reveal")).addEventListener(aj,ak,ai);}},removeEventListener:function(aj,ak,ai){if("addEventListener" in window){(f.wrapper||document.querySelector(".reveal")).removeEventListener(aj,ak,ai); +}}function t(ak,aj){for(var al in aj){ak[al]=aj[al];}}function S(al,aj){var am=al.x-aj.x,ak=al.y-aj.y;return Math.sqrt(am*am+ak*ak);}function q(aj){return function(ak){ak.preventDefault(); +aj.call();};}function ac(){setTimeout(function(){window.scrollTo(0,1);},0);}function r(ak,aj){var al=document.createEvent("HTMLEvents",1,2);al.initEvent(ak,true,true); +t(al,aj);f.wrapper.dispatchEvent(al);}function ag(ak){if(document.querySelector(":focus")!==null||ak.shiftKey||ak.altKey||ak.ctrlKey||ak.metaKey){return; +}var aj=true;switch(ak.keyCode){case 80:case 33:Z();break;case 78:case 34:x();break;case 72:case 37:B();break;case 76:case 39:j();break;case 75:case 38:u(); +break;case 74:case 40:F();break;case 36:O(0);break;case 35:O(Number.MAX_VALUE);break;case 32:L()?ad():x();break;case 13:L()?ad():aj=false;break;case 66:case 190:aa(); +break;default:aj=false;}if(aj){ak.preventDefault();}else{if(ak.keyCode===27&&T){X();ak.preventDefault();}}N();}function A(aj){ab.startX=aj.touches[0].clientX; +ab.startY=aj.touches[0].clientY;ab.startCount=aj.touches.length;if(aj.touches.length===2){ab.startSpan=S({x:aj.touches[1].clientX,y:aj.touches[1].clientY},{x:ab.startX,y:ab.startY}); +}}function ae(ao){if(!ab.handled){var am=ao.touches[0].clientX;var al=ao.touches[0].clientY;if(ao.touches.length===2&&ab.startCount===2){var an=S({x:ao.touches[1].clientX,y:ao.touches[1].clientY},{x:ab.startX,y:ab.startY}); +if(Math.abs(ab.startSpan-an)>ab.threshold){ab.handled=true;if(anab.threshold&&Math.abs(ak)>Math.abs(aj)){ab.handled=true;B();}else{if(ak<-ab.threshold&&Math.abs(ak)>Math.abs(aj)){ab.handled=true;j();}else{if(aj>ab.threshold){ab.handled=true; +u();}else{if(aj<-ab.threshold){ab.handled=true;F();}}}}}}ao.preventDefault();}else{if(navigator.userAgent.match(/android/gi)){ao.preventDefault();}}}function W(aj){ab.handled=false; +}function p(aj){clearTimeout(z);z=setTimeout(function(){var ak=aj.detail||-aj.wheelDelta;if(ak>0){x();}else{Z();}},100);}function w(aj){J();}function C(aj){if(L()){aj.preventDefault(); +ad();m=this.getAttribute("data-index-h");e=this.getAttribute("data-index-v");a();}}function M(){if(T&&!("msPerspective" in document.body.style)){var ak=document.querySelectorAll(".reveal .slides section a:not(.image)"); +for(var al=0,aj=ak.length;al'+am.innerHTML+"";}}}}function I(){if(R.overview){f.wrapper.classList.add("overview");var aj=document.querySelectorAll(l); +for(var ao=0,am=aj.length;ao3?"none":"block";}ak[ao].classList.remove("past"); +ak[ao].classList.remove("present");ak[ao].classList.remove("future");if(aoar){ak[ao].classList.add("future"); +}}if(ap.querySelector("section")){ak[ao].classList.add("stack");}}ak[ar].classList.add("present");var al=ak[ar].getAttribute("data-state");if(al){ai=ai.concat(al.split(" ")); +}var an=ak[ar].getAttribute("data-duration");if(an){Y=parseInt(an);}else{Y=R.autoSlide;}}else{ar=0;}return ar;}function a(ap,au){y=G;var am=ai.concat(); +ai.length=0;var at=m,ak=e;m=ah(l,ap===undefined?m:ap);e=ah(b,au===undefined?e:au);stateLoop:for(var an=0,aq=ai.length;an0,right:m0,down:e0||e>0){aj+=m;}if(e>0){aj+="/"+e;}window.location.hash=aj;}}function v(){if(document.querySelector(b+".present")){var ak=document.querySelectorAll(b+".present .fragment:not(.visible)"); +if(ak.length){ak[0].classList.add("visible");r("fragmentshown",{fragment:ak[0]});return true;}}else{var aj=document.querySelectorAll(l+".present .fragment:not(.visible)"); +if(aj.length){aj[0].classList.add("visible");r("fragmentshown",{fragment:aj[0]});return true;}}return false;}function Q(){if(document.querySelector(b+".present")){var ak=document.querySelectorAll(b+".present .fragment.visible"); +if(ak.length){ak[ak.length-1].classList.remove("visible");r("fragmenthidden",{fragment:ak[ak.length-1]});return true;}}else{var aj=document.querySelectorAll(l+".present .fragment.visible"); +if(aj.length){aj[aj.length-1].classList.remove("visible");r("fragmenthidden",{fragment:aj[aj.length-1]});return true;}}return false;}function N(){clearTimeout(k); +if(Y){k=setTimeout(x,Y);}}function O(ak,aj){a(ak,aj);}function B(){if(L()||Q()===false){a(m-1,0);}}function j(){if(L()||v()===false){a(m+1,0);}}function u(){if(L()||Q()===false){a(m,e-1); +}}function F(){if(L()||v()===false){a(m,e+1);}}function Z(){if(Q()===false){if(g().up){u();}else{var aj=document.querySelector(".reveal .slides>section.past:nth-child("+m+")"); +if(aj){e=(aj.querySelectorAll("section").length+1)||0;m--;a();}}}}function x(){if(v()===false){g().down?F():j();}N();}return{initialize:i,navigateTo:O,navigateLeft:B,navigateRight:j,navigateUp:u,navigateDown:F,navigatePrev:Z,navigateNext:x,toggleOverview:X,addEventListeners:E,removeEventListeners:U,getIndices:function(aj){var an=m,al=e; +if(aj){var ao=!!aj.parentNode.nodeName.match(/section/gi);var am=ao?aj.parentNode:aj;var ak=Array.prototype.slice.call(document.querySelectorAll(l));an=Math.max(ak.indexOf(am),0); +if(ao){al=Math.max(Array.prototype.slice.call(aj.parentNode.children).indexOf(aj),0);}}return{h:an,v:al};},getPreviousSlide:function(){return y;},getCurrentSlide:function(){return G; +},getQueryHash:function(){var aj={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(ak){aj[ak.split("=").shift()]=ak.split("=").pop();});return aj; +},addEventListener:function(ak,al,aj){if("addEventListener" in window){(f.wrapper||document.querySelector(".reveal")).addEventListener(ak,al,aj);}},removeEventListener:function(ak,al,aj){if("addEventListener" in window){(f.wrapper||document.querySelector(".reveal")).removeEventListener(ak,al,aj); }}};})(); \ No newline at end of file