1document.addEventListener('alpine:init', () => { 2 Alpine.data('emailOnlyRegisterApp', () => ({ 3 submitting: false, 4 showLoginLink: false, 5 statusMessage: '', 6 submitUrl: '', 7 8 init() { 9 this.submitUrl = this.$el.dataset.submitUrl; 10 const root = $(this.$el); 11 12 root.find('.emailyonlysubmithook').on('keypress', (event) => { 13 const key = event.keyCode || event.which; 14 if (key === 13) { 15 event.preventDefault(); 16 root.find('.email-only-reg__form__submit').first().click(); 17 return false; 18 } 19 }); 20 }, 21 22 registerClick(event) { 23 this.submitting = true; 24 25 var parent = $(event.target).closest('.email-only-reg'); 26 27 let pageValid = true; 28 29 var email = $(parent).find('.email-only-reg__form__textbox').val().trim(); 30 31 if (!this.validateEmail(email)) 32 pageValid = false; 33 34 if (!pageValid) { 35 this.submitting = false; 36 return false; 37 } 38 39 var regvm = {}; 40 regvm.EmailOnlyRegistration_EmailAddress = email; 41 regvm.xexyz = $(parent).find('.requirednotes').val(); 42 regvm.xexyz_cb = $(parent).find('.terms-cb').prop('checked'); 43 44 this.emailOnlyRegister(regvm); 45 46 return false; 47 }, 48 49 emailOnlyRegister(regvm, callback) { 50 const reqData = JSON.stringify(regvm); 51 const self = this; 52 53 $.ajax({
54 url: self.submitUrl, 55 method: 'POST', 56 contentType: "application/json; charset=utf-8", 57 dataType: 'json', 58 data: reqData, 59 success: function (data) { 60 if (data.status === 1) { 61 62 fdEvents.publish("sign_up", { 63 method: "email_only", 64 send_to: "all" 65 }); 66 67 if (data.eventId) { 68 window.fbPixel.done(function () { 69 fbq('track', 'CompleteRegistration', { eventID: data.eventId }); 70 }); 71 } 72 73 if (callback) 74 callback(); 75 else { 76 setTimeout(function () { 77 window.location = data.redirectUrl; 78 }, 100); 79 } 80 } 81 else { 82 self.submitting = false; 83 self.statusMessage = data.message; 84 } 85 }, 86 error: function (data) { 87 console.log(data.responseText); 88 self.submitting = false; 89 } 90 }); 91 }, 92 93 validateEmail(email) { 94 const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; 95 96 if (email.length === 0) { 97 this.statusMessage = 'Please enter your email address first.'; 98 return false; 99 } 100 101 if (!emailRegex.test(email)) { 102 this.statusMessage = 'Please enter a valid email address.'; 103 return false; 104 } 105 106 this.statusMessage = ''; 107 return true; 108 } 109 })); 110});
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.