PageSourceSearch

https://tristatefootandankle.com/wp-content/plugins/contact-form-add/public/assets/js/smuzforms.js?ver=2.0

js tristatefootandankle.com collected 2026-10-06 20:55:30 UTC 12,558 bytes, 479 lines download raw bytes

1(function($) {
2
3	$.extend( $.validator.messages, smuzform.errorMessages );
4
5	$('.smform').validate();
6
7	/**
8	Enable ajax form.
9	**/
10
11	$('form.smform').submit(function() {
12
13		if ( $( ':file', $(this) ).length >= 1 )
14			return true;
15
16		if ( ! $('.smform').valid() )
17			return false;
18
19		var form = $(this);
20		
21		var spinner  = $( '.smform-ajax-spinner .sk-circle', form );
22
23		var submitBtn = $( '.smform-submit', form );
24
25		var successMsg = $( '.smform-ajax-msg', form );
26
27		var errorCont = $( '.smform-errors-cont', form );
28
29		var action = $(this).prop( 'action' );
30
31		action = action + '&use=ajax';
32
33		spinner.show();
34		submitBtn.prop( 'disabled', true );
35
36		$.post( action, form.serialize(), function( resp ) {
37
38			var response = JSON.parse( resp );
39
40			if ( response.signal ) {
41
42				if ( response.isMsg ) {
43					successMsg.text( response.thanksMsg );
44					successMsg.fadeIn();
45					errorCont.fadeOut();
46				} else {
47					window.location = response.redirectUrl;
48				}
49
50				form[0].reset();
51
52				$( document ).trigger( 'smuzFormSubmitSuccess', [ form, response ] );
53
54			} else {
55
56				var errors = response.errors;
57				
58				var errorHtml = '';
59				
60				for (  var i = 0; i < errors.length; i++ ) {
61					
62					var item = '<li class="smform-error-field"><strong class="smform-error-field-label">'+ errors[i].additionalData.fieldLabel +'! </strong> '+ errors[i].message +'</li>';
63					errorHtml = errorHtml + item;
64
65				}
66
67				errorHtml = '<ul>' + errorHtml + '</ul>';
68
69				errorCont.html( errorHtml );
70
71				errorCont.fadeIn();
72
73				$('html, body').animate({
74				     scrollTop: errorCont.offset().top - 200   
75				   }, 200);
76
77				successMsg.fadeOut();
78
79				$( document ).trigger( 'smuzFormSubmitError', [ form, response ] );
80
81			}
82
83
84			
85
86		}).always( function() {
87
88			spinner.hide();
89
90			submitBtn.prop( 'disabled', false );
91
92		});
93
94		return false;
95	});
96
97	/**
98	Bind Conditonal Logic for form fields.
99	**/
100	$('.smform-fieldcont').each( function( index, elem) {
101
102		var enabled = $(this).data('rule'),
103			action = $(this).data('ruleaction'),
104			operator = $(this).data('ruleoperator'),
105			cmpValue = $(this).data('rulecmpvalue'),
106			field = $(this).data('rulefield'),
107			parentElementRef = $(this);
108
109		var fieldBind = 'smFieldData[' + field + ']';
110
111		if ( field === '' || action === '' || operator === '' ) return;
112
113		if ( enabled === 'enabled' ) {
114
115			if ( action === 'hide' )
116				parentElementRef.show();
117
118			var bindTo = 'input[name="'+fieldBind+'"]';
119			
120			$(bindTo).on( 'change', function(e) {
121				
122				var applyRules = false,
123					bindToValue = $(this).val();
124					revertAction = false;
125
126				if ( operator === 'is' ) {
127
128					if ( ! isNaN( cmpValue ) ) {
129						
130						if ( parseInt( cmpValue ) === parseInt( bindToValue ) )
131							applyRules = true;
132
133					} else {
134
135						if ( cmpValue.toLowerCase() === bindToValue.toLowerCase() )
136							applyRules = true;
137
138					}
139					
140
141				} else if ( operator === 'isNot' ) {
142
143					if ( ! isNaN( cmpValue ) ) {
144
145						if ( parseInt( cmpValue ) !== parseInt( bindToValue ) )
146							applyRules = true;
147
148					} else {
149
150						if ( cmpValue.toLowerCase() !== bindToValue.toLowerCase() )
151						applyRules = true;
152
153					}
154
155				} else { applyRules = false; }
156
157				if ( applyRules ) {
158
159					if ( action === 'show' ) {
160
161						parentElementRef.show();
162
163					}
164
165					if ( action === 'hide' ) {
166
167						parentElementRef.hide();
168						
169					}
170
171				} else {
172
173					if ( action === 'show' )
174						parentElementRef.hide();
175					else if ( action === 'hide' )
176						parentElementRef.show();
177
178				}
179
180			});
181
182		}
183
184	}); //End Logic;
185
186if ( $('.smform-multipage').length ) {
187	$(document).ready(function(){
188		var current = 1;
189		
190		widget      = $(".smformpage");
191		btnnext     = $(".smform-multipage-next");
192		btnback     = $(".smform-multipage-back"); 
193		btnsubmit   = $(".smform-multipage-submit");
194
195		// Init buttons and UI
196		widget.not(':eq(0)').hide();
197		hideButtons(current);
198		setProgress(current);
199
200		// Next button click action
201		btnnext.click(function(){
202			if(current < widget.length){
203				// Check validation
204				if($(".smform-multipage").valid()){
205					widget.show();
206					widget.not(':eq('+(current++)+')').hide();
207					//setProgress(current);
208					manageActiveTab(current);
209				}
210			}
211			hideButtons(current);
212		})
213
214		// Submit button click
215		btnsubmit.click(function(){
216			$('form.smform-multipage').submit();
217		});
218
219
220		// Back button click action
221		btnback.click(function(){
222			if(current > 1){
223				current = current - 2;
224				if(current < widget.length){
225					widget.show();
226					widget.not(':eq('+(current++)+')').hide();
227					//setProgress(current);
228					manageActiveTab(current);
229				}
230			}
231			hideButtons(current);
232		})
233
234	    $('.smform-multipage').validate({ // initialize plugin
235			ignore:":not(:visible)"
236	    });
237
238	});
239
240	// Change progress bar action
241	setProgress = function(currstep){
242		var percent = parseFloat(100 / widget.length) * currstep;
243		percent = percent.toFixed();
244		$(".progress-bar").css("width",percent+"%").html(percent+"%");		
245	}
246
247	// Hide buttons according to the current step
248	hideButtons = function(current){
249		var limit = parseInt(widget.length); 
250
251		$(".action").hide();
252
253		if(current < limit) btnnext.show();
254		if(current > 1) btnback.show();
255		if (current == limit) { 
256			// Show entered values
257			$(".display label.lbl").each(function(){
258				$(this).html($("#"+$(this).data("id")).val());	
259			});
260			btnnext.hide(); 
261			btnsubmit.show();
262		}
263	}
264
265	manageActiveTab = function(currstep) {
266
267		if ( currstep < 1 )
268			return false;
269
270		 $('.smform-multipage-step').each( function( index, elem ) {
271
272		 	$(this).removeClass('active');
273
274		 	var pageid = parseInt( $(this).data('page') ) + 1;
275
276		 	if ( pageid === currstep  )
277		 		$(this).addClass('active');
278
279		 });
280
281	}
282}
283
284$('.smformstylehidden').each( function( index, elem ) {
285
286	if ( $(this).val() === '' || $(this).val() === '[]' )
287		return false;
288
289	var style = JSON.parse( $(this).val() );
290
291	if ( style.enabled !== true )
292		return false;
293
294	var form = $( '#smform-' + $(this).data('formid') );
295
296	var cont = $( '#smformcont-' + $(this).data('formid') );
297
298	var heading = $( '.smform-title', form );
299
300	var description = $( '.smform-description', form );
301
302	var fieldLabel = $( '.smform-field-label', form );
303
304	var fieldInput = $( '.smform-control:not(.radio, .checkbox)', form );
305
306	var submitBtn = $( '.smform-submit', form );
307
308	$( '.smform-error-field', form ).css({
309		'color': style.formCont.errorMsgColor + ' !important'
310	});
311
312
313	$( '.smform-labelpostop .smform-field-label', cont ).css ( 'width', '100%' );
314
315	$( '.smInlineForm span label', form ).css( 'color', style.fieldLabel.advancedColor );
316
317	if ( style.formCont.hideHeadingSection === true )
318		$( '.smform-header', form ).hide();
319
320	if ( style.submitBtn.alignCenter === true )
321		$( '.smform-submitbtn-cont', form ).css( 'text-align', 'center' );
322
323	$( '.smform-controllabelpos-radio', form ).css( 'background-color', 'transparent' );
324
325
326	$( '.smform-controllabelpos-radio', form ).css( 'color', style.formCont.color );
327
328
329	cont.css({
330		'font-size': style.formCont.fontSize + 'px',
331		'color': style.formCont.color,
332		'background-color': style.formCont.bgColor,
333		'margin': style.formCont.margin,
334		'padding': style.formCont.padding
335	});
336
337	if ( style.formCont.bgImageUrl !== '' ) {
338
339		cont.css({
340			'background-image': "url('"+ style.formCont.bgImageUrl +"')",
341			'background-repeat': 'no-repeat',
342			'background-size': 'cover',
343			'background-position': 'center'
344		});
345
346	}
347
348	$('form', cont).css({
349		'font-size': style.formCont.fontSize + 'px',
350		'color': style.formCont.color
351	})
352
353	heading.css({
354		'font-size': style.formHeading.fontSize + 'px',
355		'color': style.formHeading.color,
356		'background-color': style.formHeading.bgColor,
357		'margin': style.formHeading.margin,
358		'padding': style.formHeading.padding
359	});
360
361	description.css({
362		'font-size': style.formDescription.fontSize + 'px',
363		'color': style.formDescription.color,
364		'background-color': style.formDescription.bgColor,
365		'margin': style.formDescription.margin,
366		'padding': style.formDescription.padding
367	});
368
369	$('p', description).css({
370		'font-size': style.fontSize + 'px',
371		'color': style.formDescription.color
372	});
373
374	fieldLabel.css({
375		'font-size': style.fieldLabel.fontSize + 'px',
376		'color': style.fieldLabel.color,
377		'background-color': style.fieldLabel.bgColor,
378		'margin': style.fieldLabel.margin,
379		'padding': style.fieldLabel.padding,
380		'font-weight': style.fieldLabel.fontWeight,
381		'margin-left': style.fieldLabel.marginLeft + 'px',
382		'margin-right': style.fieldLabel.marginRight + 'px',
383		'margin-top': style.fieldLabel.marginTop + 'px',
384		'margin-bottom': style.fieldLabel.marginBottom + 'px',
385		'padding-left': style.fieldLabel.paddingLeft + 'px',
386		'padding-right': style.fieldLabel.paddingRight + 'px',
387		'padding-top': style.fieldLabel.paddingTop + 'px',
388		'padding-bottom': style.fieldLabel.paddingBottom + 'px',
389		'border-color': style.fieldLabel.borderColor,
390		'border-width': style.fieldLabel.borderSize + 'px',
391		'border-radius': style.fieldLabel.borderRadius + 'px',
392		'border-style': style.fieldLabel.borderStyle
393	});
394
395	fieldInput.css({
396
397		'font-size': style.fieldInput.fontSize + 'px',
398		'font-weight': style.fieldInput.fontWeight,
399		'color': style.fieldInput.color,
400		'background-color': style.fieldInput.bgColor,
401		'margin-left': style.fieldInput.marginLeft + 'px',
402		'margin-right': style.fieldInput.marginRight + 'px',
403		'margin-top': style.fieldInput.marginTop + 'px',
404		'margin-bottom': style.fieldInput.marginBottom + 'px',
405		'padding-left': style.fieldInput.paddingLeft + 'px',
406		'padding-right': style.fieldInput.paddingRight + 'px',
407		'padding-top': style.fieldInput.paddingTop + 'px',
408		'padding-bottom': style.fieldInput.paddingBottom + 'px',
409		'border-color': style.fieldInput.borderColor,
410		'border-width': style.fieldInput.borderSize + 'px',
411		'border-radius': style.fieldInput.borderRadius + 'px',
412		'border-style': style.fieldInput.borderStyle
413
414	});
415
416	submitBtn.css({
417
418		'font-size': style.submitBtn.fontSize + 'px',
419		'font-weight': style.submitBtn.fontWeight,
420		'color': style.submitBtn.color,
421		'background-color': style.submitBtn.bgColor,
422		'margin-left': style.submitBtn.marginLeft + 'px',
423		'margin-right': style.submitBtn.marginRight + 'px',
424		'margin-top': style.submitBtn.marginTop + 'px',
425		'margin-bottom': style.submitBtn.marginBottom + 'px',
426		'padding-left': style.submitBtn.paddingLeft + 'px',
427		'padding-right': style.submitBtn.paddingRight + 'px',
428		'padding-top': style.submitBtn.paddingTop + 'px',
429		'padding-bottom': style.submitBtn.paddingBottom + 'px',
430		'border-color': style.submitBtn.borderColor,
431		'border-width': style.submitBtn.borderSize + 'px',
432		'border-radius': style.submitBtn.borderRadius + 'px',
433		'border-style': style.submitBtn.borderStyle
434
435	});
436
437
438	var selectOfSubmitBtn = '#smformcont-' + $(this).data('formid') + ' .smform-submit';
439
440	var selectOfErrorMsg = '#smformcont-' + $(this).data('formid') + ' .smform-error-field';
441
442	var selectOfInlineErrorMsg = '#smformcont-' + $(this).data('formid') + ' .error';
443
444	var selectOfSuccessMsg = '#smformcont-' + $(this).data('formid') + ' .smform-ajax-msg';
445
446	style.submitBtn.hoverBgColor = $('<div />').css('display','none').text(style.submitBtn.hoverBgColor).text();
447
448	style.formCont.errorMsgColor = $('<div />').css('display','none').text(style.formCont.errorMsgColor).text();
449	
450	style.formCont.successMsgColor = $('<div />').css('display','none').text(style.formCont.successMsgColor).text();
451
452	if ( style.submitBtn.hoverBgColor !== '' )
453		$('head').append('<style>'+selectOfSubmitBtn+':hover{background-color : ' + style.submitBtn.hoverBgColor  + ' !important;}</style>');
454
455	if ( style.formCont.successMsgColor !== '' )
456		$('head').append('<style>'+selectOfSuccessMsg+'{color : ' + style.formCont.successMsgColor  + ' !important;}</style>');
457
458	if ( style.formCont.errorMsgColor !== '' ) {
459
460		$('head').append('<style>'+selectOfErrorMsg+'{color : ' + style.formCont.errorMsgColor  + ' !important;}</style>');
461
462		$('head').append('<style>'+selectOfInlineErrorMsg+'{color : ' + style.formCont.errorMsgColor  + ' !important;}</style>');
463
464	}
465
466	if ( style.formCont.successMsgFontSize !== '' )
467		$('head').append('<style>'+selectOfSuccessMsg+'{font-size : ' + parseInt( style.formCont.successMsgFontSize )  + 'px !important;}</style>');
468
469
470	if ( style.formCont.hideFormOnSuccessForSuccessMsg === true ) {
471
472		$( document ).on( 'smuzFormSubmitSuccess', function( event, form, response ) {
473			form.html( $( '<div />' ).addClass( 'smform-ajax-msg' ).html( $('.smform-ajax-msg', form).text() ).fadeIn() );
474		});
475	}
476
477});
478
479})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.