1(function ($) { 2 $(document).ready(function () { 3 $('[data-off-canvas]').on('click', function () { 4 const target = $(this); 5 const entryFormContainer = $(target.data('off-canvas') + '-container').find('.demo-entry-form'); 6 const meetingContainer = entryFormContainer.siblings('.meetings-iframe-container'); 7 entryFormContainer.removeClass('d-none'); 8 entryFormContainer.find('.fusion-form-working').removeClass('fusion-form-working'); 9 if (target.data('organization')) { 10 entryFormContainer 11 .find('[name="organization"]').last() 12 .attr('type', 'hidden') 13 .val(target.data('organization')); 14 } 15 entryFormContainer.find('[name="hs_language"]').last().val($('.wpml-ls-native').attr('lang')); 16 meetingContainer.addClass('d-none'); 17 entryFormContainer 18 .find('form') 19 .on('submit', function (event) { 20 const trigger = $(this); 21 const form = trigger.closest('form')[0]; 22 const emailField = entryFormContainer.find('[name="email"]').last()[0]; 23 const email = emailField ? String(emailField.value || '').trim() : ''; 24 25 if (emailField) { 26 emailField.setCustomValidity(''); 27 $(emailField).closest('.fusion-form-field').removeClass('awb-has-value').removeClass('error'); 28 } 29 30 if (emailField && email.length > 0 && !isValidEmailAddress(email)) { 31 emailField.setCustomValidity('Please enter a valid email address.'); 32 $(emailField).closest('.fusion-form-field').addClass('awb-has-value').addClass('error'); 33 } 34 35 if (form && !form.checkValidity()) { 36 event.preventDefault(); 37 $(form).find('.fusion-form-working').removeClass('fusion-form-working'); 38 form.reportValidity(); 39 return false; 40 } 41 42 const meetingIframe = meetingContainer.find('> iframe'); 43 const firstName = entryFormContainer.find('[name="firstname"]').last().val(); 44 const lastName = entryFormContainer.find('[name="lastname"]').last().val(); 45 const geographicalArea = entryFormContainer.find('[name="geographical_area"]').last().val(); 46 const parameters = '&email=' + email + '&firstName=' + firstName + '&lastName=' + lastName; 47 48 meetingIframe.attr('src', meetingContainer.attr('data-src') + parameters + '&parentHubspotUtk'); 49 50 const baseSubmitURL = 'https://api.hsforms.com/submissions/v3/integration/submit' 51 const portalId = '22255530'; 52 const formGuid = '053b7d9d-fbf8-4e8e-96c2-51498b5dcb8c'; 53 const submitURL = `${baseSubmitURL}/${portalId}/${formGuid}`; 54 const formData = prepareHSFormSubmission(trigger.closest('form')[0]); 55 postData(submitURL, formData).then(() => { 56 if (trigger.closest('.demo-entry-form').find('.error:not(.awb-alert-close-boxed)').length === 0) { 57 trigger.closest('.demo-entry-form').addClass('d-none'); 58 meetingContainer.removeClass('d-none'); 59 } 60 }); 61 }); 62 }); 63 64 //Event visiting tracking form 65 $('form.fusion-form-57426').off('submit').on('submit', function () { 66 const target = $(this); 67 setTimeout(function () { 68 if (target.find('.fusion-form-label-above.error').length === 0) { 69 $('.awb-off-canvas-wrap').hide(); 70 } 71 }, 500); 72 }); 73 74 //Fixes of the issue with rendering YouTube videos in the Event Modal's iframe. 75 $('#event-youtube-button').on('click touch', function () { 76 var modalId = $(this).data('modal-id'); 77 setTimeout(function () { 78 var modalIframe = $('#' + modalId).find('iframe'); 79 modalIframe.attr('src', modalIframe.data('orig-src')); 80 }, 500); 81 82 }); 83 84 $('button.btn-newsletter-gov').off('click').on('click', function () { 85 const target = $(this); 86 const form = target.closest('form')[0]; 87 const emailField = form ? form.querySelector('[name="email"]') : null; 88 const email = emailField ? String(emailField.value || '').trim() : ''; 89 90 if (emailField) { 91 emailField.setCustomValidity(''); 92 } 93 94 if (emailField && email.length > 0 && !isValidEmailAddress(email)) { 95 emailField.setCustomValidity('Please enter a valid email address.'); 96 } 97 98 if (form && !form.checkValidity()) { 99 $(form).find('.fusion-form-working').removeClass('fusion-form-working'); 100 form.reportValidity(); 101 return false;
102 } 103 104 const baseSubmitURL = 'https://api.hsforms.com/submissions/v3/integration/submit' 105 const portalId = '22255530'; 106 const formGuid = 'c2a1e90f-8af0-44d3-ba80-0041d7a6b7bf'; 107 const submitURL = `${baseSubmitURL}/${portalId}/${formGuid}`; 108 const formData = prepareHSFormSubmission(form); 109 110 if (!target.hasClass('subscribed')) { 111 target.addClass('subscribed'); 112 void postData(submitURL, formData); 113 } 114 }); 115 116 $('button.btn-newsletter-edu').off('click').on('click', function () { 117 const target = $(this); 118 const form = target.closest('form')[0]; 119 const emailField = form ? form.querySelector('[name="email"]') : null; 120 const email = emailField ? String(emailField.value || '').trim() : ''; 121 122 if (emailField) { 123 emailField.setCustomValidity(''); 124 } 125 126 if (emailField && email.length > 0 && !isValidEmailAddress(email)) { 127 emailField.setCustomValidity('Please enter a valid email address.'); 128 } 129 130 if (form && !form.checkValidity()) { 131 $(form).find('.fusion-form-working').removeClass('fusion-form-working'); 132 form.reportValidity(); 133 return false; 134 } 135 136 const baseSubmitURL = 'https://api.hsforms.com/submissions/v3/integration/submit' 137 const portalId = '22255530'; 138 const formGuid = '47807afc-5862-4d7d-a991-388ed3c705da'; 139 const submitURL = `${baseSubmitURL}/${portalId}/${formGuid}`; 140 const formData = prepareHSFormSubmission(form); 141 142 if (!target.hasClass('subscribed')) { 143 target.addClass('subscribed'); 144 void postData(submitURL, formData); 145 } 146 }); 147 148 }); 149})(jQuery); 150 151 152function formFieldsToHSJSON(form) { 153 let fieldArray = []; 154 let formData = new FormData(form); 155 for (let field of formData) { 156 let values = { 157 "name": field[0], 158 "value": field[1] 159 } 160 fieldArray.push(values) 161 } 162 return fieldArray; 163} 164 165 166function buildHSContext() { 167 let hsContext = {}; 168 hsContext.hutk = getCookie('hubspotutk'); 169 hsContext.pageUri = window.location.href; 170 hsContext.pageName = document.title; 171 return hsContext; 172} 173 174function prepareHSFormSubmission(form) { 175 var submissionData = {}; 176 submissionData.submittedAt = Date.now(); 177 submissionData.fields = formFieldsToHSJSON(form); 178 submissionData.context = buildHSContext(); 179 return submissionData; 180} 181 182function isValidEmailAddress(email) { 183 return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(email || '').trim()); 184} 185 186async function postData(url = '', data = {}) { 187 const response = await fetch(url, { 188 method: 'POST', 189 mode: 'cors', 190 cache: 'no-cache', 191 credentials: 'same-origin', 192 headers: { 193 'Content-Type': 'application/json' 194 }, 195 redirect: 'follow', 196 referrerPolicy: 'no-referrer', 197 body: JSON.stringify(data) 198 }); 199 return response.json(); 200} 201 202function getCookie(cname) { 203 let name = cname + "="; 204 let decodedCookie = decodeURIComponent(document.cookie); 205 let ca = decodedCookie.split(';'); 206 for (let i = 0; i < ca.length; i++) { 207 let c = ca[i]; 208 while (c.charAt(0) === ' ') { 209 c = c.substring(1); 210 } 211 if (c.indexOf(name) === 0) { 212 return c.substring(name.length, c.length); 213 } 214 } 215 return ""; 216}
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.