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 _wpcf7.supportHtml5 = $.wpcf7SupportHtml5(); 11 12 $('div.wpcf7 > form').ajaxForm({ 13 beforeSubmit: function(formData, jqForm, options) { 14 jqForm.wpcf7ClearResponseOutput(); 15 jqForm.find('img.ajax-loader').css({ visibility: 'visible' }); 16 return true; 17 }, 18 beforeSerialize: function(jqForm, options) { 19 jqForm.find('[placeholder].placeheld').each(function(i, n) { 20 $(n).val(''); 21 }); 22 return true; 23 }, 24 data: { '_wpcf7_is_ajax_call': 1 }, 25 dataType: 'json', 26 success: function(data) { 27 if (! $.isPlainObject(data) || $.isEmptyObject(data)) 28 return; 29 30 var ro = $(data.into).find('div.wpcf7-response-output'); 31 $(data.into).wpcf7ClearResponseOutput(); 32 33 $(data.into).find('.wpcf7-form-control').removeClass('wpcf7-not-valid'); 34 $(data.into).find('form.wpcf7-form').removeClass('invalid spam sent failed'); 35 36 if (data.captcha) 37 $(data.into).wpcf7RefillCaptcha(data.captcha); 38 39 if (data.quiz) 40 $(data.into).wpcf7RefillQuiz(data.quiz); 41 42 if (data.invalids) { 43 $.each(data.invalids, function(i, n) { 44 $(data.into).find(n.into).wpcf7NotValidTip(n.message); 45 $(data.into).find(n.into).find('.wpcf7-form-control').addClass('wpcf7-not-valid'); 46 }); 47 48 ro.addClass('wpcf7-validation-errors'); 49 $(data.into).find('form.wpcf7-form').addClass('invalid'); 50 51 $(data.into).trigger('invalid.wpcf7'); 52 53 } else if (1 == data.spam) { 54 ro.addClass('wpcf7-spam-blocked'); 55 $(data.into).find('form.wpcf7-form').addClass('spam'); 56 57 $(data.into).trigger('spam.wpcf7'); 58 59 } else if (1 == data.mailSent) { 60 ro.addClass('wpcf7-mail-sent-ok'); 61 $(data.into).find('form.wpcf7-form').addClass('sent'); 62 63 if (data.onSentOk) 64 $.each(data.onSentOk, function(i, n) { eval(n) }); 65 66 $(data.into).trigger('mailsent.wpcf7'); 67 68 } else { 69 ro.addClass('wpcf7-mail-sent-ng'); 70 $(data.into).find('form.wpcf7-form').addClass('failed'); 71 72 $(data.into).trigger('mailfailed.wpcf7'); 73 } 74 75 if (data.onSubmit) 76 $.each(data.onSubmit, function(i, n) { eval(n) }); 77 78 $(data.into).trigger('submit.wpcf7'); 79 80 if (1 == data.mailSent) 81 $(data.into).find('form').resetForm().clearForm(); 82 83 $(data.into).find('[placeholder].placeheld').each(function(i, n) { 84 $(n).val($(n).attr('placeholder')); 85 }); 86 87 $(data.into).wpcf7FillResponseOutput(data.message); 88 }, 89 error: function(xhr, status, error, $form) { 90 var e = $('<div class="ajax-error"></div>').text(error.message); 91 $form.after(e); 92 } 93 }); 94 95 $('div.wpcf7 > form').wpcf7InitForm(); 96 97 } catch (e) { 98 } 99 }); 100 101 $.fn.wpcf7InitForm = function() { 102 return this.each(function(i, n) { 103 var $f = $(n); 104 105 if (_wpcf7.cached) 106 $f.wpcf7OnloadRefill(); 107 108 $f.wpcf7ToggleSubmit(); 109 110 $f.find('.wpcf7-submit').wpcf7AjaxLoader(); 111 112 $f.find('.wpcf7-acceptance').click(function() { 113 $f.wpcf7ToggleSubmit(); 114 }); 115 116 $f.find('.wpcf7-exclusive-checkbox').wpcf7ExclusiveCheckbox(); 117 118 $f.find('[placeholder]').wpcf7Placeholder(); 119 120 if (_wpcf7.jqueryUi && ! _wpcf7.supportHtml5.date) { 121 $f.find('input.wpcf7-date[type="date"]').each(function() { 122 $(this).datepicker({ 123 dateFormat: 'yy-mm-dd', 124 minDate: new Date($(this).attr('min')), 125 maxDate: new Date($(this).attr('max')) 126 }); 127 }); 128 } 129 130 if (_wpcf7.jqueryUi && ! _wpcf7.supportHtml5.number) { 131 $f.find('input.wpcf7-number[type="number"]').each(function() { 132 $(this).spinner({ 133 min: $(this).attr('min'), 134 max: $(this).attr('max'), 135 step: $(this).attr('step') 136 }); 137 }); 138 } 139 }); 140 }; 141 142 $.fn.wpcf7ExclusiveCheckbox = function() { 143 return this.find('input:checkbox').click(function() { 144 $(this).closest('.wpcf7-checkbox').find('input:checkbox').not(this).removeAttr('checked'); 145 }); 146 }; 147 148 $.fn.wpcf7Placeholder = function() { 149 if (_wpcf7.supportHtml5.placeholder) 150 return this; 151 152 return this.each(function() { 153 $(this).val($(this).attr('placeholder')); 154 $(this).addClass('placeheld'); 155 156 $(this).focus(function() { 157 if ($(this).hasClass('placeheld')) 158 $(this).val('').removeClass('placeheld'); 159 }); 160 161 $(this).blur(function() { 162 if ('' == $(this).val()) { 163 $(this).val($(this).attr('placeholder')); 164 $(this).addClass('placeheld'); 165 } 166 }); 167 }); 168 }; 169 170 $.fn.wpcf7AjaxLoader = function() { 171 return this.each(function() { 172 var loader = $('<img class="ajax-loader" />') 173 .attr({ src: _wpcf7.loaderUrl, alt: _wpcf7.sending }) 174 .css('visibility', 'hidden'); 175 176 $(this).after(loader); 177 }); 178 }; 179 180 $.fn.wpcf7ToggleSubmit = function() { 181 return this.each(function() { 182 var form = $(this); 183 if (this.tagName.toLowerCase() != 'form') 184 form = $(this).find('form').first(); 185 186 if (form.hasClass('wpcf7-acceptance-as-validation')) 187 return; 188
189 var submit = form.find('input:submit'); 190 if (! submit.length) return; 191 192 var acceptances = form.find('input:checkbox.wpcf7-acceptance'); 193 if (! acceptances.length) return; 194 195 submit.removeAttr('disabled'); 196 acceptances.each(function(i, n) { 197 n = $(n); 198 if (n.hasClass('wpcf7-invert') && n.is(':checked') 199 || ! n.hasClass('wpcf7-invert') && ! n.is(':checked')) 200 submit.attr('disabled', 'disabled'); 201 }); 202 }); 203 }; 204 205 $.fn.wpcf7NotValidTip = function(message) { 206 return this.each(function() { 207 var into = $(this); 208 into.append('<span class="wpcf7-not-valid-tip">' + message + '</span>'); 209 $('span.wpcf7-not-valid-tip').mouseover(function() { 210 $(this).fadeOut('fast'); 211 }); 212 into.find(':input').mouseover(function() { 213 into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast'); 214 }); 215 into.find(':input').focus(function() { 216 into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast'); 217 }); 218 }); 219 }; 220 221 $.fn.wpcf7OnloadRefill = function() { 222 return this.each(function() { 223 var url = $(this).attr('action'); 224 if (0 < url.indexOf('#')) 225 url = url.substr(0, url.indexOf('#')); 226 227 var id = $(this).find('input[name="_wpcf7"]').val(); 228 var unitTag = $(this).find('input[name="_wpcf7_unit_tag"]').val(); 229 230 $.getJSON(url, 231 { _wpcf7_is_ajax_call: 1, _wpcf7: id, _wpcf7_request_ver: $.now() }, 232 function(data) { 233 if (data && data.captcha) 234 $('#' + unitTag).wpcf7RefillCaptcha(data.captcha); 235 236 if (data && data.quiz) 237 $('#' + unitTag).wpcf7RefillQuiz(data.quiz); 238 } 239 ); 240 }); 241 }; 242 243 $.fn.wpcf7RefillCaptcha = function(captcha) { 244 return this.each(function() { 245 var form = $(this); 246 247 $.each(captcha, function(i, n) { 248 form.find(':input[name="' + i + '"]').clearFields(); 249 form.find('img.wpcf7-captcha-' + i).attr('src', n); 250 var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n); 251 form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]); 252 }); 253 }); 254 }; 255 256 $.fn.wpcf7RefillQuiz = function(quiz) { 257 return this.each(function() { 258 var form = $(this); 259 260 $.each(quiz, function(i, n) { 261 form.find(':input[name="' + i + '"]').clearFields(); 262 form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]); 263 form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]); 264 }); 265 }); 266 }; 267 268 $.fn.wpcf7ClearResponseOutput = function() { 269 return this.each(function() { 270 $(this).find('div.wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked'); 271 $(this).find('span.wpcf7-not-valid-tip').remove(); 272 $(this).find('img.ajax-loader').css({ visibility: 'hidden' }); 273 }); 274 }; 275 276 $.fn.wpcf7FillResponseOutput = function(message) { 277 return this.each(function() { 278 $(this).find('div.wpcf7-response-output').append(message).slideDown('fast'); 279 }); 280 }; 281 282 $.wpcf7SupportHtml5 = function() { 283 var features = {}; 284 var input = document.createElement('input'); 285 286 features.placeholder = 'placeholder' in input; 287 288 var inputTypes = ['email', 'url', 'tel', 'number', 'range', 'date']; 289 290 $.each(inputTypes, function(index, value) { 291 input.setAttribute('type', value); 292 features[value] = input.type !== 'text'; 293 }); 294 295 return features; 296 }; 297 298})(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.