const al posto di alcune let

This commit is contained in:
Matteo Manzinello 2019-05-06 14:55:17 +02:00
parent fbd4efeea3
commit 5f42d2c79c

View File

@ -1,8 +1,5 @@
function mailgoInit() { function mailgoInit() {
// ottengo tutti i mailto contenuti nella pagina const styles = `
let mailgos = document.querySelectorAll('a[href^="mailto:"]:not(.no-mailgo)');
let styles = `
.mailgo { .mailgo {
all: initial; all: initial;
* { * {
@ -93,12 +90,15 @@ function mailgoInit() {
font-weight: 500; font-weight: 500;
}`; }`;
let styleSheet = document.createElement("style"); const styleSheet = document.createElement("style");
styleSheet.type = "text/css"; styleSheet.type = "text/css";
styleSheet.innerText = styles; styleSheet.innerText = styles;
document.head.appendChild(styleSheet); document.head.appendChild(styleSheet);
console.log("mailgo is WIP!"); // ottengo tutti i mailto contenuti nella pagina
const mailgos = document.querySelectorAll(
'a[href^="mailto:"]:not(.no-mailgo)'
);
// attivo mailgo su tutti gli elementi // attivo mailgo su tutti gli elementi
mailgos.forEach(function(mailgo, index) { mailgos.forEach(function(mailgo, index) {
@ -288,7 +288,7 @@ function mailgoInit() {
document.addEventListener("DOMContentLoaded", mailgoInit, false); document.addEventListener("DOMContentLoaded", mailgoInit, false);
function validateEmail(email) { 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,}))$/; 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); return re.test(email);
} }