Added slide::stopTimer, fixed pageDown to next step of inner navigation; Fix for list mode

This commit is contained in:
miripiruni 2013-05-05 02:36:12 +04:00
parent 03d73e8d79
commit 0fa03213c5
1 changed files with 14 additions and 11 deletions

View File

@ -354,7 +354,7 @@ window.shower = window.shower || (function(window, document, undefined) {
* Go to slide number. * Go to slide number.
* @param {Number} slideNumber slide number (sic!). Attention: starts from zero. * @param {Number} slideNumber slide number (sic!). Attention: starts from zero.
* @param {Function} [callback] runs only if you not in List mode. * @param {Function} [callback] runs only if you not in List mode.
* @returns {Number} * @returns {Number|Boolean}
*/ */
shower.go = function(slideNumber, callback) { shower.go = function(slideNumber, callback) {
var slide; var slide;
@ -363,6 +363,10 @@ window.shower = window.shower || (function(window, document, undefined) {
throw new Error('Gimme slide number as Number, baby!'); throw new Error('Gimme slide number as Number, baby!');
} }
if ( ! shower.slideList[slideNumber]) {
return false;
}
// Also triggers popstate and invoke shower.enter__Mode() // Also triggers popstate and invoke shower.enter__Mode()
url.hash = shower.getSlideHash(slideNumber); url.hash = shower.getSlideHash(slideNumber);
@ -416,8 +420,13 @@ window.shower = window.shower || (function(window, document, undefined) {
var currentSlideNumber = shower.getCurrentSlideNumber(), var currentSlideNumber = shower.getCurrentSlideNumber(),
slide = shower.slideList[currentSlideNumber]; slide = shower.slideList[currentSlideNumber];
if (shower.isSlideMode()) {
slide.stopTimer(); slide.stopTimer();
slide.next(shower); slide.next(shower);
} else {
shower.go(currentSlideNumber + 1);
}
if (typeof(callback) === 'function') { if (typeof(callback) === 'function') {
callback(); callback();
@ -455,15 +464,9 @@ window.shower = window.shower || (function(window, document, undefined) {
*/ */
shower._turnPreviousSlide = function(callback) { shower._turnPreviousSlide = function(callback) {
var currentSlideNumber = shower.getCurrentSlideNumber(), var currentSlideNumber = shower.getCurrentSlideNumber(),
slide;
// Slides starts from 0
if (currentSlideNumber < 1) {
return false;
}
slide = shower.slideList[currentSlideNumber]; slide = shower.slideList[currentSlideNumber];
slide.timing && slide.stopTimer();
slide.stopTimer();
if (shower.isSlideMode()) { if (shower.isSlideMode()) {
slide.prev(shower); slide.prev(shower);