Added the hacker space section

This commit is contained in:
Plexi09 2026-02-23 22:30:01 +01:00
parent 876cc5b5cd
commit 9681466082
Signed by: Plexi09
GPG key ID: 20D439A69163544A
5 changed files with 248 additions and 0 deletions

View file

@ -331,4 +331,56 @@ document.addEventListener('DOMContentLoaded', () => {
);
}
// ── 18. HACKER SPACE COPY FUNCTIONALITY ────────────────────────────
const copyBtns = document.querySelectorAll('.copy-btn');
copyBtns.forEach(btn => {
btn.addEventListener('click', () => {
// Find the pre or code element within the same card
const card = btn.closest('.space-card');
const codeElement = card.querySelector('pre, code');
if (codeElement) {
const textToCopy = codeElement.innerText;
navigator.clipboard.writeText(textToCopy).then(() => {
const originalIcon = btn.innerHTML;
// Show success feedback
btn.innerHTML = '<i class="fas fa-check"></i>';
btn.classList.add('text-green-400');
setTimeout(() => {
btn.innerHTML = originalIcon;
btn.classList.remove('text-green-400');
}, 2000);
}).catch(err => {
console.error('Failed to copy: ', err);
});
}
});
});
// ── 19. HACKER SPACE EXPAND FUNCTIONALITY ──────────────────────────
const toggleBtns = document.querySelectorAll('.toggle-btn');
toggleBtns.forEach(btn => {
btn.addEventListener('click', () => {
const card = btn.closest('.space-card');
const wrapper = card.querySelector('.key-wrapper');
const icon = btn.querySelector('i');
const textSpan = btn.querySelector('span');
wrapper.classList.toggle('expanded');
btn.classList.toggle('active');
if (wrapper.classList.contains('expanded')) {
textSpan.textContent = 'Show Less';
} else {
textSpan.textContent = 'Show More';
}
});
});
});