(function(){var f=document.getElementById('cr-form');if(!f)return;var m=document.getElementById('cr-msg'); f.addEventListener('submit',function(e){e.preventDefault(); var E=f.elements,n=(E['name'].value||'').trim(),em=(E['email'].value||'').trim(),t=E['request'].value.trim(); if(!n){m.textContent='Please add your name.';return;} if(!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(em)){m.textContent='Please add a valid email.';return;} if(!t){m.textContent='Please write a short message.';return;} var b=f.querySelector('button');b.disabled=true;m.textContent='Sending…'; fetch('/api/request',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({request:'Name: '+n+'\nEmail: '+em+'\n\n'+t,name:n,email:em,message:t,site:location.hostname,website:E['website'].value})}) .then(function(r){if(!r.ok)throw 0;f.reset();m.textContent='Thanks. We got your note and will be in touch about joining our team.';}) .catch(function(){m.textContent='That didn’t go through. Please try again in a minute.';}) .then(function(){b.disabled=false;});});})();