PageSourceSearch

https://insidefandb.com/wp-content/plugins/contact-form-7/includes/js/scripts_ver-5.1.9.js

js insidefandb.com collected 2026-09-26 13:56:28 UTC 15,349 bytes, 548 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.resetCounter( $form );
149
150		// URL Input Correction
151		$form.on( 'change', '.wpcf7-validates-as-url', function() {
152			var val = $.trim( $( this ).val() );
153
154			if ( val
155			&& ! val.match( /^[a-z][a-z0-9.+-]*:/i )
156			&& -1 !== val.indexOf( '.' ) ) {
157				val = val.replace( /^\/+/, '' );
158				val = 'http://' + val;
159			}
160
161			$( this ).val( val );
162		} );
163	};
164
165	wpcf7.submit = function( form ) {
166		if ( typeof window.FormData !== 'function' ) {
167			return;
168		}
169
170		var $form = $( form );
171
172		$( '.ajax-loader', $form ).addClass( 'is-active' );
173
174		wpcf7.clearResponse( $form );
175
176		var formData = new FormData( $form.get( 0 ) );
177
178		var detail = {
179			id: $form.closest( 'div.wpcf7' ).attr( 'id' ),
180			status: 'init',
181			inputs: [],
182			formData: formData
183		};
184
185		$.each( $form.serializeArray(), function( i, field ) {
186			if ( '_wpcf7' == field.name ) {
187				detail.contactFormId = field.value;
188			} else if ( '_wpcf7_version' == field.name ) {
189				detail.pluginVersion = field.value;
190			} else if ( '_wpcf7_locale' == field.name ) {
191				detail.contactFormLocale = field.value;
192			} else if ( '_wpcf7_unit_tag' == field.name ) {
193				detail.unitTag = field.value;
194			} else if ( '_wpcf7_container_post' == field.name ) {
195				detail.containerPostId = field.value;
196			} else if ( field.name.match( /^_wpcf7_\w+_free_text_/ ) ) {
197				var owner = field.name.replace( /^_wpcf7_\w+_free_text_/, '' );
198				detail.inputs.push( {
199					name: owner + '-free-text',
200					value: field.value
201				} );
202			} else if ( field.name.match( /^_/ ) ) {
203				// do nothing
204			} else {
205				detail.inputs.push( field );
206			}
207		} );
208
209		wpcf7.triggerEvent( $form.closest( 'div.wpcf7' ), 'beforesubmit', detail );
210
211		var ajaxSuccess = function( data, status, xhr, $form ) {
212			detail.id = $( data.into ).attr( 'id' );
213			detail.status = data.status;
214			detail.apiResponse = data;
215
216			var $message = $( '.wpcf7-response-output', $form );
217
218			switch ( data.status ) {
219				case 'validation_failed':
220					$.each( data.invalidFields, function( i, n ) {
221						$( n.into, $form ).each( function() {
222							wpcf7.notValidTip( this, n.message );
223							$( '.wpcf7-form-control', this ).addClass( 'wpcf7-not-valid' );
224							$( '[aria-invalid]', this ).attr( 'aria-invalid', 'true' );
225						} );
226					} );
227
228					$message.addClass( 'wpcf7-validation-errors' );
229					$form.addClass( 'invalid' );
230
231					wpcf7.triggerEvent( data.into, 'invalid', detail );
232					break;
233				case 'acceptance_missing':
234					$message.addClass( 'wpcf7-acceptance-missing' );
235					$form.addClass( 'unaccepted' );
236
237					wpcf7.triggerEvent( data.into, 'unaccepted', detail );
238					break;
239				case 'spam':
240					$message.addClass( 'wpcf7-spam-blocked' );
241					$form.addClass( 'spam' );
242
243					wpcf7.triggerEvent( data.into, 'spam', detail );
244					break;
245				case 'aborted':
246					$message.addClass( 'wpcf7-aborted' );
247					$form.addClass( 'aborted' );
248
249					wpcf7.triggerEvent( data.into, 'aborted', detail );
250					break;
251				case 'mail_sent':
252					$message.addClass( 'wpcf7-mail-sent-ok' );
253					$form.addClass( 'sent' );
254
255					wpcf7.triggerEvent( data.into, 'mailsent', detail );
256					break;
257				case 'mail_failed':
258					$message.addClass( 'wpcf7-mail-sent-ng' );
259					$form.addClass( 'failed' );
260
261					wpcf7.triggerEvent( data.into, 'mailfailed', detail );
262					break;
263				default:
264					var customStatusClass = 'custom-'
265						+ data.status.replace( /[^0-9a-z]+/i, '-' );
266					$message.addClass( 'wpcf7-' + customStatusClass );
267					$form.addClass( customStatusClass );
268			}
269
270			wpcf7.refill( $form, data );
271
272			wpcf7.triggerEvent( data.into, 'submit', detail );
273
274			if ( 'mail_sent' == data.status ) {
275				$form.each( function() {
276					this.reset();
277				} );
278
279				wpcf7.toggleSubmit( $form );
280				wpcf7.resetCounter( $form );
281			}
282
283			if ( ! wpcf7.supportHtml5.placeholder ) {
284				$form.find( '[placeholder].placeheld' ).each( function( i, n ) {
285					$( n ).val( $( n ).attr( 'placeholder' ) );
286				} );
287			}
288
289			$message.html( '' ).append( data.message ).slideDown( 'fast' );
290			$message.attr( 'role', 'alert' );
291
292			$( '.screen-reader-response', $form.closest( '.wpcf7' ) ).each( function() {
293				var $response = $( this );
294				$response.html( '' ).attr( 'role', '' ).append( data.message );
295
296				if ( data.invalidFields ) {
297					var $invalids = $( '<ul></ul>' );
298
299					$.each( data.invalidFields, function( i, n ) {
300						if ( n.idref ) {
301							var $li = $( '<li></li>' ).append( $( '<a></a>' ).attr( 'href', '#' + n.idref ).append( n.message ) );
302						} else {
303							var $li = $( '<li></li>' ).append( n.message );
304						}
305
306						$invalids.append( $li );
307					} );
308
309					$response.append( $invalids );
310				}
311
312				$response.attr( 'role', 'alert' ).focus();
313			} );
314		};
315
316		$.ajax( {
317			type: 'POST',
318			url: wpcf7.apiSettings.getRoute(
319				'/contact-forms/' + wpcf7.getId( $form ) + '/feedback' ),
320			data: formData,
321			dataType: 'json',
322			processData: false,
323			contentType: false
324		} ).done( function( data, status, xhr ) {
325			ajaxSuccess( data, status, xhr, $form );
326			$( '.ajax-loader', $form ).removeClass( 'is-active' );
327		} ).fail( function( xhr, status, error ) {
328			var $e = $( '<div class="ajax-error"></div>' ).text( error.message );
329			$form.after( $e );
330		} );
331	};
332
333	wpcf7.triggerEvent = function( target, name, detail ) {
334		var $target = $( target );
335
336		/* DOM event */
337		var event = new CustomEvent( 'wpcf7' + name, {
338			bubbles: true,
339			detail: detail
340		} );
341
342		$target.get( 0 ).dispatchEvent( event );
343
344		/* jQuery event */
345		$target.trigger( 'wpcf7:' + name, detail );
346		$target.trigger( name + '.wpcf7', detail ); // deprecated
347	};
348
349	wpcf7.toggleSubmit = function( form, state ) {
350		var $form = $( form );
351		var $submit = $( 'input:submit', $form );
352
353		if ( typeof state !== 'undefined' ) {
354			$submit.prop( 'disabled', ! state );
355			return;
356		}
357
358		if ( $form.hasClass( 'wpcf7-acceptance-as-validation' ) ) {
359			return;
360		}
361
362		$submit.prop( 'disabled', false );
363
364		$( '.wpcf7-acceptance', $form ).each( function() {
365			var $span = $( this );
366			var $input = $( 'input:checkbox', $span );
367
368			if ( ! $span.hasClass( 'optional' ) ) {
369				if ( $span.hasClass( 'invert' ) && $input.is( ':checked' )
370				|| ! $span.hasClass( 'invert' ) && ! $input.is( ':checked' ) ) {
371					$submit.prop( 'disabled', true );
372					return false;
373				}
374			}
375		} );
376	};
377
378	wpcf7.resetCounter = function( form ) {
379		var $form = $( form );
380
381		$( '.wpcf7-character-count', $form ).each( function() {
382			var $count = $( this );
383			var name = $count.attr( 'data-target-name' );
384			var down = $count.hasClass( 'down' );
385			var starting = parseInt( $count.attr( 'data-starting-value' ), 10 );
386			var maximum = parseInt( $count.attr( 'data-maximum-value' ), 10 );
387			var minimum = parseInt( $count.attr( 'data-minimum-value' ), 10 );
388
389			var updateCount = function( target ) {
390				var $target = $( target );
391				var length = $target.val().length;
392				var count = down ? starting - length : length;
393				$count.attr( 'data-current-value', count );
394				$count.text( count );
395
396				if ( maximum && maximum < length ) {
397					$count.addClass( 'too-long' );
398				} else {
399					$count.removeClass( 'too-long' );
400				}
401
402				if ( minimum && length < minimum ) {
403					$count.addClass( 'too-short' );
404				} else {
405					$count.removeClass( 'too-short' );
406				}
407			};
408
409			$( ':input[name="' + name + '"]', $form ).each( function() {
410				updateCount( this );
411
412				$( this ).keyup( function() {
413					updateCount( this );
414				} );
415			} );
416		} );
417	};
418
419	wpcf7.notValidTip = function( target, message ) {
420		var $target = $( target );
421		$( '.wpcf7-not-valid-tip', $target ).remove();
422
423		$( '<span></span>' ).attr( {
424			'class': 'wpcf7-not-valid-tip',
425			'role': 'alert',
426			'aria-hidden': 'true',
427		} ).text( message ).appendTo( $target );
428
429		if ( $target.is( '.use-floating-validation-tip *' ) ) {
430			var fadeOut = function( target ) {
431				$( target ).not( ':hidden' ).animate( {
432					opacity: 0
433				}, 'fast', function() {
434					$( this ).css( { 'z-index': -100 } );
435				} );
436			};
437
438			$target.on( 'mouseover', '.wpcf7-not-valid-tip', function() {
439				fadeOut( this );
440			} );
441
442			$target.on( 'focus', ':input', function() {
443				fadeOut( $( '.wpcf7-not-valid-tip', $target ) );
444			} );
445		}
446	};
447
448	wpcf7.refill = function( form, data ) {
449		var $form = $( form );
450
451		var refillCaptcha = function( $form, items ) {
452			$.each( items, function( i, n ) {
453				$form.find( ':input[name="' + i + '"]' ).val( '' );
454				$form.find( 'img.wpcf7-captcha-' + i ).attr( 'src', n );
455				var match = /([0-9]+)\.(png|gif|jpeg)$/.exec( n );
456				$form.find( 'input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]' ).attr( 'value', match[ 1 ] );
457			} );
458		};
459
460		var refillQuiz = function( $form, items ) {
461			$.each( items, function( i, n ) {
462				$form.find( ':input[name="' + i + '"]' ).val( '' );
463				$form.find( ':input[name="' + i + '"]' ).siblings( 'span.wpcf7-quiz-label' ).text( n[ 0 ] );
464				$form.find( 'input:hidden[name="_wpcf7_quiz_answer_' + i + '"]' ).attr( 'value', n[ 1 ] );
465			} );
466		};
467
468		if ( typeof data === 'undefined' ) {
469			$.ajax( {
470				type: 'GET',
471				url: wpcf7.apiSettings.getRoute(
472					'/contact-forms/' + wpcf7.getId( $form ) + '/refill' ),
473				beforeSend: function( xhr ) {
474					var nonce = $form.find( ':input[name="_wpnonce"]' ).val();
475
476					if ( nonce ) {
477						xhr.setRequestHeader( 'X-WP-Nonce', nonce );
478					}
479				},
480				dataType: 'json'
481			} ).done( function( data, status, xhr ) {
482				if ( data.captcha ) {
483					refillCaptcha( $form, data.captcha );
484				}
485
486				if ( data.quiz ) {
487					refillQuiz( $form, data.quiz );
488				}
489			} );
490
491		} else {
492			if ( data.captcha ) {
493				refillCaptcha( $form, data.captcha );
494			}
495
496			if ( data.quiz ) {
497				refillQuiz( $form, data.quiz );
498			}
499		}
500	};
501
502	wpcf7.clearResponse = function( form ) {
503		var $form = $( form );
504		$form.removeClass( 'invalid spam sent failed' );
505		$form.siblings( '.screen-reader-response' ).html( '' ).attr( 'role', '' );
506
507		$( '.wpcf7-not-valid-tip', $form ).remove();
508		$( '[aria-invalid]', $form ).attr( 'aria-invalid', 'false' );
509		$( '.wpcf7-form-control', $form ).removeClass( 'wpcf7-not-valid' );
510
511		$( '.wpcf7-response-output', $form )
512			.hide().empty().removeAttr( 'role' )
513			.removeClass( 'wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked' );
514	};
515
516	wpcf7.apiSettings.getRoute = function( path ) {
517		var url = wpcf7.apiSettings.root;
518
519		url = url.replace(
520			wpcf7.apiSettings.namespace,
521			wpcf7.apiSettings.namespace + path );
522
523		return url;
524	};
525
526} )( jQuery );
527
528/*
529 * Polyfill for Internet Explorer
530 * See https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
531 */
532( function () {
533	if ( typeof window.CustomEvent === "function" ) return false;
534
535	function CustomEvent ( event, params ) {
536		params = params || { bubbles: false, cancelable: false, detail: undefined };
537		var evt = document.createEvent( 'CustomEvent' );
538		evt.initCustomEvent( event,
539			params.bubbles, params.cancelable, params.detail );
540		return evt;
541	}
542
543	CustomEvent.prototype = window.Event.prototype;
544
545	window.CustomEvent = CustomEvent;
546} )();
547
548}

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.