PageSourceSearch

https://1000towns.ca/wp-content/cache/min/1/js/w/webforms.min.js?ver=1788835917

js 1000towns.ca collected 2026-09-25 04:08:44 UTC 12,126 bytes, 1 lines download raw bytes

1function webforms_script(){var n="https://static.mailerlite.com",e="",r=(0<e.length&&(n=e),"https://track.mailerlite.com"),t=".ml-subscribe-form form, .ml-contact-form form, .ml-preferences-form form",i=0,d=!1;function a(){void 0!==window.jQuery&&(window.ml_jQuery=window.jQuery.noConflict(!0)),o()}function p(e,t){if("function"==typeof window.ml_webform_after_success&&window.ml_webform_after_success(),!e.data("continue")&&!e.data("redirect")){var i=t.attr("id").substr(5).split("-");if(0===i.length)return;var i="ml_webform_success_"+i[0],n=t.find(".ml-block-success"),a=t.find(".ml-block-form");n.length&&a.length?(n.show(),a.hide()):"function"==typeof window[i]&&(window[i](),s())}window!=window.parent&&window.parent.postMessage("mlWebformSubmitSuccess-"+t.attr("id").substr(5),"*");n="ml_survey_success";"function"==typeof window[n]&&(window[n](e.data("scope-id")),s())}function o(){var e,t,i=[n+"/js/w/ml_jQuery.inputmask.bundle.min.js?v3.3.1"];for(e in i)i.hasOwnProperty(e)&&((t=document.createElement("script")).setAttribute("type","text/javascript"),t.setAttribute("src",i[e]),e==i.length-1&&(t.onload=s,t.onreadystatechange=function(){"complete"!==this.readyState&&"loaded"!==this.readyState||s()}),document.getElementsByTagName("head")[0].appendChild(t))}function l(){var e=document.querySelectorAll(t);i!==e.length&&(i=e.length,s())}function s(){var w="";if("function"==typeof window.ml_guid){w=window.ml_guid();try{window.localStorage&&(window.localStorage.ml_guid?w=window.localStorage.ml_guid:window.localStorage.ml_guid=w)}catch(e){}}var f=!1;try{window&&window.location&&window.location.hostname&&window.parent&&window.parent.window&&window.parent.window.location&&window.parent.window.location.hostname&&(f=window.location.hostname===window.parent.window.location.hostname)}catch(e){f=!1}new MutationObserver(l).observe(window.document,{attributes:!0,childList:!0,subtree:!0}),window.ml_jQuery(t).each(function(){var t,i,e,l=window.ml_jQuery(this),s=window.ml_jQuery(this).closest(".ml-subscribe-form, .ml-contact-form, .ml-preferences-form"),n=window.ml_jQuery(this),a=!1,u=(n.closest(".ml-webform-submit-wrapper").length&&(a=(n=n.closest(".ml-webform-submit-wrapper")).find("button.ml-webform-submit-button")),n.find("button.primary")),c=n.find("button.loading"),m=0<c.length,o=(l.find("input,textarea,select").attr("aria-invalid","false"),l.find(".ml-validate-date input").inputmask(void 0,{oncomplete:function(){window.ml_jQuery(this).closest(".ml-validate-date").addClass("ml-validate-date-valid")},onincomplete:function(){window.ml_jQuery(this).closest(".ml-validate-date").removeClass("ml-validate-date-valid")},oncleared:function(){window.ml_jQuery(this).closest(".ml-validate-date").removeClass("ml-validate-date-valid")},onKeyValidation:function(){window.ml_jQuery(this).closest(".ml-validate-date").removeClass("ml-validate-date-valid")}}),l.find(".ml-validate-phone input").inputmask(void 0,{oncomplete:function(){window.ml_jQuery(this).closest(".ml-validate-phone").addClass("ml-validate-phone-valid")},onincomplete:function(){window.ml_jQuery(this).closest(".ml-validate-phone").removeClass("ml-validate-phone-valid")},oncleared:function(){window.ml_jQuery(this).closest(".ml-validate-phone").removeClass("ml-validate-phone-valid")},onKeyValidation:function(){window.ml_jQuery(this).closest(".ml-validate-phone").removeClass("ml-validate-phone-valid")}}),l[0].querySelector("input[name='email_confirmation']"));o&&(o.addEventListener("paste",function(e){e.preventDefault()}),n=l[0].querySelector("input[name='fields[email]']"),t=n.value,n.addEventListener("input",function(e){t!==e.target.value?o.classList.remove("d-none"):o.classList.add("d-none")})),void 0!==l.data("ml-submit-bound")&&l.data("ml-submit-bound")||(l.data("ml-submit-bound",1),s.find(".ml-block-success").bind("click",function(){s.find(".ml-block-success").hide(),s.find(".ml-block-form").find('input[type="text"]').val("");var e=s.find(".ml-block-form").find('input[type="checkbox"],input[type="radio"]');void 0!==e.prop?e.prop("checked",!1):e.attr("checked",!1),s.find(".ml-block-form").show()}),n=window.ml_jQuery(":submit",l),(n=a?a:n).click(function(){l.find('input[type="hidden"].ml-submit-hidden-value').remove(),window.ml_jQuery(this).attr("name")&&l.append(window.ml_jQuery('<input type="hidden" class="ml-submit-hidden-value">').attr({name:window.ml_jQuery(this).attr("name"),value:window.ml_jQuery(this).attr("value")}))}),window.ml_jQuery("body").hasClass("ml-submit-success")&&p(l,s),e=function(e){if(e.preventDefault(),l.data("loading"))return!1;var t,i,n,a,o,r,d;l.find(".ml-error").removeClass("ml-error"),l.find(":input[aria-invalid=true]").attr("aria-invalid","false"),l.find(".ml-server-error").addClass("d-none"),l.find(".ml-field-error-message").text(""),d=!0,(r=l).find(".ml-validate-required").each(function(e,t){var i=!1;window.ml_jQuery(t).find('input[type="text"], input[type="email"], input[type="number"], select, textarea').each(function(e,t){void 0!==window.ml_jQuery(t).val()&&""!==window.ml_jQuery(t).val()&&(i=!0)}),window.ml_jQuery(t).find('input[type="checkbox"],input[type="radio"],input[type="hidden"]').each(function(e,t){void 0!==window.ml_jQuery(t).prop?window.ml_jQuery(t).prop("checked")&&(i=!0):window.ml_jQuery(t).attr("checked")&&(i=!0)}),i||(window.ml_jQuery(t).addClass("ml-error"),window.ml_jQuery(t).find(":input[aria-invalid=false]").attr("aria-invalid","true"),d=!1)}),r.find(".ml-validate-email").each(function(e,t){var i=!0;window.ml_jQuery(t).find('input[type="text"], input[type="email"]').each(function(e,t){void 0===window.ml_jQuery(t).val()||""===window.ml_jQuery(t).val()||((e,t)=>{var i=/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]){2,40}$/.test(e.trim()),t=t.find("input[name='email_confirmation']");return i=t.length&&"none"!==t.css("display")?e===t[0].value:i})(window.ml_jQuery(t).val(),r)||(i=!1)}),i||(window.ml_jQuery(t).addClass("ml-error"),window.ml_jQuery(t).find(":input[aria-invalid=false]").attr("aria-invalid","true"),d=!1)}),r.find(".ml-validate-date").each(function(e,i){var n=!0;window.ml_jQuery(i).find('input[type="text"]').each(function(e,t){void 0===window.ml_jQuery(t).val()||""===window.ml_jQuery(t).val()||window.ml_jQuery(i).hasClass("ml-validate-date-valid")||(n=!1)}),n||(window.ml_jQuery(i).addClass("ml-error"),window.ml_jQuery(i).find(":input[aria-invalid=false]").attr("aria-invalid","true"),d=!1)}),r.find(".ml-validate-phone").each(function(e,i){var n=!0;window.ml_jQuery(i).find('input[type="text"]').each(function(e,t){void 0===window.ml_jQuery(t).val()||""===window.ml_jQuery(t).val()||window.ml_jQuery(i).hasClass("ml-validate-phone-valid")||(n=!1)}),n||(window.ml_jQuery(i).addClass("ml-error"),window.ml_jQuery(i).find(":input[aria-invalid=false]").attr("aria-invalid","true"),d=!1)}),d&&(m&&(u.hide(),c.show()),e=(e=l.serialize())+"&ajax=1&guid="+w,t=l.attr("action"),l.data("loading",!0),i="GET",l.data("force-post")&&(i="POST"),n="jsonp",l.data("request-data-type")&&(n=l.data("request-data-type")),a=/^https?:\/\/.*$/i.test(t),o=!0,l.data("email-not-required")&&(o=!1),a?f&&-1===e.toLowerCase().indexOf("email")&&o?(console.error("Form submit error. Email field is required in preview mode"),l.data("loading",!1)):window.ml_jQuery.ajax({type:i,url:t,data:e,jsonpCallback:"mlWebformSubmitted",dataType:n,success:function(e){var t;l.data("loading",!1),m&&(u.show(),c.hide()),e.success?((t=(t=l).find("#redirect_url")).length&&location.assign(t.val()),p(l,s),y()):e.f
1ieldsToConfirm&&e.fieldsToConfirm.length?($(".row-form").hide(),$(".row-confirm").show(),$(window).scrollTop(0),y()):void 0!==e.errors&&(void 0!==e.errors.groups&&e.errors.groups&&(l.find(".ml-block-groups").addClass("ml-error"),l.find(".ml-block-groups :input[aria-invalid=false]").attr("aria-invalid","true")),void 0!==e.errors.fields)&&e.errors.fields&&v(l,e.errors.fields),l.data("redirect")&&(t=l.data("redirect-target"),f?window.top.open(l.data("redirect"),t||"_blank"):window.parent.postMessage("mlWebformRedirect-"+encodeURIComponent(l.data("redirect"))+(t?"-"+t:""),"*"))},error:function(e){l.data("loading",!1),m&&(u.show(),c.hide());var i,t={};try{t=JSON.parse(e.responseText)}catch(e){}l.find(".ml-server-error").text(t.message||"Something went wrong, please try again"),l.find(".ml-server-error").removeClass("d-none"),t.errors&&t.errors.fields&&Object.keys(t.errors.fields).length&&(v(l,Object.keys(t.errors.fields)),i=l,e=t.errors.fields,i)&&e&&window.ml_jQuery.each(e,function(e,t){e&&t&&(t=t.join(" "),i.find(".ml-field-"+e).find(".ml-field-error-message").text(t))})}}):(console.error("Form submit error. Invalid form action url"),l.data("loading",!1)),l.data("close"))&&"function"==typeof window.close&&window.close()},a?n.bind("click",e):l.bind("submit",e),a=l.attr("data-id"),n=l.attr("data-code"),a&&((new Image).src=r+"/webforms/o/"+a+"/"+n+"?v"+Math.floor(Date.now()/1e3))),i=l,window.fields&&window.fields.length&&"object"==typeof window.fields&&i&&window.fields.forEach(function(e){var t;e.field&&e.field_type?(t=i.find("input[aria-label='"+e.field+"']")).length&&(t.val(e.value),"DATE"===e.field_type)&&t.closest(".ml-validate-date").addClass("ml-validate-date-valid"):console.error('Missing data! "field" and "field_type" properties are required.')}),window.survey_preset&&window.survey_preset.length&&"object"==typeof window.survey_preset&&!d&&(d=!0,e=window.ml_jQuery(".ml-survey").find(".ml-carousel-item"))&&e.length&&e.each(function(e){var t=$(this).find(".preference-survey-question").text()||"",n=$(this).find(".survey-dropdown-box")||!1,i=[];if(n&&n.length)i=n.find(".single-choice-item a");else{var a=$(this).find(".btn-list-container");if(!a)return;i=a.find(".custom-control-label")}i&&i.length&&window.survey_preset.forEach(function(e){e.question&&e.answers&&e.question.trim()===t.trim()&&i.each(function(){var t=$(this),i=t.text().trim()||"";0<t.length&&(i=t[0].dataset&&t[0].dataset.answer?t[0].dataset.answer:i),e.answers.forEach(function(e){if(i===e.trim())if(n&&n.length)try{t.closest(".single-choice-item a")[0].click()}catch(e){}else try{t.closest(".custom-control-label").click()}catch(e){}})})})}),window!=window.parent&&(window.ml_jQuery(document).on("click",".overlay, .ml-subscribe-close",function(){window.parent.postMessage("mlCloseIframe-"+l.data("code"),"*")}),window.ml_jQuery(".ml-subscribe-form").bind("click",function(e){var t=e.target||e.srcElement;window.ml_jQuery(t).is("div.ml-subscribe-close")||e.stopPropagation()}))})}function v(i,e){i&&e&&window.ml_jQuery.each(e,function(e,t){i.find(".ml-field-"+t).addClass("ml-error"),i.find(".ml-field-"+t+":input[aria-invalid=false]").attr("aria-invalid","true")})}function y(){var e,t,i;window.verticalSurvey&&window.verticalSurvey.request_url&&window.verticalSurvey.answers&&window.verticalSurvey.answers.length&&(e=window.verticalSurvey.answers,t=window.verticalSurvey.request_url,(i=new XMLHttpRequest).onreadystatechange=function(){if(4!==i.readyState||200!==i.status)return!1;var e=JSON.parse(i.responseText);e&&e.success||console.error("Vertical survey answers failed to submit")},/^https?:\/\/.*$/i.test(t))&&(i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json;charset=UTF-8"),i.send(JSON.stringify(e)))}void 0!==window.ml_jQuery&&"function"==typeof window.ml_jQuery.ajax?o():void 0!==window.jQuery&&"function"==typeof window.jQuery.ajax?(window.ml_jQuery=window.jQuery,o()):((e=document.createElement("script")).setAttribute("type","text/javascript"),e.setAttribute("src","https://assets.mlcdn.com/ml/ajax/libs/jquery/3.7.1/jquery.min.js"),e.onload=a,e.onreadystatechange=function(){"complete"!==this.readyState&&"loaded"!==this.readyState||a()},document.getElementsByTagName("head")[0].appendChild(e),window.ml_guid=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()})}"loading"!==document.readyState?webforms_script():document.addEventListener?document.addEventListener("DOMContentLoaded",webforms_script):document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&webforms_script()})

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.