fix error with removal of control button and progress bar event listeners (closes #323)
This commit is contained in:
1 parent
d182235f1f
commit
9b830131f7
2 files changed
+29
-33
No files matched your search
+27
-31
@@ -404,17 +404,17 @@ var Reveal = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( config.progress && dom.progress ) {
|
if ( config.progress && dom.progress ) {
|
||||||
dom.progress.addEventListener( 'click', preventAndForward( onProgressClick ), false );
|
dom.progress.addEventListener( 'click', onProgressClicked, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( config.controls && dom.controls ) {
|
if ( config.controls && dom.controls ) {
|
||||||
var actionEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
|
var actionEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
|
||||||
dom.controlsLeft.forEach( function( el ) { el.addEventListener( actionEvent, preventAndForward( navigateLeft ), false ); } );
|
dom.controlsLeft.forEach( function( el ) { el.addEventListener( actionEvent, onNavigateLeftClicked, false ); } );
|
||||||
dom.controlsRight.forEach( function( el ) { el.addEventListener( actionEvent, preventAndForward( navigateRight ), false ); } );
|
dom.controlsRight.forEach( function( el ) { el.addEventListener( actionEvent, onNavigateRightClicked, false ); } );
|
||||||
dom.controlsUp.forEach( function( el ) { el.addEventListener( actionEvent, preventAndForward( navigateUp ), false ); } );
|
dom.controlsUp.forEach( function( el ) { el.addEventListener( actionEvent, onNavigateUpClicked, false ); } );
|
||||||
dom.controlsDown.forEach( function( el ) { el.addEventListener( actionEvent, preventAndForward( navigateDown ), false ); } );
|
dom.controlsDown.forEach( function( el ) { el.addEventListener( actionEvent, onNavigateDownClicked, false ); } );
|
||||||
dom.controlsPrev.forEach( function( el ) { el.addEventListener( actionEvent, preventAndForward( navigatePrev ), false ); } );
|
dom.controlsPrev.forEach( function( el ) { el.addEventListener( actionEvent, onNavigatePrevClicked, false ); } );
|
||||||
dom.controlsNext.forEach( function( el ) { el.addEventListener( actionEvent, preventAndForward( navigateNext ), false ); } );
|
dom.controlsNext.forEach( function( el ) { el.addEventListener( actionEvent, onNavigateNextClicked, false ); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -435,17 +435,17 @@ var Reveal = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( config.progress && dom.progress ) {
|
if ( config.progress && dom.progress ) {
|
||||||
dom.progress.removeEventListener( 'click', preventAndForward( onProgressClick ), false );
|
dom.progress.removeEventListener( 'click', onProgressClicked, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( config.controls && dom.controls ) {
|
if ( config.controls && dom.controls ) {
|
||||||
var actionEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
|
var actionEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
|
||||||
dom.controlsLeft.forEach( function( el ) { el.removeEventListener( actionEvent, preventAndForward( navigateLeft ), false ); } );
|
dom.controlsLeft.forEach( function( el ) { el.removeEventListener( actionEvent, onNavigateLeftClicked, false ); } );
|
||||||
dom.controlsRight.forEach( function( el ) { el.removeEventListener( actionEvent, preventAndForward( navigateRight ), false ); } );
|
dom.controlsRight.forEach( function( el ) { el.removeEventListener( actionEvent, onNavigateRightClicked, false ); } );
|
||||||
dom.controlsUp.forEach( function( el ) { el.removeEventListener( actionEvent, preventAndForward( navigateUp ), false ); } );
|
dom.controlsUp.forEach( function( el ) { el.removeEventListener( actionEvent, onNavigateUpClicked, false ); } );
|
||||||
dom.controlsDown.forEach( function( el ) { el.removeEventListener( actionEvent, preventAndForward( navigateDown ), false ); } );
|
dom.controlsDown.forEach( function( el ) { el.removeEventListener( actionEvent, onNavigateDownClicked, false ); } );
|
||||||
dom.controlsPrev.forEach( function( el ) { el.removeEventListener( actionEvent, preventAndForward( navigatePrev ), false ); } );
|
dom.controlsPrev.forEach( function( el ) { el.removeEventListener( actionEvent, onNavigatePrevClicked, false ); } );
|
||||||
dom.controlsNext.forEach( function( el ) { el.removeEventListener( actionEvent, preventAndForward( navigateNext ), false ); } );
|
dom.controlsNext.forEach( function( el ) { el.removeEventListener( actionEvent, onNavigateNextClicked, false ); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -487,22 +487,6 @@ var Reveal = (function(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Prevents an events defaults behavior calls the
|
|
||||||
* specified delegate.
|
|
||||||
*
|
|
||||||
* @param {Function} delegate The method to call
|
|
||||||
* after the wrapper has been executed
|
|
||||||
*/
|
|
||||||
function preventAndForward( delegate ) {
|
|
||||||
|
|
||||||
return function( event ) {
|
|
||||||
event.preventDefault();
|
|
||||||
delegate.call( null, event );
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Causes the address bar to hide on mobile devices,
|
* Causes the address bar to hide on mobile devices,
|
||||||
* more vertical space ftw.
|
* more vertical space ftw.
|
||||||
@@ -1733,7 +1717,9 @@ var Reveal = (function(){
|
|||||||
*
|
*
|
||||||
* ( clickX / presentationWidth ) * numberOfSlides
|
* ( clickX / presentationWidth ) * numberOfSlides
|
||||||
*/
|
*/
|
||||||
function onProgressClick( event ) {
|
function onProgressClicked( event ) {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
var slidesTotal = toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).length;
|
var slidesTotal = toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).length;
|
||||||
var slideIndex = Math.floor( ( event.clientX / dom.wrapper.offsetWidth ) * slidesTotal );
|
var slideIndex = Math.floor( ( event.clientX / dom.wrapper.offsetWidth ) * slidesTotal );
|
||||||
@@ -1742,6 +1728,16 @@ var Reveal = (function(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handles for navigation control buttons.
|
||||||
|
*/
|
||||||
|
function onNavigateLeftClicked( event ) { event.preventDefault(); navigateLeft(); }
|
||||||
|
function onNavigateRightClicked( event ) { event.preventDefault(); navigateRight(); }
|
||||||
|
function onNavigateUpClicked( event ) { event.preventDefault(); navigateUp(); }
|
||||||
|
function onNavigateDownClicked( event ) { event.preventDefault(); navigateDown(); }
|
||||||
|
function onNavigatePrevClicked( event ) { event.preventDefault(); navigatePrev(); }
|
||||||
|
function onNavigateNextClicked( event ) { event.preventDefault(); navigateNext(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for the window level 'hashchange' event.
|
* Handler for the window level 'hashchange' event.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
/*!
|
/*!
|
||||||
* reveal.js 2.3 (2013-02-03, 01:31)
|
* reveal.js 2.3 (2013-02-03, 01:59)
|
||||||
* http://lab.hakim.se/reveal-js
|
* http://lab.hakim.se/reveal-js
|
||||||
* MIT licensed
|
* MIT licensed
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
|
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
|
||||||
*/
|
*/
|
||||||
var Reveal=function(){"use strict";function E(e){if(!d&&!p){document.body.setAttribute("class","no-transforms");return}window.addEventListener("load",B,!1),A(i,e),x(),T()}function S(){h.theme=document.querySelector("#theme"),h.wrapper=document.querySelector(".reveal"),h.slides=document.querySelector(".reveal .slides");if(!h.wrapper.querySelector(".progress")&&i.progress){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="<span></span>",h.wrapper.appendChild(e)}if(!h.wrapper.querySelector(".controls")&&i.controls){var t=document.createElement("aside");t.classList.add("controls"),t.innerHTML='<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>',h.wrapper.appendChild(t)}if(!h.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),h.wrapper.appendChild(n)}if(!h.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),h.wrapper.appendChild(r)}h.progress=document.querySelector(".reveal .progress"),h.progressbar=document.querySelector(".reveal .progress span"),i.controls&&(h.controls=document.querySelector(".reveal .controls"),h.controlsLeft=O(document.querySelectorAll(".navigate-left")),h.controlsRight=O(document.querySelectorAll(".navigate-right")),h.controlsUp=O(document.querySelectorAll(".navigate-up")),h.controlsDown=O(document.querySelectorAll(".navigate-down")),h.controlsPrev=O(document.querySelectorAll(".navigate-prev")),h.controlsNext=O(document.querySelectorAll(".navigate-next")))}function x(){navigator.userAgent.match(/(iphone|ipod)/i)&&(window.addEventListener("load",D,!1),window.addEventListener("orientationchange",D,!1))}function T(){function o(){t.length&&head.js.apply(null,t),N()}var e=[],t=[];for(var n=0,r=i.dependencies.length;n<r;n++){var s=i.dependencies[n];if(!s.condition||s.condition())s.async?t.push(s.src):e.push(s.src),typeof s.callback=="function"&&head.ready(s.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],s.callback)}e.length?(head.ready(o),head.js.apply(null,e)):o()}function N(){S(),k(),C(),B(),Z(),it(),setTimeout(function(){P("ready",{indexh:o,indexv:u,currentSlide:f})},1)}function C(){p===!1&&(i.transition="linear"),i.controls&&h.controls&&(h.controls.style.display="block"),i.progress&&h.progress&&(h.progress.style.display="block"),i.transition!=="default"&&h.wrapper.classList.add(i.transition),i.rtl&&h.wrapper.classList.add("rtl"),i.center&&h.wrapper.classList.add("center"),i.mouseWheel&&(document.addEventListener("DOMMouseScroll",vt,!1),document.addEventListener("mousewheel",vt,!1)),i.rollingLinks&&H();if(i.theme&&h.theme){var e=h.theme.getAttribute("href"),t=/[^\/]*?(?=\.css)/,n=e.match(t)[0];i.theme!==n&&(e=e.replace(t,i.theme),h.theme.setAttribute("href",e))}}function k(){window.addEventListener("hashchange",gt,!1),window.addEventListener("resize",yt,!1),i.touch&&(document.addEventListener("touchstart",ht,!1),document.addEventListener("touchmove",pt,!1),document.addEventListener("touchend",dt,!1)),i.keyboard&&document.addEventListener("keydown",ct,!1),i.progress&&h.progress&&h.progress.addEventListener("click",_(mt),!1);if(i.controls&&h.controls){var e="ontouchstart"in window?"touchstart":"click";h.controlsLeft.forEach(function(t){t.addEventListener(e,_(st),!1)}),h.controlsRight.forEach(function(t){t.addEventListener(e,_(ot),!1)}),h.controlsUp.forEach(function(t){t.addEventListener(e,_(ut),!1)}),h.controlsDown.forEach(function(t){t.addEventListener(e,_(at),!1)}),h.controlsPrev.forEach(function(t){t.addEventListener(e,_(ft),!1)}),h.controlsNext.forEach(function(t){t.addEventListener(e,_(lt),!1)})}}function L(){document.removeEventListener("keydown",ct,!1),window.removeEventListener("hashchange",gt,!1),window.removeEventListener("resize",yt,!1),i.touch&&(document.removeEventListener("touchstart",ht,!1),document.removeEventListener("touchmove",pt,!1),document.removeEventListener("touchend",dt,!1)),i.progress&&h.progress&&h.progress.removeEventListener("click",_(mt),!1);if(i.controls&&h.controls){var e="ontouchstart"in window?"touchstart":"click";h.controlsLeft.forEach(function(t){t.removeEventListener(e,_(st),!1)}),h.controlsRight.forEach(function(t){t.removeEventListener(e,_(ot),!1)}),h.controlsUp.forEach(function(t){t.removeEventListener(e,_(ut),!1)}),h.controlsDown.forEach(function(t){t.removeEventListener(e,_(at),!1)}),h.controlsPrev.forEach(function(t){t.removeEventListener(e,_(ft),!1)}),h.controlsNext.forEach(function(t){t.removeEventListener(e,_(lt),!1)})}}function A(e,t){for(var n in t)e[n]=t[n]}function O(e){return Array.prototype.slice.call(e)}function M(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function _(e){return function(t){t.preventDefault(),e.call(null,t)}}function D(){window.orientation===0?(document.documentElement.style.overflow="scroll",document.body.style.height="120%"):(document.documentElement.style.overflow="",document.body.style.Line truncated
|
var Reveal=function(){"use strict";function E(e){if(!d&&!p){document.body.setAttribute("class","no-transforms");return}window.addEventListener("load",H,!1),A(i,e),x(),T()}function S(){h.theme=document.querySelector("#theme"),h.wrapper=document.querySelector(".reveal"),h.slides=document.querySelector(".reveal .slides");if(!h.wrapper.querySelector(".progress")&&i.progress){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="<span></span>",h.wrapper.appendChild(e)}if(!h.wrapper.querySelector(".controls")&&i.controls){var t=document.createElement("aside");t.classList.add("controls"),t.innerHTML='<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>',h.wrapper.appendChild(t)}if(!h.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),h.wrapper.appendChild(n)}if(!h.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),h.wrapper.appendChild(r)}h.progress=document.querySelector(".reveal .progress"),h.progressbar=document.querySelector(".reveal .progress span"),i.controls&&(h.controls=document.querySelector(".reveal .controls"),h.controlsLeft=O(document.querySelectorAll(".navigate-left")),h.controlsRight=O(document.querySelectorAll(".navigate-right")),h.controlsUp=O(document.querySelectorAll(".navigate-up")),h.controlsDown=O(document.querySelectorAll(".navigate-down")),h.controlsPrev=O(document.querySelectorAll(".navigate-prev")),h.controlsNext=O(document.querySelectorAll(".navigate-next")))}function x(){navigator.userAgent.match(/(iphone|ipod)/i)&&(window.addEventListener("load",_,!1),window.addEventListener("orientationchange",_,!1))}function T(){function o(){t.length&&head.js.apply(null,t),N()}var e=[],t=[];for(var n=0,r=i.dependencies.length;n<r;n++){var s=i.dependencies[n];if(!s.condition||s.condition())s.async?t.push(s.src):e.push(s.src),typeof s.callback=="function"&&head.ready(s.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],s.callback)}e.length?(head.ready(o),head.js.apply(null,e)):o()}function N(){S(),k(),C(),H(),Y(),rt(),setTimeout(function(){D("ready",{indexh:o,indexv:u,currentSlide:f})},1)}function C(){p===!1&&(i.transition="linear"),i.controls&&h.controls&&(h.controls.style.display="block"),i.progress&&h.progress&&(h.progress.style.display="block"),i.transition!=="default"&&h.wrapper.classList.add(i.transition),i.rtl&&h.wrapper.classList.add("rtl"),i.center&&h.wrapper.classList.add("center"),i.mouseWheel&&(document.addEventListener("DOMMouseScroll",dt,!1),document.addEventListener("mousewheel",dt,!1)),i.rollingLinks&&P();if(i.theme&&h.theme){var e=h.theme.getAttribute("href"),t=/[^\/]*?(?=\.css)/,n=e.match(t)[0];i.theme!==n&&(e=e.replace(t,i.theme),h.theme.setAttribute("href",e))}}function k(){window.addEventListener("hashchange",St,!1),window.addEventListener("resize",xt,!1),i.touch&&(document.addEventListener("touchstart",ct,!1),document.addEventListener("touchmove",ht,!1),document.addEventListener("touchend",pt,!1)),i.keyboard&&document.addEventListener("keydown",lt,!1),i.progress&&h.progress&&h.progress.addEventListener("click",vt,!1);if(i.controls&&h.controls){var e="ontouchstart"in window?"touchstart":"click";h.controlsLeft.forEach(function(t){t.addEventListener(e,mt,!1)}),h.controlsRight.forEach(function(t){t.addEventListener(e,gt,!1)}),h.controlsUp.forEach(function(t){t.addEventListener(e,yt,!1)}),h.controlsDown.forEach(function(t){t.addEventListener(e,bt,!1)}),h.controlsPrev.forEach(function(t){t.addEventListener(e,wt,!1)}),h.controlsNext.forEach(function(t){t.addEventListener(e,Et,!1)})}}function L(){document.removeEventListener("keydown",lt,!1),window.removeEventListener("hashchange",St,!1),window.removeEventListener("resize",xt,!1),i.touch&&(document.removeEventListener("touchstart",ct,!1),document.removeEventListener("touchmove",ht,!1),document.removeEventListener("touchend",pt,!1)),i.progress&&h.progress&&h.progress.removeEventListener("click",vt,!1);if(i.controls&&h.controls){var e="ontouchstart"in window?"touchstart":"click";h.controlsLeft.forEach(function(t){t.removeEventListener(e,mt,!1)}),h.controlsRight.forEach(function(t){t.removeEventListener(e,gt,!1)}),h.controlsUp.forEach(function(t){t.removeEventListener(e,yt,!1)}),h.controlsDown.forEach(function(t){t.removeEventListener(e,bt,!1)}),h.controlsPrev.forEach(function(t){t.removeEventListener(e,wt,!1)}),h.controlsNext.forEach(function(t){t.removeEventListener(e,Et,!1)})}}function A(e,t){for(var n in t)e[n]=t[n]}function O(e){return Array.prototype.slice.call(e)}function M(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function _(){window.orientation===0?(document.documentElement.style.overflow="scroll",document.body.style.height="120%"):(document.documentElement.style.overflow="",document.body.style.height="100%"),setTimeout(function(){window.scrollTo(0,1)},10)}function D(e,t){var n=document.createEvent("HTMLine truncated
|
||||||
Reference in new issue
Block a user