From 5bd8de1880bf78f413bf0eddff1b4f6a07344e4b Mon Sep 17 00:00:00 2001 From: amazingSurge Date: Wed, 1 Apr 2015 17:34:00 +0800 Subject: [PATCH 1/2] Added header, body, content, actions & steps css classes options --- build/jquery.steps.js | 216 ++++++++++++++++++++++++++++++------------ package.json | 22 ++--- src/defaults.js | 60 ++++++++++++ src/privates.js | 151 +++++++++++++++++------------ src/publics.js | 2 +- 5 files changed, 319 insertions(+), 132 deletions(-) diff --git a/build/jquery.steps.js b/build/jquery.steps.js index 956b05a..9dd40dc 100644 --- a/build/jquery.steps.js +++ b/build/jquery.steps.js @@ -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.1.0 - 04/01/2015 + * Copyright (c) 2015 Rafael Staib (http://www.jquery-steps.com) * Licensed under MIT http://www.opensource.org/licenses/MIT */ ;(function ($, undefined) @@ -273,11 +273,12 @@ function destroy(wizard, options) * @private * @method finishStep * @param wizard {Object} The jQuery wizard object + * @param options {Object} Settings of the current wizard * @param state {Object} The state container of the current wizard **/ -function finishStep(wizard, state) +function finishStep(wizard, options, state) { - var currentStep = wizard.find(".steps li").eq(state.currentIndex); + var currentStep = getStepsCollection(wizard, options).children("li").eq(state.currentIndex); if (wizard.triggerHandler("finishing", [state.currentIndex])) { @@ -348,6 +349,26 @@ function getSteps(wizard) return wizard.data("steps"); } +function getStepsCollection(wizard, options) +{ + return wizard.find('.' + options.stepsCssClass + ' > ul'); +} + +function getContentContainer(wizard, options) +{ + return wizard.find('.' + options.contentCssClass); +} + +function getHeaderCollection(wizard, options) +{ + return wizard.find('.' + options.contentCssClass + ' > ' + '.' + options.headerCssClass); +} + +function getBodyCollection(wizard, options) +{ + return wizard.find('.' + options.contentCssClass + ' > ' + '.' + options.bodyCssClass); +} + /** * Gets a specific step object by index. * @@ -517,7 +538,7 @@ function goToStep(wizard, options, state, index) } else { - wizard.find(".steps li").eq(oldIndex).addClass("error"); + getStepsCollection(wizard, options).children("li").eq(oldIndex).addClass("error"); } return true; @@ -609,7 +630,7 @@ function insertStep(wizard, options, state, index, step) } state.stepCount++; - var contentContainer = wizard.find(".content"), + var contentContainer = getContentContainer(wizard, options), header = $("<{0}>{1}".format(options.headerTag, step.title)), body = $("<{0}>".format(options.bodyTag)); @@ -627,7 +648,7 @@ function insertStep(wizard, options, state, index, step) getStepPanel(wizard, (index - 1)).after(body).after(header); } - renderBody(wizard, state, body, index); + renderBody(wizard, options, state, body, index); renderTitle(wizard, options, state, header, index); refreshSteps(wizard, options, state, index); if (index === state.currentIndex) @@ -709,7 +730,7 @@ function loadAsyncContent(wizard, options, state) switch (getValidEnumValue(contentMode, currentStep.contentMode)) { case contentMode.iframe: - wizard.find(".content > .body").eq(state.currentIndex).empty() + getBodyCollection(wizard, options).eq(state.currentIndex).empty() .html("