1_corona_notification = function($) { 2 3 var public = { 4 onSubmit: null 5 }; 6 7 var private = { 8 validator: [], 9 10 init: function () { 11 $(document).ready(function () { 12 if (!$.validator.methods.notempty) { 13 $.validator.addMethod('notempty', function(value, element) { 14 return value.trim() != ''; 15 }, 'Invalid field value'); 16 } 17 if (!$.validator.methods.email) { 18 $.validator.addMethod('email', function(value, element) { 19 return gui.validation.email(value); 20 }, 'Incorrect email format'); 21 } 22 23 private.validations(); 24 private.events(); 25 }); 26 }, 27 28 validations: function () { 29 $('#corona-notification-form').validate({ 30 ignore: '' 31 }); 32 33 $('#corona-notification-form [name="notification-name"]').rules('add', { 34 notempty: true, 35 messages: { 36 notempty: $('#corona-notification-form [name="notification-name"]').attr('data-error-msg-notempty') 37 } 38 }); 39 40 $('#corona-notification-form [name="notification-email"]').rules('add', { 41 required: true, 42 email: true, 43 messages: { 44 required: $('#corona-notification-form [name="notification-email"]').attr('data-error-msg-required'), 45 email: $('#corona-notification-form [name="notification-email"]').attr('data-error-msg-email') 46 } 47 }); 48 }, 49 50 events: function () { 51 $('#corona-form-submit').click(function (e) { 52 e.preventDefault(); 53 if ($('#corona-notification-form').valid() == true) { 54 gui.loader.show('body'); 55 56 grecaptcha.ready(function () { 57 grecaptcha.execute(google_recaptcha_site_key, { action: 'corona_recaptcha' }) 58 .then(function (token) { 59 $('#corona-notification-form #g-recaptcha-response').val(token); 60 $('.grecaptcha-badge').removeClass('animate__bounceOutRight'); 61 $('.grecaptcha-badge').addClass('animate__animated animate__bounceInRight'); 62 $('.grecaptcha-badge').css('opacity', '1'); 63 setTimeout(function () { 64 $('.grecaptcha-badge').addClass('animate__bounceOutRight'); 65 }, 5000); 66 67 private.ajax.handleCovidSubscriptions(); 68 }) 69 }); 70 } 71 return false; 72 }) 73 }, 74 75 ajax: { 76 handleCovidSubscriptions: function () { 77 $.ajax({ 78 type: "POST", 79 url: "/front-ajax", 80 data: { 81 action: 'handle_covid_subscriptions', 82 first_name: $('#corona-notification-form [name="notification-name"]').val(), 83 email: $('#corona-notification-form [name="notification-email"]').val(), 84 recaptcha_response: $('#corona-notification-form [name="g-recaptcha-response"]').val(), 85 nonce: handleCovidSubscriptionsNonce 86 } 87 }).done(function(ans) { 88 gui.loader.hide(); 89 90 if (ans == 'success') { 91 $('#corona-notification-form').remove(); 92 $('.notification-success').show(); 93 } else { 94 gui.alertify.alert({ 95 label: 'OK', 96 custom_class: 'btn-outline v-middle' 97 }, 98 '', 99 'We are having problems handling your request right now. Please try again or if the issue persists contact us.' 100 ); 101 } 102 }).error(function () { 103 gui.alertify.alert({ 104 label: 'OK', 105 custom_class: 'btn-outline v-middle' 106 }, 107 '', 108 'We are having problems handling your request right now. Please try again or if the issue persists contact us.' 109 ); 110 111 gui.loader.hide(); 112 }); 113 } 114 } 115 }; 116 117 private.init(); 118 119 return public; 120} 121 122page = new _corona_notification(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.