1(function ($) { 2 3 $(function () { 4 5 $(".m-newslettersignup").each(function () { 6 const $root = $(this); 7 const btn = $root.find("button[type=submit]"); 8 $(btn).on("click", function (e) { 9 e.preventDefault(); 10 11 $root.find("[js-emailaddress-error]").hide(); 12 $root.find("[js-newsletter-error]").hide(); 13 $root.find("[js-subscribed]").hide(); 14 15 16 let acceptPrivacyPolicy = $root.find("[js-accept-privacy-policy]").prop("checked"); 17 if (!acceptPrivacyPolicy) { 18 $root.find("[js-checkbox-error]").show(); 19 //return; 20 } else { 21 $root.find("[js-checkbox-error]").hide(); 22 } 23 24 let emailAddress = $root.find("[js-email-address]").val(); 25 if (emailAddress === "") { 26 $root.find("[js-emailaddress-error]").show(); 27 return; 28 } 29 30 if (emailAddress !== "" && acceptPrivacyPolicy) { 31 let listId = $root.data("list-id"); 32 $.post("/umbraco/api/NewsletterApi/Add", { emailAddress: emailAddress, acceptPrivacyPolicy: acceptPrivacyPolicy, currentPageId: currentPageId, listId: listId }, function () { 33 $root.find("[js-subscribed]").show(); 34 $root.find("form").hide(); 35 }).fail(function () { 36 $root.find("[js-newsletter-error]").show(); 37 }); 38 } 39 }); 40 }); 41 }); 42 43})(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.