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 3.9 3.9-beta 3.9.1 3.9.2 3.9.3 4.0 4.0.1 4.0.2 4.0.3 4.1 4.1-beta 4.1.1 4.1.2 4.2 4.2-beta 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6 4.6.1 4.7 4.8 4.8.1 4.9 4.9.1 4.9.2 5.0 5.0.1
contact-form-7 / scripts.js
contact-form-7 Last commit date
admin 16 years ago images 18 years ago includes 16 years ago languages 16 years ago modules 16 years ago README.txt 16 years ago screenshot-1.png 16 years ago scripts.js 16 years ago settings.php 16 years ago styles-rtl.css 16 years ago styles.css 16 years ago uninstall.php 16 years ago wp-contact-form-7.php 16 years ago
scripts.js
153 lines
1 jQuery(document).ready(function() {
2 try {
3 jQuery('div.wpcf7 > form').ajaxForm({
4 beforeSubmit: wpcf7BeforeSubmit,
5 dataType: 'json',
6 success: wpcf7ProcessJson
7 });
8 } catch (e) {
9 }
10
11 try {
12 jQuery('div.wpcf7 > form').each(function(i, n) {
13 wpcf7ToggleSubmit(jQuery(n));
14 });
15 } catch (e) {
16 }
17
18 try {
19 if (_wpcf7.cached) {
20 jQuery('div.wpcf7 > form').each(function(i, n) {
21 wpcf7OnloadRefill(n);
22 });
23 }
24 } catch (e) {
25 }
26 });
27
28 // Exclusive checkbox
29 function wpcf7ExclusiveCheckbox(elem) {
30 jQuery(elem.form).find('input:checkbox[name="' + elem.name + '"]').not(elem).removeAttr('checked');
31 }
32
33 // Toggle submit button
34 function wpcf7ToggleSubmit(form) {
35 var submit = jQuery(form).find('input:submit');
36 if (! submit.length) return;
37
38 var acceptances = jQuery(form).find('input:checkbox.wpcf7-acceptance');
39 if (! acceptances.length) return;
40
41 submit.removeAttr('disabled');
42 acceptances.each(function(i, n) {
43 n = jQuery(n);
44 if (n.hasClass('wpcf7-invert') && n.is(':checked') || ! n.hasClass('wpcf7-invert') && ! n.is(':checked'))
45 submit.attr('disabled', 'disabled');
46 });
47 }
48
49 function wpcf7BeforeSubmit(formData, jqForm, options) {
50 wpcf7ClearResponseOutput();
51 jQuery('img.ajax-loader', jqForm[0]).css({ visibility: 'visible' });
52
53 formData.push({name: '_wpcf7_is_ajax_call', value: 1});
54 jQuery(jqForm[0]).append('<input type="hidden" name="_wpcf7_is_ajax_call" value="1" />');
55
56 return true;
57 }
58
59 function wpcf7NotValidTip(into, message) {
60 jQuery(into).append('<span class="wpcf7-not-valid-tip">' + message + '</span>');
61 jQuery('span.wpcf7-not-valid-tip').mouseover(function() {
62 jQuery(this).fadeOut('fast');
63 });
64 jQuery(into).find(':input').mouseover(function() {
65 jQuery(into).find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
66 });
67 jQuery(into).find(':input').focus(function() {
68 jQuery(into).find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
69 });
70 }
71
72 function wpcf7OnloadRefill(form) {
73 var url = jQuery(form).attr('action');
74 if (0 < url.indexOf('#'))
75 url = url.substr(0, url.indexOf('#'));
76
77 var id = jQuery(form).find('input[name="_wpcf7"]').val();
78 var unitTag = jQuery(form).find('input[name="_wpcf7_unit_tag"]').val();
79
80 jQuery.getJSON(url,
81 { _wpcf7_is_ajax_call: 1, _wpcf7: id },
82 function(data) {
83 if (data && data.captcha) {
84 wpcf7RefillCaptcha('#' + unitTag, data.captcha);
85 }
86 if (data && data.quiz) {
87 wpcf7RefillQuiz('#' + unitTag, data.quiz);
88 }
89 }
90 );
91 }
92
93 function wpcf7ProcessJson(data) {
94 var wpcf7ResponseOutput = jQuery(data.into).find('div.wpcf7-response-output');
95 wpcf7ClearResponseOutput();
96
97 if (data.invalids) {
98 jQuery.each(data.invalids, function(i, n) {
99 wpcf7NotValidTip(jQuery(data.into).find(n.into), n.message);
100 });
101 wpcf7ResponseOutput.addClass('wpcf7-validation-errors');
102 }
103
104 if (data.captcha) {
105 wpcf7RefillCaptcha(data.into, data.captcha);
106 }
107
108 if (data.quiz) {
109 wpcf7RefillQuiz(data.into, data.quiz);
110 }
111
112 if (1 == data.spam) {
113 wpcf7ResponseOutput.addClass('wpcf7-spam-blocked');
114 }
115
116 if (1 == data.mailSent) {
117 jQuery(data.into).find('form').resetForm().clearForm();
118 wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ok');
119
120 if (data.onSentOk)
121 jQuery.each(data.onSentOk, function(i, n) { eval(n) });
122 } else {
123 wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ng');
124 }
125
126 if (data.onSubmit)
127 jQuery.each(data.onSubmit, function(i, n) { eval(n) });
128
129 wpcf7ResponseOutput.append(data.message).slideDown('fast');
130 }
131
132 function wpcf7RefillCaptcha(form, captcha) {
133 jQuery.each(captcha, function(i, n) {
134 jQuery(form).find(':input[name="' + i + '"]').clearFields();
135 jQuery(form).find('img.wpcf7-captcha-' + i).attr('src', n);
136 var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n);
137 jQuery(form).find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]);
138 });
139 }
140
141 function wpcf7RefillQuiz(form, quiz) {
142 jQuery.each(quiz, function(i, n) {
143 jQuery(form).find(':input[name="' + i + '"]').clearFields();
144 jQuery(form).find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]);
145 jQuery(form).find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]);
146 });
147 }
148
149 function wpcf7ClearResponseOutput() {
150 jQuery('div.wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked');
151 jQuery('span.wpcf7-not-valid-tip').remove();
152 jQuery('img.ajax-loader').css({ visibility: 'hidden' });
153 }