PageSourceSearch

https://assignedmedia.org/wp-content/plugins/mailster/build/form/view.js

js assignedmedia.org collected 2026-10-01 10:44:33 UTC 8,012 bytes, 1 lines download raw bytes

1(()=>{"use strict";const e={n:t=>{const r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.hasOwn(e,t)},t=window.wp.apiFetch;var r=e.n(t);const s=window.wp.domReady;var o=e.n(s);!function(){const e=(e,t,r)=>{e.addEventListener(t,r)},t=(e,t,r)=>{e.removeEventListener(t,r)},s=(e,t)=>Array.prototype.slice.call(e.querySelectorAll(t)),a=(e,t)=>e.querySelector(t),i=window,l=i.document,n=i.setTimeout,c=i.clearTimeout,d=l.documentElement;let f=null;const u="click",m="mouseout",p="scroll",h="touchstart",b="mousedown",v="mousemove",g="keydown",y="keyup",k="keypress";function L(e){e.stopPropagation()}function w(e,t,r){let s;return()=>{const o=this,a=arguments,i=r&&!s;c(s),s=n(()=>{s=null,r||e.apply(o,a)},t),i&&e.apply(o,a)}}function E(e,t,r){const s="mailster-form-"+e;if(void 0===r){const e=JSON.parse(i.localStorage.getItem(s));return t?e&&e[t]?e[t]:null:e}{const o=E(e)||{};o[t]=r,i.localStorage.setItem(s,JSON.stringify(o))}}function A(e,t,r){const s="mailster_form_"+e,o=i[s]||{};if(void 0===r)return t?o[t]:o;o[t]=r,i[s]=o}function _(e,t,r){try{const e="__test__";i.localStorage.setItem(e,e),i.localStorage.removeItem(e),_=E}catch(e){_=A}return _(e,t,r)}o()(()=>{const o=s(l,".mailster-block-form"),E=i.mailsterBlockEvents||{},A=function(){const e={},t=i.location.search.replace("?","").split("&"),r=t.length;for(let s=0;s<r;s++){const r=t[s].slice(0,t[s].search("=")),o=t[s].slice(t[s].search("=")).replace("=","");e[r]=o}return e}();Array.prototype.forEach.call(o,o=>{const T=a(o,".mailster-block-form-data"),S=JSON.parse(T.textContent),O=o.closest(".wp-block-mailster-form-outside-wrapper"),C=s(O,".mailster-block-form-close, .mailster-block-form-inner-close"),D=C[C.length-1],x=a(O,'button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])'),I=a(o,".mailster-block-form-info"),P=3600*(S.cooldown||0),H="submission"===S.type;let j=null,M=null,R=!1;const J={delay:()=>{j=n(()=>{K()&&G()},1e3*S.trigger_delay)},inactive:()=>{e(i,b,N),e(i,v,N),e(i,k,N),e(i,p,N),e(i,h,N)},scroll(){e(i,p,U),e(i,h,U)},click:()=>{const t=s(l,S.trigger_click);Array.prototype.forEach.call(t,t=>{e(t,u,G)})},exit:()=>{e(l,m,q)}};Array.prototype.forEach.call(s(l,".has-mailster-form-"+S.identifier),t=>{e(t,u,G)});const N=w(function(e){c(M),M=n(()=>{K()&&G()},1e3*S.trigger_inactive)},100),U=w(function(e){if(scroll.el=scroll.el||d,scroll.body=scroll.body||l.body,(scroll.el.scrollTop||scroll.body.scrollTop)/((scroll.el.scrollHeight||scroll.body.scrollHeight)-scroll.el.clientHeight)>=S.trigger_scroll/100){if(!K())return;G()}},50);function q(e){if(!e.toElement&&!e.relatedTarget){if(!K())return;G()}}function F(e){if(e.preventDefault(),R)return;R=!0;const t=new FormData(o),i={},c=[],d=a(I,".mailster-block-form-info-success"),f=a(I,".mailster-block-form-info-error");o.classList.remove("completed"),s(o,".is-error").forEach(e=>{e.classList.remove("is-error")}),s(o,"[aria-invalid]").forEach(e=>{e.removeAttribute("aria-invalid")}),o.classList.add("loading"),o.setAttribute("aria-disabled",!0),l.referrer&&new URL(l.referrer).origin!==l.location.origin?t.append("_referer",l.referrer):t.append("_referer",l.location.href);const u=t.getAll("_lists[]");let m;u.length||t.append("_lists[]",[]);for(let e of t.keys())"_lists[]"===e?(m=u,e=e.replace("[]","")):m=t.get(e),i[e]=m;r()({path:"mailster/v1/forms/"+S.id+"/"+S.type,method:H?"POST":"PATCH",data:i}).then(e=>{W("conversion"),Z("submit",{...e.data,formdata:i}),I.classList.remove("is-error"),o.classList.remove("has-errors"),H&&e.data.redirect?n(()=>location.href=e.data.redirect,150):(e.message&&c.push(e.message),c.length&&(d.innerHTML=c.join("<br>")),I.setAttribute("role","alert"),I.classList.add("is-success"),H&&(o.classList.add("completed"),l.activeElement.blur(),Z("complete",{...e.data,formdata:i}),S.triggers&&n(()=>{V(),o.reset()},3e3)))}).catch(e=>{e.data.fields?(o.classList.add("has-errors"),Object.keys(e.data.fields).map(t=>{const r=a(o,".wp-block-mailster-"+t+", .wp-block-mailster-field-"+t),s="hint-"+S.identifier+"-"+t;if(r){const e=a(r,"input, select, textarea");
1e.setAttribute("aria-invalid","true"),e.setAttribute("aria-describedby",s),r.classList.add("is-error")}const i=r?.dataset?.errorMessage||e.data.fields[t];console.error("["+t+"]",i),c.push('<div id="'+s+'" role="alert">'+i+"</div>")})):e.message&&(console.error(e.message),c.push(e.message)),I.classList.remove("is-success"),I.classList.add("is-error"),f.innerHTML=c.join(""),Z("error",{...e.data,formdata:i})}).finally(()=>{W("show"),o.classList.remove("loading"),o.removeAttribute("aria-disabled"),I.setAttribute("aria-hidden","false"),R=!1})}function K(){return!!S.isPreview||!X("conversion")&&!B("closed",P)}function B(e,t){return!(X(e,0)<+new Date-1e3*t)}function G(r){if(O&&!O.classList.contains("active")){if(f)return;f=S,c(j),c(M),t(l,m,q),t(i,p,U),t(i,h,U),t(i,b,N),t(i,v,N),t(i,k,N),t(i,v,N),t(i,p,N),t(i,h,N),e(l,y,z),e(l,g,Q),n(()=>e(O,u,$),1500),C.forEach(t=>e(t,u,$)),e(o,u,L),O.classList.add("active"),I.classList.remove("is-success"),o.classList.remove("completed"),O.setAttribute("aria-hidden","false"),O.focus(),d.classList.add("mailster-form-active"),r&&r.type===u&&(r.preventDefault(),n(()=>x.focus(),500)),Z("open"),Y()}}function V(){t(l,y,z),t(l,g,Q),t(O,u,V),t(O,u,$),C.forEach(e=>t(e,u,$)),t(o,u,L),O.classList.add("closing"),d.classList.remove("mailster-form-active"),Z("close"),n(()=>{O.classList.remove("closing"),O.classList.remove("active"),O.setAttribute("aria-hidden","true")},500),f=null}function $(e){e&&e.preventDefault(),V(),W("closed")}function z(e){"Escape"!==e.key&&27!==e.keyCode||$()}function Q(e){"Tab"!==e.key&&9!==e.keyCode||(x===e.target&&e.shiftKey&&(D.focus(),e.preventDefault()),D!==e.target||e.shiftKey||(x.focus(),e.preventDefault())),"Enter"!==e.key&&13!==e.keyCode||(F(e),e.preventDefault())}function W(e,t){return H?_(S.identifier,e,t||+new Date):null}function X(e,t=null){if(!H)return null;return _(S.identifier,e)||t}function Y(){if(S.isPreview||!H)return!1;B("impression",3600)||r()({path:"mailster/v1/forms/"+S.id+"/impression",method:"POST",data:S}).catch(e=>{e.message&&console.error(e.message)}).finally(()=>{Z("impression"),W("impression")})}function Z(e,t){const r={type:e,el:o,form:S,data:t},s=new CustomEvent("mailster:"+e,{bubbles:!0,detail:r});return r.event=s,E[S.id]&&E[S.id][e]&&E[S.id][e].apply(r),o.dispatchEvent(s)}if(S.prefill&&A&&Object.entries(A).forEach(([e,t])=>{const r=a(o,'[name="'+e+'"]');if(r)switch(r.type){case"checkbox":r.checked=!!t&&"false"!==t;break;case"radio":const a=s(o,'[name="'+e+'"]');for(let e=0;e<a.length;e++)a[e].checked=a[e].value===decodeURIComponent(t);break;case"date":r.value=t;break;default:r.value=decodeURIComponent(t)}}),S){if(S.triggers)S.triggers.forEach(e=>{J[e]&&J[e].call(this)}),O.classList.add(function(e){const t=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+\.{0,1}\d*))?\)$/);return(299*t[1]+587*t[2]+114*t[3])/1e3>=128?"is-light-bg":"is-dark-bg"}(i.getComputedStyle(O,"").getPropertyValue("background-color")));else{const e=new IntersectionObserver(t=>{t[0].isIntersecting&&(Y(),e.unobserve(t[0].target))},{threshold:1});e.observe(o),Z("load")}H||(o.classList.add("loading","silent"),o.setAttribute("aria-disabled",!0),R=!0,r()({path:"mailster/v1/forms/"+S.id+"/data",method:"GET"}).then(e=>{for(const t in e.data){const r=a(o,'[name="'+t+'"]'),i=e.data[t];if(r&&i)switch(r.type){case"checkbox":r.checked=!!i;break;case"radio":const e=s(o,'[name="'+t+'"]');for(let t=0;t<e.length;t++)e[t].checked=e[t].value===i;break;default:r.value=i}}if(e.lists){const t=s(o,'[name="_lists[]"]');for(let r=0;r<t.length;r++)t[r].checked=e.lists.includes(t[r].value)}}).catch(e=>{console.error(e),o.classList.add("has-errors"),a(I,".mailster-block-form-info-error").innerHTML=e?.message}).finally(()=>{o.classList.remove("loading","silent"),o.removeAttribute("aria-disabled"),I.setAttribute("aria-hidden","false"),R=!1}))}e(o,"submit",F)})})}()})();

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.