Free javascript Hosting


script-button-min.js

Uploaded on May 22 2022 21:50 by fabien.inan

let initialBorderColor,initialButtonColor=[];const focusOutHandler=function(e){if("email"===e.target.type||"email"===e.target.name){const t=e.target.value;fetch(`https://mail-checker-api.herokuapp.com/email/${t}`).then((function(e){return e.json()})).then((function(e){if(console.log(e),e.disposable){document.querySelectorAll("[type=submit]").forEach((function(e,t){initialButtonColor[t]=e.style.backgroundColor,e.disabled=!0,e.style.backgroundColor="gray"}));const e=document.querySelectorAll("input[type=email]")||document.querySelectorAll("input[name=email]");if(initialBorderColor=e[0].style.borderColor,e[0].style.borderColor="red",!document.getElementById("disposableWarningMessage")){const t=document.createElement("div");t.setAttribute("id","disposableWarningMessage"),t.innerHTML="fr"===document.documentElement.lang||"fr-FR"===document.documentElement.lang?"Les adresses emails temporaires ne sont pas acceptés":"Disposable e-mail address are not accepted",t.style.color="red",t.style.display="block",t.style.marginBottom="8px",e[0].parentNode.insertBefore(t,e?.nextSibling)}}else if("The email address is invalid."===e.error){document.querySelectorAll("[type=submit]").forEach((function(e,t){initialButtonColor[t]=e.style.backgroundColor,e.disabled=!0,e.style.backgroundColor="gray"}));const e=document.querySelectorAll("input[type=email]")||document.querySelectorAll("input[name=email]");initialBorderColor=e[0].style.borderColor,e[0].style.borderColor="red";const t=document.createElement("div");t.setAttribute("id","disposableWarningMessage"),t.innerHTML="fr"===document.documentElement.lang||"fr-FR"===document.documentElement.lang?"Le format de l'adresse email est invalide":"This is not a valid email address",t.style.color="red",t.style.display="block",t.style.marginBottom="8px",e[0].parentNode.insertBefore(t,e?.nextSibling)}else{document.querySelectorAll("[type=submit]").forEach((function(e,t){e.disabled=!1,e.style.backgroundColor=initialButtonColor[t]}));(document.querySelectorAll("input[type=email]")||document.querySelectorAll("input[name=email]"))[0].style.borderColor=initialBorderColor,document.getElementById("disposableWarningMessage")?.remove()}}))}};window.addEventListener("blur",focusOutHandler,!0);

Back to list