Skip to content

Commit

Permalink
Make sure onEnter callback gets called for first step of tour - fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
James Warwood committed Aug 14, 2014
1 parent fc7f9d7 commit d0f7852
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ is compiled. Instead, you should modify the LESS and compile it (see the sectio

### 14/08/2014

* `v2.3.6`: Fix `onEnter` callback not firing if used with first step of a tour
* `v2.3.5`: Re-work fix for issue #36, original attempt at fixing in `v2.3.3`

### 13/08/2014
Expand Down
16 changes: 11 additions & 5 deletions dist/jquery.pagewalkthrough.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* James Warwood <james.duncan.1991@googlemail.com>
* Craig Roberts <craig0990@googlemail.com>
* Created On: 27/02/2013
* Version: 2.3.5
* Version: 2.3.6
* Issue, Feature & Bug Support: https://github.com/warby-/jquery-pagewalkthrough/issues
***/

Expand Down Expand Up @@ -102,6 +102,8 @@
//check if first time walkthrough
if (_isCookieLoad == undefined) {
_isWalkthroughActive = true;

if (!(onEnter())) return;
showStep();
showButton('jpwClose', 'body');

Expand Down Expand Up @@ -155,8 +157,14 @@

},

show: function(name) {
show: function(name, e) {
// If no name, then first argument is event
e = name == null ? name : e;

name = name || this.first().data('jpw').name;

if (name === _activeId || !(onEnter(e))) return;

_isWalkthroughActive = true;
_firstTimeLoad = true;
_activeWalkthrough = _globalWalkthrough[this.first().data('jpw').name];
Expand Down Expand Up @@ -601,9 +609,7 @@
var options = _activeWalkthrough;

if (typeof options.steps[_index].onEnter === "function") {
if (!options.steps[_index].onEnter.call(this, e, _index)) {
return false;
}
return options.steps[_index].onEnter.call(this, e, _index);
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.pagewalkthrough.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pagewalkthrough.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"highlighting",
"guide"
],
"version": "2.3.5",
"version": "2.3.6",
"author": {
"name": "Erwin Yusrizal",
"email": "erwin.yusrizal@gmail.com"
Expand Down
16 changes: 11 additions & 5 deletions src/jquery.pagewalkthrough.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* James Warwood <james.duncan.1991@googlemail.com>
* Craig Roberts <craig0990@googlemail.com>
* Created On: 27/02/2013
* Version: 2.3.5
* Version: 2.3.6
* Issue, Feature & Bug Support: https://github.com/warby-/jquery-pagewalkthrough/issues
***/

Expand Down Expand Up @@ -102,6 +102,8 @@
//check if first time walkthrough
if (_isCookieLoad == undefined) {
_isWalkthroughActive = true;

if (!(onEnter())) return;
showStep();
showButton('jpwClose', 'body');

Expand Down Expand Up @@ -155,8 +157,14 @@

},

show: function(name) {
show: function(name, e) {
// If no name, then first argument is event
e = name == null ? name : e;

name = name || this.first().data('jpw').name;

if (name === _activeId || !(onEnter(e))) return;

_isWalkthroughActive = true;
_firstTimeLoad = true;
_activeWalkthrough = _globalWalkthrough[this.first().data('jpw').name];
Expand Down Expand Up @@ -601,9 +609,7 @@
var options = _activeWalkthrough;

if (typeof options.steps[_index].onEnter === "function") {
if (!options.steps[_index].onEnter.call(this, e, _index)) {
return false;
}
return options.steps[_index].onEnter.call(this, e, _index);
}

return true;
Expand Down

0 comments on commit d0f7852

Please sign in to comment.