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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 15 years ago images 18 years ago includes 15 years ago languages 15 years ago modules 15 years ago jquery.form.js 15 years ago license.txt 16 years ago readme.txt 15 years ago screenshot-1.png 16 years ago scripts.js 15 years ago settings.php 16 years ago styles-rtl.css 16 years ago styles.css 15 years ago uninstall.php 16 years ago wp-contact-form-7.php 15 years ago
scripts.js
198 lines
1 (function($) {
2
3 $(function() {
4 try {
5 if (typeof _wpcf7 == 'undefined' || _wpcf7 === null)
6 _wpcf7 = {};
7
8 _wpcf7 = $.extend({ cached: 0 }, _wpcf7);
9
10 $('div.wpcf7 > form').ajaxForm({
11 beforeSubmit: function(formData, jqForm, options) {
12 jqForm.wpcf7ClearResponseOutput();
13 jqForm.find('img.ajax-loader').css({ visibility: 'visible' });
14 return true;
15 },
16 beforeSerialize: function(jqForm, options) {
17 jqForm.find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
18 $(n).val('');
19 });
20 return true;
21 },
22 data: { '_wpcf7_is_ajax_call': 1 },
23 dataType: 'json',
24 success: function(data) {
25 var ro = $(data.into).find('div.wpcf7-response-output');
26 $(data.into).wpcf7ClearResponseOutput();
27
28 if (data.invalids) {
29 $.each(data.invalids, function(i, n) {
30 $(data.into).find(n.into).wpcf7NotValidTip(n.message);
31 });
32 ro.addClass('wpcf7-validation-errors');
33 }
34
35 if (data.captcha)
36 $(data.into).wpcf7RefillCaptcha(data.captcha);
37
38 if (data.quiz)
39 $(data.into).wpcf7RefillQuiz(data.quiz);
40
41 if (1 == data.spam)
42 ro.addClass('wpcf7-spam-blocked');
43
44 if (1 == data.mailSent) {
45 $(data.into).find('form').resetForm().clearForm();
46 ro.addClass('wpcf7-mail-sent-ok');
47
48 if (data.onSentOk)
49 $.each(data.onSentOk, function(i, n) { eval(n) });
50 } else {
51 ro.addClass('wpcf7-mail-sent-ng');
52 }
53
54 if (data.onSubmit)
55 $.each(data.onSubmit, function(i, n) { eval(n) });
56
57 $(data.into).find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
58 $(n).val($(n).attr('title'));
59 });
60
61 ro.append(data.message).slideDown('fast');
62 }
63 });
64
65 $('div.wpcf7 > form').each(function(i, n) {
66 if (_wpcf7.cached)
67 $(n).wpcf7OnloadRefill();
68
69 $(n).wpcf7ToggleSubmit();
70
71 $(n).find('.wpcf7-acceptance').click(function() {
72 $(n).wpcf7ToggleSubmit();
73 });
74
75 $(n).find('.wpcf7-exclusive-checkbox').each(function(i, n) {
76 $(n).find('input:checkbox').click(function() {
77 $(n).find('input:checkbox').not(this).removeAttr('checked');
78 });
79 });
80
81 $(n).find('.wpcf7-use-title-as-watermark').each(function(i, n) {
82 var input = $(n);
83 input.val(input.attr('title'));
84 input.addClass('watermark');
85
86 input.focus(function() {
87 if ($(this).hasClass('watermark'))
88 $(this).val('').removeClass('watermark');
89 });
90
91 input.blur(function() {
92 if ('' == $(this).val())
93 $(this).val($(this).attr('title')).addClass('watermark');
94 });
95 });
96 });
97
98 } catch (e) {
99 }
100 });
101
102 $.fn.wpcf7ToggleSubmit = function() {
103 return this.each(function() {
104 var form = $(this);
105 if (this.tagName.toLowerCase() != 'form')
106 form = $(this).find('form').first();
107
108 if (form.hasClass('wpcf7-acceptance-as-validation'))
109 return;
110
111 var submit = form.find('input:submit');
112 if (! submit.length) return;
113
114 var acceptances = form.find('input:checkbox.wpcf7-acceptance');
115 if (! acceptances.length) return;
116
117 submit.removeAttr('disabled');
118 acceptances.each(function(i, n) {
119 n = $(n);
120 if (n.hasClass('wpcf7-invert') && n.is(':checked')
121 || ! n.hasClass('wpcf7-invert') && ! n.is(':checked'))
122 submit.attr('disabled', 'disabled');
123 });
124 });
125 };
126
127 $.fn.wpcf7NotValidTip = function(message) {
128 return this.each(function() {
129 var into = $(this);
130 into.append('<span class="wpcf7-not-valid-tip">' + message + '</span>');
131 $('span.wpcf7-not-valid-tip').mouseover(function() {
132 $(this).fadeOut('fast');
133 });
134 into.find(':input').mouseover(function() {
135 into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
136 });
137 into.find(':input').focus(function() {
138 into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
139 });
140 });
141 };
142
143 $.fn.wpcf7OnloadRefill = function() {
144 return this.each(function() {
145 var url = $(this).attr('action');
146 if (0 < url.indexOf('#'))
147 url = url.substr(0, url.indexOf('#'));
148
149 var id = $(this).find('input[name="_wpcf7"]').val();
150 var unitTag = $(this).find('input[name="_wpcf7_unit_tag"]').val();
151
152 $.getJSON(url,
153 { _wpcf7_is_ajax_call: 1, _wpcf7: id },
154 function(data) {
155 if (data && data.captcha)
156 $('#' + unitTag).wpcf7RefillCaptcha(data.captcha);
157
158 if (data && data.quiz)
159 $('#' + unitTag).wpcf7RefillQuiz(data.quiz);
160 }
161 );
162 });
163 };
164
165 $.fn.wpcf7RefillCaptcha = function(captcha) {
166 return this.each(function() {
167 var form = $(this);
168
169 $.each(captcha, function(i, n) {
170 form.find(':input[name="' + i + '"]').clearFields();
171 form.find('img.wpcf7-captcha-' + i).attr('src', n);
172 var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n);
173 form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]);
174 });
175 });
176 };
177
178 $.fn.wpcf7RefillQuiz = function(quiz) {
179 return this.each(function() {
180 var form = $(this);
181
182 $.each(quiz, function(i, n) {
183 form.find(':input[name="' + i + '"]').clearFields();
184 form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]);
185 form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]);
186 });
187 });
188 };
189
190 $.fn.wpcf7ClearResponseOutput = function() {
191 return this.each(function() {
192 $(this).find('div.wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked');
193 $(this).find('span.wpcf7-not-valid-tip').remove();
194 $(this).find('img.ajax-loader').css({ visibility: 'hidden' });
195 });
196 };
197
198 })(jQuery);