1/* Form submission functions for the Mailchimp Widget */ 2(function ($) { 3 function mc_beforeForm() { 4 // Disable the submit button 5 $('.mc_signup_submit_button').attr('disabled', 'disabled'); 6 } 7 8 function mc_success(data, status, xhr, submittedForm) { 9 let form = $(submittedForm); 10 if (!submittedForm || !form) { 11 form = $('.mc_signup_form'); 12 } 13 14 // Re-enable the submit button 15 $('.mc_signup_submit_button').removeAttr('disabled'); 16 17 // Put the response in the message div 18 form.find('.mc_message_wrapper').html(data); 19 20 // See if we're successful, if so, wipe the fields 21 const reg = /class=(["'])mc_success_msg\1/i; 22 23 if (reg.test(data)) { 24 $(form).each(function () { 25 this.reset(); 26 }); 27 28 $('.mc_submit_type').val('js'); 29 } 30 31 window.scrollTo({ 32 top: parseInt(form.offset().top, 10) - 28, 33 behavior: 'smooth', 34 }); 35 } 36 37 $(function ($) { 38 // Change our submit type from HTML (default) to JS 39 $('.mc_submit_type').val('js'); 40 41 // Remove the no JS field. 42 $('.mailchimp_sf_no_js').remove(); 43 44 // Attach our form submitter action 45 $('.mc_signup_form').ajaxForm({ 46 url: window.mailchimpSF.ajax_url, 47 type: 'POST', 48 dataType: 'text', 49 beforeSubmit: mc_beforeForm, 50 success: mc_success, 51 }); 52 }); 53})(window.jQuery); 54 55/* Datepicker functions for the Mailchimp Widget */ 56(function ($) { 57 if ($('.date-pick').length > 0) { 58 // Datepicker for the date-pick class 59 $('.date-pick').each(function () { 60 let format = $(this).data('format') || 'mm/dd/yyyy'; 61 format = format.replace(/yyyy/i, 'yy'); 62 $(this).datepicker({ 63 autoFocusNextInput: true, 64 constrainInput: false, 65 changeMonth: true, 66 changeYear: true, 67 // eslint-disable-next-line no-unused-vars 68 beforeShow(input, inst) { 69 $('#ui-datepicker-div').addClass('show'); 70 }, 71 dateFormat: format.toLowerCase(), 72 }); 73 }); 74 } 75 76 if ($('.birthdate-pick').length > 0) { 77 const d = new Date(); 78 $('.birthdate-pick').each(function () { 79 let format = $(this).data('format') || 'mm/dd'; 80 format = format.replace(/yyyy/i, 'yy'); 81 $(this).datepicker({ 82 autoFocusNextInput: true, 83 constrainInput: false, 84 changeMonth: true, 85 changeYear: false, 86 minDate: new Date(d.getFullYear(), 1 - 1, 1), 87 maxDate: new Date(d.getFullYear(), 12 - 1, 31), 88 // eslint-disable-next-line no-unused-vars 89 beforeShow(input, inst) { 90 $('#ui-datepicker-div').removeClass('show'); 91 }, 92 dateFormat: format.toLowerCase(), 93 }); 94 }); 95 } 96})(window.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.