// Main application script document.addEventListener('DOMContentLoaded', function() { // Initialize clipboard functionality const copyButtons = document.querySelectorAll('.copy-button'); copyButtons.forEach(button => { button.addEventListener('click', async () => { const codeBlock = button.parentElement.nextElementSibling.querySelector('code'); try { await navigator.clipboard.writeText(codeBlock.textContent); button.innerHTML = ' Copied!'; feather.replace(); setTimeout(() => { button.innerHTML = ' Copy'; feather.replace(); }, 2000); } catch (err) { console.error('Failed to copy text: ', err); } }); }); // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); });