diff options
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 81 |
1 files changed, 50 insertions, 31 deletions
diff --git a/js/reveal.js b/js/reveal.js index e95092e..3372029 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.1 r30 + * reveal.js 2.1 r32 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -33,7 +33,8 @@ var Reveal = (function(){ loop: false, // Number of milliseconds between automatically proceeding to the - // next slide, disabled when set to 0 + // next slide, disabled when set to 0, this value can be overwritten + // by using a data-autoslide attribute on your slides autoSlide: 0, // Enable slide navigation via mouse wheel @@ -46,12 +47,16 @@ var Reveal = (function(){ theme: null, // Transition style - transition: 'default', // default/cube/page/concave/linear(2d), + transition: 'default', // default/cube/page/concave/zoom/linear/none // Script dependencies to load dependencies: [] }, + // Stores if the next slide should be shown automatically + // after n milliseconds + autoSlide = config.autoSlide, + // The horizontal and verical index of the currently active slide indexh = 0, indexv = 0, @@ -97,10 +102,9 @@ var Reveal = (function(){ startSpan: 0, startCount: 0, handled: false, - threshold: 40 + threshold: 80 }; - /** * Starts up the presentation if the client is capable. */ @@ -469,7 +473,7 @@ var Reveal = (function(){ // If there's two touches we need to memorize the distance // between those two points to detect pinching - if( event.touches.length === 2 ) { + if( event.touches.length === 2 && config.overview ) { touch.startSpan = distanceBetween( { x: event.touches[1].clientX, y: event.touches[1].clientY @@ -491,7 +495,7 @@ var Reveal = (function(){ // If the touch started off with two points and still has // two active touches; test for the pinch gesture - if( event.touches.length === 2 && touch.startCount === 2 ) { + if( event.touches.length === 2 && touch.startCount === 2 && config.overview ) { // The current distance in pixels between the two touch points var currentSpan = distanceBetween( { @@ -515,9 +519,12 @@ var Reveal = (function(){ } } + event.preventDefault(); + } // There was only one touch point, look for a swipe - else if( event.touches.length === 1 ) { + else if( event.touches.length === 1 && touch.startCount !== 2 ) { + var deltaX = currentX - touch.startX, deltaY = currentY - touch.startY; @@ -537,9 +544,10 @@ var Reveal = (function(){ touch.handled = true; navigateDown(); } - } - event.preventDefault(); + event.preventDefault(); + + } } // There's a bug with swiping on some Android devices unless // the default action is always prevented @@ -735,6 +743,26 @@ var Reveal = (function(){ } /** + * Handling the fullscreen functionality via the fullscreen API + * + * @see http://fullscreen.spec.whatwg.org/ + * @see https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode + */ + function enterFullscreen() { + var element = document.body; + + // Check which implementation is available + var requestMethod = element.requestFullScreen || + element.webkitRequestFullScreen || + element.mozRequestFullScreen || + element.msRequestFullScreen; + + if( requestMethod ) { + requestMethod.apply( element ); + } + } + + /** * Enters the paused mode which fades everything on screen to * black. */ @@ -782,7 +810,6 @@ var Reveal = (function(){ * bounds. */ function updateSlides( selector, index ) { - // Select all slides and convert the NodeList result to // an array var slides = Array.prototype.slice.call( document.querySelectorAll( selector ) ), @@ -843,6 +870,16 @@ var Reveal = (function(){ if( slideState ) { state = state.concat( slideState.split( ' ' ) ); } + + // If this slide has a data-autoslide attribtue associated use this as + // autoSlide value otherwise use the global configured time + var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' ); + if( slideAutoSlide ) { + autoSlide = parseInt( slideAutoSlide ); + } else { + autoSlide = config.autoSlide + } + } else { // Since there are no slides we can't be anywhere beyond the @@ -1113,8 +1150,8 @@ var Reveal = (function(){ clearTimeout( autoSlideTimeout ); // Cue the next auto-slide if enabled - if( config.autoSlide ) { - autoSlideTimeout = setTimeout( navigateNext, config.autoSlide ); + if( autoSlide ) { + autoSlideTimeout = setTimeout( navigateNext, autoSlide ); } } @@ -1195,24 +1232,6 @@ var Reveal = (function(){ cueAutoSlide(); } - /** - * Handling the fullscreen functionality via the fullscreen API - * @see http://fullscreen.spec.whatwg.org/ - * @see https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode - */ - function enterFullscreen() { - var element = document.body; - - // Check which implementation is available - var requestMethod = element.requestFullScreen || - element.webkitRequestFullScreen || - element.mozRequestFullScreen || - element.msRequestFullScreen; - if (requestMethod) { - requestMethod.apply(element); - } - } - // Expose some methods publicly return { initialize: initialize, |