PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.2
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.2
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / assets / js / admin / customize-preview.js
everest-forms / assets / js / admin Last commit date
admin.js 3 weeks ago admin.min.js 3 weeks ago chart.js 2 years ago chart.min.js 1 year ago customize-controls.js 1 year ago customize-controls.min.js 1 year ago customize-preview.js 1 year ago customize-preview.min.js 1 year ago deactivation-feedback.js 2 years ago deactivation-feedback.min.js 2 years ago editor.js 8 years ago editor.min.js 5 years ago everest-forms-survey-polls-quiz-builder.js 2 years ago everest-forms-survey-polls-quiz-builder.min.js 2 years ago evf-admin-email.js 2 years ago evf-admin-email.min.js 1 year ago evf-clipboard.js 8 years ago evf-clipboard.min.js 8 years ago evf-enhanced-select.js 3 years ago evf-enhanced-select.min.js 2 years ago evf-file-uploader.js 1 year ago evf-file-uploader.min.js 1 year ago evf-setup.js 1 year ago evf-setup.min.js 1 year ago extensions.js 2 years ago extensions.min.js 2 years ago form-builder.js 1 week ago form-builder.min.js 1 week ago form-template-controller.js 3 years ago form-template-controller.min.js 3 years ago printThis.min.js 2 years ago progressbar.js 2 years ago progressbar.min.js 1 year ago randomColor.js 2 years ago randomColor.min.js 2 years ago settings.js 3 weeks ago settings.min.js 3 weeks ago shortcode-form-embed.js 2 years ago shortcode-form-embed.min.js 2 years ago tool-import-entries.js 2 years ago tool-import-entries.min.js 2 years ago tools.js 3 weeks ago tools.min.js 3 weeks ago upgrade.js 3 weeks ago upgrade.min.js 3 weeks ago
customize-preview.js
2269 lines
1 /* global _evfCustomizePreviewL10n */
2 ( function( $, data ) {
3 var settings = 'everest_forms_styles[' + data.form_id + ']',
4 container = $( '.everest-forms .evf-container' ),
5 field_container = container.find( '.evf-field-container' ),
6 field_label = field_container.find( '.evf-field-label' ),
7 section_title = field_container.find( '.evf-field-title h3' ),
8 field_sub_label = field_container.find( '.everest-forms-field-sublabel' ),
9 field_description = field_container.find( '.evf-field-description' ),
10 button = container.find('.evf-submit-container button, .evf-submit-container input[type=submit], .evf-submit-container input[type="reset"], .everest-forms-part button' ),
11 controls_wrapper = $( parent.document ).find( '#customize-controls' ),
12 preview_buttons = controls_wrapper.find( '#customize-footer-actions .devices button' );
13 control_selector = 'customize-control-everest_forms_styles-' + data.form_id + '-',
14 dimension_directions = ['top', 'right', 'bottom', 'left'];
15
16 // color palette.
17 controls_wrapper.find('.color-palette-item input[type="checkbox"]').on('change', function() {
18 var parentLi = $(this).closest('.customize-control-evf-color_palette');
19 parentLi.find('input[type="checkbox"]:checked').each(function() {
20 var color = $(this).val();
21 var colorElements = $(this).data('title').replace(/\s+/g, '_').toLowerCase();
22
23 switchColors( colorElements, color );
24 });
25
26 var $editColorPaletteBtn = parentLi.find( '.color-palette-edit-icon' );
27
28 $editColorPaletteBtn.on( 'click', function(){
29 setTimeout( function(){
30 if ( 0 != parentLi.find( '.color-palette-edit-interface').length ) {
31 parentLi.find( '.color-palette-edit-interface').find( '.color-picker' ).each( function(){
32 var $input = $( this ),
33 $field_type = $input.closest( '.wp-picker-container' ).siblings( 'label' ).attr( 'data-key' ),
34 colorButton = $input.closest('.wp-picker-input-wrap').siblings('.wp-color-result')[0];
35
36 if (!colorButton) {
37 console.error('Color button not found!');
38 return;
39 }
40
41 const observer = new MutationObserver((mutations) => {
42 mutations.forEach((mutation) => {
43 if (mutation.attributeName === 'style') {
44 const newColor = colorButton.style.backgroundColor;
45 switchColors( $field_type, newColor );
46 }
47 });
48 });
49
50 /**
51 * Need to observe compulsory.
52 */
53 observer.observe(colorButton, {
54 attributes: true,
55 attributeFilter: ['style']
56 });
57 })
58 }
59 }, 1000);
60 });
61 });
62
63 /**
64 * Switch color.
65 *
66 * @since 3.3.0
67 *
68 * @param {string} field_type
69 * @param {string} color
70 */
71 function switchColors( field_type, color ){
72 switch (field_type) {
73 case 'form_background':
74 container.css( 'background-color', color );
75 break;
76 case 'field_background':
77 container.find( 'input, textarea, select, canvas.evf-signature-canvas, .StripeElement' ).css( 'background-color', color );
78 break;
79 case 'field_sublabel':
80 field_sub_label.css( 'color', color );
81 break;
82 case 'field_label':
83 field_label.css( 'color', color );
84 break;
85 case 'button_text':
86 button.css( 'color', color );
87 break;
88 case 'button_background':
89 button.css( 'background-color', color );
90 break;
91 }
92 }
93
94 /**
95 * Add Google font link into header.
96 *
97 * @param {string} font_name Google Font Name.
98 */
99 function addGoogleFont( font_name ) {
100 var font_plus = '',
101 font_name = font_name.split( ' ' );
102
103 if ( $.isArray( font_name ) ) {
104 font_plus = font_name[0];
105 for ( var i = 1; i < font_name.length; i++ ) {
106 font_plus = font_plus + '+' + font_name[i];
107 }
108 }
109
110 if ( 'yes' === data.load_fonts_locally ) {
111 $.ajax(
112 {
113 type: 'POST',
114 url: data.ajax_url,
115 data: {
116 action: 'everest_forms_get_local_font_url',
117 font_url: 'https://fonts.googleapis.com/css?family=' + font_plus
118 },
119 success: response => {
120 if ( response.success ) {
121 $( '<link href="' + response.data + '" rel="stylesheet" type="text/css">' ).appendTo( 'head' );
122 }
123 }
124 }
125 );
126 } else {
127 $( '<link href="https://fonts.googleapis.com/css?family=' + font_plus + '" rel="stylesheet" type="text/css">' ).appendTo( 'head' );
128 }
129
130 $( '<link href="https://fonts.googleapis.com/css?family=' + font_plus + '" rel="stylesheet" type="text/css">' ).appendTo( 'head' );
131 }
132
133 /**
134 * Add placeholder styles for form fields.
135 *
136 * @param {string} id Field ID.
137 * @param {string} color Color for placeholder.
138 * @param {string} decoration Text decoration for placeholder.
139 */
140 function addPlaceholderStyles( id, color, decoration ) {
141 var style = "#" + id + " input::placeholder, #" + id + " textarea::placeholder {\n";
142 if ( '' !== color ) {
143 style += "color: " + color + " !important;\n";
144 }
145 if ( decoration ) {
146 style += "text-decoration: " + decoration + " !important;\n";
147 }
148 style += "}\n";
149
150 return style;
151 }
152
153 function addInputStylesOutlineVariation( id, color, checked_color ){
154 var style = "#" + id + " input[type='radio'], #" + id + " input[type='checkbox'] {\n" ;
155 style += "border: 1px solid " + color + " !important;\n";
156 style += "}\n";
157
158 style = "#" + id + " input[type='radio']:checked, #" + id + " input[type='checkbox']:checked {\n" ;
159 style += "border: 1px solid " + checked_color + " !important;\n";
160 style += "}\n";
161
162 style += "#" + id + " input[type='radio']:checked::before, #" + id + " input[type='checkbox']:checked::before {\n" ;
163 style += "content: '';\n";
164 style += "}\n";
165
166 style += "#" + id + " input[type='radio']:checked::before {\n" ;
167 style += "height: 50%;\n";
168 style += "width: 50%;\n";
169 style += "border-radius: 50%;\n";
170 style += "background-color: " + checked_color + " !important;\n";
171 style += "}\n";
172
173 style += "#" + id + " input[type='checkbox']:checked::before {\n" ;
174 style += "height: 50%;\n";
175 style += "width: 25%;\n";
176 style += "border: solid " + checked_color + " !important;\n";
177 style += "border-width: 0 2px 2px 0 !important;\n";
178 style += "transform: rotate(45deg);\n";
179 style += "margin-top: -12%;\n";
180 style += "}\n";
181
182 return style;
183 }
184
185 function addInputStylesFilledVariation( id, checked_color ){
186 var style = "#" + id + " input[type='radio']:checked, #" + id + " input[type='checkbox']:checked {\n" ;
187 style += "background-color: " + checked_color + " !important;\n";
188 style += "}\n";
189
190 style += "#" + id + " input[type='radio']:checked::before, #" + id + " input[type='checkbox']:checked::before {\n" ;
191 style += "content: '';\n";
192 style += "height: 50%;\n";
193 style += "}\n";
194
195 style += "#" + id + " input[type='radio']:checked::before {\n" ;
196 style += "width: 50%;\n";
197 style += "border-radius: 50%;\n";
198 style += "background-color: #fff !important;\n";
199 style += "}\n";
200
201 style += "#" + id + " input[type='checkbox']:checked::before {\n" ;
202 style += "width: 25%;\n";
203 style += "border: solid #fff !important;\n";
204 style += "border-width: 0 2px 2px 0 !important;\n";
205 style += "transform: rotate(45deg);\n";
206 style += "margin-top: -12%;\n";
207 style += "}\n";
208
209 return style;
210 }
211 function addInputStylesDefaultVariation( id ){
212 var style = "#" + id + " input[type='radio']:checked::before, #" + id + " input[type='checkbox']:checked::before {\n" ;
213 style += "content: none !important;\n";
214
215 return style;
216 }
217
218 // Render style for live previews.
219 $(document).ready( function() {
220 var id = container.attr('id');
221 var style = "<style id='placeholder-" + id + "'>\n";
222 style += "</style>"
223 style += "<style id='inputstyle-" + id + "'>\n";
224 style += "</style>"
225 container.prepend(style);
226 });
227
228 // Active template.
229 wp.customize( settings + '[template]', function( value ) {
230 value.bind( function( newval ) {
231 controls_wrapper.find( '.control-section-evf-templates' ).find( '.customize-template-name' ).text( data.templates[ newval ] );
232 } );
233 } );
234
235 //Show the clone template on hover
236 $(document).ready(function() {
237 controls_wrapper.find('input[name="image-radio-everest_forms_styles[563][template]"]').parent().hover(function() {
238 var $img = $(this).find('img');
239 var $clone = $img.clone().addClass('everest-forms-clone-image');
240 $(".everest-forms").append($clone);
241 $clone.css({
242 'position': 'absolute',
243 'left': 0,
244 'top': '50%',
245 'opacity': 0,
246 'transform': 'translateY(-50%)',
247 'transition': 'opacity 0.3s, transform 0.3s',
248 'z-index': 1000
249 });
250
251 setTimeout(function() {
252 $clone.css({
253 'opacity': 1,
254 'transform': 'scale(1)'
255 });
256 }, 0);
257 }, function() {
258 var $clone = $(".everest-forms").find('.everest-forms-clone-image');
259 $clone.css({
260 'opacity': 0
261 });
262 setTimeout(function() {
263 $clone.remove();
264 }, 300);
265 });
266 });
267
268
269 /* Form Wrapper start */
270
271 // Form Wrapper: width
272 wp.customize( settings + '[form_container][width]', function( value ) {
273 value.bind( function( newval ) {
274 container.css( 'width', newval + '%' );
275 } );
276 } );
277
278 // Form Wrapper: font_family
279 wp.customize( settings + '[font][font_family]', function( value ) {
280 value.bind( function( newval ) {
281 if ( '' === newval ) {
282 container.css( 'font-family', 'inherit' );
283 container.find('.evf-field-title h3').css( 'font-family', 'inherit' );
284 } else {
285 addGoogleFont( newval );
286 container.css( 'font-family', newval );
287 container.find('.evf-field-title h3').css( 'font-family', 'inherit' );
288 }
289 } );
290 } );
291
292 // Form Wrapper: background_color
293 wp.customize( settings + '[form_container][background_color]', function( value ) {
294 value.bind( function( newval ) {
295 container.css( 'background-color', newval );
296 } );
297 } );
298
299 // Form Wrapper: background_image
300 wp.customize( settings + '[form_container][opacity]', function( value ) {
301 value.bind( function( newval ) {
302 container.css( 'opacity', newval );
303 } );
304 } );
305
306 // Form Wrapper: Opacity
307 wp.customize( settings + '[form_container][background_image]', function( value ) {
308 value.bind( function( newval ) {
309 container.css( 'background-image', 'url(' + newval + ')' );
310 } );
311 } );
312
313 // Form Wrapper: background_size
314 wp.customize( settings + '[form_container][background_size]', function( value ) {
315 value.bind( function( newval ) {
316 container.css( 'background-size', newval );
317 } );
318 } );
319
320 // Form Wrapper: background_position_x
321 wp.customize( settings + '[form_container][background_position_x]', function( value ) {
322 value.bind( function( newval ) {
323 var position = newval;
324 wp.customize( settings + '[form_container][background_position_y]', function( value ) {
325 position += ' ' + value.get();
326 } );
327 container.css( 'background-position', position );
328 } );
329 } );
330
331 // Form Wrapper: background_position_y
332 wp.customize( settings + '[form_container][background_position_y]', function( value ) {
333 value.bind( function( newval ) {
334 var position = '';
335 wp.customize( settings + '[form_container][background_position_x]', function( value ) {
336 position += value.get();
337 } );
338 position += ' ' + newval;
339 container.css( 'background-position', position );
340 } );
341 } );
342
343 // Form Wrapper: background_repeat
344 wp.customize( settings + '[form_container][background_repeat]', function( value ) {
345 value.bind( function( newval ) {
346 container.css( 'background-repeat', newval );
347 } );
348 } );
349
350 // Form Wrapper: background_attachment
351 wp.customize( settings + '[form_container][background_attachment]', function( value ) {
352 value.bind( function( newval ) {
353 container.css( 'background-attachment', newval );
354 } ); wp.customize( settings + '[form_container][background_color]', function( value ) {
355 value.bind( function( newval ) {
356 container.css( 'background-color', newval );
357 } );
358 } );
359
360 } );
361
362 // Form Wrapper: border_type
363 wp.customize( settings + '[form_container][border_type]', function( value ) {
364 value.bind( function( newval ) {
365 container.css( 'border-style', newval );
366
367 wp.customize( settings + '[form_container][border_color]', function( value ) {
368 container.css( 'border-color', value.get() );
369 } );
370 } );
371 } );
372
373 // Form Wrapper: border_width
374 wp.customize( settings + '[form_container][border_width]', function( value ) {
375 value.bind( function( newval ) {
376 var default_unit = 'px';
377
378 if ( typeof newval != 'object' ) {
379 newval = JSON.parse( newval );
380 }
381
382 $.each( newval, function( prop, val ) {
383 if ( dimension_directions.indexOf( prop ) != -1 ) {
384 container.css( 'border-' + prop + '-width', val + default_unit );
385 }
386 } );
387 } );
388 } );
389
390 // Form Wrapper: border_color
391 wp.customize( settings + '[form_container][border_color]', function( value ) {
392 value.bind( function( newval ) {
393 container.css( 'border-color', newval );
394 } );
395 } );
396
397 // Form Wrapper: border_radius
398 wp.customize( settings + '[form_container][border_radius]', function( value ) {
399 value.bind( function( newval ) {
400 if ( typeof newval != 'object' ) {
401 newval = JSON.parse( newval );
402 }
403
404 var unit = newval['unit'];
405
406 $.each( newval, function( prop, val ) {
407 switch( prop ) {
408 case 'top':
409 container.css( 'border-top-left-radius', val + unit );
410 break;
411 case 'right':
412 container.css( 'border-top-right-radius', val + unit );
413 break;
414 case 'bottom':
415 container.css( 'border-bottom-right-radius', val + unit );
416 break;
417 case 'left':
418 container.css( 'border-bottom-left-radius', val + unit );
419 break;
420 }
421 } );
422 } );
423 } );
424
425 // Form Wrapper: margin
426 wp.customize( settings + '[form_container][margin]', function( value ) {
427 preview_buttons.on( 'click', function() {
428 var control_value = value.get();
429 var active_responsive_device = $(this).data('device');
430 var default_unit = 'px';
431
432 container.css( 'margin', '' );
433 if ( typeof control_value[active_responsive_device] == 'undefined') {
434 active_responsive_device = 'desktop';
435 }
436 $.each( control_value[active_responsive_device], function( prop, val ) {
437 container.css( 'margin-' + prop, val + default_unit );
438 } );
439 } );
440 value.bind( function( newval ) {
441 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
442 var default_unit = 'px';
443
444 if ( typeof newval != 'object' ) {
445 newval = JSON.parse( newval );
446 }
447 $.each( newval[active_responsive_device], function( prop, val ) {
448 container.css( 'margin-' + prop, val + default_unit );
449 } );
450 } );
451 } );
452
453 // Form Wrapper: padding
454 wp.customize( settings + '[form_container][padding]', function( value ) {
455 preview_buttons.on( 'click', function() {
456 var control_value = value.get();
457 var active_responsive_device = $(this).data('device');
458 var default_unit = 'px';
459
460 container.css( 'padding', '' );
461 if ( typeof control_value[active_responsive_device] == 'undefined') {
462 active_responsive_device = 'desktop';
463 }
464 $.each( control_value[active_responsive_device], function( prop, val ) {
465 container.css( 'padding-' + prop, val + default_unit );
466 } );
467 } );
468 value.bind( function( newval ) {
469 var default_unit = 'px';
470 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
471
472 if ( typeof newval != 'object' ) {
473 newval = JSON.parse( newval );
474 }
475 $.each( newval[active_responsive_device], function( prop, val ) {
476 container.css( 'padding-' + prop, val + default_unit );
477 } );
478 } );
479 } );
480
481 /* Form Wrapper End */
482
483 /* Field Labels Start */
484
485 // Field Labels: font_size
486 wp.customize( settings + '[typography][field_labels_font_size]', function( value ) {
487 var default_unit = 'px';
488 value.bind( function( newval ) {
489 field_label.css( 'font-size', newval + default_unit );
490 } );
491 } );
492
493 // Field Labels: font_color
494 wp.customize( settings + '[typography][field_labels_font_color]', function( value ) {
495 value.bind( function( newval ) {
496 field_label.css( 'color', newval );
497 } );
498 } );
499
500 // Field Labels: font_style
501 wp.customize( settings + '[typography][field_labels_font_style]', function( value ) {
502 value.bind( function( newval ) {
503 if ( typeof newval != 'object' ) {
504 newval = JSON.parse( newval );
505 }
506
507 $.each( newval, function( prop, val ) {
508 switch( prop ) {
509 case 'bold':
510 field_label.find( '.evf-label' ).css( 'font-weight', (val === true) ? 'bold' : 'normal' );
511 break;
512 case 'italic':
513 field_label.find( '.evf-label' ).css( 'font-style', (val === true) ? 'italic' : 'normal' );
514 break;
515 case 'underline':
516 field_label.find( '.evf-label' ).css( 'text-decoration', (val === true) ? 'underline' : 'none' );
517 break;
518 case 'uppercase':
519 field_label.find( '.evf-label' ).css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
520 break;
521 }
522 } );
523 } );
524 } );
525
526 // Field Labels: text_alignment
527 wp.customize( settings + '[typography][field_labels_text_alignment]', function( value ) {
528 value.bind( function( newval ) {
529 field_label.css( 'text-align', newval );
530 } );
531 } );
532
533 // Field Labels: line_height
534 wp.customize( settings + '[typography][field_labels_line_height]', function( value ) {
535 value.bind( function( newval ) {
536 field_label.css( 'line-height', newval );
537 } );
538 } );
539
540 // Field Labels: margin
541 wp.customize( settings + '[typography][field_labels_margin]', function( value ) {
542 preview_buttons.on( 'click', function() {
543 var control_value = value.get();
544 var active_responsive_device = $(this).data('device');
545 var default_unit = 'px';
546
547 field_label.css( 'margin', '' );
548 if ( typeof control_value[active_responsive_device] == 'undefined') {
549 active_responsive_device = 'desktop';
550 }
551 $.each( control_value[active_responsive_device], function( prop, val ) {
552 field_label.css( 'margin-' + prop, val + default_unit );
553 } );
554 } );
555 value.bind( function( newval ) {
556 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
557 var default_unit = 'px';
558
559 if ( typeof newval != 'object' ) {
560 newval = JSON.parse( newval );
561 }
562
563 $.each( newval[active_responsive_device], function( prop, val ) {
564 field_label.css( 'margin-' + prop, val + default_unit );
565 } );
566 } );
567 } );
568
569 // Field Labels: padding
570 wp.customize( settings + '[typography][field_labels_padding]', function( value ) {
571 preview_buttons.on( 'click', function() {
572 var control_value = value.get();
573 var active_responsive_device = $(this).data('device');
574 var default_unit = 'px';
575
576 field_label.css( 'padding', '' );
577 if ( typeof control_value[active_responsive_device] == 'undefined') {
578 active_responsive_device = 'desktop';
579 }
580 $.each( control_value[active_responsive_device], function( prop, val ) {
581 field_label.css( 'padding-' + prop, val + default_unit );
582 } );
583 } );
584 value.bind( function( newval ) {
585 var default_unit = 'px';
586 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
587
588 if ( typeof newval != 'object' ) {
589 newval = JSON.parse( newval );
590 }
591
592 $.each( newval[active_responsive_device], function( prop, val ) {
593 field_label.css( 'padding-' + prop, val + default_unit );
594 } );
595 } );
596 } );
597
598 /* Field Labels End */
599
600 /* Field Sublabels Start */
601
602 // Field Sublabels: font_size
603 wp.customize( settings + '[typography][field_sublabels_font_size]', function( value ) {
604 var default_unit = 'px';
605 value.bind( function( newval ) {
606 field_sub_label.css( 'font-size', newval + default_unit );
607 } );
608 } );
609
610 // Field Sublabels: font_color
611 wp.customize( settings + '[typography][field_sublabels_font_color]', function( value ) {
612 value.bind( function( newval ) {
613 field_sub_label.css( 'color', newval );
614 } );
615 } );
616
617 // Field Sublabels: font_style
618 wp.customize( settings + '[typography][field_sublabels_font_style]', function( value ) {
619 value.bind( function( newval ) {
620 if ( typeof newval != 'object' ) {
621 newval = JSON.parse( newval );
622 }
623
624 $.each( newval, function( prop, val ) {
625 switch( prop ) {
626 case 'bold':
627 field_sub_label.css( 'font-weight', (val === true) ? 'bold' : 'normal' );
628 break;
629 case 'italic':
630 field_sub_label.css( 'font-style', (val === true) ? 'italic' : 'normal' );
631 break;
632 case 'underline':
633 field_sub_label.css( 'text-decoration', (val === true) ? 'underline' : 'none' );
634 break;
635 case 'uppercase':
636 field_sub_label.css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
637 break;
638 }
639 } );
640 } );
641 } );
642
643 // Field Sublabels: text_alignment
644 wp.customize( settings + '[typography][field_sublabels_text_alignment]', function( value ) {
645 value.bind( function( newval ) {
646 field_sub_label.css( 'text-align', newval );
647 } );
648 } );
649
650 // Field Sublabels: line_height
651 wp.customize( settings + '[typography][field_sublabels_line_height]', function( value ) {
652 value.bind( function( newval ) {
653 field_sub_label.css( 'line-height', newval );
654 } );
655 } );
656
657 // Field Sublabels: margin
658 wp.customize( settings + '[typography][field_sublabels_margin]', function( value ) {
659 preview_buttons.on( 'click', function() {
660 var control_value = value.get();
661 var active_responsive_device = $(this).data('device');
662 var default_unit = 'px';
663
664 field_sub_label.css( 'margin', '' );
665 if ( typeof control_value[active_responsive_device] == 'undefined') {
666 active_responsive_device = 'desktop';
667 }
668 $.each( control_value[active_responsive_device], function( prop, val ) {
669 field_sub_label.css( 'margin-' + prop, val + default_unit );
670 } );
671 } );
672 value.bind( function( newval ) {
673 var default_unit = 'px';
674 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
675
676 if ( typeof newval != 'object' ) {
677 newval = JSON.parse( newval );
678 }
679
680 $.each( newval[active_responsive_device], function( prop, val ) {
681 field_sub_label.css( 'margin-' + prop, val + default_unit );
682 } );
683 } );
684 } );
685
686 // Field Sublabels: padding
687 wp.customize( settings + '[typography][field_sublabels_padding]', function( value ) {
688 preview_buttons.on( 'click', function() {
689 var control_value = value.get();
690 var active_responsive_device = $(this).data('device');
691 var default_unit = 'px';
692
693 field_sub_label.css( 'padding', '' );
694 if ( typeof control_value[active_responsive_device] == 'undefined') {
695 active_responsive_device = 'desktop';
696 }
697 $.each( control_value[active_responsive_device], function( prop, val ) {
698 field_sub_label.css( 'padding-' + prop, val + default_unit );
699 } );
700 } );
701 value.bind( function( newval ) {
702 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
703 var default_unit = 'px';
704 if ( typeof newval != 'object' ) {
705 newval = JSON.parse( newval );
706 }
707 $.each( newval[active_responsive_device], function( prop, val ) {
708 field_sub_label.css( 'padding-' + prop, val + default_unit );
709 } );
710 } );
711 } );
712
713 /* Field Sublabels End */
714
715 /* Field Description Start */
716
717 // Field Descriptin: font_size
718 wp.customize( settings + '[typography][field_description_font_size]', function( value ) {
719 var default_unit = 'px';
720 value.bind( function( newval ) {
721 field_description.css( 'font-size', newval + default_unit );
722 } );
723 } );
724
725 // Field Description: font_color
726 wp.customize( settings + '[typography][field_description_font_color]', function( value ) {
727 value.bind( function( newval ) {
728 field_description.css( 'color', newval );
729 } );
730 } );
731
732 // Field Description: font_style
733 wp.customize( settings + '[typography][field_description_font_style]', function( value ) {
734 value.bind( function( newval ) {
735 if ( typeof newval != 'object' ) {
736 newval = JSON.parse( newval );
737 }
738
739 $.each( newval, function( prop, val ) {
740 switch( prop ) {
741 case 'bold':
742 field_description.css( 'font-weight', (val === true) ? 'bold' : 'normal' );
743 break;
744 case 'italic':
745 field_description.css( 'font-style', (val === true) ? 'italic' : 'normal' );
746 break;
747 case 'underline':
748 field_description.css( 'text-decoration', (val === true) ? 'underline' : 'none' );
749 break;
750 case 'uppercase':
751 field_description.css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
752 break;
753 }
754 } );
755 } );
756 } );
757
758 // Field Description: text_alignment
759 wp.customize( settings + '[typography][field_description_text_alignment]', function( value ) {
760 value.bind( function( newval ) {
761 field_description.css( 'text-align', newval );
762 } );
763 } );
764
765 // Field Description: line_height
766 wp.customize( settings + '[typography][field_description_line_height]', function( value ) {
767 value.bind( function( newval ) {
768 field_description.css( 'line-height', newval );
769 } );
770 } );
771
772 // Field Description: margin
773 wp.customize( settings + '[typography][field_description_margin]', function( value ) {
774 preview_buttons.on( 'click', function() {
775 var control_value = value.get();
776 var active_responsive_device = $(this).data('device');
777 var default_unit = 'px';
778
779 field_description.css( 'margin', '' );
780 if ( typeof control_value[active_responsive_device] == 'undefined') {
781 active_responsive_device = 'desktop';
782 }
783 $.each( control_value[active_responsive_device], function( prop, val ) {
784 field_description.css( 'margin-' + prop, val + default_unit );
785 } );
786 } );
787 value.bind( function( newval ) {
788 var default_unit = 'px';
789 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
790
791 if ( typeof newval != 'object' ) {
792 newval = JSON.parse( newval );
793 }
794
795 $.each( newval[active_responsive_device], function( prop, val ) {
796 field_description.css( 'margin-' + prop, val + default_unit );
797 } );
798 } );
799 } );
800
801 // Field Description: padding
802 wp.customize( settings + '[typography][field_description_padding]', function( value ) {
803 preview_buttons.on( 'click', function() {
804 var control_value = value.get();
805 var active_responsive_device = $(this).data('device');
806 var default_unit = 'px';
807
808 field_description.css( 'padding', '' );
809 if ( typeof control_value[active_responsive_device] == 'undefined') {
810 active_responsive_device = 'desktop';
811 }
812 $.each( control_value[active_responsive_device], function( prop, val ) {
813 field_description.css( 'padding-' + prop, val + default_unit );
814 } );
815 } );
816 value.bind( function( newval ) {
817 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
818 var default_unit = 'px';
819 if ( typeof newval != 'object' ) {
820 newval = JSON.parse( newval );
821 }
822 $.each( newval[active_responsive_device], function( prop, val ) {
823 field_description.css( 'padding-' + prop, val + default_unit );
824 } );
825 } );
826 } );
827
828 /* Field Description End*/
829
830
831 /* Field Styles Start */
832
833 // Field Styles: font_size
834 wp.customize( settings + '[typography][field_styles_font_size]', function( value ) {
835 var default_unit = 'px';
836 value.bind( function( newval ) {
837 container.find('input, textarea, select, .evf-payment-total, .evf-single-item-price, .StripeElement').css( 'font-size', newval + default_unit );
838 } );
839 } );
840
841 // Field Styles: font_color
842 var prev_field_style_font_color = '';
843 wp.customize( settings + '[typography][field_styles_font_color]', function( value ) {
844 value.bind( function( newval ) {
845 prev_field_style_font_color = newval;
846 container.find('input, textarea, select, .evf-payment-total, .evf-single-item-price, .StripeElement').css( 'color', newval );
847 } );
848 } );
849
850 // Field Styles: placeholder_font_color
851 wp.customize( settings + '[typography][field_styles_placeholder_font_color]', function( value ) {
852 var id = container.attr('id');
853 value.bind( function( newval ) {
854 container.find('style#placeholder-'+id).html( addPlaceholderStyles( id, newval ) );
855 } );
856 } );
857
858 // Field Styles: font_style
859 wp.customize( settings + '[typography][field_styles_font_style]', function( value ) {
860 value.bind( function( newval ) {
861 var id = container.attr('id');
862 if ( typeof newval != 'object' ) {
863 newval = JSON.parse( newval );
864 }
865
866 $.each( newval, function( prop, val ) {
867 switch( prop ) {
868 case 'bold':
869 container.find('input, textarea, select, .evf-payment-total, .evf-single-item-price, .StripeElement').css( 'font-weight', (val === true) ? 'bold' : 'normal' );
870 break;
871 case 'italic':
872 container.find('input, textarea, select, .evf-payment-total, .evf-single-item-price, .StripeElement').css( 'font-style', (val === true) ? 'italic' : 'normal' );
873 break;
874 case 'underline':
875 container.find('input, textarea, select, .evf-payment-total, .evf-single-item-price, .StripeElement').css( 'text-decoration', (val === true) ? 'underline' : 'none' );
876 container.find('style#'+id).html( addPlaceholderStyles( id, '', (val === true) ? 'underline' : 'none' ) );
877 break;
878 case 'uppercase':
879 container.find('input, textarea, select, .evf-payment-total, .evf-single-item-price, .StripeElement').css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
880 break;
881 }
882 } );
883 } );
884 } );
885
886 // Field Styles: alignment
887 wp.customize( settings + '[typography][field_styles_alignment]', function( value ) {
888 value.bind( function( newval ) {
889 container.find('input, textarea, .evf-payment-total, .evf-single-item-price').css( 'text-align', newval );
890 container.find('select').css( 'text-align-last', newval );
891
892 var option_direction = 'ltr';
893 if ( 'right' == newval ) {
894 option_direction = 'rtl';
895 }
896
897 container.find( 'option' ).css( 'direction', option_direction );
898 } );
899 } );
900
901 // Field Styles: border_type
902 wp.customize( settings + '[field_styles][border_type]', function( value ) {
903 value.bind( function( newval ) {
904 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'border-style', newval );
905 } );
906 } );
907
908 // Field Styles: border_width
909 wp.customize( settings + '[field_styles][border_width]', function( value ) {
910 value.bind( function( newval ) {
911 var default_unit = 'px';
912
913 if ( typeof newval != 'object' ) {
914 newval = JSON.parse( newval );
915 }
916
917 $.each( newval, function( prop, val ) {
918 if ( dimension_directions.indexOf( prop ) != -1 ) {
919 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'border-' + prop + '-width', val + default_unit );
920 }
921 } );
922 } );
923 } );
924
925 // Field Styles: border_color
926 var prev_border_color='';
927 wp.customize( settings + '[typography][field_styles_border_color]', function( value ) {
928 value.bind( function( newval ) {
929 prev_border_color = newval;
930 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'border-color', newval );
931 } );
932 } );
933
934 // Field Styles: border_focus_color
935 wp.customize( settings + '[typography][field_styles_border_focus_color]', function( value ) {
936 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement ').on('focus blur', function(e) {
937 if ( 'focus' == e.type ) {
938 var control_value = value.get();
939 $( this ).css( 'border-color', control_value );
940 } else {
941 $( this ).css( 'border-color', prev_border_color );
942 }
943 } );
944 } );
945
946 // Field Styles: border_radius
947 wp.customize( settings + '[field_styles][border_radius]', function( value ) {
948 value.bind( function( newval ) {
949 if ( typeof newval != 'object' ) {
950 newval = JSON.parse( newval );
951 }
952
953 var unit = newval['unit'];
954
955 $.each( newval, function( prop, val ) {
956 switch( prop ) {
957 case 'top':
958 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'border-top-left-radius', val + unit );
959 break;
960 case 'right':
961 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'border-top-right-radius', val + unit );
962 break;
963 case 'bottom':
964 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'border-bottom-right-radius', val + unit );
965 break;
966 case 'left':
967 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'border-bottom-left-radius', val + unit );
968 break;
969 }
970 } );
971 } );
972 } );
973
974 // Field Styles: background_color
975
976
977 // Field Styles: margin
978 wp.customize( settings + '[typography][field_styles_margin]', function( value ) {
979 preview_buttons.on( 'click', function() {
980 var control_value = value.get();
981 var active_responsive_device = $(this).data('device');
982 var default_unit = 'px';
983
984 container.find('input, textarea, select, canvas.evf-signature-canvas, .evf-payment-total, .evf-single-item-price, .StripeElement').css( 'margin', '' );
985 if ( typeof control_value[active_responsive_device] == 'undefined') {
986 active_responsive_device = 'desktop';
987 }
988 $.each( control_value[active_responsive_device], function( prop, val ) {
989 container.find('input, textarea, select, canvas.evf-signature-canvas, .evf-payment-total, .evf-single-item-price, .StripeElement').css( 'margin-' + prop, val + default_unit );
990 } );
991 } );
992 value.bind( function( newval ) {
993 var default_unit = 'px';
994 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
995
996 if ( typeof newval != 'object' ) {
997 newval = JSON.parse( newval );
998 }
999
1000 $.each( newval[active_responsive_device], function( prop, val ) {
1001 container.find('input, textarea, select, canvas.evf-signature-canvas, .evf-payment-total, .evf-single-item-price, .StripeElement').css( 'margin-' + prop, val + default_unit );
1002 } );
1003 } );
1004 } );
1005
1006 // Field Styles: padding
1007 wp.customize( settings + '[typography][field_styles_padding]', function( value ) {
1008 preview_buttons.on( 'click', function() {
1009 var control_value = value.get();
1010 var active_responsive_device = $(this).data('device');
1011 var default_unit = 'px';
1012
1013 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'padding', '' );
1014 if ( typeof control_value[active_responsive_device] == 'undefined') {
1015 active_responsive_device = 'desktop';
1016 }
1017 $.each( control_value[active_responsive_device], function( prop, val ) {
1018 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'padding-' + prop, val + default_unit );
1019 } );
1020 } );
1021 value.bind( function( newval ) {
1022 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
1023 var default_unit = 'px';
1024 if ( typeof newval != 'object' ) {
1025 newval = JSON.parse( newval );
1026 }
1027 $.each( newval[active_responsive_device], function( prop, val ) {
1028 container.find('input, textarea, select, canvas.evf-signature-canvas, .StripeElement').css( 'padding-' + prop, val + default_unit );
1029 } );
1030 } );
1031 } );
1032
1033 /* Field Styles End */
1034
1035 /* File Upload Styles Start */
1036
1037 // File Upload Styles: font_size
1038 wp.customize( settings + '[typography][file_upload_font_size]', function( value ) {
1039 var default_unit = 'px';
1040 value.bind( function( newval ) {
1041 container.find('.everest-forms-uploader .everest-forms-upload-title, .everest-forms-uploader .everest-forms-upload-hint, .everest-forms-uploader .dz-details, .everest-forms-uploader .dz-error-message').css( 'font-size', newval + default_unit );
1042 } );
1043 } );
1044
1045 // File Upload Styles: font_color
1046 var prev_file_upload_style_font_color = '';
1047 wp.customize( settings + '[typography][file_upload_font_color]', function( value ) {
1048 value.bind( function( newval ) {
1049 prev_file_upload_style_font_color = newval;
1050 container.find('.everest-forms-uploader .everest-forms-upload-title, .everest-forms-uploader .everest-forms-upload-hint, .everest-forms-uploader .dz-details').css( 'color', newval );
1051 } );
1052 } );
1053
1054 // File Upload Styles: background_color
1055 wp.customize( settings + '[typography][file_upload_background_color]', function( value ) {
1056 value.bind( function( newval ) {
1057 container.find( '.everest-forms-uploader' ).css( 'background-color', newval );
1058 } );
1059 } );
1060
1061 // File Upload Icon Styles: background_color
1062 wp.customize( settings + '[typography][file_upload_icon_background_color]', function( value ) {
1063 value.bind( function( newval ) {
1064 container.find( '.everest-forms-uploader .dz-message > svg' ).css( 'background-color', newval );
1065 } );
1066 } );
1067
1068 // File Upload Icon Styles: fill_color
1069 var prev_file_upload_style_icon_fill_color = '';
1070 wp.customize( settings + '[typography][file_upload_icon_color]', function( value ) {
1071 value.bind( function( newval ) {
1072 prev_file_upload_style_icon_fill_color = newval;
1073 container.find('.everest-forms-uploader .dz-message > svg').css( 'fill', newval );
1074 } );
1075 } );
1076
1077 // File Upload Styles: border_type
1078 wp.customize( settings + '[file_upload_styles][border_type]', function( value ) {
1079 value.bind( function( newval ) {
1080 container.find('.everest-forms-uploader').css( 'border-style', newval );
1081 } );
1082 } );
1083
1084 // File Upload Styles: border_width
1085 wp.customize( settings + '[file_upload_styles][border_width]', function( value ) {
1086 value.bind( function( newval ) {
1087 var default_unit = 'px';
1088
1089 if ( typeof newval != 'object' ) {
1090 newval = JSON.parse( newval );
1091 }
1092
1093 $.each( newval, function( prop, val ) {
1094 if ( dimension_directions.indexOf( prop ) != -1 ) {
1095 container.find('.everest-forms-uploader').css( 'border-' + prop + '-width', val + default_unit );
1096 }
1097 } );
1098 } );
1099 } );
1100
1101 // File Upload Styles: border_color
1102 var prev_border_color='';
1103 wp.customize( settings + '[typography][file_upload_border_color]', function( value ) {
1104 value.bind( function( newval ) {
1105 prev_border_color = newval;
1106 container.find('.everest-forms-uploader').css( 'border-color', newval );
1107 } );
1108 } );
1109
1110 // File Upload Styles: border_radius
1111 wp.customize( settings + '[file_upload_styles][border_radius]', function( value ) {
1112 value.bind( function( newval ) {
1113 if ( typeof newval != 'object' ) {
1114 newval = JSON.parse( newval );
1115 }
1116
1117 var unit = newval['unit'];
1118
1119 $.each( newval, function( prop, val ) {
1120 switch( prop ) {
1121 case 'top':
1122 container.find('.everest-forms-uploader').css( 'border-top-left-radius', val + unit );
1123 break;
1124 case 'right':
1125 container.find('.everest-forms-uploader').css( 'border-top-right-radius', val + unit );
1126 break;
1127 case 'bottom':
1128 container.find('.everest-forms-uploader').css( 'border-bottom-right-radius', val + unit );
1129 break;
1130 case 'left':
1131 container.find('.everest-forms-uploader').css( 'border-bottom-left-radius', val + unit );
1132 break;
1133 }
1134 } );
1135 } );
1136 } );
1137
1138 // File Upload Styles: margin
1139 wp.customize( settings + '[typography][file_upload_margin]', function( value ) {
1140 preview_buttons.on( 'click', function() {
1141 var control_value = value.get();
1142 var active_responsive_device = $(this).data('device');
1143 var default_unit = 'px';
1144
1145 container.find('.everest-forms-uploader').css( 'margin', '' );
1146 if ( typeof control_value[active_responsive_device] == 'undefined') {
1147 active_responsive_device = 'desktop';
1148 }
1149 $.each( control_value[active_responsive_device], function( prop, val ) {
1150 container.find('.everest-forms-uploader').css( 'margin-' + prop, val + default_unit );
1151 } );
1152 } );
1153 value.bind( function( newval ) {
1154 var default_unit = 'px';
1155 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
1156
1157 if ( typeof newval != 'object' ) {
1158 newval = JSON.parse( newval );
1159 }
1160
1161 $.each( newval[active_responsive_device], function( prop, val ) {
1162 container.find('.everest-forms-uploader').css( 'margin-' + prop, val + default_unit );
1163 } );
1164 } );
1165 } );
1166
1167 // File Upload Styles: padding
1168 wp.customize( settings + '[typography][file_upload_padding]', function( value ) {
1169 preview_buttons.on( 'click', function() {
1170 var control_value = value.get();
1171 var active_responsive_device = $(this).data('device');
1172 var default_unit = 'px';
1173
1174 container.find('.everest-forms-uploader').css( 'padding', '' );
1175 if ( typeof control_value[active_responsive_device] == 'undefined') {
1176 active_responsive_device = 'desktop';
1177 }
1178 $.each( control_value[active_responsive_device], function( prop, val ) {
1179 container.find('.everest-forms-uploader').css( 'padding-' + prop, val + default_unit );
1180 } );
1181 } );
1182 value.bind( function( newval ) {
1183 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
1184 var default_unit = 'px';
1185 if ( typeof newval != 'object' ) {
1186 newval = JSON.parse( newval );
1187 }
1188 $.each( newval[active_responsive_device], function( prop, val ) {
1189 container.find('.everest-forms-uploader').css( 'padding-' + prop, val + default_unit );
1190 } );
1191 } );
1192 } );
1193
1194 /* Checkbox and Radio Styles Starts */
1195
1196 // Checkbox and Radio: font_size
1197 wp.customize( settings + '[typography][checkbox_radio_font_size]', function( value ) {
1198 var default_unit = 'px';
1199 value.bind( function( newval ) {
1200 container.find('input[type="radio"] + label, input[type="checkbox"] + label').css( 'font-size', newval + default_unit );
1201 } );
1202 } );
1203
1204 // Checkbox and Radio: font_style
1205 wp.customize( settings + '[typography][checkbox_radio_font_style]', function( value ) {
1206 value.bind( function( newval ) {
1207 if ( typeof newval != 'object' ) {
1208 newval = JSON.parse( newval );
1209 }
1210
1211 $.each( newval, function( prop, val ) {
1212 switch( prop ) {
1213 case 'bold':
1214 container.find('input[type="radio"] + label, input[type="checkbox"] + label').css( 'font-weight', (val === true) ? 'bold' : 'normal' );
1215 break;
1216 case 'italic':
1217 container.find('input[type="radio"] + label, input[type="checkbox"] + label').css( 'font-style', (val === true) ? 'italic' : 'normal' );
1218 break;
1219 case 'underline':
1220 container.find('input[type="radio"] + label, input[type="checkbox"] + label').css( 'text-decoration', (val === true) ? 'underline' : 'none' );
1221 break;
1222 case 'uppercase':
1223 container.find('input[type="radio"] + label, input[type="checkbox"] + label').css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
1224 break;
1225 }
1226 } );
1227 } );
1228 } );
1229
1230 // Checkbox and Radio: font_color
1231 wp.customize( settings + '[typography][checkbox_radio_font_color]', function( value ) {
1232 value.bind( function( newval ) {
1233 container.find('input[type="radio"] + label, input[type="checkbox"] + label').css( 'color', newval );
1234 } );
1235 } );
1236
1237 // Checkbox and Radio Styles: alignment
1238 wp.customize( settings + '[typography][checkbox_radio_alignment]', function( value ) {
1239 value.bind( function( newval ) {
1240 container.find('.evf-field-checkbox ul li, .evf-field-radio ul li, .evf-field-payment-multiple ul li, .evf-field-payment-checkbox ul li').css( 'text-align', newval );
1241
1242 var option_direction = 'ltr';
1243 if ( 'right' == newval ) {
1244 option_direction = 'rtl';
1245 }
1246
1247 container.find( 'option' ).css( 'direction', option_direction );
1248 } );
1249 } );
1250
1251 // Checkbox and Radio Styles: margin
1252 wp.customize( settings + '[typography][checkbox_radio_margin]', function( value ) {
1253 var inline_style = 'default';
1254 preview_buttons.on( 'click', function() {
1255 var control_value = value.get();
1256 var active_responsive_device = $(this).data('device');
1257 var default_unit = 'px';
1258 wp.customize( settings + '[typography][inline_style]', function( value ) {
1259 inline_style = value.get();
1260 });
1261
1262 container.find('.evf-field-checkbox ul li, .evf-field-radio ul li, .evf-field-payment-multiple ul li, .evf-field-payment-checkbox ul li').css( 'margin', '' );
1263 if ( typeof control_value[active_responsive_device] == 'undefined') {
1264 active_responsive_device = 'desktop';
1265 }
1266 $.each( control_value[active_responsive_device], function( prop, val ) {
1267 if( 'two_columns' === inline_style && ( 'right' === prop || 'left' === prop ) ) {
1268 val = 0;
1269 }
1270 container.find('.evf-field-checkbox ul li, .evf-field-radio ul li, .evf-field-payment-multiple ul li, .evf-field-payment-checkbox ul li').css( 'margin-' + prop, val + default_unit );
1271 } );
1272 } );
1273 value.bind( function( newval ) {
1274 var default_unit = 'px';
1275 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
1276 wp.customize( settings + '[typography][inline_style]', function( value ) {
1277 inline_style = value.get();
1278 });
1279
1280 if ( typeof newval != 'object' ) {
1281 newval = JSON.parse( newval );
1282 }
1283
1284 $.each( newval[active_responsive_device], function( prop, val ) {
1285 if( 'two_columns' === inline_style && ( 'right' === prop || 'left' === prop ) ) {
1286 val = 0;
1287 }
1288 container.find('.evf-field-checkbox ul li, .evf-field-radio ul li, .evf-field-payment-multiple ul li, .evf-field-payment-checkbox ul li').css( 'margin-' + prop, val + default_unit );
1289 } );
1290 } );
1291 } );
1292
1293 // Checkbox and Radio Styles: padding
1294 wp.customize( settings + '[typography][checkbox_radio_padding]', function( value ) {
1295 preview_buttons.on( 'click', function() {
1296 var control_value = value.get();
1297 var active_responsive_device = $(this).data('device');
1298 var default_unit = 'px';
1299
1300 container.find('.evf-field-checkbox ul li, .evf-field-radio ul li, .evf-field-payment-multiple ul li, .evf-field-payment-checkbox ul li').css( 'padding', '' );
1301 if ( typeof control_value[active_responsive_device] == 'undefined') {
1302 active_responsive_device = 'desktop';
1303 }
1304 $.each( control_value[active_responsive_device], function( prop, val ) {
1305 container.find('.evf-field-checkbox ul li, .evf-field-radio ul li, .evf-field-payment-multiple ul li, .evf-field-payment-checkbox ul li').css( 'padding-' + prop, val + default_unit );
1306 } );
1307 } );
1308 value.bind( function( newval ) {
1309 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
1310 var default_unit = 'px';
1311 if ( typeof newval != 'object' ) {
1312 newval = JSON.parse( newval );
1313 }
1314 $.each( newval[active_responsive_device], function( prop, val ) {
1315 container.find('.evf-field-checkbox ul li, .evf-field-radio ul li, .evf-field-payment-multiple ul li, .evf-field-payment-checkbox ul li').css( 'padding-' + prop, val + default_unit );
1316 } );
1317 } );
1318 } );
1319
1320 // Checkbox and Radio Styles: default_style, inline_style, two_columns_style
1321 wp.customize( settings + '[typography][checkbox_radio_inline_style]', function( value ) {
1322 value.bind( function( newval ) {
1323 var ul = container.find('.evf-field-checkbox ul, .evf-field-radio ul, .evf-field-payment-multiple ul, .evf-field-payment-checkbox ul');
1324 ul.addClass(newval);
1325 switch(newval) {
1326 case 'inline':
1327 ul.css({
1328 'display' : 'flex',
1329 'flex-wrap' : 'wrap',
1330 });
1331 ul.find('li').css({
1332 'display' : 'flex',
1333 'flex' : 'auto',
1334 });
1335 ul.find('li label').css({
1336 'flex' : '1',
1337 });
1338 break;
1339 case 'two_columns':
1340 ul.css({
1341 'display' : 'flex',
1342 'flex-wrap' : 'wrap',
1343 });
1344 ul.find('li').css({
1345 'display' : 'flex',
1346 'flex' : '0 50%',
1347 });
1348 ul.find('li label').css({
1349 'flex' : '1',
1350 });
1351 break;
1352 default:
1353 ul.css({
1354 'display' : 'inherit',
1355 'flex-wrap' : '',
1356 });
1357 ul.find('li').css({
1358 'flex' : '',
1359 'max-width' : '',
1360 });
1361 ul.find('li label').css({
1362 'flex' : '',
1363 });
1364 break;
1365 }
1366 } );
1367 } );
1368
1369 // Checkbox and Radio Styles: design_style
1370 wp.customize( settings + '[typography][checkbox_radio_style_variation]', function( value ) {
1371 var id = container.attr('id');
1372 value.bind( function( newval ) {
1373 var size = 0;
1374 var color = '';
1375 var checked_color = '';
1376 wp.customize( settings + '[typography][checkbox_radio_size]', function( value ) {
1377 var default_unit = 'px';
1378 size = value.get() + default_unit;
1379 } );
1380 wp.customize( settings + '[typography][checkbox_radio_color]', function( value ) {
1381 color = value.get();
1382 });
1383 wp.customize( settings + '[typography][checkbox_radio_checked_color]', function( value ) {
1384 checked_color = value.get();
1385 });
1386 var input = container.find('input[type="radio"], input[type="checkbox"]');
1387 switch(newval) {
1388 case 'outline':
1389 container.find('style#placeholder-'+id).html( addInputStylesOutlineVariation( id, color, checked_color ) );
1390 input.css({
1391 'width' : size,
1392 'height' : size,
1393 'display' : 'inline-flex',
1394 'align-items' : 'center',
1395 'justify-content' : 'center',
1396 'background-color' : 'transparent',
1397 'border' : '1px solid '+color,
1398 });
1399 break;
1400 case 'filled':
1401 container.find('style#placeholder-'+id).html( addInputStylesFilledVariation( id, checked_color ) );
1402 input.css({
1403 'border' : '',
1404 'width' : size,
1405 'height' : size,
1406 'background-color' : color,
1407 'border' : 'none',
1408 });
1409 break;
1410 default:
1411 container.find('style#placeholder-'+id).html( addInputStylesDefaultVariation( id ) );
1412 input.css({
1413 'width' : 'auto',
1414 'height' : 'inherit',
1415 'display' : '',
1416 'align-items' : '',
1417 'justify-content' : '',
1418 'background-color' : '',
1419 'border' : '',
1420 });
1421 break;
1422 }
1423 var input = container.find('input[type="checkbox"]');
1424 switch(newval) {
1425 case 'outline':
1426 input.css({
1427 '-webkit-appearance' : 'none',
1428 });
1429 break;
1430 case 'filled':
1431 input.css({
1432 '-webkit-appearance' : 'none',
1433 });
1434 break;
1435 default:
1436 input.css({
1437 '-webkit-appearance' : 'checkbox',
1438 });
1439 break;
1440 }
1441 var input = container.find('input[type="radio"]');
1442 switch(newval) {
1443 case 'outline':
1444 input.css({
1445 '-webkit-appearance' : 'none',
1446 });
1447 break;
1448 case 'filled':
1449 input.css({
1450 '-webkit-appearance' : 'none',
1451 });
1452 break;
1453 default:
1454 input.css({
1455 '-webkit-appearance' : 'radio',
1456 });
1457 break;
1458 }
1459 } );
1460 } );
1461
1462 // Checkbox and Radio: size
1463 wp.customize( settings + '[typography][checkbox_radio_size]', function( value ) {
1464 var default_unit = 'px';
1465 value.bind( function( newval ) {
1466 container.find('input[type="radio"], input[type="checkbox"]').css( {'width': newval + default_unit, 'height': newval + default_unit });
1467 } );
1468 } );
1469
1470 // Checkbox and Radio: color
1471 wp.customize( settings + '[typography][checkbox_radio_color]', function( value ) {
1472 var style_variation = 'default';
1473 value.bind( function( newval ) {
1474 wp.customize( settings + '[checkbox_radio_styles][checkbox_radio_style_variation]', function( value ) {
1475 style_variation = value.get();
1476 });
1477 if( 'outline' === style_variation ){
1478 container.find('input[type="radio"], input[type="checkbox"]').css( 'border-color', newval ).css( 'background-color', 'transparent' );
1479 }else if( 'filled' === style_variation ){
1480 container.find('input[type="radio"], input[type="checkbox"]').css( 'border-color', newval ).css( 'background-color', newval );
1481 }else{
1482 container.find('input[type="radio"], input[type="checkbox"]').css( 'border-color', 'inherit' ).css( 'background-color', 'inherit' );
1483 }
1484 } );
1485 } );
1486
1487 // Checkbox and Radio: checked_color
1488 wp.customize( settings + '[typography][checkbox_radio_checked_color]', function( value ) {
1489 var id = container.attr('id');
1490 var style_variation = 'default';
1491 var color = '';
1492 value.bind( function( newval ) {
1493 wp.customize( settings + '[typography][checkbox_radio_color]', function( value ) {
1494 color = value.get();
1495 });
1496 wp.customize( settings + '[typography][checkbox_radio_style_variation]', function( value ) {
1497 style_variation = value.get();
1498 });
1499 if( 'outline' === style_variation ){
1500 container.find('style#placeholder-'+id).html( addInputStylesOutlineVariation( id, color, newval ) );
1501 }else if( 'filled' === style_variation ){
1502 container.find('style#placeholder-'+id).html( addInputStylesFilledVariation( id, newval ) );
1503 }else{
1504 container.find('style#placeholder-'+id).html( addInputStylesDefaultVariation( id ) );
1505 }
1506 } );
1507 } );
1508
1509 /* Checkbox and Radio Styles Ends */
1510
1511 /* Section Title Start */
1512
1513 // Section Title: font_size
1514 wp.customize( settings + '[typography][section_title_font_size]', function( value ) {
1515 var default_unit = 'px';
1516 value.bind( function( newval ) {
1517 section_title.css( 'font-size', newval + default_unit );
1518 } );
1519 } );
1520
1521 // Section Title: font_color
1522 wp.customize( settings + '[typography][section_title_font_color]', function( value ) {
1523 value.bind( function( newval ) {
1524 section_title.css( 'color', newval );
1525 } );
1526 } );
1527
1528 // Section Title: font_style
1529 wp.customize( settings + '[typography][section_title_font_style]', function( value ) {
1530 value.bind( function( newval ) {
1531 var id = container.attr('id');
1532 if ( typeof newval != 'object' ) {
1533 newval = JSON.parse( newval );
1534 }
1535
1536 $.each( newval, function( prop, val ) {
1537 switch( prop ) {
1538 case 'bold':
1539 section_title.css( 'font-weight', (val === true) ? 'bold' : 'normal' );
1540 break;
1541 case 'italic':
1542 section_title.css( 'font-style', (val === true) ? 'italic' : 'normal' );
1543 break;
1544 case 'underline':
1545 section_title.css( 'text-decoration', (val === true) ? 'underline' : 'none' );
1546 section_title.find('style#'+id).html( addPlaceholderStyles( id, '', (val === true) ? 'underline' : 'none' ) );
1547 break;
1548 case 'uppercase':
1549 section_title.css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
1550 break;
1551 }
1552 } );
1553 } );
1554 } );
1555
1556 // Section Title: text_alignment
1557 wp.customize( settings + '[typography][section_title_text_alignment]', function(value) {
1558 value.bind( function ( newval ) {
1559 section_title.css( 'text-align', newval );
1560 } );
1561 } );
1562
1563 // Section Title: line_height
1564 wp.customize( settings + '[typography][section_title_line_height]', function(value) {
1565 value.bind( function ( newval ) {
1566 section_title.css( 'line-height', newval );
1567 } );
1568 } );
1569
1570 // Section Title: margin
1571 wp.customize( settings + '[typography][section_title_margin]', function(value) {
1572 preview_buttons.on( 'click', function () {
1573 var control_value = value.get();
1574 var active_responsive_device = $( this ).data( 'device' );
1575 var default_unit = 'px';
1576
1577 section_title.css( 'margin', '' );
1578 if ( typeof control_value[active_responsive_device] == 'undefined' ) {
1579 active_responsive_device = 'desktop';
1580 }
1581 $.each( control_value[active_responsive_device], function( prop, val ) {
1582 section_title.css( 'margin-' + prop, val + default_unit );
1583 } );
1584 } );
1585 value.bind( function( newval ) {
1586 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data( 'device' );
1587 var default_unit = 'px';
1588
1589 if ( typeof newval != 'object' ) {
1590 newval = JSON.parse( newval );
1591 }
1592 $.each( newval[active_responsive_device], function( prop, val ) {
1593 section_title.css( 'margin-' + prop, val + default_unit );
1594 } );
1595 } );
1596 } );
1597
1598 // Section Title: padding
1599 wp.customize( settings + '[typography][section_title_padding]', function( value ) {
1600 preview_buttons.on( 'click', function() {
1601 var control_value = value.get();
1602 var active_responsive_device = $(this).data('device');
1603 var default_unit = 'px';
1604
1605 section_title.css( 'padding', '' );
1606 if ( typeof control_value[active_responsive_device] == 'undefined' ) {
1607 active_responsive_device = 'desktop';
1608 }
1609 $.each( control_value[active_responsive_device], function( prop, val ) {
1610 section_title.css('padding-' + prop, val + default_unit);
1611 } );
1612 } );
1613 value.bind( function( newval ) {
1614 var default_unit = 'px';
1615 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data( 'device' );
1616
1617 if ( typeof newval != 'object' ) {
1618 newval = JSON.parse( newval );
1619 }
1620 $.each( newval[active_responsive_device], function( prop, val ) {
1621 section_title.css( 'padding-' + prop, val + default_unit );
1622 } );
1623 } );
1624 } );
1625
1626 /* Section Title End */
1627
1628 /* Button Styles Start */
1629
1630 // Button Styles: font_size
1631 wp.customize( settings + '[typography][button_font_size]', function( value ) {
1632 var default_unit = 'px';
1633 value.bind( function( newval ) {
1634 button.css( 'font-size', newval + default_unit );
1635 } );
1636 } );
1637
1638 // Button Styles: font_style
1639 wp.customize( settings + '[typography][button_font_style]', function( value ) {
1640 value.bind( function( newval ) {
1641 if ( typeof newval != 'object' ) {
1642 newval = JSON.parse( newval );
1643 }
1644
1645 $.each( newval, function( prop, val ) {
1646 switch( prop ) {
1647 case 'bold':
1648 button.css( 'font-weight', (val === true) ? 'bold' : 'normal' );
1649 break;
1650 case 'italic':
1651 button.css( 'font-style', (val === true) ? 'italic' : 'normal' );
1652 break;
1653 case 'underline':
1654 button.css( 'text-decoration', (val === true) ? 'underline' : 'none' );
1655 break;
1656 case 'uppercase':
1657 button.css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
1658 break;
1659 }
1660 } );
1661 } );
1662 } );
1663
1664 // Button Styles: font_color
1665 var button_pev_hover_font_color = '';
1666 wp.customize( settings + '[typography][button_font_color]', function( value ) {
1667 value.bind( function( newval ) {
1668 button_pev_hover_font_color = newval;
1669 button.css( 'color', newval );
1670 } );
1671 } );
1672
1673 // Button Styles: hover_font_color
1674 wp.customize( settings + '[typography][button_hover_font_color]', function( value ) {
1675 button.on( 'mouseover mouseleave', function(e) {
1676 if ( 'mouseover' == e.type ) {
1677 var control_value = value.get();
1678 $( this ).css( 'color', control_value );
1679 } else {
1680 $( this ).css( 'color', button_pev_hover_font_color );
1681 }
1682 } );
1683 } );
1684
1685 // Button Styles: background_color
1686 var button_pev_color = '';
1687 wp.customize( settings + '[typography][button_background_color]', function( value ) {
1688 value.bind( function( newval ) {
1689 button_pev_color = newval;
1690 button.css( 'background-color', newval );
1691 } );
1692 } );
1693
1694 // Button Styles: hover_background_color
1695 wp.customize( settings + '[typography][button_hover_background_color]', function( value ) {
1696 button.on( 'mouseover mouseleave', function(e) {
1697 if ( 'mouseover' == e.type ) {
1698 var control_value = value.get();
1699 $( this ).css( 'background-color', control_value );
1700 } else {
1701 $( this ).css( 'background-color', button_pev_color );
1702 }
1703 } );
1704 } );
1705
1706 // Button Styles: alignment
1707 wp.customize( settings + '[typography][button_alignment]', function( value ) {
1708 value.bind( function( newval ) {
1709 container.find('.evf-submit-container:not(.everest-forms-multi-part-actions)').css( 'text-align', newval );
1710 } );
1711 } );
1712
1713 // Button Styles: border_type
1714 wp.customize( settings + '[button][border_type]', function( value ) {
1715 value.bind( function( newval ) {
1716 button.css( 'border-style', newval );
1717 } );
1718 } );
1719
1720
1721 // Button Styles: border_color
1722 var button_pev_border_hover_color = '';
1723 wp.customize( settings + '[typography][button_border_color]', function( value ) {
1724 value.bind( function( newval ) {
1725 button_pev_border_hover_color = newval;
1726 button.css( 'border-color', newval );
1727 } );
1728 } );
1729
1730 // Button Styles: border_hover_color
1731 wp.customize( settings + '[typography][button_border_hover_color]', function( value ) {
1732 button.on( 'mouseover mouseleave', function(e) {
1733 if ( 'mouseover' == e.type ) {
1734 var control_value = value.get();
1735 $( this ).css( 'border-color', control_value );
1736 } else {
1737 $( this ).css( 'border-color', button_pev_border_hover_color );
1738 }
1739 } );
1740 } );
1741
1742 // Button Styles: border_radius
1743 wp.customize( settings + '[button][border_radius]', function( value ) {
1744 value.bind( function( newval ) {
1745 if ( typeof newval != 'object' ) {
1746 newval = JSON.parse( newval );
1747 }
1748
1749 var unit = newval['unit'];
1750
1751 $.each( newval, function( prop, val ) {
1752 switch( prop ) {
1753 case 'top':
1754 button.css( 'border-top-left-radius', val + unit );
1755 break;
1756 case 'right':
1757 button.css( 'border-top-right-radius', val + unit );
1758 break;
1759 case 'bottom':
1760 button.css( 'border-bottom-right-radius', val + unit );
1761 break;
1762 case 'left':
1763 button.css( 'border-bottom-left-radius', val + unit );
1764 break;
1765 }
1766 } );
1767 } );
1768 } );
1769
1770 // Button Styles: border_width
1771 wp.customize( settings + '[button][border_width]', function( value ) {
1772 value.bind( function( newval ) {
1773 var default_unit = 'px';
1774
1775 if ( typeof newval != 'object' ) {
1776 newval = JSON.parse( newval );
1777 }
1778
1779 $.each( newval, function( prop, val ) {
1780 if ( dimension_directions.indexOf( prop ) != -1 ) {
1781 button.css( 'border-' + prop + '-width', val + default_unit );
1782 }
1783 } );
1784 } );
1785 } );
1786
1787
1788 // Button Styles: line_height
1789 wp.customize( settings + '[typography][button_line_height]', function( value ) {
1790 value.bind( function( newval ) {
1791 button.css( 'line-height', newval );
1792 } );
1793 } );
1794
1795 // Button Styles: margin
1796 wp.customize( settings + '[typography][button_margin]', function( value ) {
1797 preview_buttons.on( 'click', function() {
1798 var control_value = value.get();
1799 var active_responsive_device = $(this).data('device');
1800 var default_unit = 'px';
1801
1802 button.css( 'margin', '' );
1803 if ( typeof control_value[active_responsive_device] == 'undefined') {
1804 active_responsive_device = 'desktop';
1805 }
1806 $.each( control_value[active_responsive_device], function( prop, val ) {
1807 button.css( 'margin-' + prop, val + default_unit );
1808 } );
1809 } );
1810 value.bind( function( newval ) {
1811 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
1812 var default_unit = 'px';
1813 if ( typeof newval != 'object' ) {
1814 newval = JSON.parse( newval );
1815 }
1816 $.each( newval[active_responsive_device], function( prop, val ) {
1817 button.css( 'margin-' + prop, val + default_unit );
1818 } );
1819
1820 var submit_button = $( '.evf-submit-container.everest-forms-multi-part-actions button[type="submit"]' );
1821 var button_height = submit_button.outerHeight( true );
1822
1823 submit_button.closest( '.evf-submit-container.everest-forms-multi-part-actions:not(.everest-forms-nav-align--left, .everest-forms-nav-align--center)' ).css( 'margin-top', '-' + button_height + 'px' );
1824 } );
1825 } );
1826
1827 // Button Styles: padding
1828 wp.customize( settings + '[typography][button_padding]', function( value ) {
1829 preview_buttons.on( 'click', function() {
1830 var control_value = value.get();
1831 var active_responsive_device = $(this).data('device');
1832 var default_unit = 'px';
1833
1834 button.css( 'padding', '' );
1835 if ( typeof control_value[active_responsive_device] == 'undefined') {
1836 active_responsive_device = 'desktop';
1837 }
1838 $.each( control_value[active_responsive_device], function( prop, val ) {
1839 button.css( 'padding-' + prop, val + default_unit );
1840 } );
1841 } );
1842 value.bind( function( newval ) {
1843 var active_responsive_device = controls_wrapper.find( '#customize-footer-actions .devices button.active' ).data('device');
1844 var default_unit = 'px';
1845 if ( typeof newval != 'object' ) {
1846 newval = JSON.parse( newval );
1847 }
1848 $.each( newval[active_responsive_device], function( prop, val ) {
1849 button.css( 'padding-' + prop, val + default_unit );
1850 } );
1851 } );
1852 } );
1853
1854 /* Button Styles End */
1855
1856 /**
1857 * Submission Message Start
1858 *
1859 * This includes success, error and validation message.
1860 */
1861
1862 /* Submission Success Message Starts */
1863
1864 // Show dummy submission success message.
1865 wp.customize( settings + '[success_message][show_submission_message]', function( value ) {
1866 var toggle_success_message = function( display ) {
1867 container.find( '.everest-forms-notice.everest-forms-notice--success' ).remove();
1868
1869 if ( true === display ) {
1870 container.prepend( '<div class="everest-forms-notice everest-forms-notice--success" role="alert">' + data.notices.success + '</div>' );
1871 }
1872 };
1873
1874 toggle_success_message( value.get() );
1875 value.bind( function( val ) {
1876 toggle_success_message( val );
1877 } );
1878 } );
1879
1880 // Submission Success Message: font_size
1881 wp.customize( settings + '[success_message][font_size]', function( value ) {
1882 var default_unit = 'px';
1883 value.bind( function( newval ) {
1884 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'font-size', newval + default_unit );
1885 } );
1886 } );
1887
1888 // Submission Success Message: font_style
1889 wp.customize( settings + '[success_message][font_style]', function( value ) {
1890 value.bind( function( newval ) {
1891 if ( typeof newval != 'object' ) {
1892 newval = JSON.parse( newval );
1893 }
1894
1895 $.each( newval, function( prop, val ) {
1896 switch( prop ) {
1897 case 'bold':
1898 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'font-weight', (val === true) ? 'bold' : 'normal' );
1899 break;
1900 case 'italic':
1901 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'font-style', (val === true) ? 'italic' : 'normal' );
1902 break;
1903 case 'underline':
1904 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'text-decoration', (val === true) ? 'underline' : 'none' );
1905 break;
1906 case 'uppercase':
1907 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
1908 break;
1909 }
1910 } );
1911 } );
1912 } );
1913
1914 // Submission Success Message: text_alignment
1915 wp.customize( settings + '[success_message][text_alignment]', function( value ) {
1916 value.bind( function( newval ) {
1917 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'text-align', newval );
1918 } );
1919 } );
1920
1921 // Submission Success Message: font_color
1922 wp.customize( settings + '[success_message][font_color]', function( value ) {
1923 value.bind( function( newval ) {
1924 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'color', newval );
1925 } );
1926 } );
1927
1928 // Submission Success Message: background_color
1929 wp.customize( settings + '[success_message][background_color]', function( value ) {
1930 value.bind( function( newval ) {
1931 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'background-color', newval );
1932 } );
1933 } );
1934
1935 // Submission Success Message: border_type
1936 wp.customize( settings + '[success_message][border_type]', function( value ) {
1937 value.bind( function( newval ) {
1938 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'border-style', newval );
1939 } );
1940 } );
1941
1942 // Submission Success Message: border_width
1943 wp.customize( settings + '[success_message][border_width]', function( value ) {
1944 value.bind( function( newval ) {
1945 var default_unit = 'px';
1946 if ( typeof newval != 'object' ) {
1947 newval = JSON.parse( newval );
1948 }
1949 $.each( newval, function( prop, val ) {
1950 if ( dimension_directions.indexOf( prop ) != -1 ) {
1951 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'border-' + prop + '-width', val + default_unit );
1952 }
1953 } );
1954 } );
1955 } );
1956
1957 // Submission Success Message: border_color
1958 wp.customize( settings + '[success_message][border_color]', function( value ) {
1959 value.bind( function( newval ) {
1960 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'border-color', newval );
1961 } );
1962 } );
1963
1964 // Submission Success Message: border_radius
1965 wp.customize( settings + '[success_message][border_radius]', function( value ) {
1966 value.bind( function( newval ) {
1967 if ( typeof newval != 'object' ) {
1968 newval = JSON.parse( newval );
1969 }
1970
1971 var unit = newval['unit'];
1972
1973 $.each( newval, function( prop, val ) {
1974 switch( prop ) {
1975 case 'top':
1976 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'border-top-left-radius', val + unit );
1977 break;
1978 case 'right':
1979 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'border-top-right-radius', val + unit );
1980 break;
1981 case 'bottom':
1982 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'border-bottom-right-radius', val + unit );
1983 break;
1984 case 'left':
1985 container.find( '.everest-forms-notice.everest-forms-notice--success' ).css( 'border-bottom-left-radius', val + unit );
1986 break;
1987 }
1988 } );
1989 } );
1990 } );
1991
1992 /* Submission Success Message Styles ends */
1993
1994 /* Submission Error Message Starts */
1995
1996 // Show dummy submission error message.
1997 wp.customize( settings + '[error_message][show_submission_message]', function( value ) {
1998 var toggle_error_message = function( display ) {
1999 container.find( '.everest-forms-notice.everest-forms-notice--error' ).remove();
2000
2001 if ( true === display ) {
2002 container.prepend( '<div class="everest-forms-notice everest-forms-notice--error" role="alert">' + data.notices.error + '</div>' );
2003 }
2004 };
2005
2006 toggle_error_message( value.get() );
2007 value.bind( function( val ) {
2008 toggle_error_message( val );
2009 } );
2010 } );
2011
2012 // Submission Error Message: font_size
2013 wp.customize( settings + '[error_message][font_size]', function( value ) {
2014 var default_unit = 'px';
2015 value.bind( function( newval ) {
2016 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'font-size', newval + default_unit );
2017 } );
2018 } );
2019
2020 // Submission Error Message: font_style
2021 wp.customize( settings + '[error_message][font_style]', function( value ) {
2022 value.bind( function( newval ) {
2023 if ( typeof newval != 'object' ) {
2024 newval = JSON.parse( newval );
2025 }
2026
2027 $.each( newval, function( prop, val ) {
2028 switch( prop ) {
2029 case 'bold':
2030 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'font-weight', (val === true) ? 'bold' : 'normal' );
2031 break;
2032 case 'italic':
2033 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'font-style', (val === true) ? 'italic' : 'normal' );
2034 break;
2035 case 'underline':
2036 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'text-decoration', (val === true) ? 'underline' : 'none' );
2037 break;
2038 case 'uppercase':
2039 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
2040 break;
2041 }
2042 } );
2043 } );
2044 } );
2045
2046 // Submission Error Message: text_alignment
2047 wp.customize( settings + '[error_message][text_alignment]', function( value ) {
2048 value.bind( function( newval ) {
2049 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'text-align', newval );
2050 } );
2051 } );
2052
2053 // Submission Error Message: font_color
2054 wp.customize( settings + '[error_message][font_color]', function( value ) {
2055 value.bind( function( newval ) {
2056 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'color', newval );
2057 } );
2058 } );
2059
2060 // Submission Error Message: background_color
2061 wp.customize( settings + '[error_message][background_color]', function( value ) {
2062 value.bind( function( newval ) {
2063 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'background-color', newval );
2064 } );
2065 } );
2066
2067 // Submission Error Message: border_type
2068 wp.customize( settings + '[error_message][border_type]', function( value ) {
2069 value.bind( function( newval ) {
2070 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'border-style', newval );
2071 } );
2072 } );
2073
2074 // Submission Error Message: border_width
2075 wp.customize( settings + '[error_message][border_width]', function( value ) {
2076 value.bind( function( newval ) {
2077 var default_unit = 'px';
2078 if ( typeof newval != 'object' ) {
2079 newval = JSON.parse( newval );
2080 }
2081 $.each( newval, function( prop, val ) {
2082 if ( dimension_directions.indexOf( prop ) != -1 ) {
2083 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'border-' + prop + '-width', val + default_unit );
2084 }
2085 } );
2086 } );
2087 } );
2088
2089 // Submission Error Message: border_color
2090 wp.customize( settings + '[error_message][border_color]', function( value ) {
2091 value.bind( function( newval ) {
2092 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'border-color', newval );
2093 } );
2094 } );
2095
2096 // Submission Error Message: border_radius
2097 wp.customize( settings + '[error_message][border_radius]', function( value ) {
2098 value.bind( function( newval ) {
2099 if ( typeof newval != 'object' ) {
2100 newval = JSON.parse( newval );
2101 }
2102
2103 var unit = newval['unit'];
2104
2105 $.each( newval, function( prop, val ) {
2106 switch( prop ) {
2107 case 'top':
2108 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'border-top-left-radius', val + unit );
2109 break;
2110 case 'right':
2111 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'border-top-right-radius', val + unit );
2112 break;
2113 case 'bottom':
2114 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'border-bottom-right-radius', val + unit );
2115 break;
2116 case 'left':
2117 container.find( '.everest-forms-notice.everest-forms-notice--error' ).css( 'border-bottom-left-radius', val + unit );
2118 break;
2119 }
2120 } );
2121 } );
2122 } );
2123
2124 /* Field validation Message Starts */
2125
2126 // Show dummy field validation message.
2127 wp.customize( settings + '[validation_message][show_submission_message]', function( value ) {
2128 var toggle_validation_message = function( display ) {
2129 container.find( '.evf-error' ).remove();
2130
2131 if ( true === display ) {
2132 container.find( '.evf-field' ).append( '<label class="evf-error" for="dummy-validation">This field is required.</label>' );
2133 }
2134 };
2135
2136 toggle_validation_message( value.get() );
2137 value.bind( function( val ) {
2138 toggle_validation_message( val );
2139 } );
2140 } );
2141
2142 // Validation Message: font_size
2143 wp.customize( settings + '[validation_message][font_size]', function( value ) {
2144 var default_unit = 'px';
2145 value.bind( function( newval ) {
2146 container.find( '.evf-error' ).css( 'font-size', newval + default_unit );
2147 } );
2148 } );
2149
2150
2151 // Validation Message: font_style
2152 wp.customize( settings + '[validation_message][font_style]', function( value ) {
2153 value.bind( function( newval ) {
2154 if ( typeof newval != 'object' ) {
2155 newval = JSON.parse( newval );
2156 }
2157
2158 $.each( newval, function( prop, val ) {
2159 switch( prop ) {
2160 case 'bold':
2161 container.find( '.evf-error' ).css( 'font-weight', (val === true) ? 'bold' : 'normal' );
2162 break;
2163 case 'italic':
2164 container.find( '.evf-error' ).css( 'font-style', (val === true) ? 'italic' : 'normal' );
2165 break;
2166 case 'underline':
2167 container.find( '.evf-error' ).css( 'text-decoration', (val === true) ? 'underline' : 'none' );
2168 break;
2169 case 'uppercase':
2170 container.find( '.evf-error' ).css( 'text-transform', (val === true) ? 'uppercase' : 'none' );
2171 break;
2172 }
2173 } );
2174 } );
2175 } );
2176
2177 // Validation Message: text_alignment
2178 wp.customize( settings + '[validation_message][text_alignment]', function( value ) {
2179 value.bind( function( newval ) {
2180 container.find( '.evf-error' ).css( 'text-align', newval );
2181 } );
2182 } );
2183
2184 // Validation Message: font_color
2185 wp.customize( settings + '[validation_message][font_color]', function( value ) {
2186 value.bind( function( newval ) {
2187 container.find( '.evf-error' ).css( 'color', newval );
2188 } );
2189 } );
2190
2191 // Validation Message: background_color
2192 wp.customize( settings + '[validation_message][background_color]', function( value ) {
2193 value.bind( function( newval ) {
2194 container.find( '.evf-error' ).css( 'background-color', newval );
2195 } );
2196 } );
2197
2198 // Validation Message: border_type
2199 wp.customize( settings + '[validation_message][border_type]', function( value ) {
2200 value.bind( function( newval ) {
2201 container.find( '.evf-error' ).css( 'border-style', newval );
2202 } );
2203 } );
2204
2205 // Validation Message: border_width
2206 wp.customize( settings + '[validation_message][border_width]', function( value ) {
2207 value.bind( function( newval ) {
2208 var default_unit = 'px';
2209 if ( typeof newval != 'object' ) {
2210 newval = JSON.parse( newval );
2211 }
2212 $.each( newval, function( prop, val ) {
2213 if ( dimension_directions.indexOf( prop ) != -1 ) {
2214 container.find( '.evf-error' ).css( 'border-' + prop + '-width', val + default_unit );
2215 }
2216 } );
2217 } );
2218 } );
2219
2220 // Validation Message: border_color
2221 wp.customize( settings + '[validation_message][border_color]', function( value ) {
2222 value.bind( function( newval ) {
2223 container.find( '.evf-error' ).css( 'border-color', newval );
2224 } );
2225 } );
2226
2227 // Validation Message: border_radius
2228 wp.customize( settings + '[validation_message][border_radius]', function( value ) {
2229 value.bind( function( newval ) {
2230 if ( typeof newval != 'object' ) {
2231 newval = JSON.parse( newval );
2232 }
2233
2234 var unit = newval['unit'];
2235
2236 $.each( newval, function( prop, val ) {
2237 switch( prop ) {
2238 case 'top':
2239 container.find( '.evf-error' ).css( 'border-top-left-radius', val + unit );
2240 break;
2241 case 'right':
2242 container.find( '.evf-error' ).css( 'border-top-right-radius', val + unit );
2243 break;
2244 case 'bottom':
2245 container.find( '.evf-error' ).css( 'border-bottom-right-radius', val + unit );
2246 break;
2247 case 'left':
2248 container.find( '.evf-error' ).css( 'border-bottom-left-radius', val + unit );
2249 break;
2250 }
2251 } );
2252 } );
2253 } );
2254
2255 // Button Styles: alignment
2256 wp.customize(settings + '[button][alignment]', function (value) {
2257 value.bind(function (newval) {
2258 container.find(".evf-submit-container ").css("text-align", newval);
2259 container.find(".evf-submit-container ").css({
2260 display: "block",
2261 });
2262 container.find(".evf-submit-container button").css({
2263 float: "none",
2264 });
2265 });
2266 });
2267
2268 } )( jQuery, _evfCustomizePreviewL10n );
2269