首次提交:初始化项目代码
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
function revealEmail(element) {
|
||||
const maskedEmail = element.getAttribute('data-email');
|
||||
if (!maskedEmail) return;
|
||||
|
||||
if (element.classList.contains('revealed')) {
|
||||
window.location.href = 'mailto:' + maskedEmail;
|
||||
return;
|
||||
}
|
||||
|
||||
element.classList.add('revealed');
|
||||
|
||||
const emailParts = maskedEmail.split('@');
|
||||
if (emailParts.length === 2) {
|
||||
element.innerHTML = '<i class="fas fa-envelope"></i> <a href="mailto:' + maskedEmail + '" style="color: inherit; text-decoration: none;">' + maskedEmail + '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const emailElements = document.querySelectorAll('.email-protected');
|
||||
emailElements.forEach(function(el) {
|
||||
el.style.cursor = 'pointer';
|
||||
el.title = '点击查看完整邮箱';
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user