File size: 1,331 Bytes
677409b 1c64423 677409b d4cd5fa 1c64423 677409b 1c64423 d4cd5fa 677409b d4cd5fa 677409b d4cd5fa 677409b d4cd5fa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
// Copy Code
function copyCode(button) {
const code = button.previousElementSibling.querySelector('code').textContent;
navigator.clipboard.writeText(code).then(() => {
button.textContent = 'Copied!';
setTimeout(() => button.textContent = 'Copy', 2000);
});
}
// Redirect to /gradio with loading animation
document.getElementById('chatbot-link')?.addEventListener('click', (e) => {
e.preventDefault();
const btn = e.target;
btn.querySelector('.loading').classList.remove('hidden');
btn.disabled = true;
setTimeout(() => {
window.location.href = '/gradio';
}, 1000); // تأخير بسيط عشان الـ animation
});
// Card animations
document.querySelectorAll('.feature-card, .footer-card, .news-card').forEach(card => {
card.addEventListener('mouseenter', () => {
card.style.transform = 'scale(1.05) rotate(1deg)';
});
card.addEventListener('mouseleave', () => {
card.style.transform = 'scale(1) rotate(0deg)';
});
});
// Sidebar toggle for mobile
document.addEventListener('DOMContentLoaded', () => {
const sidebar = document.querySelector('.sidebar');
const toggleBtn = document.querySelector('.sidebar-toggle');
toggleBtn.addEventListener('click', () => {
sidebar.classList.toggle('active');
});
});
|