From 0fa03213c5ea1f75b04838d9f419186f5ccaae24 Mon Sep 17 00:00:00 2001 From: miripiruni Date: Sun, 5 May 2013 02:36:12 +0400 Subject: [PATCH] Added slide::stopTimer, fixed pageDown to next step of inner navigation; Fix for list mode --- shower.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/shower.js b/shower.js index fb3fe74..cfb611c 100755 --- a/shower.js +++ b/shower.js @@ -354,7 +354,7 @@ window.shower = window.shower || (function(window, document, undefined) { * Go to slide number. * @param {Number} slideNumber slide number (sic!). Attention: starts from zero. * @param {Function} [callback] runs only if you not in List mode. - * @returns {Number} + * @returns {Number|Boolean} */ shower.go = function(slideNumber, callback) { var slide; @@ -363,6 +363,10 @@ window.shower = window.shower || (function(window, document, undefined) { throw new Error('Gimme slide number as Number, baby!'); } + if ( ! shower.slideList[slideNumber]) { + return false; + } + // Also triggers popstate and invoke shower.enter__Mode() url.hash = shower.getSlideHash(slideNumber); @@ -416,8 +420,13 @@ window.shower = window.shower || (function(window, document, undefined) { var currentSlideNumber = shower.getCurrentSlideNumber(), slide = shower.slideList[currentSlideNumber]; - slide.stopTimer(); - slide.next(shower); + + if (shower.isSlideMode()) { + slide.stopTimer(); + slide.next(shower); + } else { + shower.go(currentSlideNumber + 1); + } if (typeof(callback) === 'function') { callback(); @@ -455,15 +464,9 @@ window.shower = window.shower || (function(window, document, undefined) { */ shower._turnPreviousSlide = function(callback) { var currentSlideNumber = shower.getCurrentSlideNumber(), - slide; + slide = shower.slideList[currentSlideNumber]; - // Slides starts from 0 - if (currentSlideNumber < 1) { - return false; - } - - slide = shower.slideList[currentSlideNumber]; - slide.timing && slide.stopTimer(); + slide.stopTimer(); if (shower.isSlideMode()) { slide.prev(shower);