From eb0a8cfa95e9f5cfce01f7fd9cd1bf49744a29b8 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sat, 2 Jun 2012 18:37:18 -0400 Subject: [PATCH] api methods for adding/removing all event listeners (#48) --- js/reveal.js | 3 +++ js/reveal.min.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/js/reveal.js b/js/reveal.js index c51f87b9..c1f50b80 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -908,6 +908,9 @@ var Reveal = (function(){ navigateDown: navigateDown, toggleOverview: toggleOverview, + addEventListeners: addEventListeners, + removeEventListeners: removeEventListeners, + // Forward event binding to the reveal DOM element addEventListener: function( type, listener, useCapture ) { ( dom.wrapper || document.querySelector( '.reveal' ) ).addEventListener( type, listener, useCapture ); diff --git a/js/reveal.min.js b/js/reveal.min.js index 6cf8e841..37f6cbea 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -56,5 +56,5 @@ if(W.length){W[W.length-1].classList.remove("visible");o("fragmenthidden",{fragm if(V.length){V[V.length-1].classList.remove("visible");o("fragmenthidden",{fragment:V[0]});return true;}}return false;}function F(W,V){k=W===undefined?k:W; c=V===undefined?c:V;b();}function w(){if(O()||G()===false){k--;c=0;b();}}function i(){if(O()||s()===false){k++;c=0;b();}}function r(){if(O()||G()===false){c--; b();}}function A(){if(O()||s()===false){c++;b();}}function N(){if(G()===false){if(f().up){r();}else{var V=document.querySelector(".reveal .slides>section.past:nth-child("+k+")"); -if(V){c=(V.querySelectorAll("section").length+1)||0;k--;b();}}}}function u(){if(s()===false){f().down?A():i();}}function M(){if(O()){Q();}else{B();}}return{initialize:h,navigateTo:F,navigateLeft:w,navigateRight:i,navigateUp:r,navigateDown:A,toggleOverview:M,addEventListener:function(W,X,V){(d.wrapper||document.querySelector(".reveal")).addEventListener(W,X,V); +if(V){c=(V.querySelectorAll("section").length+1)||0;k--;b();}}}}function u(){if(s()===false){f().down?A():i();}}function M(){if(O()){Q();}else{B();}}return{initialize:h,navigateTo:F,navigateLeft:w,navigateRight:i,navigateUp:r,navigateDown:A,toggleOverview:M,addEventListeners:z,removeEventListeners:K,addEventListener:function(W,X,V){(d.wrapper||document.querySelector(".reveal")).addEventListener(W,X,V); },removeEventListener:function(W,X,V){(d.wrapper||document.querySelector(".reveal")).removeEventListener(W,X,V);}};})(); \ No newline at end of file