PageSourceSearch

https://distribucionmayorista.online/themes/warehousechild/modules/ets_contactform7/views/js/scripts.js

js distribucionmayorista.online collected 2026-10-04 13:26:27 UTC 29,313 bytes, 933 lines download raw bytes

1/**
2 * 2007-2022 ETS-Soft
3 *
4 * NOTICE OF LICENSE
5 *
6 * This file is not open source! Each license that you purchased is only available for 1 wesite only.
7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses.
8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
9 *
10 * DISCLAIMER
11 *
12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
13 * versions in the future. If you wish to customize PrestaShop for your
14 * needs please contact us for extra customization service at an affordable price
15 *
16 *  @author ETS-Soft <[email protected]>
17 *  @copyright  2007-2022 ETS-Soft
18 *  @license    Valid for 1 website (or project) for each purchase of license
19 *  International Registered Trademark & Property of ETS-Soft
20 */
21( function( $ ) {
22
23	'use strict';
24    var wpcf7 = {"apiSettings":{"root":"http:\/\/web.prestahero.com\/chung\/wp494\/wp-json\/contact-form-7\/v1","namespace":"contact-form-7\/v1"},"recaptcha":{"messages":{"empty":"Please verify that you are not a robot."}}};
25	if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) {
26		return;
27	}
28
29	wpcf7 = $.extend( {
30		cached: 0,
31		inputs: []
32	}, wpcf7 );
33    
34	$( function() {
35		wpcf7.supportHtml5 = ( function() {
36			var features = {};
37			var input = document.createElement( 'input' );
38
39			features.placeholder = 'placeholder' in input;
40
41			var inputTypes = [ 'email', 'url', 'tel', 'number', 'range', 'date' ];
42
43			$.each( inputTypes, function( index, value ) {
44				input.setAttribute( 'type', value );
45				features[ value ] = input.type !== 'text';
46			} );
47			return features;
48		} )();
49
50		$( 'div.wpcf7 > form' ).each( function() {
51			var $form = $( this );
52			wpcf7.initForm( $form );
53
54			if ( wpcf7.cached ) {
55				wpcf7.refill( $form );
56			}
57		} );
58	} );
59
60	wpcf7.getId = function( form ) {
61		return parseInt( $( 'input[name="_wpcf7"]', form ).val(), 10 );
62	};
63
64	wpcf7.initForm = function( form ) {
65		var $form = $( form );
66		$form.submit( function( event ) {
67			if ( typeof window.FormData !== 'function' ) {
68				return;
69			}
70
71			wpcf7.submit( $form );
72			event.preventDefault();
73		} );
74        if($form.find('.ajax-loader').length<=0)
75            $form.find('.wpcf7-submit').after('<span class="ajax-loader"></span>' );
76		wpcf7.toggleSubmit( $form );
77
78		$form.on( 'click', '.wpcf7-acceptance', function() {
79			wpcf7.toggleSubmit( $form );
80		} );
81
82		// Exclusive Checkbox
83		$( '.wpcf7-exclusive-checkbox', $form ).on( 'click', 'input:checkbox', function() {
84			var name = $( this ).attr( 'name' );
85			$form.find( 'input:checkbox[name="' + name + '"]' ).not( this ).prop( 'checked', false );
86		} );
87
88		// Free Text Option for Checkboxes and Radio Buttons
89		$( '.wpcf7-list-item.has-free-text', $form ).each( function() {
90			var $freetext = $( ':input.wpcf7-free-text', this );
91			var $wrap = $( this ).closest( '.wpcf7-form-control' );
92			if ( $( ':checkbox, :radio', this ).is( ':checked' ) ) {
93				$freetext.prop( 'disabled', false );
94			} else {
95				$freetext.prop( 'disabled', true );
96			}
97			$wrap.on( 'change', ':checkbox, :radio', function() {
98				var $cb = $( '.has-free-text', $wrap ).find( ':checkbox, :radio' );
99				if ( $cb.is( ':checked' ) ) {
100					$freetext.prop( 'disabled', false ).focus();
101				} else {
102					$freetext.prop( 'disabled', true );
103				}
104			});
105		} );
106
107		// Placeholder Fallback
108		if ( ! wpcf7.supportHtml5.placeholder ) {
109			$( '[placeholder]', $form ).each( function() {
110				$( this ).val( $( this ).attr( 'placeholder' ) );
111				$( this ).addClass( 'placeheld' );
112
113				$( this ).focus( function() {
114					if ( $( this ).hasClass( 'placeheld' ) ) {
115						$( this ).val( '' ).removeClass( 'placeheld' );
116					}
117				} );
118
119				$( this ).blur( function() {
120					if ( '' === $( this ).val() ) {
121						$( this ).val( $( this ).attr( 'placeholder' ) );
122						$( this ).addClass( 'placeheld' );
123					}
124				} );
125			} );
126		}
127
128		if ( wpcf7.jqueryUi && ! wpcf7.supportHtml5.date ) {
129			$form.find( 'input.wpcf7-date[type="date"]' ).each( function() {
130				$( this ).datepicker( {
131					dateFormat: 'yy-mm-dd',
132					minDate: new Date( $( this ).attr( 'min' ) ),
133					maxDate: new Date( $( this ).attr( 'max' ) )
134				} );
135			} );
136		}
137
138		if ( wpcf7.jqueryUi && ! wpcf7.supportHtml5.number ) {
139			$form.find( 'input.wpcf7-number[type="number"]' ).each( function() {
140				$( this ).spinner( {
141					min: $( this ).attr( 'min' ),
142					max: $( this ).attr( 'max' ),
143					step: $( this ).attr( 'step' )
144				} );
145			} );
146		}
147
148		// Character Count
149		$( '.wpcf7-character-count', $form ).each( function() {
150			var $count = $( this );
151			var name = $count.attr( 'data-target-name' );
152			var down = $count.hasClass( 'down' );
153			var starting = parseInt( $count.attr( 'data-starting-value' ), 10 );
154			var maximum = parseInt( $count.attr( 'data-maximum-value' ), 10 );
155			var minimum = parseInt( $count.attr( 'data-minimum-value' ), 10 );
156
157			var updateCount = function( target ) {
158				var $target = $( target );
159				var length = $target.val().length;
160				var count = down ? starting - length : length;
161				$count.attr( 'data-current-value', count );
162				$count.text( count );
163
164				if ( maximum && maximum < length ) {
165					$count.addClass( 'too-long' );
166				} else {
167					$count.removeClass( 'too-long' );
168				}
169
170				if ( minimum && length < minimum ) {
171					$count.addClass( 'too-short' );
172				} else {
173					$count.removeClass( 'too-short' );
174				}
175			};
176
177			$( ':input[name="' + name + '"]', $form ).each( function() {
178				updateCount( this );
179
180				$( this ).keyup( function() {
181					updateCount( this );
182				} );
183			} );
184		} );
185
186		// URL Input Correction
187		$form.on( 'change', '.wpcf7-validates-as-url', function() {
188			var val = $.trim( $( this ).val() );
189
190			if ( val
191			&& ! val.match( /^[a-z][a-z0-9.+-]*:/i )
192			&& -1 !== val.indexOf( '.' ) ) {
193				val = val.replace( /^\/+/, '' );
194				val = 'http://' + val;
195			}
196
197			$( this ).val( val );
198		} );
199	};
200
201
202
203	/*ORIGINAL*/
204	/* wpcf7.submit = function( form ) {
205	    if (typeof tinyMCE !== 'undefined' && tinyMCE.editors.length > 0 && $('.autoload_rte_ctf7').length) {
206                tinyMCE.triggerSave();
207        }
208		if ( typeof window.FormData !== 'function' ) {
209			return;
210		}
211		var $form = $( form );
212        if($form.hasClass('is-active') )
213            return false;
214		$( '.ajax-loader', $form ).addClass( 'is-active' );
215        $form.addClass( 'is-active' );
216		$( '[placeholder].placeheld', $form ).each( function( i, n ) {
217			$( n ).val( '' );
218		} );
219
220		wpcf7.clearResponse( $form );
221
222		var formData = new FormData( $form.get( 0 ) );
223
224		var detail = {
225			id: $form.closest( 'div.wpcf7' ).attr( 'id' ),
226			status: 'init',
227			inputs: [],
228			formData: formData
229		};
230
231		$.each( $form.serializeArray(), function( i, field ) {
232			if ( '_wpcf7' == field.name ) {
233				detail.contactFormId = field.value;
234			} else if ( '_etscf7_version' == field.name ) {
235				detail.pluginVersion = field.value;
236			} else if ( '_etscf7_locale' == field.name ) {
237				detail.contactFormLocale = field.value;
238			} else if ( '_etscf7_unit_tag' == field.name ) {
239				detail.unitTag = field.value;
240			} else if ( '_etscf7_container_post' == field.name ) {
241				detail.containerPostId = field.value;
242			} else if ( field.name.match( /^_etscf7_\w+_free_text_/ ) ) {
243				var owner = field.name.replace( /^_etscf7_\w+_free_text_/, '' );
244				detail.inputs.push( {
245					name: owner + '-free-text',
246					value: field.value
247				} );
248			} else if ( field.name.match( /^_/ ) ) {
249				// do nothing
250			} else {
251				detail.inputs.push( field );
252			}
253		} );
254		wpcf7.triggerEvent( $form.closest( 'div.wpcf7' ), 'beforesubmit', detail );
255		var ajaxSuccess = function( data, status, xhr, $form ) {
256			detail.id = $( data.into ).attr( 'id' );
257			detail.status = data.status;
258			detail.apiResponse = data;
259			var $message = $( '.wpcf7-response-output', $form );
260            $message.removeClass( 'alert-warning' );
261            $message.removeClass( 'alert-success' );
262			switch ( data.status ) {
263				case 'validation_failed':
264					$.each( data.invalidFields, function( i, n ) {
265						$( n.into, $form ).each( function() {
266							wpcf7.notValidTip( this, n.message );
267							$( '.wpcf7-form-control', this ).addClass( 'wpcf7-not-valid' );
268							$( '[aria-invalid]', this ).attr( 'aria-invalid', 'true' );
269						} );
270					} );
271					$message.addClass( 'alert alert-warning' );
272					$form.addClass( 'invalid' );
273					wpcf7.triggerEvent( data.into, 'invalid', detail );
274					break;
275				case 'acceptance_missing':
276					$message.addClass( 'alert alert-warning' );
277					$form.addClass( 'unaccepted' );
278					wpcf7.triggerEvent( data.into, 'unaccepted', detail );
279					break;
280				case 'spam':
281					$message.addClass( 'alert alert-warning' );
282					$form.addClass( 'spam' );
283					$( '[name="g-recaptcha-response"]', $form ).each( function() {
284						if ( '' === $( this ).val() ) {
285							var $recaptcha = $( this ).closest( '.wpcf7-form-control-wrap' );
286							wpcf7.notValidTip( $recaptcha, wpcf7.recaptcha.messages.empty );
287						}
288					} );
289					wpcf7.triggerEvent( data.into, 'spam', detail );
290					break;
291				case 'aborted':
292					$message.addClass( 'alert alert-warning' );
293					$form.addClass( 'aborted' );
294
295					wpcf7.triggerEvent( data.into, 'aborted', detail );
296					break;
297				case 'mail_sent':
298					$message.addClass( 'alert alert-success' );
299					$form.addClass( 'sent' );
300					wpcf7.triggerEvent( data.into, 'mailsent', detail );
301					break;
302				case 'mail_failed':
303					$message.addClass( 'alert alert-warning' );
304					$form.addClass( 'failed' );
305
306					wpcf7.triggerEvent( data.into, 'mailfailed', detail );
307					break;
308				case 'mail_redirect':
309					$message.hide().remove();
310					window.location.href = data.message;
311					break;
312				case 'load_thank_page':
313					$message.hide().remove();
314					window.location.href = data.message;
315					break;
316				default:
317					var customStatusClass = 'custom-'
318						+ data.status.replace( /[^0-9a-z]+/i, '-' );
319					$message.addClass( 'wpcf7-' + customStatusClass );
320					$form.addClass( customStatusClass );
321			}
322
323			wpcf7.refill( $form, data );
324
325			wpcf7.triggerEvent( data.into, 'submit', detail );
326
327			if ( 'mail_sent' == data.status ) {
328				$form.each( function() {
329					this.reset();
330				} );
331			}
332
333			$form.find( '[placeholder].placeheld' ).each( function( i, n ) {
334				$( n ).val( $( n ).attr( 'placeholder' ) );
335			} );
336
337			$message.html( '' ).append( data.message ).slideDown( 'fast' );
338			$message.attr( 'role', 'alert' );
339
340			$( '.screen-reader-response', $form.closest( '.wpcf7' ) ).each( function() {
341				var $response = $( this );
342				$response.html( '' ).attr( 'role', '' ).append( data.message );
343
344				if ( data.invalidFields ) {
345					var $invalids = $( '<ul></ul>' );
346
347					$.each( data.invalidFields, function( i, n ) {
348						if ( n.idref ) {
349							var $li = $( '<li></li>' ).append( $( '<a></a>' ).attr( 'href', '#' + n.idref ).append( n.message ) );
350						} else {
351							var $li = $( '<li></li>' ).append( n.message );
352						}
353
354						$invalids.append( $li );
355					} );
356
357					$response.append( $invalids );
358				}
359
360				$response.attr( 'role', 'alert' ).focus();
361			} );
362		};
363		$.ajax( {
364			type: 'POST',
365			url: $form.attr('action'),
366			data: formData,
367			dataType: 'json',
368			processData: false,
369			contentType: false
370		} ).done( function( data, status, xhr ) {
371			ajaxSuccess( data, status, xhr, $form );
372			$( '.ajax-loader', $form ).removeClass( 'is-active' );
373            $form.removeClass('is-active');
374            if($form.find('.pa-captcha-refesh').length)
375                refeshImage($form.find('.pa-captcha-refesh'));
376            $(document).trigger("wpcf7submit");
377		} ).fail( function( xhr, status, error ) {
378            $form.find('.wpcf7-response-output').removeClass( 'alert-warning' );
379            $form.find('.wpcf7-response-output').removeClass( 'alert-success' );
380            $form.find('.wpcf7-response-output').html('There was a technical error when submitting the form. Please contact webmaster for more information');
381            $form.find('.wpcf7-response-output').addClass( 'alert alert-warning' );
382            $form.find('.wpcf7-response-output').addClass( 'invalid' ).show();
383            $form.find('.ajax-loader').removeClass('is-active');
384            $form.removeClass('is-active');
385            if($form.find('.pa-captcha-refesh'))
386                refeshImage($form.find('.pa-captcha-refesh'));
387            $(document).trigger("wpcf7submit");
388		} );
389	}; */
390
391
392
393	/*Mod con Regex 01/04/25*/
394		wpcf7.submit = function( form ) {
395			if (typeof tinyMCE !== 'undefined' && tinyMCE.editors.length > 0 && $('.autoload_rte_ctf7').length) {
396				tinyMCE.triggerSave();
397			}
398			if ( typeof window.FormData !== 'function' ) {
399				return;
400			}
401			var $form = $( form );
402			if($form.hasClass('is-active') )
403				return false;
404			
405			// Validación del campo teléfono
406			var phoneInput = $form.find('input[name="your-phone"]');
407			var phoneValue = phoneInput.val();
408			var phoneRegex = /^\+(\d{1,4})\s?(\d{1,4})\s?(\d{1,4})\s?(\d{1,4})\s?(\d{1,4})$/;  // Regex para validar teléfono internacional
409		
410			// Limpiar mensaje de error previo
411			phoneInput.closest('label').find('.phone-error-message').remove();
412		
413			// Si el teléfono no es válido, mostrar mensaje de error y evitar el envío
414			if (phoneValue && !phoneRegex.test(phoneValue)) {
415				var errorMessage = '<span class="phone-error-message" style="color:red;">Por favor, ingresa un número de teléfono válido.</span>';
416				phoneInput.closest('label').append(errorMessage);
417				return false;  // Detener el envío del formulario si el teléfono es inválido
418			}
419		
420			// Si todo es válido, continuar con el envío del formulario
421			$('.ajax-loader', $form).addClass('is-active');
422			$form.addClass('is-active');
423			$('[placeholder].placeheld', $form).each(function(i, n) {
424				$(n).val('');
425			});
426		
427			wpcf7.clearResponse($form);
428		
429			var formData = new FormData($form.get(0));
430		
431			var detail = {
432				id: $form.closest('div.wpcf7').attr('id'),
433				status: 'init',
434				inputs: [],
435				formData: formData
436			};
437		
438			$.each($form.serializeArray(), function(i, field) {
439				if ('_wpcf7' == field.name) {
440					detail.contactFormId = field.value;
441				} else if ('_etscf7_version' == field.name) {
442					detail.pluginVersion = field.value;
443				} else if ('_etscf7_locale' == field.name) {
444					detail.contactFormLocale = field.value;
445				} else if ('_etscf7_unit_tag' == field.name) {
446					detail.unitTag = field.value;
447				} else if ('_etscf7_container_post' == field.name) {
448					detail.containerPostId = field.value;
449				} else if (field.name.match(/^_etscf7_\w+_free_text_/)) {
450					var owner = field.name.replace(/^_etscf7_\w+_free_text_/, '');
451					detail.inputs.push({
452						name: owner + '-free-text',
453						value: field.value
454					});
455				} else if (field.name.match(/^_/)) {
456					// Do nothing
457				} else {
458					detail.inputs.push(field);
459				}
460			});
461		
462			wpcf7.triggerEvent($form.closest('div.wpcf7'), 'beforesubmit', detail);
463		
464			var ajaxSuccess = function(data, status, xhr, $form) {
465				detail.id = $(data.into).attr('id');
466				detail.status = data.status;
467				detail.apiResponse = data;
468				var $message = $('.wpcf7-response-output', $form);
469				$message.removeClass('alert-warning');
470				$message.removeClass('alert-success');
471				switch (data.status) {
472					case 'validation_failed':
473						$.each(data.invalidFields, function(i, n) {
474							$(n.into, $form).each(function() {
475								wpcf7.notValidTip(this, n.message);
476								$('.wpcf7-form-control', this).addClass('wpcf7-not-valid');
477								$('[aria-invalid]', this).attr('aria-invalid', 'true');
478							});
479						});
480						$message.addClass('alert alert-warning');
481						$form.addClass('invalid');
482						wpcf7.triggerEvent(data.into, 'invalid', detail);
483						break;
484					case 'acceptance_missing':
485						$message.addClass('alert alert-warning');
486						$form.addClass('unaccepted');
487						wpcf7.triggerEvent(data.into, 'unaccepted', detail);
488						break;
489					case 'spam':
490						$message.addClass('alert alert-warning');
491						$form.addClass('spam');
492						$('[name="g-recaptcha-response"]', $form).each(function() {
493							if ('' === $(this).val()) {
494								var $recaptcha = $(this).closest('.wpcf7-form-control-wrap');
495								wpcf7.notValidTip($recaptcha, wpcf7.recaptcha.messages.empty);
496							}
497						});
498						wpcf7.triggerEvent(data.into, 'spam', detail);
499						break;
500					case 'aborted':
501						$message.addClass('alert alert-warning');
502						$form.addClass('aborted');
503						wpcf7.triggerEvent(data.into, 'aborted', detail);
504						break;
505					case 'mail_sent':
506						$message.addClass('alert alert-success');
507						$form.addClass('sent');
508						wpcf7.triggerEvent(data.into, 'mailsent', detail);
509						break;
510					case 'mail_failed':
511						$message.addClass('alert alert-warning');
512						$form.addClass('failed');
513						wpcf7.triggerEvent(data.into, 'mailfailed', detail);
514						break;
515					case 'mail_redirect':
516						$message.hide().remove();
517						window.location.href = data.message;
518						break;
519					case 'load_thank_page':
520						$message.hide().remove();
521						window.location.href = data.message;
522						break;
523					default:
524						var customStatusClass = 'custom-' + data.status.replace(/[^0-9a-z]+/i, '-');
525						$message.addClass('wpcf7-' + customStatusClass);
526						$form.addClass(customStatusClass);
527				}
528		
529				wpcf7.refill($form, data);
530		
531				wpcf7.triggerEvent(data.into, 'submit', detail);
532		
533				if ('mail_sent' == data.status) {
534					$form.each(function() {
535						this.reset();
536					});
537				}
538		
539				$form.find('[placeholder].placeheld').each(function(i, n) {
540					$(n).val($(n).attr('placeholder'));
541				});
542		
543				$message.html('').append(data.message).slideDown('fast');
544				$message.attr('role', 'alert');
545		
546				$('.screen-reader-response', $form.closest('.wpcf7')).each(function() {
547					var $response = $(this);
548					$response.html('').attr('role', '').append(data.message);
549		
550					if (data.invalidFields) {
551						var $invalids = $('<ul></ul>');
552		
553						$.each(data.invalidFields, function(i, n) {
554							if (n.idref) {
555								var $li = $('<li></li>').append($('<a></a>').attr('href', '#' + n.idref).append(n.message));
556							} else {
557								var $li = $('<li></li>').append(n.message);
558							}
559		
560							$invalids.append($li);
561						});
562		
563						$response.append($invalids);
564					}
565		
566					$response.attr('role', 'alert').focus();
567				});
568			};
569		
570			$.ajax({
571				type: 'POST',
572				url: $form.attr('action'),
573				data: formData,
574				dataType: 'json',
575				processData: false,
576				contentType: false
577			}).done(function(data, status, xhr) {
578				ajaxSuccess(data, status, xhr, $form);
579				$('.ajax-loader', $form).removeClass('is-active');
580				$form.removeClass('is-active');
581				if($form.find('.pa-captcha-refesh').length)
582					refeshImage($form.find('.pa-captcha-refesh'));
583				$(document).trigger("wpcf7submit");
584			}).fail(function(xhr, status, error) {
585				$form.find('.wpcf7-response-output').removeClass('alert-warning');
586				$form.find('.wpcf7-response-output').removeClass('alert-success');
587				$form.find('.wpcf7-response-output').html('There was a technical error when submitting the form. Please contact webmaster for more information');
588				$form.find('.wpcf7-response-output').addClass('alert alert-warning');
589				$form.find('.wpcf7-response-output').addClass('invalid').show();
590				$form.find('.ajax-loader').removeClass('is-active');
591				$form.removeClass('is-active');
592				if($form.find('.pa-captcha-refesh'))
593					refeshImage($form.find('.pa-captcha-refesh'));
594				$(document).trigger("wpcf7submit");
595			});
596		};
597	/*--------*/
598
599
600
601
602	wpcf7.triggerEvent = function( target, name, detail ) {
603		var $target = $( target );
604
605		/* DOM event */
606		var event = new CustomEvent( 'wpcf7' + name, {
607			bubbles: true,
608			detail: detail
609		} );
610		/* jQuery event */
611		$target.trigger( 'wpcf7:' + name, detail );
612		$target.trigger( name + '.wpcf7', detail );
613        
614	};
615
616	wpcf7.toggleSubmit = function( form, state ) {
617		var $form = $( form );
618		var $submit = $( 'input:submit', $form );
619
620		if ( typeof state !== 'undefined' ) {
621			$submit.prop( 'disabled', ! state );
622			return;
623		}
624
625		if ( $form.hasClass( 'wpcf7-acceptance-as-validation' ) ) {
626			return;
627		}
628		$submit.prop( 'disabled', false );
629
630		$( '.wpcf7-acceptance', $form ).each( function() {
631			var $span = $( this );
632			var $input = $( 'input:checkbox', $span );
633
634			if ( ! $span.hasClass( 'optional' ) ) {
635				if ( $span.hasClass( 'invert' ) && $input.is( ':checked' )
636				|| ! $span.hasClass( 'invert' ) && ! $input.is( ':checked' ) ) {
637                    $submit.prop( 'disabled', true );
638					return false;
639				}
640			}
641		} );
642	};
643
644	wpcf7.notValidTip = function( target, message ) {
645		var $target = $( target );
646		$( '.wpcf7-not-valid-tip', $target ).remove();
647		$( '<span role="alert" class="wpcf7-not-valid-tip"></span>' )
648			.text( message ).appendTo( $target );
649
650		if ( $target.is( '.use-floating-validation-tip *' ) ) {
651			var fadeOut = function( target ) {
652				$( target ).not( ':hidden' ).animate( {
653					opacity: 0
654				}, 'fast', function() {
655					$( this ).css( { 'z-index': -100 } );
656				} );
657			};
658
659			$target.on( 'mouseover', '.wpcf7-not-valid-tip', function() {
660				fadeOut( this );
661			} );
662
663			$target.on( 'focus', ':input', function() {
664				fadeOut( $( '.wpcf7-not-valid-tip', $target ) );
665			} );
666		}
667	};
668
669	wpcf7.refill = function( form, data ) {
670		var $form = $( form );
671
672		var refillCaptcha = function( $form, items ) {
673			$.each( items, function( i, n ) {
674				$form.find( ':input[name="' + i + '"]' ).val( '' );
675				$form.find( 'img.wpcf7-captcha-' + i ).attr( 'src', n );
676				var match = /([0-9]+)\.(png|gif|jpeg)$/.exec( n );
677				$form.find( 'input:hidden[name="_etscf7_captcha_challenge_' + i + '"]' ).attr( 'value', match[ 1 ] );
678			} );
679		};
680
681		var refillQuiz = function( $form, items ) {
682			$.each( items, function( i, n ) {
683				$form.find( ':input[name="' + i + '"]' ).val( '' );
684				$form.find( ':input[name="' + i + '"]' ).siblings( 'span.wpcf7-quiz-label' ).text( n[ 0 ] );
685				$form.find( 'input:hidden[name="_etscf7_quiz_answer_' + i + '"]' ).attr( 'value', n[ 1 ] );
686			} );
687		};
688
689		if ( typeof data === 'undefined' ) {
690			$.ajax( {
691				type: 'GET',
692				url: wpcf7.apiSettings.getRoute(
693					'/contact-forms/' + wpcf7.getId( $form ) + '/refill' ),
694				beforeSend: function( xhr ) {
695					var nonce = $form.find( ':input[name="_wpnonce"]' ).val();
696
697					if ( nonce ) {
698						xhr.setRequestHeader( 'X-WP-Nonce', nonce );
699					}
700				},
701				dataType: 'json'
702			} ).done( function( data, status, xhr ) {
703				if ( data.captcha ) {
704					refillCaptcha( $form, data.captcha );
705				}
706
707				if ( data.quiz ) {
708					refillQuiz( $form, data.quiz );
709				}
710			} );
711
712		} else {
713			if ( data.captcha ) {
714				refillCaptcha( $form, data.captcha );
715			}
716
717			if ( data.quiz ) {
718				refillQuiz( $form, data.quiz );
719			}
720		}
721	};
722
723	wpcf7.clearResponse = function( form ) {
724		var $form = $( form );
725		$form.removeClass( 'invalid spam sent failed' );
726		$form.siblings( '.screen-reader-response' ).html( '' ).attr( 'role', '' );
727
728		$( '.wpcf7-not-valid-tip', $form ).remove();
729		$( '[aria-invalid]', $form ).attr( 'aria-invalid', 'false' );
730		$( '.wpcf7-form-control', $form ).removeClass( 'wpcf7-not-valid' );
731
732		$( '.wpcf7-response-output', $form )
733			.hide().empty().removeAttr( 'role' )
734			.removeClass( 'wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked' );
735	};
736
737	wpcf7.apiSettings.getRoute = function( path ) {
738		var url = wpcf7.apiSettings.root;
739
740		url = url.replace(
741			wpcf7.apiSettings.namespace,
742			wpcf7.apiSettings.namespace + path );
743
744		return url;
745	};
746
747} )( jQuery );
748
749/*
750 * Polyfill for Internet Explorer
751 * See https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
752 */
753( function () {
754	if ( typeof window.CustomEvent === "function" ) return false;
755
756	function CustomEvent ( event, params ) {
757		params = params || { bubbles: false, cancelable: false, detail: undefined };
758		var evt = document.createEvent( 'CustomEvent' );
759		evt.initCustomEvent( event,
760			params.bubbles, params.cancelable, params.detail );
761		return evt;
762	}
763
764	CustomEvent.prototype = window.Event.prototype;
765
766	window.CustomEvent = CustomEvent;
767} )();
768
769$(document).ready(function(){
770    $('.wpcf7 input[type="url"]').each(function(){
771       if($(this).val())
772       {
773            $(this).val( $(this).val().replace('default:current_url', window.location.href));
774       } 
775    });
776    $(document).on('click','.ctf_click_open_contactform7',function(){
777       var id=$(this).attr('data-id');
778       $('#ctf-popup-wapper-'+id).addClass('show'); 
779       if(!$(this).hasClass('addlogded'))
780       {
781            ajaxAddLoger($('#ctf-popup-wapper-'+id).find('.wpcf7').attr('data-id'));
782            $(this).addClass('addlogded');
783       }
784    });
785    $(document).on('click','.wpcf7.hook',function(){
786           var id=$(this).attr('data-id');
787           $('#ctf-popup-wapper-'+id).addClass('show'); 
788           if(!$(this).hasClass('addlogded'))
789           {
790                ajaxAddLoger(id);
791                $(this).addClass('addlogded');
792           }
793    });
794    $(document).on('click','.ctf_close_popup',function(){
795       $(this).closest('.ctf-popup-wapper').removeClass('show'); 
796    });
797    $(document).mouseup(function (e)
798    {
799        var container = $('.ctf-popup-content');
800        var datepicker=$('.ui-datepicker');
801        if (!container.is(e.target) && container.has(e.target).length === 0 &&!datepicker.is(e.target) && datepicker.has(e.target).length === 0)
802        {
803            $('.ctf-popup-wapper').removeClass('show');
804        }
805    });
806    $(document).keyup(function(e) {
807         if (e.keyCode == 27) { // escape key maps to keycode `27`
808            $('.ctf-popup-wapper').removeClass('show');
809        }
810    });
811    if ($(".wpcf7 .datetimepicker").length > 0) {
812		$(".wpcf7 .datetimepicker").datetimepicker({
813            timepicker:true,
814            format:'Y-m-d h:i'
815        });
816	}
817    if ($(".wpcf7 .datepicker").length > 0) {
818		$(".wpcf7 .datepicker").datetimepicker({
819            timepicker:false,
820            format:'Y-m-d'
821        });
822	}
823    $('.pa-captcha-refesh').click(function(){
824        refeshImage($(this));
825        return false;
826    });
827    if($('input[type="range"]').length)
828    {
829        $('input[type="range"]').each(function(){
830            if($(this).prev('.rang-value').length>0)
831                $(this).prev('.rang-value').html($(this).val()); 
832        });
833    }
834    $('input[type="range"]').change(function(){
835        if($(this).prev('.rang-value').length>0)
836            $(this).prev('.rang-value').html($(this).val()); 
837    });
838    
839    
840    //Init MCE
841    if(typeof tinyMCE !== 'undefined' && $('.autoload_rte_ctf7').length)
842    {
843        tinymce.init({
844              selector: '.autoload_rte_ctf7',
845              plugins: "align link image media code emoticons",
846              browser_spellcheck: true,
847              themes: "modern",         
848            toolbar1: "emoticons,bold,italic,underline,link,align,bulli,numlist,table,image",   
849            convert_urls: false   
850        });
851    }
852    
853});
854function refeshImage($this)
855{
856    if($this.prev('.pa-captcha-img-data').length)
857    {
858        originalCapcha = $this.prev('.pa-captcha-img-data').attr('src');
859        originalCode = $this.attr('data-rand');
860        newCode = Math.random();
861        $this.prev('.pa-captcha-img-data').attr('src', originalCapcha.replace(originalCode,newCode));
862        $this.attr('data-rand', newCode);
863        $('input[type="captcha"]').val('');
864    }
865    
866}
867function ajaxAddLoger(id_contact)
868{						
869    $.ajax({
870		type: 'POST',
871		headers: { "cache-control": "no-cache" },
872		url: link_contact_ets,
873		dataType : "json",
874		data:'action=addLoger&id_contact='+id_contact,
875		success: function(jsonData)
876		{
877            
878        }
879	});
880}
881function ctf_loadCaptcha()  {
882        var img = $('.pa-captcha-img-data:not(.loaded)').first();
883        if (img.length > 0)
884        {
885            img.load(function() {
886                ctf_refreshCaptcha(img);
887                if (img[0].complete) {
888                    ctf_loadCaptcha();
889                }
890            }).filter(function() { return this.complete; }).load();
891        }
892    }
893function ctf_refreshCaptcha (img) {
894    if (img.length && !img.hasClass('loaded'))
895    {
896        var orgLink = img.attr('src');
897        var orgCode = img.attr('data-rand');
898        var rand = Math.random();
899        img.attr('src', orgLink.replace(orgCode, rand));
900        img.attr('data-rand', rand);
901        if (!img.hasClass('loaded')) {
902            img.addClass('loaded');
903        }
904    }
905}
906document.addEventListener("DOMContentLoaded", function(event) {
907    if ( $('.pa-captcha-img-data').length > 1)
908    {
909        ctf_loadCaptcha();
910    }
911});
912
913/* Quang */
914var ets_ctf7_update = {
915	init : function () {
916		this.check_maxlength_number();
917	},
918	check_maxlength_number : function () {
919		$(document).on("keyup",'.wpcf7-form-control-wrap input[type="number"],.wpcf7-form-control-wrap input[type="number"]', function (e) {
920			var $field = $(this),
921				val=this.value; // retrieve the index
922			if (val.length > Number($field.attr("maxlength"))) {
923				val=val.slice(0, $field.attr('maxlength'));
924				$field.val(val);
925			}
926		});
927	}
928};
929
930$(document).ready(function () {
931	ets_ctf7_update.init();
932});
933/* End Quang */

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.