1(function ($) { 2 $(document).ready(function () { 3 var ac_form = $('form[name="ac-subscribe-form"]'); 4 5 function showError(message) { 6 clearMessage(); 7 ac_form.find('#ac-error-response').show().text(message); 8 } 9 10 function showSuccess(message) { 11 clearMessage(); 12 ac_form.find('#ac-success-response').show().text(message); 13 } 14 15 function clearMessage() { 16 ac_form.find('#ac-error-response').text('').hide(); 17 ac_form.find('#ac-success-response').text('').hide(); 18 } 19 20 function disableForm() { 21 ac_form.find('button[type=submit]').attr('disabled', true); 22 ac_form.find('input[name=email]').attr('disabled', true); 23 } 24 25 function enableForm() { 26 ac_form.find('button[type=submit]').removeAttr('disabled'); 27 ac_form.find('input[name=email]').removeAttr('disabled'); 28 } 29 30 ac_form.submit(function (e) { 31 e.preventDefault(); 32 clearMessage(); 33 var email = $(this).find('input[name=email]').val(); 34 if (!email.match(/^[\+_a-z0-9-'&=]+(\.[\+_a-z0-9-']+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/i)) { 35 return showError('Email is not valid'); 36 } 37 disableForm(); 38 $.post(AC_SUB.ajaxurl, { 39 action: 'ac_sub', 40 email: email, 41 _wpnonce: AC_SUB.token 42 }, function (data) { 43 if (data && data.success) { 44 ac_form.find('input[name=email]').val(''); 45 showSuccess(data.data.message) 46 } else { 47 showError('Something wrong') 48 } 49 enableForm(); 50 }).fail(function (res) { 51 var data = res.responseJSON; 52 if (data && !data.success) { 53 showError(data.data.message) 54 } else { 55 showError('Something wrong') 56 } 57 enableForm(); 58 }) 59 }); 60 }); 61})(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.