PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.3.0
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.3.0
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
cartflows / modules / beaver-builder / cartflows-bb-next-step / js / settings.js

settings.js in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 3.3.0, at modules/beaver-builder/cartflows-bb-next-step/js/settings.js

153 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function ( $ ) {
2 FLBuilder.registerModuleHelper( 'cartflows-bb-next-step', {
3 init() {
4 const form = $( '.fl-builder-settings' ),
5 btn_style = form.find( 'select[name=style]' ),
6 transparent_button_options = form.find(
7 'select[name=transparent_button_options]'
8 ),
9 hover_attribute = form.find( 'select[name=hover_attribute]' ),
10 btn_style_opt = form.find( 'select[name=flat_button_options]' );
11
12 // Init validation events.
13 this._btn_styleChanged();
14 this.imgicon_postion();
15
16 // Validation events.
17 btn_style.on( 'change', $.proxy( this._btn_styleChanged, this ) );
18 btn_style_opt.on(
19 'change',
20 $.proxy( this._btn_styleChanged, this )
21 );
22 transparent_button_options.on(
23 'change',
24 $.proxy( this._btn_styleChanged, this )
25 );
26 hover_attribute.on(
27 'change',
28 $.proxy( this._btn_styleChanged, this )
29 );
30 },
31
32 _btn_styleChanged() {
33 const form = $( '.fl-builder-settings' ),
34 btn_style = form.find( 'select[name=style]' ).val(),
35 btn_style_opt = form
36 .find( 'select[name=flat_button_options]' )
37 .val(),
38 hover_attribute = form
39 .find( 'select[name=hover_attribute]' )
40 .val(),
41 transparent_button_options = form
42 .find( 'select[name=transparent_button_options]' )
43 .val(),
44 icon = form.find( 'input[name=icon]' );
45
46 icon.rules( 'remove' );
47
48 if ( btn_style === 'flat' && btn_style_opt !== 'none' ) {
49 icon.rules( 'add', { required: true } );
50 }
51
52 if ( btn_style === 'threed' ) {
53 form.find( '#fl-field-threed_button_options' ).show();
54 form.find( '#fl-field-hover_attribute' ).hide();
55 form.find( '#fl-field-bg_color th label' ).text(
56 'Background Color'
57 );
58 form.find( '#fl-field-bg_hover_color th label' ).text(
59 'Background Hover Color'
60 );
61 form.find( '#fl-field-border_size' ).hide();
62 form.find( '#fl-field-transparent_button_options' ).hide();
63 form.find( '#fl-field-flat_button_options' ).hide();
64 form.find( '#fl-field-width' ).show();
65 } else if ( btn_style === 'flat' ) {
66 form.find( '#fl-field-flat_button_options' ).show();
67 form.find( '#fl-field-hover_attribute' ).hide();
68 form.find( '#fl-field-bg_color th label' ).text(
69 'Background Color'
70 );
71 form.find( '#fl-field-bg_hover_color th label' ).text(
72 'Background Hover Color'
73 );
74 form.find( '#fl-field-threed_button_options' ).hide();
75 form.find( '#fl-field-border_size' ).hide();
76 form.find( '#fl-field-transparent_button_options' ).hide();
77 form.find( '#fl-field-width' ).show();
78 } else if ( btn_style === 'transparent' ) {
79 form.find( '#fl-field-border_size' ).show();
80 form.find( '#fl-field-transparent_button_options' ).show();
81 form.find( '#fl-field-threed_button_options' ).hide();
82 form.find( '#fl-field-flat_button_options' ).hide();
83 form.find( '#fl-field-bg_color th label' ).text(
84 'Border Color'
85 );
86 form.find( '#fl-field-width' ).show();
87 if ( transparent_button_options === 'none' ) {
88 form.find( '#fl-field-hover_attribute' ).show();
89 if ( hover_attribute === 'bg' ) {
90 form.find( '#fl-field-bg_hover_color th label' ).text(
91 'Background Hover Color'
92 );
93 } else {
94 form.find( '#fl-field-bg_hover_color th label' ).text(
95 'Border Hover Color'
96 );
97 }
98 } else {
99 form.find( '#fl-field-hover_attribute' ).hide();
100 form.find( '#fl-field-bg_hover_color th label' ).text(
101 'Background Hover Color'
102 );
103 }
104 } else if ( 'default' === btn_style ) {
105 form.find( '#fl-field-width' ).hide();
106 form.find( '#fl-field-border_radius' ).hide();
107 form.find( '#fl-field-border_size' ).hide();
108 form.find( '#fl-field-transparent_button_options' ).hide();
109 form.find( '#fl-field-threed_button_options' ).hide();
110 form.find( '#fl-field-button_gradient' ).hide();
111 form.find( '#fl-field-button_gradient' ).hide();
112 form.find( '#fl-field-hover_attribute' ).hide();
113 form.find( '#fl-field-flat_button_options' ).hide();
114 } else {
115 form.find( '#fl-field-hover_attribute' ).hide();
116 form.find( '#fl-field-bg_color th label' ).text(
117 'Background Color'
118 );
119 form.find( '#fl-field-bg_hover_color th label' ).text(
120 'Background Hover Color'
121 );
122 form.find( '#fl-field-border_size' ).hide();
123 form.find( '#fl-field-transparent_button_options' ).hide();
124 form.find( '#fl-field-threed_button_options' ).hide();
125 form.find( '#fl-field-flat_button_options' ).hide();
126 form.find( '#fl-field-width' ).show();
127 }
128
129 this.imgicon_postion();
130 },
131 imgicon_postion() {
132 const form = $( '.fl-builder-settings' ),
133 creative_button_styles = form
134 .find( 'select[name=style]' )
135 .val(),
136 flat_button_options = form
137 .find( 'select[name=flat_button_options]' )
138 .val();
139
140 if (
141 creative_button_styles === 'flat' &&
142 flat_button_options !== 'none'
143 ) {
144 setTimeout( function () {
145 jQuery( '#fl-field-icon_position' ).hide();
146 }, 100 );
147 } else {
148 jQuery( '#fl-field-icon_position' ).show();
149 }
150 },
151 } );
152 } )( jQuery );
153