@@ -49,65 +49,42 @@ jQuery(document).ready(function ($) {
4949 if ( $hash ) {
5050 let $selected_section = $hash ;
5151
52- // Add active class and add handling for before and after active element
53- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . prevAll ( ) . removeClass ( 'active' ) ;
54- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . prevAll ( ) . addClass ( 'previous' ) ;
55- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . removeClass ( 'previous' ) ;
56- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . addClass ( 'active' ) ;
57- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . nextAll ( ) . removeClass ( 'active' ) ;
58- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . nextAll ( ) . removeClass ( 'previous' ) ;
52+ $ ( ".nav-link" ) . removeClass ( "active previous" ) ;
53+ $ ( ".nav-link[selected-section=" + $selected_section + "]" )
54+ . addClass ( "active" )
55+ . prevAll ( ) . addClass ( "previous" ) ;
5956
60- // Update Title Bar
6157 $ ( ".row.top-bar" ) . text ( slug_to_title ( $selected_section ) ) ;
6258
63- // Handles displaying clicked tab while hiding others
6459 $ ( ".options" ) . each ( function ( ) {
65- let $section_element = $ ( this ) ;
66- let $section = $ ( this ) . attr ( 'section' ) ;
67-
68- if ( $section != $selected_section ) {
69- $section_element . hide ( ) ;
70- } else {
71- $section_element . show ( ) ;
72- }
60+ let $section = $ ( this ) . attr ( "section" ) ;
61+ $ ( this ) . toggle ( $section === $selected_section ) ;
7362 } ) ;
7463 }
7564 }
7665
7766 // Process switching tabs
7867 function switchTabHandling ( ) {
7968 $ ( ".nav-link" ) . on ( "click" , function ( e ) {
80- let $selected_section_element = $ ( this ) ;
81- let $selected_section = $selected_section_element . attr ( 'selected-section' ) ;
69+ let $selected_section = $ ( this ) . attr ( 'selected-section' ) ;
8270
83- // Add active class and add handling for before and after active element
84- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . prevAll ( ) . removeClass ( 'active' ) ;
85- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . prevAll ( ) . addClass ( 'previous' ) ;
86- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . removeClass ( 'previous' ) ;
87- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . addClass ( 'active' ) ;
88- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . nextAll ( ) . removeClass ( 'active' ) ;
89- $ ( ".nav-link[selected-section=" + $selected_section + "]" ) . nextAll ( ) . removeClass ( 'previous' ) ;
71+ // Reset active/previous classes
72+ $ ( ".nav-link" ) . removeClass ( "active previous" ) ;
73+ $ ( this ) . addClass ( "active" ) ;
74+ $ ( this ) . prevAll ( ) . addClass ( "previous" ) ;
9075
9176 // Update Title Bar
9277 $ ( ".row.top-bar" ) . text ( slug_to_title ( $selected_section ) ) ;
9378
94- // Handles displaying clicked tab while hiding others
9579 $ ( ".options" ) . each ( function ( ) {
96- let $section_element = $ ( this ) ;
97- let $section = $ ( this ) . attr ( 'section' ) ;
98-
99- if ( $section != $selected_section ) {
100- $section_element . hide ( ) ;
101- } else {
102- $section_element . show ( ) ;
103- }
80+ let $section = $ ( this ) . attr ( "section" ) ;
81+ $ ( this ) . toggle ( $section === $selected_section ) ;
10482 } ) ;
10583
10684 // Close helpers
10785 toggled = false ;
108-
109- $ ( this ) . parent ( ) . parent ( ) . parent ( ) . find ( ".col-lg-8" ) . toggleClass ( "col-lg-10" ) . toggleClass ( "col-lg-8" ) ;
110- $ ( this ) . parent ( ) . parent ( ) . parent ( ) . find ( ".col-md-10" ) . toggleClass ( "col-md-12" ) . toggleClass ( "col-md-10" ) ;
86+ $ ( this ) . closest ( ".bootstrap-wrapper" ) . find ( ".col-lg-8" ) . toggleClass ( "col-lg-10 col-lg-8" ) ;
87+ $ ( this ) . closest ( ".bootstrap-wrapper" ) . find ( ".col-md-10" ) . toggleClass ( "col-md-12 col-md-10" ) ;
11188 $ ( ".helper-sidebar" ) . hide ( ) ;
11289
11390 inputGroupEqualWidth ( $selected_section ) ;
@@ -117,26 +94,41 @@ jQuery(document).ready(function ($) {
11794 // Helper Sidebar
11895 function helperHandling ( ) {
11996 $ ( ".helper-icon" ) . click ( function ( ) {
120- var helper = $ ( this ) . parents ( '.input-group ' ) . find ( '.helper-placeholder' ) . text ( ) ;
97+ var helper = $ ( this ) . parents ( '.field-container ' ) . find ( '.helper-placeholder' ) . text ( ) ;
12198
12299 if ( ! toggled ) {
100+ let $sidebar = $ ( ".sidebar" ) ;
101+
123102 toggled = true ;
124103
125- $ ( ".bootstrap-wrapper" ) . find ( ".col-lg-10" ) . toggleClass ( "col-lg-10" ) . toggleClass ( "col-lg-8" ) ;
126- $ ( ".bootstrap-wrapper" ) . find ( ".col-md-12" ) . toggleClass ( "col-md-12" ) . toggleClass ( "col-md-10" ) ;
127- $ ( ".helper-sidebar" ) . toggle ( ) ;
104+ if ( $sidebar . length > 0 ) {
105+ $ ( ".helper-sidebar" ) . toggle ( ) ;
106+ $ ( ".sidebar" ) . toggle ( ) ;
107+ } else {
108+ $ ( ".bootstrap-wrapper" ) . find ( ".col-lg-10" ) . toggleClass ( "col-lg-10" ) . toggleClass ( "col-lg-8" ) ;
109+ $ ( ".bootstrap-wrapper" ) . find ( ".col-md-12" ) . toggleClass ( "col-md-12" ) . toggleClass ( "col-md-10" ) ;
110+ $ ( ".helper-sidebar" ) . toggle ( ) ;
111+ }
128112 }
113+
129114 $ ( ".helper-text" ) . text ( helper ) ;
130115
131116 $ ( 'html,body' ) . animate ( { scrollTop : 0 } , 'fast' ) ;
132117 } ) ;
133118
134119 $ ( ".helper-close" ) . click ( function ( ) {
120+ let $sidebar = $ ( ".sidebar" ) ;
121+
135122 toggled = false ;
136123
137- $ ( ".bootstrap-wrapper" ) . find ( ".col-lg-8" ) . toggleClass ( "col-lg-10" ) . toggleClass ( "col-lg-8" ) ;
138- $ ( ".bootstrap-wrapper" ) . find ( ".col-md-10" ) . toggleClass ( "col-md-12" ) . toggleClass ( "col-md-10" ) ;
139- $ ( ".helper-sidebar" ) . toggle ( ) ;
124+ if ( $sidebar . length > 0 ) {
125+ $ ( ".helper-sidebar" ) . toggle ( ) ;
126+ $ ( ".sidebar" ) . toggle ( ) ;
127+ } else {
128+ $ ( ".bootstrap-wrapper" ) . find ( ".col-lg-8" ) . toggleClass ( "col-lg-10" ) . toggleClass ( "col-lg-8" ) ;
129+ $ ( ".bootstrap-wrapper" ) . find ( ".col-md-10" ) . toggleClass ( "col-md-12" ) . toggleClass ( "col-md-10" ) ;
130+ $ ( ".helper-sidebar" ) . toggle ( ) ;
131+ }
140132 } ) ;
141133 }
142134
@@ -197,10 +189,10 @@ jQuery(document).ready(function ($) {
197189 return ;
198190 }
199191
200- $ ( '.input-group ' + '.' + dropdown_value ) . each ( function ( ) {
192+ $ ( '.field-container ' + '.' + dropdown_value ) . each ( function ( ) {
201193 $ ( this ) . show ( ) ;
202194
203- if ( $ ( this ) [ 0 ] === $ ( '.input-group ' + '.' + dropdown_value ) . last ( ) [ 0 ] ) {
195+ if ( $ ( this ) [ 0 ] === $ ( '.field-container ' + '.' + dropdown_value ) . last ( ) [ 0 ] ) {
204196 $ ( this ) . css ( "margin-bottom" , 0 )
205197 }
206198 } ) ;
@@ -215,10 +207,10 @@ jQuery(document).ready(function ($) {
215207 $ ( this ) . hide ( ) ;
216208 } ) ;
217209
218- $ ( '.input-group ' + '.' + dropdown_value ) . each ( function ( ) {
210+ $ ( '.field-container ' + '.' + dropdown_value ) . each ( function ( ) {
219211 $ ( this ) . show ( ) ;
220212
221- if ( $ ( this ) [ 0 ] === $ ( '.input-group ' + '.' + dropdown_value ) . last ( ) [ 0 ] ) {
213+ if ( $ ( this ) [ 0 ] === $ ( '.field-container ' + '.' + dropdown_value ) . last ( ) [ 0 ] ) {
222214 $ ( this ) . css ( "margin-bottom" , 0 )
223215 }
224216 } ) ;
@@ -233,8 +225,8 @@ jQuery(document).ready(function ($) {
233225 let $active_tab = $ ( ".nav-link.active" ) . attr ( 'selected-section' ) ;
234226
235227 let $selected_section_inputs = selected_section
236- ? $ ( "[section='" + selected_section + "']" ) . find ( '.input-group -text:visible' )
237- : $ ( "[section='" + $active_tab + "']" ) . find ( '.input-group -text:visible' ) ;
228+ ? $ ( "[section='" + selected_section + "']" ) . find ( '.field-container -text:visible' )
229+ : $ ( "[section='" + $active_tab + "']" ) . find ( '.field-container -text:visible' ) ;
238230
239231 $selected_section_inputs . css ( "width" , "auto" ) ;
240232
0 commit comments