Commit 09750b07 authored by miripiruni's avatar miripiruni

Refactoring: shower.increaseInnerNavigation() returns only Boolean

parent a06c84a0
...@@ -172,8 +172,8 @@ window.shower = (function(window, document, undefined) { ...@@ -172,8 +172,8 @@ window.shower = (function(window, document, undefined) {
// NOTE: But first of all check if there is no current slide // NOTE: But first of all check if there is no current slide
if ( if (
-1 === currentSlideNumber || -1 === currentSlideNumber ||
!slideList[currentSlideNumber].hasInnerNavigation || ! slideList[currentSlideNumber].hasInnerNavigation ||
-1 === shower.increaseInnerNavigation(currentSlideNumber) ! shower.increaseInnerNavigation(currentSlideNumber)
) { ) {
shower.go(currentSlideNumber + 1); shower.go(currentSlideNumber + 1);
// slides starts from 0 // slides starts from 0
...@@ -540,12 +540,11 @@ window.shower = (function(window, document, undefined) { ...@@ -540,12 +540,11 @@ window.shower = (function(window, document, undefined) {
/** /**
* Increases inner navigation by adding 'active' class to next inactive inner navigation item * Increases inner navigation by adding 'active' class to next inactive inner navigation item
* @param {Number} slideNumber * @param {Number} slideNumber
* @returns {Number} * @returns {Boolean}
*/ */
shower.increaseInnerNavigation = function(slideNumber) { shower.increaseInnerNavigation = function(slideNumber) {
var nextNodes, var nextNodes,
node, node;
ret = -1;
if ( ! shower._isNumber(slideNumber)) { if ( ! shower._isNumber(slideNumber)) {
throw new Error('Gimme slide number as Number, baby!'); throw new Error('Gimme slide number as Number, baby!');
...@@ -558,11 +557,11 @@ window.shower = (function(window, document, undefined) { ...@@ -558,11 +557,11 @@ window.shower = (function(window, document, undefined) {
if (0 !== nextNodes.length) { if (0 !== nextNodes.length) {
node = nextNodes[0]; node = nextNodes[0];
node.classList.add('active'); node.classList.add('active');
ret = nextNodes.length - 1; return true;
} }
} }
return ret; return false;
}; };
...@@ -644,8 +643,8 @@ window.shower = (function(window, document, undefined) { ...@@ -644,8 +643,8 @@ window.shower = (function(window, document, undefined) {
if (shower.isSlideMode()) { if (shower.isSlideMode()) {
// Inner navigation is "completed" if current slide have // Inner navigation is "completed" if current slide have
// no inner navigation or inner navigation is fully shown // no inner navigation or inner navigation is fully shown
isInnerNavCompleted = !slideList[currentSlideNumber].hasInnerNavigation || isInnerNavCompleted = ! slideList[currentSlideNumber].hasInnerNavigation ||
-1 === shower.increaseInnerNavigation(currentSlideNumber); ! shower.increaseInnerNavigation(currentSlideNumber);
} else { } else {
// Also inner navigation is always "completed" if we are in // Also inner navigation is always "completed" if we are in
// list mode // list mode
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment