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