PageSourceSearch

https://ishrgroup.us.org/wp-content/plugins/contact-form-7/includes/js/scripts_ver-5.1.4.js

js ishrgroup.us.org collected 2026-10-10 02:37:11 UTC 15,162 bytes, 537 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opens = _____WB$wombat$assign$function_____("opens");
10( function( $ ) {
11
12	'use strict';
13
14	if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) {
15		return;
16	}
17
18	wpcf7 = $.extend( {
19		cached: 0,
20		inputs: []
21	}, wpcf7 );
22
23	$( function() {
24		wpcf7.supportHtml5 = ( function() {
25			var features = {};
26			var input = document.createElement( 'input' );
27
28			features.placeholder = 'placeholder' in input;
29
30			var inputTypes = [ 'email', 'url', 'tel', 'number', 'range', 'date' ];
31
32			$.each( inputTypes, function( index, value ) {
33				input.setAttribute( 'type', value );
34				features[ value ] = input.type !== 'text';
35			} );
36
37			return features;
38		} )();
39
40		$( 'div.wpcf7 > form' ).each( function() {
41			var $form = $( this );
42			wpcf7.initForm( $form );
43
44			if ( wpcf7.cached ) {
45				wpcf7.refill( $form );
46			}
47		} );
48	} );
49
50	wpcf7.getId = function( form ) {
51		return parseInt( $( 'input[name="_wpcf7"]', form ).val(), 10 );
52	};
53
54	wpcf7.initForm = function( form ) {
55		var $form = $( form );
56
57		$form.submit( function( event ) {
58			if ( ! wpcf7.supportHtml5.placeholder ) {
59				$( '[placeholder].placeheld', $form ).each( function( i, n ) {
60					$( n ).val( '' ).removeClass( 'placeheld' );
61				} );
62			}
63
64			if ( typeof window.FormData === 'function' ) {
65				wpcf7.submit( $form );
66				event.preventDefault();
67			}
68		} );
69
70		$( '.wpcf7-submit', $form ).after( '<span class="ajax-loader"></span>' );
71
72		wpcf7.toggleSubmit( $form );
73
74		$form.on( 'click', '.wpcf7-acceptance', function() {
75			wpcf7.toggleSubmit( $form );
76		} );
77
78		// Exclusive Checkbox
79		$( '.wpcf7-exclusive-checkbox', $form ).on( 'click', 'input:checkbox', function() {
80			var name = $( this ).attr( 'name' );
81			$form.find( 'input:checkbox[name="' + name + '"]' ).not( this ).prop( 'checked', false );
82		} );
83
84		// Free Text Option for Checkboxes and Radio Buttons
85		$( '.wpcf7-list-item.has-free-text', $form ).each( function() {
86			var $freetext = $( ':input.wpcf7-free-text', this );
87			var $wrap = $( this ).closest( '.wpcf7-form-control' );
88
89			if ( $( ':checkbox, :radio', this ).is( ':checked' ) ) {
90				$freetext.prop( 'disabled', false );
91			} else {
92				$freetext.prop( 'disabled', true );
93			}
94
95			$wrap.on( 'change', ':checkbox, :radio', function() {
96				var $cb = $( '.has-free-text', $wrap ).find( ':checkbox, :radio' );
97
98				if ( $cb.is( ':checked' ) ) {
99					$freetext.prop( 'disabled', false ).focus();
100				} else {
101					$freetext.prop( 'disabled', true );
102				}
103			} );
104		} );
105
106		// Placeholder Fallback
107		if ( ! wpcf7.supportHtml5.placeholder ) {
108			$( '[placeholder]', $form ).each( function() {
109				$( this ).val( $( this ).attr( 'placeholder' ) );
110				$( this ).addClass( 'placeheld' );
111
112				$( this ).focus( function() {
113					if ( $( this ).hasClass( 'placeheld' ) ) {
114						$( this ).val( '' ).removeClass( 'placeheld' );
115					}
116				} );
117
118				$( this ).blur( function() {
119					if ( '' === $( this ).val() ) {
120						$( this ).val( $( this ).attr( 'placeholder' ) );
121						$( this ).addClass( 'placeheld' );
122					}
123				} );
124			} );
125		}
126
127		if ( wpcf7.jqueryUi && ! wpcf7.supportHtml5.date ) {
128			$form.find( 'input.wpcf7-date[type="date"]' ).each( function() {
129				$( this ).datepicker( {
130					dateFormat: 'yy-mm-dd',
131					minDate: new Date( $( this ).attr( 'min' ) ),
132					maxDate: new Date( $( this ).attr( 'max' ) )
133				} );
134			} );
135		}
136
137		if ( wpcf7.jqueryUi && ! wpcf7.supportHtml5.number ) {
138			$form.find( 'input.wpcf7-number[type="number"]' ).each( function() {
139				$( this ).spinner( {
140					min: $( this ).attr( 'min' ),
141					max: $( this ).attr( 'max' ),
142					step: $( this ).attr( 'step' )
143				} );
144			} );
145		}
146
147		// Character Count
148		$( '.wpcf7-character-count', $form ).each( function() {
149			var $count = $( this );
150			var name = $count.attr( 'data-target-name' );
151			var down = $count.hasClass( 'down' );
152			var starting = parseInt( $count.attr( 'data-starting-value' ), 10 );
153			var maximum = parseInt( $count.attr( 'data-maximum-value' ), 10 );
154			var minimum = parseInt( $count.attr( 'data-minimum-value' ), 10 );
155
156			var updateCount = function( target ) {
157				var $target = $( target );
158				var length = $target.val().length;
159				var count = down ? starting - length : length;
160				$count.attr( 'data-current-value', count );
161				$count.text( count );
162
163				if ( maximum && maximum < length ) {
164					$count.addClass( 'too-long' );
165				} else {
166					$count.removeClass( 'too-long' );
167				}
168
169				if ( minimum && length < minimum ) {
170					$count.addClass( 'too-short' );
171				} else {
172					$count.removeClass( 'too-short' );
173				}
174			};
175
176			$( ':input[name="' + name + '"]', $form ).each( function() {
177				updateCount( this );
178
179				$( this ).keyup( function() {
180					updateCount( this );
181				} );
182			} );
183		} );
184
185		// URL Input Correction
186		$form.on( 'change', '.wpcf7-validates-as-url', function() {
187			var val = $.trim( $( this ).val() );
188
189			if ( val
190			&& ! val.match( /^[a-z][a-z0-9.+-]*:/i )
191			&& -1 !== val.indexOf( '.' ) ) {
192				val = val.replace( /^\/+/, '' );
193				val = 'http://' + val;
194			}
195
196			$( this ).val( val );
197		} );
198	};
199
200	wpcf7.submit = function( form ) {
201		if ( typeof window.FormData !== 'function' ) {
202			return;
203		}
204
205		var $form = $( form );
206
207		$( '.ajax-loader', $form ).addClass( 'is-active' );
208
209		wpcf7.clearResponse( $form );
210
211		var formData = new FormData( $form.get( 0 ) );
212
213		var detail = {
214			id: $form.closest( 'div.wpcf7' ).attr( 'id' ),
215			status: 'init',
216			inputs: [],
217			formData: formData
218		};
219
220		$.each( $form.serializeArray(), function( i, field ) {
221			if ( '_wpcf7' == field.name ) {
222				detail.contactFormId = field.value;
223			} else if ( '_wpcf7_version' == field.name ) {
224				detail.pluginVersion = field.value;
225			} else if ( '_wpcf7_locale' == field.name ) {
226				detail.contactFormLocale = field.value;
227			} else if ( '_wpcf7_unit_tag' == field.name ) {
228				detail.unitTag = field.value;
229			} else if ( '_wpcf7_container_post' == field.name ) {
230				detail.containerPostId = field.value;
231			} else if ( field.name.match( /^_wpcf7_\w+_free_text_/ ) ) {
232				var owner = field.name.replace( /^_wpcf7_\w+_free_text_/, '' );
233				detail.inputs.push( {
234					name: owner + '-free-text',
235					value: field.value
236				} );
237			} else if ( field.name.match( /^_/ ) ) {
238				// do nothing
239			} else {
240				detail.inputs.push( field );
241			}
242		} );
243
244		wpcf7.triggerEvent( $form.closest( 'div.wpcf7' ), 'beforesubmit', detail );
245
246		var ajaxSuccess = function( data, status, xhr, $form ) {
247			detail.id = $( data.into ).attr( 'id' );
248			detail.status = data.status;
249			detail.apiResponse = data;
250
251			var $message = $( '.wpcf7-response-output', $form );
252
253			switch ( data.status ) {
254				case 'validation_failed':
255					$.each( data.invalidFields, function( i, n ) {
256						$( n.into, $form ).each( function() {
257							wpcf7.notValidTip( this, n.message );
258							$( '.wpcf7-form-control', this ).addClass( 'wpcf7-not-valid' );
259							$( '[aria-invalid]', this ).attr( 'aria-invalid', 'true' );
260						} );
261					} );
262
263					$message.addClass( 'wpcf7-validation-errors' );
264					$form.addClass( 'invalid' );
265
266					wpcf7.triggerEvent( data.into, 'invalid', detail );
267					break;
268				case 'acceptance_missing':
269					$message.addClass( 'wpcf7-acceptance-missing' );
270					$form.addClass( 'unaccepted' );
271
272					wpcf7.triggerEvent( data.into, 'unaccepted', detail );
273					break;
274				case 'spam':
275					$message.addClass( 'wpcf7-spam-blocked' );
276					$form.addClass( 'spam' );
277
278					wpcf7.triggerEvent( data.into, 'spam', detail );
279					break;
280				case 'aborted':
281					$message.addClass( 'wpcf7-aborted' );
282					$form.addClass( 'aborted' );
283
284					wpcf7.triggerEvent( data.into, 'aborted', detail );
285					break;
286				case 'mail_sent':
287					$message.addClass( 'wpcf7-mail-sent-ok' );
288					$form.addClass( 'sent' );
289
290					wpcf7.triggerEvent( data.into, 'mailsent', detail );
291					break;
292				case 'mail_failed':
293					$message.addClass( 'wpcf7-mail-sent-ng' );
294					$form.addClass( 'failed' );
295
296					wpcf7.triggerEvent( data.into, 'mailfailed', detail );
297					break;
298				default:
299					var customStatusClass = 'custom-'
300						+ data.status.replace( /[^0-9a-z]+/i, '-' );
301					$message.addClass( 'wpcf7-' + customStatusClass );
302					$form.addClass( customStatusClass );
303			}
304
305			wpcf7.refill( $form, data );
306
307			wpcf7.triggerEvent( data.into, 'submit', detail );
308
309			if ( 'mail_sent' == data.status ) {
310				$form.each( function() {
311					this.reset();
312				} );
313
314				wpcf7.toggleSubmit( $form );
315			}
316
317			if ( ! wpcf7.supportHtml5.placeholder ) {
318				$form.find( '[placeholder].placeheld' ).each( function( i, n ) {
319					$( n ).val( $( n ).attr( 'placeholder' ) );
320				} );
321			}
322
323			$message.html( '' ).append( data.message ).slideDown( 'fast' );
324			$message.attr( 'role', 'alert' );
325
326			$( '.screen-reader-response', $form.closest( '.wpcf7' ) ).each( function() {
327				var $response = $( this );
328				$response.html( '' ).attr( 'role', '' ).append( data.message );
329
330				if ( data.invalidFields ) {
331					var $invalids = $( '<ul></ul>' );
332
333					$.each( data.invalidFields, function( i, n ) {
334						if ( n.idref ) {
335							var $li = $( '<li></li>' ).append( $( '<a></a>' ).attr( 'href', '#' + n.idref ).append( n.message ) );
336						} else {
337							var $li = $( '<li></li>' ).append( n.message );
338						}
339
340						$invalids.append( $li );
341					} );
342
343					$response.append( $invalids );
344				}
345
346				$response.attr( 'role', 'alert' ).focus();
347			} );
348		};
349
350		$.ajax( {
351			type: 'POST',
352			url: wpcf7.apiSettings.getRoute(
353				'/contact-forms/' + wpcf7.getId( $form ) + '/feedback' ),
354			data: formData,
355			dataType: 'json',
356			processData: false,
357			contentType: false
358		} ).done( function( data, status, xhr ) {
359			ajaxSuccess( data, status, xhr, $form );
360			$( '.ajax-loader', $form ).removeClass( 'is-active' );
361		} ).fail( function( xhr, status, error ) {
362			var $e = $( '<div class="ajax-error"></div>' ).text( error.message );
363			$form.after( $e );
364		} );
365	};
366
367	wpcf7.triggerEvent = function( target, name, detail ) {
368		var $target = $( target );
369
370		/* DOM event */
371		var event = new CustomEvent( 'wpcf7' + name, {
372			bubbles: true,
373			detail: detail
374		} );
375
376		$target.get( 0 ).dispatchEvent( event );
377
378		/* jQuery event */
379		$target.trigger( 'wpcf7:' + name, detail );
380		$target.trigger( name + '.wpcf7', detail ); // deprecated
381	};
382
383	wpcf7.toggleSubmit = function( form, state ) {
384		var $form = $( form );
385		var $submit = $( 'input:submit', $form );
386
387		if ( typeof state !== 'undefined' ) {
388			$submit.prop( 'disabled', ! state );
389			return;
390		}
391
392		if ( $form.hasClass( 'wpcf7-acceptance-as-validation' ) ) {
393			return;
394		}
395
396		$submit.prop( 'disabled', false );
397
398		$( '.wpcf7-acceptance', $form ).each( function() {
399			var $span = $( this );
400			var $input = $( 'input:checkbox', $span );
401
402			if ( ! $span.hasClass( 'optional' ) ) {
403				if ( $span.hasClass( 'invert' ) && $input.is( ':checked' )
404				|| ! $span.hasClass( 'invert' ) && ! $input.is( ':checked' ) ) {
405					$submit.prop( 'disabled', true );
406					return false;
407				}
408			}
409		} );
410	};
411
412	wpcf7.notValidTip = function( target, message ) {
413		var $target = $( target );
414		$( '.wpcf7-not-valid-tip', $target ).remove();
415		$( '<span role="alert" class="wpcf7-not-valid-tip"></span>' )
416			.text( message ).appendTo( $target );
417
418		if ( $target.is( '.use-floating-validation-tip *' ) ) {
419			var fadeOut = function( target ) {
420				$( target ).not( ':hidden' ).animate( {
421					opacity: 0
422				}, 'fast', function() {
423					$( this ).css( { 'z-index': -100 } );
424				} );
425			};
426
427			$target.on( 'mouseover', '.wpcf7-not-valid-tip', function() {
428				fadeOut( this );
429			} );
430
431			$target.on( 'focus', ':input', function() {
432				fadeOut( $( '.wpcf7-not-valid-tip', $target ) );
433			} );
434		}
435	};
436
437	wpcf7.refill = function( form, data ) {
438		var $form = $( form );
439
440		var refillCaptcha = function( $form, items ) {
441			$.each( items, function( i, n ) {
442				$form.find( ':input[name="' + i + '"]' ).val( '' );
443				$form.find( 'img.wpcf7-captcha-' + i ).attr( 'src', n );
444				var match = /([0-9]+)\.(png|gif|jpeg)$/.exec( n );
445				$form.find( 'input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]' ).attr( 'value', match[ 1 ] );
446			} );
447		};
448
449		var refillQuiz = function( $form, items ) {
450			$.each( items, function( i, n ) {
451				$form.find( ':input[name="' + i + '"]' ).val( '' );
452				$form.find( ':input[name="' + i + '"]' ).siblings( 'span.wpcf7-quiz-label' ).text( n[ 0 ] );
453				$form.find( 'input:hidden[name="_wpcf7_quiz_answer_' + i + '"]' ).attr( 'value', n[ 1 ] );
454			} );
455		};
456
457		if ( typeof data === 'undefined' ) {
458			$.ajax( {
459				type: 'GET',
460				url: wpcf7.apiSettings.getRoute(
461					'/contact-forms/' + wpcf7.getId( $form ) + '/refill' ),
462				beforeSend: function( xhr ) {
463					var nonce = $form.find( ':input[name="_wpnonce"]' ).val();
464
465					if ( nonce ) {
466						xhr.setRequestHeader( 'X-WP-Nonce', nonce );
467					}
468				},
469				dataType: 'json'
470			} ).done( function( data, status, xhr ) {
471				if ( data.captcha ) {
472					refillCaptcha( $form, data.captcha );
473				}
474
475				if ( data.quiz ) {
476					refillQuiz( $form, data.quiz );
477				}
478			} );
479
480		} else {
481			if ( data.captcha ) {
482				refillCaptcha( $form, data.captcha );
483			}
484
485			if ( data.quiz ) {
486				refillQuiz( $form, data.quiz );
487			}
488		}
489	};
490
491	wpcf7.clearResponse = function( form ) {
492		var $form = $( form );
493		$form.removeClass( 'invalid spam sent failed' );
494		$form.siblings( '.screen-reader-response' ).html( '' ).attr( 'role', '' );
495
496		$( '.wpcf7-not-valid-tip', $form ).remove();
497		$( '[aria-invalid]', $form ).attr( 'aria-invalid', 'false' );
498		$( '.wpcf7-form-control', $form ).removeClass( 'wpcf7-not-valid' );
499
500		$( '.wpcf7-response-output', $form )
501			.hide().empty().removeAttr( 'role' )
502			.removeClass( 'wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked' );
503	};
504
505	wpcf7.apiSettings.getRoute = function( path ) {
506		var url = wpcf7.apiSettings.root;
507
508		url = url.replace(
509			wpcf7.apiSettings.namespace,
510			wpcf7.apiSettings.namespace + path );
511
512		return url;
513	};
514
515} )( jQuery );
516
517/*
518 * Polyfill for Internet Explorer
519 * See https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
520 */
521( function () {
522	if ( typeof window.CustomEvent === "function" ) return false;
523
524	function CustomEvent ( event, params ) {
525		params = params || { bubbles: false, cancelable: false, detail: undefined };
526		var evt = document.createEvent( 'CustomEvent' );
527		evt.initCustomEvent( event,
528			params.bubbles, params.cancelable, params.detail );
529		return evt;
530	}
531
532	CustomEvent.prototype = window.Event.prototype;
533
534	window.CustomEvent = CustomEvent;
535} )();
536
537}

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.