Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
prevent nextStep() from progressing tour after multistep is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon Koo committed Feb 5, 2013
1 parent 92082ff commit bc45ab1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
14 changes: 11 additions & 3 deletions js/hopscotch-0.0.4.js
Expand Up @@ -1298,12 +1298,14 @@
self = this,
step,
origStepNum,
wasMultiPage,
changeStepCb;

bubble.hide();

doCallbacks = utils.valOrDefault(doCallbacks, true);
step = getCurrStep();
wasMultiPage = step.multipage;
origStepNum = currStepNum;

/**
Expand All @@ -1318,20 +1320,26 @@
}

if (doCallbacks) {
// invoke callbacks
// Step-specific callbacks
if (direction > 0 && step.onNext) {
step.onNext();
}
else if (direction < 0 && step.onPrev) {
step.onPrev();
}

// Tour-wide next/prev callbacks
utils.invokeCallbacks(direction > 0 ? 'next' : 'prev', [currTour.id, origStepNum]);

if (direction > 0 && wasMultiPage) {
return;
}
}

this.showStep(stepNum);
};

if (opt.skipIfNoElement) {
if (!wasMultiPage && opt.skipIfNoElement) {
goToStepWithTarget(direction, function(stepNum) {
changeStepCb.call(self, stepNum);
});
Expand All @@ -1340,7 +1348,7 @@
// only try incrementing once, and invoke error callback if no target is found
currStepNum += direction;
step = getCurrStep();
if (!utils.getStepTarget(step)) {
if (!utils.getStepTarget(step) && !wasMultiPage) {
utils.invokeCallbacks('error', [currTour.id, currStepNum]);
return this.endTour(true, false);
}
Expand Down
8 changes: 4 additions & 4 deletions js/hopscotch-0.0.4.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions minify.sh
Expand Up @@ -2,14 +2,15 @@
echo ""
echo "Minifying files into assets.js..."
echo "================================="
echo "This script uses the YUI Compressor and assumes the location of the compiler is:"
echo "/Users/gkoo/workspace/yuicompressor-2.4.7/build/yuicompressor-2.4.7.jar"
echo "This script uses the Google Closure Compiler and assumes the location of the compiler is:"
echo "/Users/gkoo/workspace/compiler-latest-1/compiler.jar"
echo ""
echo "INPUT FILES:"
echo "============"
echo "hopscotch-0.0.3.js"
echo "hopscotch-0.0.4.js"

java -jar /Users/gkoo/workspace/yuicompressor-2.4.7/build/yuicompressor-2.4.7.jar --type js /Users/gkoo/Sites/hopscotch/js/hopscotch-0.0.3.js > /Users/gkoo/Sites/hopscotch/js/hopscotch-0.0.3.min.js
java -jar /Users/gkoo/workspace/compiler-latest-1/compiler.jar --js=/Users/gkoo/Sites/hopscotch/js/hopscotch-0.0.4.js --js_output_file=/Users/gkoo/Sites/hopscotch/js/hopscotch-0.0.4.min.js
#java -jar /Users/gkoo/workspace/yuicompressor-2.4.7/build/yuicompressor-2.4.7.jar --type js /Users/gkoo/Sites/hopscotch/js/hopscotch-0.0.3.js > /Users/gkoo/Sites/hopscotch/js/hopscotch-0.0.3.min.js

echo "Done minifying..."

Expand Down

0 comments on commit bc45ab1

Please sign in to comment.