1jQuery(document).ready(function ($) { 2 const FORM_CONFIGS = { 3 "#cig__jobAlertForm": { 4 fields: { 5 ".cig__success-keywords": "#cig__formKeywords", 6 ".cig__success-location": "#cig__formLocation", 7 ".cig__success-email": "#alert__email", 8 ".cig__success-frequency": 'select[name="email_frequency"]', 9 }, 10 successId: "#cig__jobAlertSuccess", 11 }, 12 "#cig__newsletterForm": { 13 fields: { 14 ".cig__success-nl-email": "#news__email", 15 ".cig__success-nl-option": 'select[name="get_newsletter"]', 16 }, 17 successId: "#cig__newsletterSuccess", 18 }, 19 }; 20 21 function getFieldValue($el) { 22 return $el.is("select") ? $el.find("option:selected").text() : $el.val(); 23 } 24 25 function handleFormSubmit(formWrapperId, config) { 26 const $formWrapper = $(formWrapperId); 27 28 $formWrapper.on("submit", "form", function (e) { 29 e.preventDefault(); 30 if (typeof window.createAlert === "function" && this.id) { 31 return window.createAlert(this.id); 32 } 33 34 // Populate success state 35 $.each(config.fields, function (successSelector, fieldSelector) { 36 $(successSelector).text(getFieldValue($(fieldSelector))); 37 }); 38 39 // Transition to success 40 $formWrapper.fadeOut(200, function () { 41 $(config.successId).fadeIn(200); 42 }); 43 }); 44 } 45 46 $.each(FORM_CONFIGS, handleFormSubmit); 47});
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.