@@ -123,14 +123,14 @@ function analyzeData(wizard, options, state)
123123 var item = $ ( this ) , // item == header
124124 content = stepContents . eq ( index ) ,
125125 modeData = content . data ( "mode" ) ,
126- mode = ( modeData == null ) ? $ . fn . steps . contentMode . html : getValidEnumValue ( $ . fn . steps . contentMode ,
126+ mode = ( modeData == null ) ? contentMode . html : getValidEnumValue ( contentMode ,
127127 ( / ^ \s * $ / . test ( modeData ) || isNaN ( modeData ) ) ? modeData : parseInt ( modeData , 0 ) ) ,
128- contentUrl = ( mode === $ . fn . steps . contentMode . html || content . data ( "url" ) === undefined ) ?
128+ contentUrl = ( mode === contentMode . html || content . data ( "url" ) === undefined ) ?
129129 "" : content . data ( "url" ) ,
130- contentLoaded = ( mode !== $ . fn . steps . contentMode . html && content . data ( "loaded" ) === "1" ) ,
131- step = $ . extend ( { } , $ . fn . steps . stepModel , {
130+ contentLoaded = ( mode !== contentMode . html && content . data ( "loaded" ) === "1" ) ,
131+ step = $ . extend ( { } , stepModel , {
132132 title : item . html ( ) ,
133- content : ( mode === $ . fn . steps . contentMode . html ) ? content . html ( ) : "" ,
133+ content : ( mode === contentMode . html ) ? content . html ( ) : "" ,
134134 contentUrl : contentUrl ,
135135 contentMode : mode ,
136136 contentLoaded : contentLoaded
@@ -181,11 +181,6 @@ function format(format)
181181 return format ;
182182}
183183
184- function generateMenuItem ( tag , label )
185- {
186- return "<li><a href=\"#" + tag + "\" role=\"menuitem\">" + label + "</a></li>" ;
187- }
188-
189184function getOptions ( wizard )
190185{
191186 return wizard . data ( "options" ) ;
@@ -358,9 +353,9 @@ function goToStep(wizard, options, state, index)
358353 loadAsyncContent ( wizard , options , state ) ;
359354
360355 var stepContents = wizard . find ( ".content > .body" ) ;
361- switch ( getValidEnumValue ( $ . fn . steps . transitionEffect , options . transitionEffect ) )
356+ switch ( getValidEnumValue ( transitionEffect , options . transitionEffect ) )
362357 {
363- case $ . fn . steps . transitionEffect . fade :
358+ case transitionEffect . fade :
364359 state . transitionShowElement = stepContents . eq ( index ) ;
365360 stepContents . eq ( oldIndex ) . fadeOut ( options . transitionEffectSpeed , function ( )
366361 {
@@ -376,7 +371,7 @@ function goToStep(wizard, options, state, index)
376371 } ) . promise ( ) ;
377372 break ;
378373
379- case $ . fn . steps . transitionEffect . slide :
374+ case transitionEffect . slide :
380375 state . transitionShowElement = stepContents . eq ( index ) ;
381376 stepContents . eq ( oldIndex ) . slideUp ( options . transitionEffectSpeed , function ( )
382377 {
@@ -392,7 +387,7 @@ function goToStep(wizard, options, state, index)
392387 } ) . promise ( ) ;
393388 break ;
394389
395- case $ . fn . steps . transitionEffect . slideLeft :
390+ case transitionEffect . slideLeft :
396391 var newStep = stepContents . eq ( index ) ,
397392 currentStep = stepContents . eq ( oldIndex ) ,
398393 outerWidth = currentStep . outerWidth ( true ) ,
@@ -437,7 +432,7 @@ function increaseCurrentIndexBy(state, increaseBy)
437432function initialize ( options )
438433{
439434 /*jshint -W040 */
440- var opts = $ . extend ( true , { } , $ . fn . steps . defaults , options ) ;
435+ var opts = $ . extend ( true , { } , defaults , options ) ;
441436
442437 return this . each ( function ( i )
443438 {
@@ -498,7 +493,7 @@ function insertStep(wizard, options, state, index, step)
498493 // TODO: Validate step object
499494
500495 // Change data
501- step = $ . extend ( { } , $ . fn . steps . stepModel , step ) ;
496+ step = $ . extend ( { } , stepModel , step ) ;
502497 insertStepToCache ( wizard , index , step ) ;
503498 if ( state . currentIndex >= index )
504499 {
@@ -508,10 +503,10 @@ function insertStep(wizard, options, state, index, step)
508503 state . stepCount ++ ;
509504
510505 var contentContainer = wizard . find ( ".content" ) ,
511- header = $ ( document . createElement ( options . headerTag ) ) . html ( step . title ) ,
512- body = $ ( document . createElement ( options . bodyTag ) ) ;
506+ header = $ ( format ( "<{0}>{1}</{0}>" , options . headerTag , step . title ) ) ,
507+ body = $ ( format ( "<{0}></{0}>" , options . bodyTag ) ) ;
513508
514- if ( step . contentMode == null || step . contentMode === $ . fn . steps . contentMode . html )
509+ if ( step . contentMode == null || step . contentMode === contentMode . html )
515510 {
516511 body . html ( step . content ) ;
517512 }
@@ -597,15 +592,15 @@ function loadAsyncContent(wizard, options, state)
597592
598593 if ( ! options . enableContentCache || ! currentStep . contentLoaded )
599594 {
600- switch ( getValidEnumValue ( $ . fn . steps . contentMode , currentStep . contentMode ) )
595+ switch ( getValidEnumValue ( contentMode , currentStep . contentMode ) )
601596 {
602- case $ . fn . steps . contentMode . iframe :
597+ case contentMode . iframe :
603598 wizard . find ( ".content > .body" ) . eq ( state . currentIndex ) . empty ( )
604- . html ( $ ( "<iframe src=\"" + currentStep . contentUrl + "\" />" ) )
599+ . html ( "<iframe src=\"" + currentStep . contentUrl + "\" />" )
605600 . data ( "loaded" , "1" ) ;
606601 break ;
607602
608- case $ . fn . steps . contentMode . async :
603+ case contentMode . async :
609604 var currentStepContent = wizard . find ( "#" + getUniqueId ( wizard ) + _tabpanelSuffix + state . currentIndex ) . aria ( "busy" , "true" )
610605 . empty ( ) . append ( renderTemplate ( options . loadingTemplate , { text : options . labels . loading } ) ) ;
611606 $ . ajax ( { url : currentStep . contentUrl , cache : false } )
@@ -863,7 +858,7 @@ function removeStep(wizard, options, state, index)
863858 }
864859
865860 // Change data
866- removeStepToCache ( wizard , index ) ;
861+ removeStepFromCache ( wizard , index ) ;
867862 if ( state . currentIndex > index )
868863 {
869864 state . currentIndex -- ;
@@ -893,7 +888,7 @@ function removeStep(wizard, options, state, index)
893888 return true ;
894889}
895890
896- function removeStepToCache ( wizard , index )
891+ function removeStepFromCache ( wizard , index )
897892{
898893 getSteps ( wizard ) . splice ( index , 1 ) ;
899894}
@@ -911,10 +906,9 @@ function removeStepToCache(wizard, index)
911906function render ( wizard , options , state )
912907{
913908 // Create a content wrapper and copy HTML from the intial wizard structure
914- var contentWrapper = $ ( document . createElement ( options . contentContainerTag ) )
915- . addClass ( "content" ) . html ( wizard . html ( ) ) ,
916- stepsWrapper = $ ( document . createElement ( options . stepsContainerTag ) )
917- . addClass ( "steps" ) . append ( $ ( "<ul role=\"tablist\"></ul>" ) ) ,
909+ var wrapperTemplate = "<{0} class=\"{1}\">{2}</{0}>" ,
910+ contentWrapper = $ ( format ( wrapperTemplate , options . contentContainerTag , "content" , wizard . html ( ) ) ) ,
911+ stepsWrapper = $ ( format ( wrapperTemplate , options . stepsContainerTag , "steps" , "<ul role=\"tablist\"></ul>" ) ) ,
918912 stepTitles = contentWrapper . children ( options . headerTag ) ,
919913 stepContents = contentWrapper . children ( options . bodyTag ) ;
920914
@@ -974,23 +968,24 @@ function renderPagination(wizard, options, state)
974968{
975969 if ( options . enablePagination )
976970 {
977- var actionCollection = $ ( "<ul role=\"menu\" aria-label=\"" + options . labels . pagination + "\"></ul>" ) ,
978- actionWrapper = $ ( document . createElement ( options . actionContainerTag ) )
979- . addClass ( "actions" ) . append ( actionCollection ) ;
980- wizard . append ( actionWrapper ) ;
971+ var pagination = "<{0} class=\"actions\"><ul role=\"menu\" aria-label=\"{1}\">{2}</ul></{0}>" ,
972+ buttonTemplate = "<li><a href=\"#{0}\" role=\"menuitem\">{1}</a></li>" ,
973+ buttons = "" ;
981974
982975 if ( ! options . forceMoveForward )
983976 {
984- actionCollection . append ( generateMenuItem ( "previous" , options . labels . previous ) ) ;
977+ buttons += format ( buttonTemplate , "previous" , options . labels . previous ) ;
985978 }
986979
987- actionCollection . append ( generateMenuItem ( "next" , options . labels . next ) ) ;
980+ buttons += format ( buttonTemplate , "next" , options . labels . next ) ;
988981
989982 if ( options . enableFinishButton )
990983 {
991- actionCollection . append ( generateMenuItem ( "finish" , options . labels . finish ) ) ;
984+ buttons += format ( buttonTemplate , "finish" , options . labels . finish ) ;
992985 }
993986
987+ wizard . append ( format ( pagination , options . actionContainerTag , options . labels . pagination , buttons ) ) ;
988+
994989 refreshPagination ( wizard , options , state ) ;
995990 loadAsyncContent ( wizard , options , state ) ;
996991 }
0 commit comments