works to make the multiple email address compatible
This commit is contained in:
parent
2f0d0aaa4e
commit
08e29707bb
13
dist/mailgo.js
vendored
13
dist/mailgo.js
vendored
@ -186,10 +186,10 @@ var mailgoRender = function mailgoRender(mailgo) {
|
||||
} // validate the email address
|
||||
|
||||
|
||||
if (!validateEmail(mail)) return; // if cc, bcc is not valid cc, bcc = ""
|
||||
if (!validateEmails(mail.split(","))) return; // if cc, bcc is not valid cc, bcc = ""
|
||||
|
||||
if (!validateEmail(cc)) cc = "";
|
||||
if (!validateEmail(bcc)) bcc = ""; // information
|
||||
if (cc && !validateEmails(cc.split(","))) cc = "";
|
||||
if (bcc && !validateEmails(bcc.split(","))) bcc = ""; // information
|
||||
|
||||
var titleEl = getE("mailgo-title");
|
||||
var detailsEl = getE("mailgo-details");
|
||||
@ -347,11 +347,16 @@ var mailgoKeydown = function mailgoKeydown(mail, cc, bcc, subject, bodyMail, enc
|
||||
|
||||
document.addEventListener("DOMContentLoaded", mailgoInit); // event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
|
||||
|
||||
document.addEventListener("click", mailgoCheckRender); // validate the email with regex
|
||||
document.addEventListener("click", mailgoCheckRender); // validate a single email with regex
|
||||
|
||||
var validateEmail = function validateEmail(email) {
|
||||
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
return re.test(email);
|
||||
}; // validate an array of emails
|
||||
|
||||
|
||||
var validateEmails = function validateEmails(arr) {
|
||||
return arr.every(validateEmail);
|
||||
}; // copy of a string
|
||||
|
||||
|
||||
|
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
@ -227,11 +227,11 @@ const mailgoRender = mailgo => {
|
||||
}
|
||||
|
||||
// validate the email address
|
||||
if (!validateEmail(mail)) return;
|
||||
if (!validateEmails(mail.split(","))) return;
|
||||
|
||||
// if cc, bcc is not valid cc, bcc = ""
|
||||
if (!validateEmail(cc)) cc = "";
|
||||
if (!validateEmail(bcc)) bcc = "";
|
||||
if (cc && !validateEmails(cc.split(","))) cc = "";
|
||||
if (bcc && !validateEmails(bcc.split(","))) bcc = "";
|
||||
|
||||
// information
|
||||
let titleEl = getE("mailgo-title");
|
||||
@ -426,12 +426,15 @@ document.addEventListener("DOMContentLoaded", mailgoInit);
|
||||
// event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
|
||||
document.addEventListener("click", mailgoCheckRender);
|
||||
|
||||
// validate the email with regex
|
||||
// validate a single email with regex
|
||||
const validateEmail = email => {
|
||||
let re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
return re.test(email);
|
||||
};
|
||||
|
||||
// validate an array of emails
|
||||
const validateEmails = arr => arr.every(validateEmail);
|
||||
|
||||
// copy of a string
|
||||
const copyToClipboard = str => {
|
||||
let el = document.createElement("textarea");
|
||||
|
Loading…
x
Reference in New Issue
Block a user