diff --git a/_layouts/index.liquid b/_layouts/index.liquid index 0b1d7d7..4cec98c 100644 --- a/_layouts/index.liquid +++ b/_layouts/index.liquid @@ -18,6 +18,17 @@ X + +
{{ page.content }}
{{ site.data[site.data.lang].globals.go-down }} @@ -60,24 +71,10 @@ const mailButton = document.getElementById('mail-button'); const closeButton = document.querySelector('.close-button'); const modalMessage = document.getElementById('modal-message'); -const userLang = navigator.language; -const isSpanish = userLang.startsWith('es'); - -const messages = { - success: { - en: `success

Thank you!

Your email has been successfully registered!

`, - es: `success

¡Gracias!

¡Tu correo ha sido registrado exitosamente!

` - }, - error: { - en: `error

Oops!

We encountered an error registering your email.

Please try again.

`, - es: `error

¡Ups!

Presentamos un error al registrar tu correo.

Inténtalo nuevamente, por favor.

` - } -}; - function openModal(type) { - const message = isSpanish ? messages[type].es : messages[type].en; - modalMessage.innerHTML = message; - modal.showModal(); + const message = modal.querySelector(`[data-msg=${type}]`); + modalMessage.replaceChildren(message.content.cloneNode(true)); + modal.showModal(); } closeButton.addEventListener('click', () => {