This repository has been archived on 2026-05-22. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blowfish/assets/js/email.js
T
2026-02-26 13:35:29 +08:00

14 lines
442 B
JavaScript

(function () {
const links = document.querySelectorAll(".email-link");
links.forEach((link) => {
let email = atob(link.getAttribute("data-email"));
const subject = link.getAttribute("data-subject");
let mailto = email.startsWith("mailto:") ? email : "mailto:" + email;
if (subject) {
mailto += (mailto.includes("?") ? "&" : "?") + "subject=" + encodeURIComponent(subject);
}
link.href = mailto;
});
})();