PageSourceSearch

https://sefdym.gr/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=4.5

js sefdym.gr collected 2026-09-28 08:48:25 UTC 12,244 bytes, 462 lines download raw bytes

1(function($) {
2
3	'use strict';
4
5	if (typeof _wpcf7 == 'undefined' || _wpcf7 === null) {
6		_wpcf7 = {};
7	}
8
9	_wpcf7 = $.extend({
10		cached: 0
11	}, _wpcf7);
12
13	$.fn.wpcf7InitForm = function() {
14		this.ajaxForm({
15			beforeSubmit: function(arr, $form, options) {
16				$form.wpcf7ClearResponseOutput();
17				$form.find('[aria-invalid]').attr('aria-invalid', 'false');
18				$form.find('img.ajax-loader').css({ visibility: 'visible' });
19				return true;
20			},
21			beforeSerialize: function($form, options) {
22				$form.find('[placeholder].placeheld').each(function(i, n) {
23					$(n).val('');
24				});
25				return true;
26			},
27			data: { '_wpcf7_is_ajax_call': 1 },
28			dataType: 'json',
29			success: $.wpcf7AjaxSuccess,
30			error: function(xhr, status, error, $form) {
31				var e = $('<div class="ajax-error"></div>').text(error.message);
32				$form.after(e);
33			}
34		});
35
36		if (_wpcf7.cached) {
37			this.wpcf7OnloadRefill();
38		}
39
40		this.wpcf7ToggleSubmit();
41
42		this.find('.wpcf7-submit').wpcf7AjaxLoader();
43
44		this.find('.wpcf7-acceptance').click(function() {
45			$(this).closest('form').wpcf7ToggleSubmit();
46		});
47
48		this.find('.wpcf7-exclusive-checkbox').wpcf7ExclusiveCheckbox();
49
50		this.find('.wpcf7-list-item.has-free-text').wpcf7ToggleCheckboxFreetext();
51
52		this.find('[placeholder]').wpcf7Placeholder();
53
54		if (_wpcf7.jqueryUi && ! _wpcf7.supportHtml5.date) {
55			this.find('input.wpcf7-date[type="date"]').each(function() {
56				$(this).datepicker({
57					dateFormat: 'yy-mm-dd',
58					minDate: new Date($(this).attr('min')),
59					maxDate: new Date($(this).attr('max'))
60				});
61			});
62		}
63
64		if (_wpcf7.jqueryUi && ! _wpcf7.supportHtml5.number) {
65			this.find('input.wpcf7-number[type="number"]').each(function() {
66				$(this).spinner({
67					min: $(this).attr('min'),
68					max: $(this).attr('max'),
69					step: $(this).attr('step')
70				});
71			});
72		}
73
74		this.find('.wpcf7-character-count').wpcf7CharacterCount();
75
76		this.find('.wpcf7-validates-as-url').change(function() {
77			$(this).wpcf7NormalizeUrl();
78		});
79
80		this.find('.wpcf7-recaptcha').wpcf7Recaptcha();
81	};
82
83	$.wpcf7AjaxSuccess = function(data, status, xhr, $form) {
84		if (! $.isPlainObject(data) || $.isEmptyObject(data)) {
85			return;
86		}
87
88		var $responseOutput = $form.find('div.wpcf7-response-output');
89
90		$form.wpcf7ClearResponseOutput();
91
92		$form.find('.wpcf7-form-control').removeClass('wpcf7-not-valid');
93		$form.removeClass('invalid spam sent failed');
94
95		if (data.captcha) {
96			$form.wpcf7RefillCaptcha(data.captcha);
97		}
98
99		if (data.quiz) {
100			$form.wpcf7RefillQuiz(data.quiz);
101		}
102
103		if (data.invalids) {
104			$.each(data.invalids, function(i, n) {
105				$form.find(n.into).wpcf7NotValidTip(n.message);
106				$form.find(n.into).find('.wpcf7-form-control').addClass('wpcf7-not-valid');
107				$form.find(n.into).find('[aria-invalid]').attr('aria-invalid', 'true');
108			});
109
110			$responseOutput.addClass('wpcf7-validation-errors');
111			$form.addClass('invalid');
112
113			$(data.into).trigger('wpcf7:invalid');
114			$(data.into).trigger('invalid.wpcf7'); // deprecated
115
116		} else if (1 == data.spam) {
117			$form.find('[name="g-recaptcha-response"]').each(function() {
118				if ('' == $(this).val()) {
119					var $recaptcha = $(this).closest('.wpcf7-form-control-wrap');
120					$recaptcha.wpcf7NotValidTip(_wpcf7.recaptcha.messages.empty);
121				}
122			});
123
124			$responseOutput.addClass('wpcf7-spam-blocked');
125			$form.addClass('spam');
126
127			$(data.into).trigger('wpcf7:spam');
128			$(data.into).trigger('spam.wpcf7'); // deprecated
129
130		} else if (1 == data.mailSent) {
131			$responseOutput.addClass('wpcf7-mail-sent-ok');
132			$form.addClass('sent');
133
134			if (data.onSentOk) {
135				$.each(data.onSentOk, function(i, n) { eval(n) });
136			}
137
138			$(data.into).trigger('wpcf7:mailsent');
139			$(data.into).trigger('mailsent.wpcf7'); // deprecated
140
141		} else {
142			$responseOutput.addClass('wpcf7-mail-sent-ng');
143			$form.addClass('failed');
144
145			$(data.into).trigger('wpcf7:mailfailed');
146			$(data.into).trigger('mailfailed.wpcf7'); // deprecated
147		}
148
149		if (data.onSubmit) {
150			$.each(data.onSubmit, function(i, n) { eval(n) });
151		}
152
153		$(data.into).trigger('wpcf7:submit');
154		$(data.into).trigger('submit.wpcf7'); // deprecated
155
156		if (1 == data.mailSent) {
157			$form.resetForm();
158		}
159
160		$form.find('[placeholder].placeheld').each(function(i, n) {
161			$(n).val($(n).attr('placeholder'));
162		});
163
164		$responseOutput.append(data.message).slideDown('fast');
165		$responseOutput.attr('role', 'alert');
166
167		$.wpcf7UpdateScreenReaderResponse($form, data);
168	};
169
170	$.fn.wpcf7ExclusiveCheckbox = function() {
171		return this.find('input:checkbox').click(function() {
172			var name = $(this).attr('name');
173			$(this).closest('form').find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false);
174		});
175	};
176
177	$.fn.wpcf7Placeholder = function() {
178		if (_wpcf7.supportHtml5.placeholder) {
179			return this;
180		}
181
182		return this.each(function() {
183			$(this).val($(this).attr('placeholder'));
184			$(this).addClass('placeheld');
185
186			$(this).focus(function() {
187				if ($(this).hasClass('placeheld'))
188					$(this).val('').removeClass('placeheld');
189			});
190
191			$(this).blur(function() {
192				if ('' == $(this).val()) {
193					$(this).val($(this).attr('placeholder'));
194					$(this).addClass('placeheld');
195				}
196			});
197		});
198	};
199
200	$.fn.wpcf7AjaxLoader = function() {
201		return this.each(function() {
202			var loader = $('<img class="ajax-loader" />')
203				.attr({ src: _wpcf7.loaderUrl, alt: _wpcf7.sending })
204				.css('visibility', 'hidden');
205
206			$(this).after(loader);
207		});
208	};
209
210	$.fn.wpcf7ToggleSubmit = function() {
211		return this.each(function() {
212			var form = $(this);
213
214			if (this.tagName.toLowerCase() != 'form') {
215				form = $(this).find('form').first();
216			}
217
218			if (form.hasClass('wpcf7-acceptance-as-validation')) {
219				return;
220			}
221
222			var submit = form.find('input:submit');
223			if (! submit.length) return;
224
225			var acceptances = form.find('input:checkbox.wpcf7-acceptance');
226			if (! acceptances.length) return;
227
228			submit.removeAttr('disabled');
229			acceptances.each(function(i, n) {
230				n = $(n);
231				if (n.hasClass('wpcf7-invert') && n.is(':checked')
232				|| ! n.hasClass('wpcf7-invert') && ! n.is(':checked')) {
233					submit.attr('disabled', 'disabled');
234				}
235			});
236		});
237	};
238
239	$.fn.wpcf7ToggleCheckboxFreetext = function() {
240		return this.each(function() {
241			var $wrap = $(this).closest('.wpcf7-form-control');
242
243			if ($(this).find(':checkbox, :radio').is(':checked')) {
244				$(this).find(':input.wpcf7-free-text').prop('disabled', false);
245			} else {
246				$(this).find(':input.wpcf7-free-text').prop('disabled', true);
247			}
248
249			$wrap.find(':checkbox, :radio').change(function() {
250				var $cb = $('.has-free-text', $wrap).find(':checkbox, :radio');
251				var $freetext = $(':input.wpcf7-free-text', $wrap);
252
253				if ($cb.is(':checked')) {
254					$freetext.prop('disabled', false).focus();
255				} else {
256					$freetext.prop('disabled', true);
257				}
258			});
259		});
260	};
261
262	$.fn.wpcf7CharacterCount = function() {
263		return this.each(function() {
264			var $count = $(this);
265			var name = $count.attr('data-target-name');
266			var down = $count.hasClass('down');
267			var starting = parseInt($count.attr('data-starting-value'), 10);
268			var maximum = parseInt($count.attr('data-maximum-value'), 10);
269			var minimum = parseInt($count.attr('data-minimum-value'), 10);
270
271			var updateCount = function($target) {
272				var length = $target.val().length;
273				var count = down ? starting - length : length;
274				$count.attr('data-current-value', count);
275				$count.text(count);
276
277				if (maximum && maximum < length) {
278					$count.addClass('too-long');
279				} else {
280					$count.removeClass('too-long');
281				}
282
283				if (minimum && length < minimum) {
284					$count.addClass('too-short');
285				} else {
286					$count.removeClass('too-short');
287				}
288			};
289
290			$count.closest('form').find(':input[name="' + name + '"]').each(function() {
291				updateCount($(this));
292
293				$(this).keyup(function() {
294					updateCount($(this));
295				});
296			});
297		});
298	};
299
300	$.fn.wpcf7NormalizeUrl = function() {
301		return this.each(function() {
302			var val = $.trim($(this).val());
303
304			if (val && ! val.match(/^[a-z][a-z0-9.+-]*:/i)) { // check the scheme part
305				val = val.replace(/^\/+/, '');
306				val = 'http://' + val;
307			}
308
309			$(this).val(val);
310		});
311	};
312
313	$.fn.wpcf7NotValidTip = function(message) {
314		return this.each(function() {
315			var $into = $(this);
316
317			$into.find('span.wpcf7-not-valid-tip').remove();
318			$into.append('<span role="alert" class="wpcf7-not-valid-tip">' + message + '</span>');
319
320			if ($into.is('.use-floating-validation-tip *')) {
321				$('.wpcf7-not-valid-tip', $into).mouseover(function() {
322					$(this).wpcf7FadeOut();
323				});
324
325				$(':input', $into).focus(function() {
326					$('.wpcf7-not-valid-tip', $into).not(':hidden').wpcf7FadeOut();
327				});
328			}
329		});
330	};
331
332	$.fn.wpcf7FadeOut = function() {
333		return this.each(function() {
334			$(this).animate({
335				opacity: 0
336			}, 'fast', function() {
337				$(this).css({'z-index': -100});
338			});
339		});
340	};
341
342	$.fn.wpcf7OnloadRefill = function() {
343		return this.each(function() {
344			var url = $(this).attr('action');
345
346			if (0 < url.indexOf('#')) {
347				url = url.substr(0, url.indexOf('#'));
348			}
349
350			var id = $(this).find('input[name="_wpcf7"]').val();
351			var unitTag = $(this).find('input[name="_wpcf7_unit_tag"]').val();
352
353			$.getJSON(url,
354				{ _wpcf7_is_ajax_call: 1, _wpcf7: id, _wpcf7_request_ver: $.now() },
355				function(data) {
356					if (data && data.captcha) {
357						$('#' + unitTag).wpcf7RefillCaptcha(data.captcha);
358					}
359
360					if (data && data.quiz) {
361						$('#' + unitTag).wpcf7RefillQuiz(data.quiz);
362					}
363				}
364			);
365		});
366	};
367
368	$.fn.wpcf7RefillCaptcha = function(captcha) {
369		return this.each(function() {
370			var form = $(this);
371
372			$.each(captcha, function(i, n) {
373				form.find(':input[name="' + i + '"]').clearFields();
374				form.find('img.wpcf7-captcha-' + i).attr('src', n);
375				var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n);
376				form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]);
377			});
378		});
379	};
380
381	$.fn.wpcf7RefillQuiz = function(quiz) {
382		return this.each(function() {
383			var form = $(this);
384
385			$.each(quiz, function(i, n) {
386				form.find(':input[name="' + i + '"]').clearFields();
387				form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]);
388				form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]);
389			});
390		});
391	};
392
393	$.fn.wpcf7ClearResponseOutput = function() {
394		return this.each(function() {
395			$(this).find('div.wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked').removeAttr('role');
396			$(this).find('span.wpcf7-not-valid-tip').remove();
397			$(this).find('img.ajax-loader').css({ visibility: 'hidden' });
398		});
399	};
400
401	$.fn.wpcf7Recaptcha = function() {
402		return this.each(function() {
403			var events = 'wpcf7:spam wpcf7:mailsent wpcf7:mailfailed';
404			$(this).closest('div.wpcf7').on(events, function(e) {
405				if (recaptchaWidgets && grecaptcha) {
406					$.each(recaptchaWidgets, function(index, value) {
407						grecaptcha.reset(value);
408					});
409				}
410			});
411		});
412	};
413
414	$.wpcf7UpdateScreenReaderResponse = function($form, data) {
415		$('.wpcf7 .screen-reader-response').html('').attr('role', '');
416
417		if (data.message) {
418			var $response = $form.siblings('.screen-reader-response').first();
419			$response.append(data.message);
420
421			if (data.invalids) {
422				var $invalids = $('<ul></ul>');
423
424				$.each(data.invalids, function(i, n) {
425					if (n.idref) {
426						var $li = $('<li></li>').append($('<a></a>').attr('href', '#' + n.idref).append(n.message));
427					} else {
428						var $li = $('<li></li>').append(n.message);
429					}
430
431					$invalids.append($li);
432				});
433
434				$response.append($invalids);
435			}
436
437			$response.attr('role', 'alert').focus();
438		}
439	};
440
441	$.wpcf7SupportHtml5 = function() {
442		var features = {};
443		var input = document.createElement('input');
444
445		features.placeholder = 'placeholder' in input;
446
447		var inputTypes = ['email', 'url', 'tel', 'number', 'range', 'date'];
448
449		$.each(inputTypes, function(index, value) {
450			input.setAttribute('type', value);
451			features[value] = input.type !== 'text';
452		});
453
454		return features;
455	};
456
457	$(function() {
458		_wpcf7.supportHtml5 = $.wpcf7SupportHtml5();
459		$('div.wpcf7 > form').wpcf7InitForm();
460	});
461
462})(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.