From 2e024b5b3e8d786562a29e11b22c0697744682e5 Mon Sep 17 00:00:00 2001 From: akiersky Date: Wed, 30 May 2012 09:38:26 -0300 Subject: [PATCH 1/5] added left, right, up, down gestures to change slides. moved window edge slide triggers to a touchend event to prevent interference of gestures --- js/reveal.js | 55 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 729f2f9c..7da99357 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -25,7 +25,8 @@ var Reveal = (function(){ mouseWheel: true, rollingLinks: true, transition: 'default', - theme: 'default' + theme: 'default', + swipeDistance: 30 }, // Slides may hold a data-state attribute which we pick up and apply @@ -82,6 +83,8 @@ var Reveal = (function(){ // Bind all view events document.addEventListener( 'keydown', onDocumentKeyDown, false ); document.addEventListener( 'touchstart', onDocumentTouchStart, false ); + document.addEventListener( 'touchmove', onDocumentTouchMove, false ); + document.addEventListener( 'touchend', onDocumentTouchEnd, false ); window.addEventListener( 'hashchange', onWindowHashChange, false ); dom.controlsLeft.addEventListener( 'click', preventAndForward( navigateLeft ), false ); dom.controlsRight.addEventListener( 'click', preventAndForward( navigateRight ), false ); @@ -235,6 +238,8 @@ var Reveal = (function(){ * * @param {Object} event */ + var touchStart = {} + var gesture = false; function onDocumentTouchStart( event ) { // We're only interested in one point taps if (event.touches.length === 1) { @@ -245,34 +250,66 @@ var Reveal = (function(){ event.preventDefault(); - var point = { + touchStart = { x: event.touches[0].clientX, y: event.touches[0].clientY }; + slide(); + } + } + + function onDocumentTouchMove( event ) { + + event.preventDefault(); + + if(!gesture) { + var touch = { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + if((touch.x - touchStart.x) > config.swipeDistance){ + gesture = true; + navigateLeft(); + } else if((touch.x - touchStart.x) < -config.swipeDistance){ + gesture = true; + navigateRight(); + } else if((touch.y - touchStart.y) > config.swipeDistance){ + gesture = true; + navigateUp(); + } else if((touch.y - touchStart.y) < -config.swipeDistance){ + gesture = true; + navigateDown(); + } + } + } + function onDocumentTouchEnd( event ) { + + event.preventDefault(); + + if(!gesture){//only check for control tap if no gesture is performed + // Define the extent of the areas that may be tapped // to navigate var wt = window.innerWidth * 0.3; var ht = window.innerHeight * 0.3; - if( point.x < wt ) { + if( touchStart.x < wt ) { navigateLeft(); } - else if( point.x > window.innerWidth - wt ) { + else if( touchStart.x > window.innerWidth - wt ) { navigateRight(); } - else if( point.y < ht ) { + else if( touchStart.y < ht ) { navigateUp(); } - else if( point.y > window.innerHeight - ht ) { + else if( touchStart.y > window.innerHeight - ht ) { navigateDown(); } - - slide(); } + gesture = false; } - /** * Handles mouse wheel scrolling, throttled to avoid * skipping multiple slides. From 049880dba3062bd8ecb91ad0bd4fd0543d03a2dd Mon Sep 17 00:00:00 2001 From: akiersky Date: Wed, 30 May 2012 11:11:34 -0300 Subject: [PATCH 2/5] fixed bug in swipe gesture interacting with links. --- js/reveal.js | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 7da99357..0debffd2 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -26,7 +26,7 @@ var Reveal = (function(){ rollingLinks: true, transition: 'default', theme: 'default', - swipeDistance: 30 + swipeDist: 30 }, // Slides may hold a data-state attribute which we pick up and apply @@ -241,22 +241,15 @@ var Reveal = (function(){ var touchStart = {} var gesture = false; function onDocumentTouchStart( event ) { - // We're only interested in one point taps - if (event.touches.length === 1) { - // Never prevent taps on anchors and images - if( event.target.tagName.toLowerCase() === 'a' || event.target.tagName.toLowerCase() === 'img' ) { - return; + + touchStart = { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + if( event.target.tagName.toLowerCase() === 'a' || event.target.tagName.toLowerCase() === 'img' ) { + } else { + event.preventDefault(); } - - event.preventDefault(); - - touchStart = { - x: event.touches[0].clientX, - y: event.touches[0].clientY - }; - - slide(); - } } function onDocumentTouchMove( event ) { @@ -268,27 +261,28 @@ var Reveal = (function(){ x: event.touches[0].clientX, y: event.touches[0].clientY }; - if((touch.x - touchStart.x) > config.swipeDistance){ + if((touch.x - touchStart.x) > config.swipeDist){ gesture = true; navigateLeft(); - } else if((touch.x - touchStart.x) < -config.swipeDistance){ + } else if((touch.x - touchStart.x) < -config.swipeDist){ gesture = true; navigateRight(); - } else if((touch.y - touchStart.y) > config.swipeDistance){ + } else if((touch.y - touchStart.y) > config.swipeDist){ gesture = true; navigateUp(); - } else if((touch.y - touchStart.y) < -config.swipeDistance){ + } else if((touch.y - touchStart.y) < -config.swipeDist){ gesture = true; navigateDown(); } } } function onDocumentTouchEnd( event ) { - - event.preventDefault(); - - if(!gesture){//only check for control tap if no gesture is performed - + if(!gesture){ + // Never prevent taps on anchors and images + if( event.target.tagName.toLowerCase() === 'a' || event.target.tagName.toLowerCase() === 'img' ) { + return; + } + // Define the extent of the areas that may be tapped // to navigate var wt = window.innerWidth * 0.3; @@ -308,6 +302,7 @@ var Reveal = (function(){ } } gesture = false; + event.preventDefault(); } /** From 8554050933818ec2059c91cc99549f956aa8446d Mon Sep 17 00:00:00 2001 From: akiersky Date: Wed, 30 May 2012 11:13:19 -0300 Subject: [PATCH 3/5] updated min.js to match --- js/reveal.min.js | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/js/reveal.min.js b/js/reveal.min.js index 675ddd58..bf14305a 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -5,47 +5,4 @@ * * Copyright (C) 2012 Hakim El Hattab, http://hakim.se */ -var Reveal=(function(){var j="#reveal .slides>section",a="#reveal .slides>section.present>section",e=!!("ontouchstart" in window),k=0,c=0,G={controls:false,progress:false,history:false,loop:false,mouseWheel:true,rollingLinks:true,transition:"default",theme:"default"},N=[],d={},H=document.body.style.perspectiveProperty!==undefined||document.body.style.WebkitPerspective!==undefined||document.body.style.MozPerspective!==undefined||document.body.style.msPerspective!==undefined||document.body.style.OPerspective!==undefined,l=document.body.style.transformProperty!==undefined||document.body.style.WebkitTransform!==undefined||document.body.style.MozTransform!==undefined||document.body.style.msTransform!==undefined||document.body.style.OTransform!==undefined,v=0,y=0; -function h(P){if(!l&&!H){document.body.setAttribute("class","no-transforms");return;}d.wrapper=document.querySelector("#reveal");d.progress=document.querySelector("#reveal .progress"); -d.progressbar=document.querySelector("#reveal .progress span");d.controls=document.querySelector("#reveal .controls");d.controlsLeft=document.querySelector("#reveal .controls .left"); -d.controlsRight=document.querySelector("#reveal .controls .right");d.controlsUp=document.querySelector("#reveal .controls .up");d.controlsDown=document.querySelector("#reveal .controls .down"); -document.addEventListener("keydown",M,false);document.addEventListener("touchstart",w,false);window.addEventListener("hashchange",t,false);d.controlsLeft.addEventListener("click",n(x),false); -d.controlsRight.addEventListener("click",n(i),false);d.controlsUp.addEventListener("click",n(r),false);d.controlsDown.addEventListener("click",n(A),false); -q(G,P);if(H===false){G.transition="linear";}if(G.controls){d.controls.style.display="block";}if(G.progress){d.progress.style.display="block";}if(G.transition!=="default"){d.wrapper.classList.add(G.transition); -}if(G.theme!=="default"){d.wrapper.classList.add(G.theme);}if(G.mouseWheel){document.addEventListener("DOMMouseScroll",m,false);document.addEventListener("mousewheel",m,false); -}if(G.rollingLinks){D();}C();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll";document.body.style.height="120%"; -window.addEventListener("load",K,false);window.addEventListener("orientationchange",K,false);}}function q(Q,P){for(var R in P){Q[R]=P[R];}}function n(P){return function(Q){Q.preventDefault(); -P.call();};}function K(){setTimeout(function(){window.scrollTo(0,1);},0);}function M(Q){if(Q.target.contentEditable!="inherit"||Q.shiftKey||Q.altKey||Q.ctrlKey||Q.metaKey){return; -}var P=false;switch(Q.keyCode){case 80:case 33:I();P=true;break;case 78:case 34:u();P=true;break;case 72:case 37:x();P=true;break;case 76:case 39:i();P=true; -break;case 75:case 38:r();P=true;break;case 74:case 40:A();P=true;break;case 36:E(0);P=true;break;case 35:E(Number.MAX_VALUE);P=true;break;case 32:J()?L():u(); -P=true;break;case 13:if(J()){L();P=true;}break;}if(P){Q.preventDefault();}else{if(Q.keyCode===27&&H){if(J()){L();}else{B();}Q.preventDefault();}}}function w(S){if(S.touches.length===1){if(S.target.tagName.toLowerCase()==="a"||S.target.tagName.toLowerCase()==="img"){return; -}S.preventDefault();var Q={x:S.touches[0].clientX,y:S.touches[0].clientY};var P=window.innerWidth*0.3;var R=window.innerHeight*0.3;if(Q.xwindow.innerWidth-P){i(); -}else{if(Q.ywindow.innerHeight-R){A();}}}}b();}}function m(P){clearTimeout(v);v=setTimeout(function(){var Q=P.detail||-P.wheelDelta; -if(Q>0){u();}else{I();}},100);}function t(P){C();}function D(){if(H){var Q=document.querySelectorAll("#reveal .slides section a:not(.image)");for(var R=0,P=Q.length; -R'+S.innerHTML+""; -}}}}function B(){d.wrapper.classList.add("overview");var P=Array.prototype.slice.call(document.querySelectorAll(j));for(var U=0,S=P.length;U3?"none":"block"; -}U[T].classList.remove("past");U[T].classList.remove("present");U[T].classList.remove("future");if(TS){U[T].classList.add("future"); -}}if(P.querySelector("section")){U[T].classList.add("stack");}}U[S].classList.add("present");var R=U[S].getAttribute("data-state");if(R){N=N.concat(R.split(" ")); -}}else{S=0;}return S;}function b(){var S=N.concat();N.length=0;k=O(j,k);c=O(a,c);stateLoop:for(var R=0,P=N.length;R0,right:k0,down:c0||c>0){P+=k; -}if(c>0){P+="/"+c;}window.location.hash=P;}}function o(Q,P){var R=document.createEvent("HTMLEvents",1,2);R.initEvent(Q,true,true);q(R,P);d.wrapper.dispatchEvent(R); -}function s(){if(document.querySelector(a+".present")){var Q=document.querySelectorAll(a+".present .fragment:not(.visible)");if(Q.length){Q[0].classList.add("visible"); -return true;}}else{var P=document.querySelectorAll(j+".present .fragment:not(.visible)");if(P.length){P[0].classList.add("visible");return true;}}return false; -}function F(){if(document.querySelector(a+".present")){var Q=document.querySelectorAll(a+".present .fragment.visible");if(Q.length){Q[Q.length-1].classList.remove("visible"); -return true;}}else{var P=document.querySelectorAll(j+".present .fragment.visible");if(P.length){P[P.length-1].classList.remove("visible");return true;}}return false; -}function E(Q,P){k=Q===undefined?k:Q;c=P===undefined?c:P;b();}function x(){if(J()||F()===false){k--;c=0;b();}}function i(){if(J()||s()===false){k++;c=0; -b();}}function r(){if(J()||F()===false){c--;b();}}function A(){if(J()||s()===false){c++;b();}}function I(){if(F()===false){if(f().up){r();}else{var P=document.querySelector("#reveal .slides>section.past:nth-child("+k+")"); -if(P){c=(P.querySelectorAll("section").length+1)||0;k--;b();}}}}function u(){if(s()===false){f().down?A():i();}}return{initialize:h,navigateTo:E,navigateLeft:x,navigateRight:i,navigateUp:r,navigateDown:A,addEventListener:function(Q,R,P){(d.wrapper||document.querySelector("#reveal")).addEventListener(Q,R,P); -},removeEventListener:function(Q,R,P){(d.wrapper||document.querySelector("#reveal")).removeEventListener(Q,R,P);}};})(); \ No newline at end of file +var Reveal=(function(){var HORIZONTAL_SLIDES_SELECTOR='#reveal .slides>section',VERTICAL_SLIDES_SELECTOR='#reveal .slides>section.present>section',IS_TOUCH_DEVICE=!!('ontouchstart'in window),indexh=0,indexv=0,config={controls:false,progress:false,history:false,loop:false,mouseWheel:true,rollingLinks:true,transition:'default',theme:'default',swipeDist:30},state=[],dom={},supports3DTransforms=document.body.style['perspectiveProperty']!==undefined||document.body.style['WebkitPerspective']!==undefined||document.body.style['MozPerspective']!==undefined||document.body.style['msPerspective']!==undefined||document.body.style['OPerspective']!==undefined,supports2DTransforms=document.body.style['transformProperty']!==undefined||document.body.style['WebkitTransform']!==undefined||document.body.style['MozTransform']!==undefined||document.body.style['msTransform']!==undefined||document.body.style['OTransform']!==undefined,mouseWheelTimeout=0,writeURLTimeout=0;function initialize(options){if(!supports2DTransforms&&!supports3DTransforms){document.body.setAttribute('class','no-transforms');return;}dom.wrapper=document.querySelector('#reveal');dom.progress=document.querySelector('#reveal .progress');dom.progressbar=document.querySelector('#reveal .progress span');dom.controls=document.querySelector('#reveal .controls');dom.controlsLeft=document.querySelector('#reveal .controls .left');dom.controlsRight=document.querySelector('#reveal .controls .right');dom.controlsUp=document.querySelector('#reveal .controls .up');dom.controlsDown=document.querySelector('#reveal .controls .down');document.addEventListener('keydown',onDocumentKeyDown,false);document.addEventListener('touchstart',onDocumentTouchStart,false);document.addEventListener('touchmove',onDocumentTouchMove,false);document.addEventListener('touchend',onDocumentTouchEnd,false);window.addEventListener('hashchange',onWindowHashChange,false);dom.controlsLeft.addEventListener('click',preventAndForward(navigateLeft),false);dom.controlsRight.addEventListener('click',preventAndForward(navigateRight),false);dom.controlsUp.addEventListener('click',preventAndForward(navigateUp),false);dom.controlsDown.addEventListener('click',preventAndForward(navigateDown),false);extend(config,options);if(supports3DTransforms===false){config.transition='linear';}if(config.controls){dom.controls.style.display='block';}if(config.progress){dom.progress.style.display='block';}if(config.transition!=='default'){dom.wrapper.classList.add(config.transition);}if(config.theme!=='default'){dom.wrapper.classList.add(config.theme);}if(config.mouseWheel){document.addEventListener('DOMMouseScroll',onDocumentMouseScroll,false);document.addEventListener('mousewheel',onDocumentMouseScroll,false);}if(config.rollingLinks){linkify();}readURL();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow='scroll';document.body.style.height='120%';window.addEventListener('load',removeAddressBar,false);window.addEventListener('orientationchange',removeAddressBar,false);}}function extend(a,b){for(var i in b){a[i]=b[i];}}function preventAndForward(delegate){return function(event){event.preventDefault();delegate.call();}}function removeAddressBar(){setTimeout(function(){window.scrollTo(0,1);},0);}function onDocumentKeyDown(event){if(event.target.contentEditable!='inherit'||event.shiftKey||event.altKey||event.ctrlKey||event.metaKey)return;var triggered=false;switch(event.keyCode){case 80:case 33:navigatePrev();triggered=true;break;case 78:case 34:navigateNext();triggered=true;break;case 72:case 37:navigateLeft();triggered=true;break;case 76:case 39:navigateRight();triggered=true;break;case 75:case 38:navigateUp();triggered=true;break;case 74:case 40:navigateDown();triggered=true;break;case 36:navigateTo(0);triggered=true;break;case 35:navigateTo(Number.MAX_VALUE);triggered=true;break;case 32:overviewIsActive()?deactivateOverview():navigateNext();triggered=true;break;case 13:if(overviewIsActive()){deactivateOverview();triggered=true;}break;}if(triggered){event.preventDefault();}else if(event.keyCode===27&&supports3DTransforms){if(overviewIsActive()){deactivateOverview();}else{activateOverview();}event.preventDefault();}}var touchStart={}var gesture=false;function onDocumentTouchStart(event){touchStart={x:event.touches[0].clientX,y:event.touches[0].clientY};if(event.target.tagName.toLowerCase()==='a'||event.target.tagName.toLowerCase()==='img'){}else{event.preventDefault();}}function onDocumentTouchMove(event){event.preventDefault();if(!gesture){var touch={x:event.touches[0].clientX,y:event.touches[0].clientY};if((touch.x-touchStart.x)>config.swipeDist){gesture=true;navigateLeft();}else if((touch.x-touchStart.x)<-config.swipeDist){gesture=true;navigateRight();}else if((touch.y-touchStart.y)>config.swipeDist){gesture=true;navigateUp();}else if((touch.y-touchStart.y)<-config.swipeDist){gesture=true;navigateDown();}}}function onDocumentTouchEnd(event){if(!gesture){if(event.target.tagName.toLowerCase()==='a'||event.target.tagName.toLowerCase()==='img'){return;}var wt=window.innerWidth*0.3;var ht=window.innerHeight*0.3;if(touchStart.xwindow.innerWidth-wt){navigateRight();}else if(touchStart.ywindow.innerHeight-ht){navigateDown();}}gesture=false;event.preventDefault();}function onDocumentMouseScroll(event){clearTimeout(mouseWheelTimeout);mouseWheelTimeout=setTimeout(function(){var delta=event.detail||-event.wheelDelta;if(delta>0){navigateNext();}else{navigatePrev();}},100);}function onWindowHashChange(event){readURL();}function linkify(){if(supports3DTransforms){var nodes=document.querySelectorAll('#reveal .slides section a:not(.image)');for(var i=0,len=nodes.length;i'+node.innerHTML+'';}};}}function activateOverview(){dom.wrapper.classList.add('overview');var horizontalSlides=Array.prototype.slice.call(document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR));for(var i=0,len1=horizontalSlides.length;i3?'none':'block';}slides[i].classList.remove('past');slides[i].classList.remove('present');slides[i].classList.remove('future');if(iindex){slides[i].classList.add('future');}if(slide.querySelector('section')){slides[i].classList.add('stack');}}slides[index].classList.add('present');var slideState=slides[index].getAttribute('data-state');if(slideState){state=state.concat(slideState.split(' '));}}else{index=0;}return index;}function slide(){var stateBefore=state.concat();state.length=0;indexh=updateSlides(HORIZONTAL_SLIDES_SELECTOR,indexh);indexv=updateSlides(VERTICAL_SLIDES_SELECTOR,indexv);stateLoop:for(var i=0,len=state.length;i0,right:indexh0,down:indexv0||indexv>0)url+=indexh;if(indexv>0)url+='/'+indexv;window.location.hash=url;}}function dispatchEvent(type,properties){var event=document.createEvent("HTMLEvents",1,2);event.initEvent(type,true,true);extend(event,properties);dom.wrapper.dispatchEvent(event);}function nextFragment(){if(document.querySelector(VERTICAL_SLIDES_SELECTOR+'.present')){var verticalFragments=document.querySelectorAll(VERTICAL_SLIDES_SELECTOR+'.present .fragment:not(.visible)');if(verticalFragments.length){verticalFragments[0].classList.add('visible');return true;}}else{var horizontalFragments=document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR+'.present .fragment:not(.visible)');if(horizontalFragments.length){horizontalFragments[0].classList.add('visible');return true;}}return false;}function previousFragment(){if(document.querySelector(VERTICAL_SLIDES_SELECTOR+'.present')){var verticalFragments=document.querySelectorAll(VERTICAL_SLIDES_SELECTOR+'.present .fragment.visible');if(verticalFragments.length){verticalFragments[verticalFragments.length-1].classList.remove('visible');return true;}}else{var horizontalFragments=document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR+'.present .fragment.visible');if(horizontalFragments.length){horizontalFragments[horizontalFragments.length-1].classList.remove('visible');return true;}}return false;}function navigateTo(h,v){indexh=h===undefined?indexh:h;indexv=v===undefined?indexv:v;slide();}function navigateLeft(){if(overviewIsActive()||previousFragment()===false){indexh--;indexv=0;slide();}}function navigateRight(){if(overviewIsActive()||nextFragment()===false){indexh++;indexv=0;slide();}}function navigateUp(){if(overviewIsActive()||previousFragment()===false){indexv--;slide();}}function navigateDown(){if(overviewIsActive()||nextFragment()===false){indexv++;slide();}}function navigatePrev(){if(previousFragment()===false){if(availableRoutes().up){navigateUp();}else{var previousSlide=document.querySelector('#reveal .slides>section.past:nth-child('+indexh+')');if(previousSlide){indexv=(previousSlide.querySelectorAll('section').length+1)||0;indexh--;slide();}}}}function navigateNext(){if(nextFragment()===false){availableRoutes().down?navigateDown():navigateRight();}}return{initialize:initialize,navigateTo:navigateTo,navigateLeft:navigateLeft,navigateRight:navigateRight,navigateUp:navigateUp,navigateDown:navigateDown,addEventListener:function(type,listener,useCapture){(dom.wrapper||document.querySelector('#reveal')).addEventListener(type,listener,useCapture);},removeEventListener:function(type,listener,useCapture){(dom.wrapper||document.querySelector('#reveal')).removeEventListener(type,listener,useCapture);}};})(); \ No newline at end of file From 6053fe5a97ac6dedee63157801bb0d3590460e3f Mon Sep 17 00:00:00 2001 From: Aaron Kiersky Date: Fri, 1 Jun 2012 13:31:01 -0400 Subject: [PATCH 4/5] added some public access methods Added overview toggle to allow for button-based overview toggling Added add/removeEvents methods to allow for adding& removing event listeners that may interfere with other libs. --- js/reveal.js | 61 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 0debffd2..a4881e00 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -26,7 +26,7 @@ var Reveal = (function(){ rollingLinks: true, transition: 'default', theme: 'default', - swipeDist: 30 + swipeDist: 40 }, // Slides may hold a data-state attribute which we pick up and apply @@ -55,6 +55,8 @@ var Reveal = (function(){ // Delays updates to the URL due to a Chrome thumbnailer bug writeURLTimeout = 0; + + /** * Starts up the slideshow by applying configuration @@ -80,16 +82,7 @@ var Reveal = (function(){ dom.controlsUp = document.querySelector( '#reveal .controls .up' ); dom.controlsDown = document.querySelector( '#reveal .controls .down' ); - // Bind all view events - document.addEventListener( 'keydown', onDocumentKeyDown, false ); - document.addEventListener( 'touchstart', onDocumentTouchStart, false ); - document.addEventListener( 'touchmove', onDocumentTouchMove, false ); - document.addEventListener( 'touchend', onDocumentTouchEnd, false ); - window.addEventListener( 'hashchange', onWindowHashChange, false ); - dom.controlsLeft.addEventListener( 'click', preventAndForward( navigateLeft ), false ); - dom.controlsRight.addEventListener( 'click', preventAndForward( navigateRight ), false ); - dom.controlsUp.addEventListener( 'click', preventAndForward( navigateUp ), false ); - dom.controlsDown.addEventListener( 'click', preventAndForward( navigateDown ), false ); + addEvents(); // Copy options over to our config object extend( config, options ); @@ -138,8 +131,34 @@ var Reveal = (function(){ window.addEventListener( 'load', removeAddressBar, false ); window.addEventListener( 'orientationchange', removeAddressBar, false ); } + + } + function addEvents() { + // Bind all view events + document.addEventListener( 'keydown', onDocumentKeyDown, false ); + document.addEventListener( 'touchstart', onDocumentTouchStart, false ); + document.addEventListener( 'touchmove', onDocumentTouchMove, false ); + document.addEventListener( 'touchend', onDocumentTouchEnd, false ); + window.addEventListener( 'hashchange', onWindowHashChange, false ); + + dom.controlsLeft.addEventListener( 'click', preventAndForward( navigateLeft ), false ); + dom.controlsRight.addEventListener( 'click', preventAndForward( navigateRight ), false ); + dom.controlsUp.addEventListener( 'click', preventAndForward( navigateUp ), false ); + dom.controlsDown.addEventListener( 'click', preventAndForward( navigateDown ), false ); + } + function removeEvents(){ + // Bind all view events + document.removeEventListener( 'keydown', onDocumentKeyDown, false ); + document.removeEventListener( 'touchstart', onDocumentTouchStart, false ); + document.removeEventListener( 'touchmove', onDocumentTouchMove, false ); + document.removeEventListener( 'touchend', onDocumentTouchEnd, false ); + window.removeEventListener( 'hashchange', onWindowHashChange, false ); + + dom.controlsLeft.removeEventListener( 'click', preventAndForward( navigateLeft ), false ); + dom.controlsRight.removeEventListener( 'click', preventAndForward( navigateRight ), false ); + dom.controlsUp.removeEventListener( 'click', preventAndForward( navigateUp ), false ); + dom.controlsDown.removeEventListener( 'click', preventAndForward( navigateDown ), false ); } - /** * Extend object a with the properties of object b. * If there's a conflict, object b takes precedence. @@ -227,7 +246,6 @@ var Reveal = (function(){ } } - /** * Handler for the document level 'touchstart' event. * @@ -358,6 +376,7 @@ var Reveal = (function(){ * can't be improved. */ function activateOverview() { + dom.wrapper.classList.add( 'overview' ); var horizontalSlides = Array.prototype.slice.call( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); @@ -373,12 +392,12 @@ var Reveal = (function(){ hslide.style.msTransform = htransform; hslide.style.OTransform = htransform; hslide.style.transform = htransform; - + if( !hslide.classList.contains( 'stack' ) ) { // Navigate to this slide on click hslide.addEventListener( 'click', onOverviewSlideClicked, true ); } - + var verticalSlides = Array.prototype.slice.call( hslide.querySelectorAll( 'section' ) ); for( var j = 0, len2 = verticalSlides.length; j < len2; j++ ) { @@ -397,6 +416,7 @@ var Reveal = (function(){ // Navigate to this slide on click vslide.addEventListener( 'click', onOverviewSlideClicked, true ); } + } } @@ -806,6 +826,14 @@ var Reveal = (function(){ availableRoutes().down ? navigateDown() : navigateRight(); } } + function overviewToggle (){ + if( overviewIsActive() ) { + deactivateOverview(); + } + else { + activateOverview(); + } + } // Expose some methods publicly return { @@ -815,6 +843,9 @@ var Reveal = (function(){ navigateRight: navigateRight, navigateUp: navigateUp, navigateDown: navigateDown, + overviewToggle: overviewToggle, + addEvents: addEvents, + removeEvents: removeEvents, // Forward event binding to the reveal DOM element addEventListener: function( type, listener, useCapture ) { From aa8e27252da5002aaed90af20898f4bfdbbfd274 Mon Sep 17 00:00:00 2001 From: Aaron Kiersky Date: Fri, 1 Jun 2012 13:33:10 -0400 Subject: [PATCH 5/5] minified! --- js/reveal.min.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/js/reveal.min.js b/js/reveal.min.js index bf14305a..7977da4a 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -1,8 +1,7 @@ /*! - * reveal.js 1.3 - * http://lab.hakim.se/reveal-js - * MIT licensed - * - * Copyright (C) 2012 Hakim El Hattab, http://hakim.se - */ -var Reveal=(function(){var HORIZONTAL_SLIDES_SELECTOR='#reveal .slides>section',VERTICAL_SLIDES_SELECTOR='#reveal .slides>section.present>section',IS_TOUCH_DEVICE=!!('ontouchstart'in window),indexh=0,indexv=0,config={controls:false,progress:false,history:false,loop:false,mouseWheel:true,rollingLinks:true,transition:'default',theme:'default',swipeDist:30},state=[],dom={},supports3DTransforms=document.body.style['perspectiveProperty']!==undefined||document.body.style['WebkitPerspective']!==undefined||document.body.style['MozPerspective']!==undefined||document.body.style['msPerspective']!==undefined||document.body.style['OPerspective']!==undefined,supports2DTransforms=document.body.style['transformProperty']!==undefined||document.body.style['WebkitTransform']!==undefined||document.body.style['MozTransform']!==undefined||document.body.style['msTransform']!==undefined||document.body.style['OTransform']!==undefined,mouseWheelTimeout=0,writeURLTimeout=0;function initialize(options){if(!supports2DTransforms&&!supports3DTransforms){document.body.setAttribute('class','no-transforms');return;}dom.wrapper=document.querySelector('#reveal');dom.progress=document.querySelector('#reveal .progress');dom.progressbar=document.querySelector('#reveal .progress span');dom.controls=document.querySelector('#reveal .controls');dom.controlsLeft=document.querySelector('#reveal .controls .left');dom.controlsRight=document.querySelector('#reveal .controls .right');dom.controlsUp=document.querySelector('#reveal .controls .up');dom.controlsDown=document.querySelector('#reveal .controls .down');document.addEventListener('keydown',onDocumentKeyDown,false);document.addEventListener('touchstart',onDocumentTouchStart,false);document.addEventListener('touchmove',onDocumentTouchMove,false);document.addEventListener('touchend',onDocumentTouchEnd,false);window.addEventListener('hashchange',onWindowHashChange,false);dom.controlsLeft.addEventListener('click',preventAndForward(navigateLeft),false);dom.controlsRight.addEventListener('click',preventAndForward(navigateRight),false);dom.controlsUp.addEventListener('click',preventAndForward(navigateUp),false);dom.controlsDown.addEventListener('click',preventAndForward(navigateDown),false);extend(config,options);if(supports3DTransforms===false){config.transition='linear';}if(config.controls){dom.controls.style.display='block';}if(config.progress){dom.progress.style.display='block';}if(config.transition!=='default'){dom.wrapper.classList.add(config.transition);}if(config.theme!=='default'){dom.wrapper.classList.add(config.theme);}if(config.mouseWheel){document.addEventListener('DOMMouseScroll',onDocumentMouseScroll,false);document.addEventListener('mousewheel',onDocumentMouseScroll,false);}if(config.rollingLinks){linkify();}readURL();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow='scroll';document.body.style.height='120%';window.addEventListener('load',removeAddressBar,false);window.addEventListener('orientationchange',removeAddressBar,false);}}function extend(a,b){for(var i in b){a[i]=b[i];}}function preventAndForward(delegate){return function(event){event.preventDefault();delegate.call();}}function removeAddressBar(){setTimeout(function(){window.scrollTo(0,1);},0);}function onDocumentKeyDown(event){if(event.target.contentEditable!='inherit'||event.shiftKey||event.altKey||event.ctrlKey||event.metaKey)return;var triggered=false;switch(event.keyCode){case 80:case 33:navigatePrev();triggered=true;break;case 78:case 34:navigateNext();triggered=true;break;case 72:case 37:navigateLeft();triggered=true;break;case 76:case 39:navigateRight();triggered=true;break;case 75:case 38:navigateUp();triggered=true;break;case 74:case 40:navigateDown();triggered=true;break;case 36:navigateTo(0);triggered=true;break;case 35:navigateTo(Number.MAX_VALUE);triggered=true;break;case 32:overviewIsActive()?deactivateOverview():navigateNext();triggered=true;break;case 13:if(overviewIsActive()){deactivateOverview();triggered=true;}break;}if(triggered){event.preventDefault();}else if(event.keyCode===27&&supports3DTransforms){if(overviewIsActive()){deactivateOverview();}else{activateOverview();}event.preventDefault();}}var touchStart={}var gesture=false;function onDocumentTouchStart(event){touchStart={x:event.touches[0].clientX,y:event.touches[0].clientY};if(event.target.tagName.toLowerCase()==='a'||event.target.tagName.toLowerCase()==='img'){}else{event.preventDefault();}}function onDocumentTouchMove(event){event.preventDefault();if(!gesture){var touch={x:event.touches[0].clientX,y:event.touches[0].clientY};if((touch.x-touchStart.x)>config.swipeDist){gesture=true;navigateLeft();}else if((touch.x-touchStart.x)<-config.swipeDist){gesture=true;navigateRight();}else if((touch.y-touchStart.y)>config.swipeDist){gesture=true;navigateUp();}else if((touch.y-touchStart.y)<-config.swipeDist){gesture=true;navigateDown();}}}function onDocumentTouchEnd(event){if(!gesture){if(event.target.tagName.toLowerCase()==='a'||event.target.tagName.toLowerCase()==='img'){return;}var wt=window.innerWidth*0.3;var ht=window.innerHeight*0.3;if(touchStart.xwindow.innerWidth-wt){navigateRight();}else if(touchStart.ywindow.innerHeight-ht){navigateDown();}}gesture=false;event.preventDefault();}function onDocumentMouseScroll(event){clearTimeout(mouseWheelTimeout);mouseWheelTimeout=setTimeout(function(){var delta=event.detail||-event.wheelDelta;if(delta>0){navigateNext();}else{navigatePrev();}},100);}function onWindowHashChange(event){readURL();}function linkify(){if(supports3DTransforms){var nodes=document.querySelectorAll('#reveal .slides section a:not(.image)');for(var i=0,len=nodes.length;i'+node.innerHTML+'';}};}}function activateOverview(){dom.wrapper.classList.add('overview');var horizontalSlides=Array.prototype.slice.call(document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR));for(var i=0,len1=horizontalSlides.length;i3?'none':'block';}slides[i].classList.remove('past');slides[i].classList.remove('present');slides[i].classList.remove('future');if(iindex){slides[i].classList.add('future');}if(slide.querySelector('section')){slides[i].classList.add('stack');}}slides[index].classList.add('present');var slideState=slides[index].getAttribute('data-state');if(slideState){state=state.concat(slideState.split(' '));}}else{index=0;}return index;}function slide(){var stateBefore=state.concat();state.length=0;indexh=updateSlides(HORIZONTAL_SLIDES_SELECTOR,indexh);indexv=updateSlides(VERTICAL_SLIDES_SELECTOR,indexv);stateLoop:for(var i=0,len=state.length;i0,right:indexh0,down:indexv0||indexv>0)url+=indexh;if(indexv>0)url+='/'+indexv;window.location.hash=url;}}function dispatchEvent(type,properties){var event=document.createEvent("HTMLEvents",1,2);event.initEvent(type,true,true);extend(event,properties);dom.wrapper.dispatchEvent(event);}function nextFragment(){if(document.querySelector(VERTICAL_SLIDES_SELECTOR+'.present')){var verticalFragments=document.querySelectorAll(VERTICAL_SLIDES_SELECTOR+'.present .fragment:not(.visible)');if(verticalFragments.length){verticalFragments[0].classList.add('visible');return true;}}else{var horizontalFragments=document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR+'.present .fragment:not(.visible)');if(horizontalFragments.length){horizontalFragments[0].classList.add('visible');return true;}}return false;}function previousFragment(){if(document.querySelector(VERTICAL_SLIDES_SELECTOR+'.present')){var verticalFragments=document.querySelectorAll(VERTICAL_SLIDES_SELECTOR+'.present .fragment.visible');if(verticalFragments.length){verticalFragments[verticalFragments.length-1].classList.remove('visible');return true;}}else{var horizontalFragments=document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR+'.present .fragment.visible');if(horizontalFragments.length){horizontalFragments[horizontalFragments.length-1].classList.remove('visible');return true;}}return false;}function navigateTo(h,v){indexh=h===undefined?indexh:h;indexv=v===undefined?indexv:v;slide();}function navigateLeft(){if(overviewIsActive()||previousFragment()===false){indexh--;indexv=0;slide();}}function navigateRight(){if(overviewIsActive()||nextFragment()===false){indexh++;indexv=0;slide();}}function navigateUp(){if(overviewIsActive()||previousFragment()===false){indexv--;slide();}}function navigateDown(){if(overviewIsActive()||nextFragment()===false){indexv++;slide();}}function navigatePrev(){if(previousFragment()===false){if(availableRoutes().up){navigateUp();}else{var previousSlide=document.querySelector('#reveal .slides>section.past:nth-child('+indexh+')');if(previousSlide){indexv=(previousSlide.querySelectorAll('section').length+1)||0;indexh--;slide();}}}}function navigateNext(){if(nextFragment()===false){availableRoutes().down?navigateDown():navigateRight();}}return{initialize:initialize,navigateTo:navigateTo,navigateLeft:navigateLeft,navigateRight:navigateRight,navigateUp:navigateUp,navigateDown:navigateDown,addEventListener:function(type,listener,useCapture){(dom.wrapper||document.querySelector('#reveal')).addEventListener(type,listener,useCapture);},removeEventListener:function(type,listener,useCapture){(dom.wrapper||document.querySelector('#reveal')).removeEventListener(type,listener,useCapture);}};})(); \ No newline at end of file + reveal.js 1.3 + http://lab.hakim.se/reveal-js + MIT licensed + + Copyright (C) 2012 Hakim El Hattab, http://hakim.se + */var Reveal=(function(){var HORIZONTAL_SLIDES_SELECTOR='#reveal .slides>section',VERTICAL_SLIDES_SELECTOR='#reveal .slides>section.present>section',IS_TOUCH_DEVICE=!!('ontouchstart'in window),indexh=0,indexv=0,config={controls:false,progress:false,history:false,loop:false,mouseWheel:true,rollingLinks:true,transition:'default',theme:'default',swipeDist:40},state=[],dom={},supports3DTransforms=document.body.style['perspectiveProperty']!==undefined||document.body.style['WebkitPerspective']!==undefined||document.body.style['MozPerspective']!==undefined||document.body.style['msPerspective']!==undefined||document.body.style['OPerspective']!==undefined,supports2DTransforms=document.body.style['transformProperty']!==undefined||document.body.style['WebkitTransform']!==undefined||document.body.style['MozTransform']!==undefined||document.body.style['msTransform']!==undefined||document.body.style['OTransform']!==undefined,mouseWheelTimeout=0,writeURLTimeout=0;function initialize(options){if(!supports2DTransforms&&!supports3DTransforms){document.body.setAttribute('class','no-transforms');return;}dom.wrapper=document.querySelector('#reveal');dom.progress=document.querySelector('#reveal .progress');dom.progressbar=document.querySelector('#reveal .progress span');dom.controls=document.querySelector('#reveal .controls');dom.controlsLeft=document.querySelector('#reveal .controls .left');dom.controlsRight=document.querySelector('#reveal .controls .right');dom.controlsUp=document.querySelector('#reveal .controls .up');dom.controlsDown=document.querySelector('#reveal .controls .down');addEvents();extend(config,options);if(supports3DTransforms===false){config.transition='linear';}if(config.controls){dom.controls.style.display='block';}if(config.progress){dom.progress.style.display='block';}if(config.transition!=='default'){dom.wrapper.classList.add(config.transition);}if(config.theme!=='default'){dom.wrapper.classList.add(config.theme);}if(config.mouseWheel){document.addEventListener('DOMMouseScroll',onDocumentMouseScroll,false);document.addEventListener('mousewheel',onDocumentMouseScroll,false);}if(config.rollingLinks){linkify();}readURL();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow='scroll';document.body.style.height='120%';window.addEventListener('load',removeAddressBar,false);window.addEventListener('orientationchange',removeAddressBar,false);}}function addEvents(){document.addEventListener('keydown',onDocumentKeyDown,false);document.addEventListener('touchstart',onDocumentTouchStart,false);document.addEventListener('touchmove',onDocumentTouchMove,false);document.addEventListener('touchend',onDocumentTouchEnd,false);window.addEventListener('hashchange',onWindowHashChange,false);dom.controlsLeft.addEventListener('click',preventAndForward(navigateLeft),false);dom.controlsRight.addEventListener('click',preventAndForward(navigateRight),false);dom.controlsUp.addEventListener('click',preventAndForward(navigateUp),false);dom.controlsDown.addEventListener('click',preventAndForward(navigateDown),false);}function removeEvents(){document.removeEventListener('keydown',onDocumentKeyDown,false);document.removeEventListener('touchstart',onDocumentTouchStart,false);document.removeEventListener('touchmove',onDocumentTouchMove,false);document.removeEventListener('touchend',onDocumentTouchEnd,false);window.removeEventListener('hashchange',onWindowHashChange,false);dom.controlsLeft.removeEventListener('click',preventAndForward(navigateLeft),false);dom.controlsRight.removeEventListener('click',preventAndForward(navigateRight),false);dom.controlsUp.removeEventListener('click',preventAndForward(navigateUp),false);dom.controlsDown.removeEventListener('click',preventAndForward(navigateDown),false);}function extend(a,b){for(var i in b){a[i]=b[i];}}function preventAndForward(delegate){return function(event){event.preventDefault();delegate.call();}}function removeAddressBar(){setTimeout(function(){window.scrollTo(0,1);},0);}function onDocumentKeyDown(event){if(event.target.contentEditable!='inherit'||event.shiftKey||event.altKey||event.ctrlKey||event.metaKey)return;var triggered=false;switch(event.keyCode){case 80:case 33:navigatePrev();triggered=true;break;case 78:case 34:navigateNext();triggered=true;break;case 72:case 37:navigateLeft();triggered=true;break;case 76:case 39:navigateRight();triggered=true;break;case 75:case 38:navigateUp();triggered=true;break;case 74:case 40:navigateDown();triggered=true;break;case 36:navigateTo(0);triggered=true;break;case 35:navigateTo(Number.MAX_VALUE);triggered=true;break;case 32:overviewIsActive()?deactivateOverview():navigateNext();triggered=true;break;case 13:if(overviewIsActive()){deactivateOverview();triggered=true;}break;}if(triggered){event.preventDefault();}else if(event.keyCode===27&&supports3DTransforms){if(overviewIsActive()){deactivateOverview();}else{activateOverview();}event.preventDefault();}}var touchStart={}var gesture=false;function onDocumentTouchStart(event){touchStart={x:event.touches[0].clientX,y:event.touches[0].clientY};if(event.target.tagName.toLowerCase()==='a'||event.target.tagName.toLowerCase()==='img'){}else{event.preventDefault();}}function onDocumentTouchMove(event){event.preventDefault();if(!gesture){var touch={x:event.touches[0].clientX,y:event.touches[0].clientY};if((touch.x-touchStart.x)>config.swipeDist){gesture=true;navigateLeft();}else if((touch.x-touchStart.x)<-config.swipeDist){gesture=true;navigateRight();}else if((touch.y-touchStart.y)>config.swipeDist){gesture=true;navigateUp();}else if((touch.y-touchStart.y)<-config.swipeDist){gesture=true;navigateDown();}}}function onDocumentTouchEnd(event){if(!gesture){if(event.target.tagName.toLowerCase()==='a'||event.target.tagName.toLowerCase()==='img'){return;}var wt=window.innerWidth*0.3;var ht=window.innerHeight*0.3;if(touchStart.xwindow.innerWidth-wt){navigateRight();}else if(touchStart.ywindow.innerHeight-ht){navigateDown();}}gesture=false;event.preventDefault();}function onDocumentMouseScroll(event){clearTimeout(mouseWheelTimeout);mouseWheelTimeout=setTimeout(function(){var delta=event.detail||-event.wheelDelta;if(delta>0){navigateNext();}else{navigatePrev();}},100);}function onWindowHashChange(event){readURL();}function linkify(){if(supports3DTransforms){var nodes=document.querySelectorAll('#reveal .slides section a:not(.image)');for(var i=0,len=nodes.length;i'+node.innerHTML+'';}};}}function activateOverview(){dom.wrapper.classList.add('overview');var horizontalSlides=Array.prototype.slice.call(document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR));for(var i=0,len1=horizontalSlides.length;i3?'none':'block';}slides[i].classList.remove('past');slides[i].classList.remove('present');slides[i].classList.remove('future');if(iindex){slides[i].classList.add('future');}if(slide.querySelector('section')){slides[i].classList.add('stack');}}slides[index].classList.add('present');var slideState=slides[index].getAttribute('data-state');if(slideState){state=state.concat(slideState.split(' '));}}else{index=0;}return index;}function slide(){var stateBefore=state.concat();state.length=0;indexh=updateSlides(HORIZONTAL_SLIDES_SELECTOR,indexh);indexv=updateSlides(VERTICAL_SLIDES_SELECTOR,indexv);stateLoop:for(var i=0,len=state.length;i0,right:indexh0,down:indexv0||indexv>0)url+=indexh;if(indexv>0)url+='/'+indexv;window.location.hash=url;}}function dispatchEvent(type,properties){var event=document.createEvent("HTMLEvents",1,2);event.initEvent(type,true,true);extend(event,properties);dom.wrapper.dispatchEvent(event);}function nextFragment(){if(document.querySelector(VERTICAL_SLIDES_SELECTOR+'.present')){var verticalFragments=document.querySelectorAll(VERTICAL_SLIDES_SELECTOR+'.present .fragment:not(.visible)');if(verticalFragments.length){verticalFragments[0].classList.add('visible');return true;}}else{var horizontalFragments=document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR+'.present .fragment:not(.visible)');if(horizontalFragments.length){horizontalFragments[0].classList.add('visible');return true;}}return false;}function previousFragment(){if(document.querySelector(VERTICAL_SLIDES_SELECTOR+'.present')){var verticalFragments=document.querySelectorAll(VERTICAL_SLIDES_SELECTOR+'.present .fragment.visible');if(verticalFragments.length){verticalFragments[verticalFragments.length-1].classList.remove('visible');return true;}}else{var horizontalFragments=document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR+'.present .fragment.visible');if(horizontalFragments.length){horizontalFragments[horizontalFragments.length-1].classList.remove('visible');return true;}}return false;}function navigateTo(h,v){indexh=h===undefined?indexh:h;indexv=v===undefined?indexv:v;slide();}function navigateLeft(){if(overviewIsActive()||previousFragment()===false){indexh--;indexv=0;slide();}}function navigateRight(){if(overviewIsActive()||nextFragment()===false){indexh++;indexv=0;slide();}}function navigateUp(){if(overviewIsActive()||previousFragment()===false){indexv--;slide();}}function navigateDown(){if(overviewIsActive()||nextFragment()===false){indexv++;slide();}}function navigatePrev(){if(previousFragment()===false){if(availableRoutes().up){navigateUp();}else{var previousSlide=document.querySelector('#reveal .slides>section.past:nth-child('+indexh+')');if(previousSlide){indexv=(previousSlide.querySelectorAll('section').length+1)||0;indexh--;slide();}}}}function navigateNext(){if(nextFragment()===false){availableRoutes().down?navigateDown():navigateRight();}}function overviewToggle(){if(overviewIsActive()){deactivateOverview();}else{activateOverview();}}return{initialize:initialize,navigateTo:navigateTo,navigateLeft:navigateLeft,navigateRight:navigateRight,navigateUp:navigateUp,navigateDown:navigateDown,overviewToggle:overviewToggle,addEvents:addEvents,removeEvents:removeEvents,addEventListener:function(type,listener,useCapture){(dom.wrapper||document.querySelector('#reveal')).addEventListener(type,listener,useCapture);},removeEventListener:function(type,listener,useCapture){(dom.wrapper||document.querySelector('#reveal')).removeEventListener(type,listener,useCapture);}};})(); \ No newline at end of file