PageSourceSearch

http://plray.jp/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=4.0.3

js plray.jp collected 2026-09-24 18:05:55 UTC 9,658 bytes, 356 lines download raw bytes

1(function($) {
2
3	if (typeof _wpcf7 == 'undefined' || _wpcf7 === null)
4		_wpcf7 = {};
5
6	_wpcf7 = $.extend({ cached: 0 }, _wpcf7);
7
8	$(function() {
9		_wpcf7.supportHtml5 = $.wpcf7SupportHtml5();
10		$('div.wpcf7 > form').wpcf7InitForm();
11	});
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		this.wpcf7ToggleSubmit();
40
41		this.find('.wpcf7-submit').wpcf7AjaxLoader();
42
43		this.find('.wpcf7-acceptance').click(function() {
44			$(this).closest('form').wpcf7ToggleSubmit();
45		});
46
47		this.find('.wpcf7-exclusive-checkbox').wpcf7ExclusiveCheckbox();
48
49		this.find('.wpcf7-list-item.has-free-text').wpcf7ToggleCheckboxFreetext();
50
51		this.find('[placeholder]').wpcf7Placeholder();
52
53		if (_wpcf7.jqueryUi && ! _wpcf7.supportHtml5.date) {
54			this.find('input.wpcf7-date[type="date"]').each(function() {
55				$(this).datepicker({
56					dateFormat: 'yy-mm-dd',
57					minDate: new Date($(this).attr('min')),
58					maxDate: new Date($(this).attr('max'))
59				});
60			});
61		}
62
63		if (_wpcf7.jqueryUi && ! _wpcf7.supportHtml5.number) {
64			this.find('input.wpcf7-number[type="number"]').each(function() {
65				$(this).spinner({
66					min: $(this).attr('min'),
67					max: $(this).attr('max'),
68					step: $(this).attr('step')
69				});
70			});
71		}
72	};
73
74	$.wpcf7AjaxSuccess = function(data, status, xhr, $form) {
75		if (! $.isPlainObject(data) || $.isEmptyObject(data))
76			return;
77
78		var $responseOutput = $form.find('div.wpcf7-response-output');
79
80		$form.wpcf7ClearResponseOutput();
81
82		$form.find('.wpcf7-form-control').removeClass('wpcf7-not-valid');
83		$form.removeClass('invalid spam sent failed');
84
85		if (data.captcha)
86			$form.wpcf7RefillCaptcha(data.captcha);
87
88		if (data.quiz)
89			$form.wpcf7RefillQuiz(data.quiz);
90
91		if (data.invalids) {
92			$.each(data.invalids, function(i, n) {
93				$form.find(n.into).wpcf7NotValidTip(n.message);
94				$form.find(n.into).find('.wpcf7-form-control').addClass('wpcf7-not-valid');
95				$form.find(n.into).find('[aria-invalid]').attr('aria-invalid', 'true');
96			});
97
98			$responseOutput.addClass('wpcf7-validation-errors');
99			$form.addClass('invalid');
100
101			$(data.into).trigger('invalid.wpcf7');
102
103		} else if (1 == data.spam) {
104			$responseOutput.addClass('wpcf7-spam-blocked');
105			$form.addClass('spam');
106
107			$(data.into).trigger('spam.wpcf7');
108
109		} else if (1 == data.mailSent) {
110			$responseOutput.addClass('wpcf7-mail-sent-ok');
111			$form.addClass('sent');
112
113			if (data.onSentOk)
114				$.each(data.onSentOk, function(i, n) { eval(n) });
115
116			$(data.into).trigger('mailsent.wpcf7');
117
118		} else {
119			$responseOutput.addClass('wpcf7-mail-sent-ng');
120			$form.addClass('failed');
121
122			$(data.into).trigger('mailfailed.wpcf7');
123		}
124
125		if (data.onSubmit)
126			$.each(data.onSubmit, function(i, n) { eval(n) });
127
128		$(data.into).trigger('submit.wpcf7');
129
130		if (1 == data.mailSent)
131			$form.resetForm();
132
133		$form.find('[placeholder].placeheld').each(function(i, n) {
134			$(n).val($(n).attr('placeholder'));
135		});
136
137		$responseOutput.append(data.message).slideDown('fast');
138		$responseOutput.attr('role', 'alert');
139
140		$.wpcf7UpdateScreenReaderResponse($form, data);
141	}
142
143	$.fn.wpcf7ExclusiveCheckbox = function() {
144		return this.find('input:checkbox').click(function() {
145			$(this).closest('.wpcf7-checkbox').find('input:checkbox').not(this).removeAttr('checked');
146		});
147	};
148
149	$.fn.wpcf7Placeholder = function() {
150		if (_wpcf7.supportHtml5.placeholder)
151			return this;
152
153		return this.each(function() {
154			$(this).val($(this).attr('placeholder'));
155			$(this).addClass('placeheld');
156
157			$(this).focus(function() {
158				if ($(this).hasClass('placeheld'))
159					$(this).val('').removeClass('placeheld');
160			});
161
162			$(this).blur(function() {
163				if ('' == $(this).val()) {
164					$(this).val($(this).attr('placeholder'));
165					$(this).addClass('placeheld');
166				}
167			});
168		});
169	};
170
171	$.fn.wpcf7AjaxLoader = function() {
172		return this.each(function() {
173			var loader = $('<img class="ajax-loader" />')
174				.attr({ src: _wpcf7.loaderUrl, alt: _wpcf7.sending })
175				.css('visibility', 'hidden');
176
177			$(this).after(loader);
178		});
179	};
180
181	$.fn.wpcf7ToggleSubmit = function() {
182		return this.each(function() {
183			var form = $(this);
184			if (this.tagName.toLowerCase() != 'form')
185				form = $(this).find('form').first();
186
187			if (form.hasClass('wpcf7-acceptance-as-validation'))
188				return;
189
190			var submit = form.find('input:submit');
191			if (! submit.length) return;
192
193			var acceptances = form.find('input:checkbox.wpcf7-acceptance');
194			if (! acceptances.length) return;
195
196			submit.removeAttr('disabled');
197			acceptances.each(function(i, n) {
198				n = $(n);
199				if (n.hasClass('wpcf7-invert') && n.is(':checked')
200				|| ! n.hasClass('wpcf7-invert') && ! n.is(':checked'))
201					submit.attr('disabled', 'disabled');
202			});
203		});
204	};
205
206	$.fn.wpcf7ToggleCheckboxFreetext = function() {
207		return this.each(function() {
208			var $wrap = $(this).closest('.wpcf7-form-control');
209
210			if ($(this).find(':checkbox, :radio').is(':checked')) {
211				$(this).find(':input.wpcf7-free-text').prop('disabled', false);
212			} else {
213				$(this).find(':input.wpcf7-free-text').prop('disabled', true);
214			}
215
216			$wrap.find(':checkbox, :radio').change(function() {
217				var $cb = $('.has-free-text', $wrap).find(':checkbox, :radio');
218				var $freetext = $(':input.wpcf7-free-text', $wrap);
219
220				if ($cb.is(':checked')) {
221					$freetext.prop('disabled', false).focus();
222				} else {
223					$freetext.prop('disabled', true);
224				}
225			});
226		});
227	};
228
229	$.fn.wpcf7NotValidTip = function(message) {
230		return this.each(function() {
231			var $into = $(this);
232
233			$into.find('span.wpcf7-not-valid-tip').remove();
234			$into.append('<span role="alert" class="wpcf7-not-valid-tip">' + message + '</span>');
235
236			if ($into.is('.use-floating-validation-tip *')) {
237				$('.wpcf7-not-valid-tip', $into).mouseover(function() {
238					$(this).wpcf7FadeOut();
239				});
240
241				$(':input', $into).focus(function() {
242					$('.wpcf7-not-valid-tip', $into).not(':hidden').wpcf7FadeOut();
243				});
244			}
245		});
246	};
247
248	$.fn.wpcf7FadeOut = function() {
249		return this.each(function() {
250			$(this).animate({
251				opacity: 0
252			}, 'fast', function() {
253				$(this).css({'z-index': -100});
254			});
255		});
256	};
257
258	$.fn.wpcf7OnloadRefill = function() {
259		return this.each(function() {
260			var url = $(this).attr('action');
261			if (0 < url.indexOf('#'))
262				url = url.substr(0, url.indexOf('#'));
263
264			var id = $(this).find('input[name="_wpcf7"]').val();
265			var unitTag = $(this).find('input[name="_wpcf7_unit_tag"]').val();
266
267			$.getJSON(url,
268				{ _wpcf7_is_ajax_call: 1, _wpcf7: id, _wpcf7_request_ver: $.now() },
269				function(data) {
270					if (data && data.captcha)
271						$('#' + unitTag).wpcf7RefillCaptcha(data.captcha);
272
273					if (data && data.quiz)
274						$('#' + unitTag).wpcf7RefillQuiz(data.quiz);
275				}
276			);
277		});
278	};
279
280	$.fn.wpcf7RefillCaptcha = function(captcha) {
281		return this.each(function() {
282			var form = $(this);
283
284			$.each(captcha, function(i, n) {
285				form.find(':input[name="' + i + '"]').clearFields();
286				form.find('img.wpcf7-captcha-' + i).attr('src', n);
287				var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n);
288				form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]);
289			});
290		});
291	};
292
293	$.fn.wpcf7RefillQuiz = function(quiz) {
294		return this.each(function() {
295			var form = $(this);
296
297			$.each(quiz, function(i, n) {
298				form.find(':input[name="' + i + '"]').clearFields();
299				form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]);
300				form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]);
301			});
302		});
303	};
304
305	$.fn.wpcf7ClearResponseOutput = function() {
306		return this.each(function() {
307			$(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');
308			$(this).find('span.wpcf7-not-valid-tip').remove();
309			$(this).find('img.ajax-loader').css({ visibility: 'hidden' });
310		});
311	};
312
313	$.wpcf7UpdateScreenReaderResponse = function($form, data) {
314		$('.wpcf7 .screen-reader-response').html('').attr('role', '');
315
316		if (data.message) {
317			var $response = $form.siblings('.screen-reader-response').first();
318			$response.append(data.message);
319
320			if (data.invalids) {
321				var $invalids = $('<ul></ul>');
322
323				$.each(data.invalids, function(i, n) {
324					if (n.idref) {
325						var $li = $('<li></li>').append($('<a></a>').attr('href', '#' + n.idref).append(n.message));
326					} else {
327						var $li = $('<li></li>').append(n.message);
328					}
329
330					$invalids.append($li);
331				});
332
333				$response.append($invalids);
334			}
335
336			$response.attr('role', 'alert').focus();
337		}
338	}
339
340	$.wpcf7SupportHtml5 = function() {
341		var features = {};
342		var input = document.createElement('input');
343
344		features.placeholder = 'placeholder' in input;
345
346		var inputTypes = ['email', 'url', 'tel', 'number', 'range', 'date'];
347
348		$.each(inputTypes, function(index, value) {
349			input.setAttribute('type', value);
350			features[value] = input.type !== 'text';
351		});
352
353		return features;
354	};
355
356})(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.