Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions src/_includes/bio.njk
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,41 @@ layout: layouts/base.njk

<script>
function copyToClipboard(text, el) {
navigator.clipboard.writeText(text);
const span = el.querySelector('span:last-child');
span.innerText = 'Copied!';
setTimeout(() => span.innerText = 'Copy', 2000);
const showSuccess = () => {
if (span) {
span.innerText = 'Copied!';
clearTimeout(el.copyTimeout);
el.copyTimeout = setTimeout(() => { span.innerText = 'Copy'; }, 2000);
}
};

if (!navigator.clipboard) {
const ta = document.createElement('textarea');
ta.value = text;
ta.style.position = 'fixed';
ta.style.opacity = '0';
document.body.appendChild(ta);
ta.select();
try {
document.execCommand('copy');
showSuccess();
} catch (err) {
console.error('Fallback copy failed:', err);
}
document.body.removeChild(ta);
return;
}

navigator.clipboard.writeText(text)
.then(showSuccess)
.catch(err => console.error('Failed to copy:', err));
}
Comment thread
BaseMax marked this conversation as resolved.

document.querySelector('.copy-email-btn')?.addEventListener('click', function() {
copyToClipboard(this.getAttribute('data-email'), this);
});

// Pass profile data to game modules
const profileData = document.getElementById('profile-data');
window.PROFILE_NAME = profileData ? profileData.dataset.name : "";
window.PROFILE_SKILLS = profileData && profileData.dataset.skills ? profileData.dataset.skills.trim().split(/\s+/).filter(Boolean) : [];
Expand Down
Loading