PageSourceSearch

https://www.alpacav.com/wp-content/plugins/contact-form-7/includes/js/scripts_ver-5.0.1.js

js alpacav.com collected 2026-10-08 02:54:55 UTC 15,273 bytes, 540 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 ( typeof window.FormData !== 'function' ) {
59				return;
60			}
61
62			wpcf7.submit( $form );
63			event.preventDefault();
64		} );
65
66		$( '.wpcf7-submit', $form ).after( '<span class="ajax-loader"></span>' );
67
68		wpcf7.toggleSubmit( $form );
69
70		$form.on( 'click', '.wpcf7-acceptance', function() {
71			wpcf7.toggleSubmit( $form );
72		} );
73
74		// Exclusive Checkbox
75		$( '.wpcf7-exclusive-checkbox', $form ).on( 'click', 'input:checkbox', function() {
76			var name = $( this ).attr( 'name' );
77			$form.find( 'input:checkbox[name="' + name + '"]' ).not( this ).prop( 'checked', false );
78		} );
79
80		// Free Text Option for Checkboxes and Radio Buttons
81		$( '.wpcf7-list-item.has-free-text', $form ).each( function() {
82			var $freetext = $( ':input.wpcf7-free-text', this );
83			var $wrap = $( this ).closest( '.wpcf7-form-control' );
84
85			if ( $( ':checkbox, :radio', this ).is( ':checked' ) ) {
86				$freetext.prop( 'disabled', false );
87			} else {
88				$freetext.prop( 'disabled', true );
89			}
90
91			$wrap.on( 'change', ':checkbox, :radio', function() {
92				var $cb = $( '.has-free-text', $wrap ).find( ':checkbox, :radio' );
93
94				if ( $cb.is( ':checked' ) ) {
95					$freetext.prop( 'disabled', false ).focus();
96				} else {
97					$freetext.prop( 'disabled', true );
98				}
99			} );
100		} );
101
102		// Placeholder Fallback
103		if ( ! wpcf7.supportHtml5.placeholder ) {
104			$( '[placeholder]', $form ).each( function() {
105				$( this ).val( $( this ).attr( 'placeholder' ) );
106				$( this ).addClass( 'placeheld' );
107
108				$( this ).focus( function() {
109					if ( $( this ).hasClass( 'placeheld' ) ) {
110						$( this ).val( '' ).removeClass( 'placeheld' );
111					}
112				} );
113
114				$( this ).blur( function() {
115					if ( '' === $( this ).val() ) {
116						$( this ).val( $( this ).attr( 'placeholder' ) );
117						$( this ).addClass( 'placeheld' );
118					}
119				} );
120			} );
121		}
122
123		if ( wpcf7.jqueryUi && ! wpcf7.supportHtml5.date ) {
124			$form.find( 'input.wpcf7-date[type="date"]' ).each( function() {
125				$( this ).datepicker( {
126					dateFormat: 'yy-mm-dd',
127					minDate: new Date( $( this ).attr( 'min' ) ),
128					maxDate: new Date( $( this ).attr( 'max' ) )
129				} );
130			} );
131		}
132
133		if ( wpcf7.jqueryUi && ! wpcf7.supportHtml5.number ) {
134			$form.find( 'input.wpcf7-number[type="number"]' ).each( function() {
135				$( this ).spinner( {
136					min: $( this ).attr( 'min' ),
137					max: $( this ).attr( 'max' ),
138					step: $( this ).attr( 'step' )
139				} );
140			} );
141		}
142
143		// Character Count
144		$( '.wpcf7-character-count', $form ).each( function() {
145			var $count = $( this );
146			var name = $count.attr( 'data-target-name' );
147			var down = $count.hasClass( 'down' );
148			var starting = parseInt( $count.attr( 'data-starting-value' ), 10 );
149			var maximum = parseInt( $count.attr( 'data-maximum-value' ), 10 );
150			var minimum = parseInt( $count.attr( 'data-minimum-value' ), 10 );
151
152			var updateCount = function( target ) {
153				var $target = $( target );
154				var length = $target.val().length;
155				var count = down ? starting - length : length;
156				$count.attr( 'data-current-value', count );
157				$count.text( count );
158
159				if ( maximum && maximum < length ) {
160					$count.addClass( 'too-long' );
161				} else {
162					$count.removeClass( 'too-long' );
163				}
164
165				if ( minimum && length < minimum ) {
166					$count.addClass( 'too-short' );
167				} else {
168					$count.removeClass( 'too-short' );
169				}
170			};
171
172			$( ':input[name="' + name + '"]', $form ).each( function() {
173				updateCount( this );
174
175				$( this ).keyup( function() {
176					updateCount( this );
177				} );
178			} );
179		} );
180
181		// URL Input Correction
182		$form.on( 'change', '.wpcf7-validates-as-url', function() {
183			var val = $.trim( $( this ).val() );
184
185			if ( val
186			&& ! val.match( /^[a-z][a-z0-9.+-]*:/i )
187			&& -1 !== val.indexOf( '.' ) ) {
188				val = val.replace( /^\/+/, '' );
189				val = 'http://' + val;
190			}
191
192			$( this ).val( val );
193		} );
194	};
195
196	wpcf7.submit = function( form ) {
197		if ( typeof window.FormData !== 'function' ) {
198			return;
199		}
200
201		var $form = $( form );
202
203		$( '.ajax-loader', $form ).addClass( 'is-active' );
204
205		$( '[placeholder].placeheld', $form ).each( function( i, n ) {
206			$( n ).val( '' );
207		} );
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					$( '[name="g-recaptcha-response"]', $form ).each( function() {
279						if ( '' === $( this ).val() ) {
280							var $recaptcha = $( this ).closest( '.wpcf7-form-control-wrap' );
281							wpcf7.notValidTip( $recaptcha, wpcf7.recaptcha.messages.empty );
282						}
283					} );
284
285					wpcf7.triggerEvent( data.into, 'spam', detail );
286					break;
287				case 'aborted':
288					$message.addClass( 'wpcf7-aborted' );
289					$form.addClass( 'aborted' );
290
291					wpcf7.triggerEvent( data.into, 'aborted', detail );
292					break;
293				case 'mail_sent':
294					$message.addClass( 'wpcf7-mail-sent-ok' );
295					$form.addClass( 'sent' );
296
297					wpcf7.triggerEvent( data.into, 'mailsent', detail );
298					break;
299				case 'mail_failed':
300					$message.addClass( 'wpcf7-mail-sent-ng' );
301					$form.addClass( 'failed' );
302
303					wpcf7.triggerEvent( data.into, 'mailfailed', detail );
304					break;
305				default:
306					var customStatusClass = 'custom-'
307						+ data.status.replace( /[^0-9a-z]+/i, '-' );
308					$message.addClass( 'wpcf7-' + customStatusClass );
309					$form.addClass( customStatusClass );
310			}
311
312			wpcf7.refill( $form, data );
313
314			wpcf7.triggerEvent( data.into, 'submit', detail );
315
316			if ( 'mail_sent' == data.status ) {
317				$form.each( function() {
318					this.reset();
319				} );
320			}
321
322			$form.find( '[placeholder].placeheld' ).each( function( i, n ) {
323				$( n ).val( $( n ).attr( 'placeholder' ) );
324			} );
325
326			$message.html( '' ).append( data.message ).slideDown( 'fast' );
327			$message.attr( 'role', 'alert' );
328
329			$( '.screen-reader-response', $form.closest( '.wpcf7' ) ).each( function() {
330				var $response = $( this );
331				$response.html( '' ).attr( 'role', '' ).append( data.message );
332
333				if ( data.invalidFields ) {
334					var $invalids = $( '<ul></ul>' );
335
336					$.each( data.invalidFields, function( i, n ) {
337						if ( n.idref ) {
338							var $li = $( '<li></li>' ).append( $( '<a></a>' ).attr( 'href', '#' + n.idref ).append( n.message ) );
339						} else {
340							var $li = $( '<li></li>' ).append( n.message );
341						}
342
343						$invalids.append( $li );
344					} );
345
346					$response.append( $invalids );
347				}
348
349				$response.attr( 'role', 'alert' ).focus();
350			} );
351		};
352
353		$.ajax( {
354			type: 'POST',
355			url: wpcf7.apiSettings.getRoute(
356				'/contact-forms/' + wpcf7.getId( $form ) + '/feedback' ),
357			data: formData,
358			dataType: 'json',
359			processData: false,
360			contentType: false
361		} ).done( function( data, status, xhr ) {
362			ajaxSuccess( data, status, xhr, $form );
363			$( '.ajax-loader', $form ).removeClass( 'is-active' );
364		} ).fail( function( xhr, status, error ) {
365			var $e = $( '<div class="ajax-error"></div>' ).text( error.message );
366			$form.after( $e );
367		} );
368	};
369
370	wpcf7.triggerEvent = function( target, name, detail ) {
371		var $target = $( target );
372
373		/* DOM event */
374		var event = new CustomEvent( 'wpcf7' + name, {
375			bubbles: true,
376			detail: detail
377		} );
378
379		$target.get( 0 ).dispatchEvent( event );
380
381		/* jQuery event */
382		$target.trigger( 'wpcf7:' + name, detail );
383		$target.trigger( name + '.wpcf7', detail ); // deprecated
384	};
385
386	wpcf7.toggleSubmit = function( form, state ) {
387		var $form = $( form );
388		var $submit = $( 'input:submit', $form );
389
390		if ( typeof state !== 'undefined' ) {
391			$submit.prop( 'disabled', ! state );
392			return;
393		}
394
395		if ( $form.hasClass( 'wpcf7-acceptance-as-validation' ) ) {
396			return;
397		}
398
399		$submit.prop( 'disabled', false );
400
401		$( '.wpcf7-acceptance', $form ).each( function() {
402			var $span = $( this );
403			var $input = $( 'input:checkbox', $span );
404
405			if ( ! $span.hasClass( 'optional' ) ) {
406				if ( $span.hasClass( 'invert' ) && $input.is( ':checked' )
407				|| ! $span.hasClass( 'invert' ) && ! $input.is( ':checked' ) ) {
408					$submit.prop( 'disabled', true );
409					return false;
410				}
411			}
412		} );
413	};
414
415	wpcf7.notValidTip = function( target, message ) {
416		var $target = $( target );
417		$( '.wpcf7-not-valid-tip', $target ).remove();
418		$( '<span role="alert" class="wpcf7-not-valid-tip"></span>' )
419			.text( message ).appendTo( $target );
420
421		if ( $target.is( '.use-floating-validation-tip *' ) ) {
422			var fadeOut = function( target ) {
423				$( target ).not( ':hidden' ).animate( {
424					opacity: 0
425				}, 'fast', function() {
426					$( this ).css( { 'z-index': -100 } );
427				} );
428			};
429
430			$target.on( 'mouseover', '.wpcf7-not-valid-tip', function() {
431				fadeOut( this );
432			} );
433
434			$target.on( 'focus', ':input', function() {
435				fadeOut( $( '.wpcf7-not-valid-tip', $target ) );
436			} );
437		}
438	};
439
440	wpcf7.refill = function( form, data ) {
441		var $form = $( form );
442
443		var refillCaptcha = function( $form, items ) {
444			$.each( items, function( i, n ) {
445				$form.find( ':input[name="' + i + '"]' ).val( '' );
446				$form.find( 'img.wpcf7-captcha-' + i ).attr( 'src', n );
447				var match = /([0-9]+)\.(png|gif|jpeg)$/.exec( n );
448				$form.find( 'input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]' ).attr( 'value', match[ 1 ] );
449			} );
450		};
451
452		var refillQuiz = function( $form, items ) {
453			$.each( items, function( i, n ) {
454				$form.find( ':input[name="' + i + '"]' ).val( '' );
455				$form.find( ':input[name="' + i + '"]' ).siblings( 'span.wpcf7-quiz-label' ).text( n[ 0 ] );
456				$form.find( 'input:hidden[name="_wpcf7_quiz_answer_' + i + '"]' ).attr( 'value', n[ 1 ] );
457			} );
458		};
459
460		if ( typeof data === 'undefined' ) {
461			$.ajax( {
462				type: 'GET',
463				url: wpcf7.apiSettings.getRoute(
464					'/contact-forms/' + wpcf7.getId( $form ) + '/refill' ),
465				beforeSend: function( xhr ) {
466					var nonce = $form.find( ':input[name="_wpnonce"]' ).val();
467
468					if ( nonce ) {
469						xhr.setRequestHeader( 'X-WP-Nonce', nonce );
470					}
471				},
472				dataType: 'json'
473			} ).done( function( data, status, xhr ) {
474				if ( data.captcha ) {
475					refillCaptcha( $form, data.captcha );
476				}
477
478				if ( data.quiz ) {
479					refillQuiz( $form, data.quiz );
480				}
481			} );
482
483		} else {
484			if ( data.captcha ) {
485				refillCaptcha( $form, data.captcha );
486			}
487
488			if ( data.quiz ) {
489				refillQuiz( $form, data.quiz );
490			}
491		}
492	};
493
494	wpcf7.clearResponse = function( form ) {
495		var $form = $( form );
496		$form.removeClass( 'invalid spam sent failed' );
497		$form.siblings( '.screen-reader-response' ).html( '' ).attr( 'role', '' );
498
499		$( '.wpcf7-not-valid-tip', $form ).remove();
500		$( '[aria-invalid]', $form ).attr( 'aria-invalid', 'false' );
501		$( '.wpcf7-form-control', $form ).removeClass( 'wpcf7-not-valid' );
502
503		$( '.wpcf7-response-output', $form )
504			.hide().empty().removeAttr( 'role' )
505			.removeClass( 'wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked' );
506	};
507
508	wpcf7.apiSettings.getRoute = function( path ) {
509		var url = wpcf7.apiSettings.root;
510
511		url = url.replace(
512			wpcf7.apiSettings.namespace,
513			wpcf7.apiSettings.namespace + path );
514
515		return url;
516	};
517
518} )( jQuery );
519
520/*
521 * Polyfill for Internet Explorer
522 * See https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
523 */
524( function () {
525	if ( typeof window.CustomEvent === "function" ) return false;
526
527	function CustomEvent ( event, params ) {
528		params = params || { bubbles: false, cancelable: false, detail: undefined };
529		var evt = document.createEvent( 'CustomEvent' );
530		evt.initCustomEvent( event,
531			params.bubbles, params.cancelable, params.detail );
532		return evt;
533	}
534
535	CustomEvent.prototype = window.Event.prototype;
536
537	window.CustomEvent = CustomEvent;
538} )();
539
540}

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.