anna.lgbt/js/index.js

54 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-08-29 09:46:23 +00:00
(function() {
function y(s) {
return s.replace(/[a-zA-Z]/g,(c)=>String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26));
}
2023-05-29 01:46:38 +00:00
const reveal = document.getElementById('email');
const dialog = document.querySelector('dialog');
2022-08-29 10:08:43 +00:00
reveal.addEventListener('click', () => {
2023-05-29 01:46:38 +00:00
dialog.setAttribute('open', 'open');
});
function revealEmail() {
2023-08-24 07:12:13 +00:00
const email = 'si' + atob('dGVAYW4=') + 'na.' + atob(y('oTqv')) + 't';
2022-08-29 10:08:43 +00:00
2023-05-29 01:46:38 +00:00
const emailLink = document.createElement('a');
2022-08-29 09:46:23 +00:00
emailLink.setAttribute('href', `mailto:${email}`);
emailLink.innerText = email;
2022-08-29 10:08:43 +00:00
reveal.replaceWith(emailLink);
2023-05-29 01:46:38 +00:00
}
function notInterested() {
const notInterested = document.createElement('span');
notInterested.innerText = 'I am not interested in your email.';
reveal.replaceWith(notInterested);
}
const yesButton = dialog.querySelector('#yes-button');
const noButton = dialog.querySelector('#no-button');
yesButton.addEventListener('click', () => {
dialog.removeAttribute('open');
localStorage.canSeeEmail = false;
notInterested();
});
noButton.addEventListener('click', () => {
dialog.removeAttribute('open');
localStorage.canSeeEmail = true;
revealEmail();
2022-08-29 09:46:23 +00:00
});
2023-05-29 01:46:38 +00:00
if (localStorage.canSeeEmail === 'true') {
revealEmail();
} else if (localStorage.canSeeEmail === 'false') {
notInterested();
}
2022-08-29 09:46:23 +00:00
})();