Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"tabs",
"steps"
],
"version": "1.1.0",
"version": "1.2.0",
"authors": [
{ "name": "Rafael Staib", "email": "[email protected]", "url": "http://www.rafaelstaib.com" }
],
Expand Down
Binary file removed build/jQuery.Steps.1.1.0.nupkg
Binary file not shown.
Binary file added build/jQuery.Steps.1.2.0.nupkg
Binary file not shown.
Binary file removed build/jquery.steps-1.1.0.zip
Binary file not shown.
Binary file added build/jquery.steps-1.2.0.zip
Binary file not shown.
74 changes: 48 additions & 26 deletions build/jquery.steps.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* jQuery Steps v1.1.0 - 09/04/2014
* Copyright (c) 2014 Rafael Staib (http://www.jquery-steps.com)
* jQuery Steps v1.2.1d.mo - 06/21/2017
* Copyright (c) 2017 Rafael Staib (http://www.jquery-steps.com)
* Licensed under MIT http://www.opensource.org/licenses/MIT
*/
;(function ($, undefined)
Expand Down Expand Up @@ -279,15 +279,25 @@ function finishStep(wizard, state)
{
var currentStep = wizard.find(".steps li").eq(state.currentIndex);

if (wizard.triggerHandler("finishing", [state.currentIndex]))
{
currentStep.addClass("done").removeClass("error");
wizard.triggerHandler("finished", [state.currentIndex]);
var response = wizard.triggerHandler("finishing", [state.currentIndex]);

if (typeof(response) === "boolean") {
response = jQuery.Deferred().resolve(response);
}
else
{

jQuery.when(response).done(function(status){
if (status)
{
currentStep.addClass("done").removeClass("error");
wizard.triggerHandler("finished", [state.currentIndex]);
}
else
{
currentStep.addClass("error");
}
}).fail(function(){
currentStep.addClass("error");
}
});
}

/**
Expand Down Expand Up @@ -500,26 +510,38 @@ function goToStep(wizard, options, state, index)
}

var oldIndex = state.currentIndex;
if (wizard.triggerHandler("stepChanging", [state.currentIndex, index]))
{
// Save new state
state.currentIndex = index;
saveCurrentStateToCookie(wizard, options, state);

// Change visualisation
refreshStepNavigation(wizard, options, state, oldIndex);
refreshPagination(wizard, options, state);
loadAsyncContent(wizard, options, state);
startTransitionEffect(wizard, options, state, index, oldIndex, function()
{
wizard.triggerHandler("stepChanged", [index, oldIndex]);
});
}
else
{
wizard.find(".steps li").eq(oldIndex).addClass("error");
var response = wizard.triggerHandler("stepChanging", [state.currentIndex, index]);

if (typeof(response) === "boolean") {
response = jQuery.Deferred().resolve(response);
}

jQuery.when(response).done(function(status){
if (status)
{
// Save new state
state.currentIndex = index;
saveCurrentStateToCookie(wizard, options, state);

// Change visualisation
refreshStepNavigation(wizard, options, state, oldIndex);
refreshPagination(wizard, options, state);
loadAsyncContent(wizard, options, state);
startTransitionEffect(wizard, options, state, index, oldIndex, function()
{
wizard.triggerHandler("stepChanged", [index, oldIndex]);
});
}
else
{
wizard.find(".steps li").eq(oldIndex).addClass("error");
}

}).fail(function(){
wizard.find(".steps li").eq(oldIndex).addClass("error");
});

return true;
}

Expand Down
6 changes: 3 additions & 3 deletions build/jquery.steps.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery-steps",
"title": "jQuery Steps",
"version": "1.1.0",
"version": "1.2.1d.mo",
"description": "A powerful jQuery wizard plugin that supports accessibility and HTML5",
"homepage": "http://www.jquery-steps.com",
"author": {
Expand Down
70 changes: 46 additions & 24 deletions src/privates.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,25 @@ function finishStep(wizard, state)
{
var currentStep = wizard.find(".steps li").eq(state.currentIndex);

if (wizard.triggerHandler("finishing", [state.currentIndex]))
{
currentStep.addClass("done").removeClass("error");
wizard.triggerHandler("finished", [state.currentIndex]);
var response = wizard.triggerHandler("finishing", [state.currentIndex]);

if (typeof(response) === "boolean") {
response = jQuery.Deferred().resolve(response);
}
else
{

jQuery.when(response).done(function(status){
if (status)
{
currentStep.addClass("done").removeClass("error");
wizard.triggerHandler("finished", [state.currentIndex]);
}
else
{
currentStep.addClass("error");
}
}).fail(function(){
currentStep.addClass("error");
}
});
}

/**
Expand Down Expand Up @@ -440,26 +450,38 @@ function goToStep(wizard, options, state, index)
}

var oldIndex = state.currentIndex;
if (wizard.triggerHandler("stepChanging", [state.currentIndex, index]))
{
// Save new state
state.currentIndex = index;
saveCurrentStateToCookie(wizard, options, state);

// Change visualisation
refreshStepNavigation(wizard, options, state, oldIndex);
refreshPagination(wizard, options, state);
loadAsyncContent(wizard, options, state);
startTransitionEffect(wizard, options, state, index, oldIndex, function()
{
wizard.triggerHandler("stepChanged", [index, oldIndex]);
});
}
else
{
wizard.find(".steps li").eq(oldIndex).addClass("error");
var response = wizard.triggerHandler("stepChanging", [state.currentIndex, index]);

if (typeof(response) === "boolean") {
response = jQuery.Deferred().resolve(response);
}

jQuery.when(response).done(function(status){
if (status)
{
// Save new state
state.currentIndex = index;
saveCurrentStateToCookie(wizard, options, state);

// Change visualisation
refreshStepNavigation(wizard, options, state, oldIndex);
refreshPagination(wizard, options, state);
loadAsyncContent(wizard, options, state);
startTransitionEffect(wizard, options, state, index, oldIndex, function()
{
wizard.triggerHandler("stepChanged", [index, oldIndex]);
});
}
else
{
wizard.find(".steps li").eq(oldIndex).addClass("error");
}

}).fail(function(){
wizard.find(".steps li").eq(oldIndex).addClass("error");
});

return true;
}

Expand Down