Spaces:
Running
Running
Upload script.js with huggingface_hub
Browse files
script.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Handle input interactions
|
| 2 |
+
const mainInput = document.querySelector('.main-input');
|
| 3 |
+
const addBtn = document.querySelector('.add-btn');
|
| 4 |
+
const uploadBtn = document.querySelector('.upload-btn');
|
| 5 |
+
|
| 6 |
+
// Focus input when clicking add button
|
| 7 |
+
if (addBtn) {
|
| 8 |
+
addBtn.addEventListener('click', () => {
|
| 9 |
+
mainInput.focus();
|
| 10 |
+
});
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
// Handle upload button click
|
| 14 |
+
if (uploadBtn) {
|
| 15 |
+
uploadBtn.addEventListener('click', () => {
|
| 16 |
+
// Create hidden file input
|
| 17 |
+
const fileInput = document.createElement('input');
|
| 18 |
+
fileInput.type = 'file';
|
| 19 |
+
fileInput.accept = 'image/*,.pdf';
|
| 20 |
+
fileInput.style.display = 'none';
|
| 21 |
+
|
| 22 |
+
fileInput.addEventListener('change', (e) => {
|
| 23 |
+
if (e.target.files && e.target.files[0]) {
|
| 24 |
+
console.log('File selected:', e.target.files[0].name);
|
| 25 |
+
// Handle file upload logic here
|
| 26 |
+
}
|
| 27 |
+
});
|
| 28 |
+
|
| 29 |
+
document.body.appendChild(fileInput);
|
| 30 |
+
fileInput.click();
|
| 31 |
+
document.body.removeChild(fileInput);
|
| 32 |
+
});
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
// Handle Enter key in input
|
| 36 |
+
if (mainInput) {
|
| 37 |
+
mainInput.addEventListener('keypress', (e) => {
|
| 38 |
+
if (e.key === 'Enter' && mainInput.value.trim()) {
|
| 39 |
+
console.log('Generating:', mainInput.value);
|
| 40 |
+
// Handle generation logic here
|
| 41 |
+
}
|
| 42 |
+
});
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
// Handle template card clicks
|
| 46 |
+
const templateCards = document.querySelectorAll('.template-card');
|
| 47 |
+
templateCards.forEach(card => {
|
| 48 |
+
card.addEventListener('click', () => {
|
| 49 |
+
const templateName = card.querySelector('.template-name').textContent;
|
| 50 |
+
console.log('Template clicked:', templateName);
|
| 51 |
+
// Handle template navigation here
|
| 52 |
+
});
|
| 53 |
+
});
|
| 54 |
+
|
| 55 |
+
// Handle navigation dropdowns
|
| 56 |
+
const dropdowns = document.querySelectorAll('.nav-link.dropdown');
|
| 57 |
+
dropdowns.forEach(dropdown => {
|
| 58 |
+
dropdown.addEventListener('click', (e) => {
|
| 59 |
+
e.preventDefault();
|
| 60 |
+
console.log('Dropdown clicked:', dropdown.textContent.trim());
|
| 61 |
+
// Handle dropdown menu display here
|
| 62 |
+
});
|
| 63 |
+
});
|
| 64 |
+
|
| 65 |
+
// Add smooth scroll behavior
|
| 66 |
+
document.documentElement.style.scrollBehavior = 'smooth';
|
| 67 |
+
|
| 68 |
+
// Add smooth animations on page load
|
| 69 |
+
window.addEventListener('load', () => {
|
| 70 |
+
const hero = document.querySelector('.hero');
|
| 71 |
+
if (hero) {
|
| 72 |
+
hero.style.opacity = '0';
|
| 73 |
+
hero.style.transform = 'translateY(10px)';
|
| 74 |
+
|
| 75 |
+
setTimeout(() => {
|
| 76 |
+
hero.style.transition = 'all 0.5s ease';
|
| 77 |
+
hero.style.opacity = '1';
|
| 78 |
+
hero.style.transform = 'translateY(0)';
|
| 79 |
+
}, 100);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
// Animate template cards
|
| 83 |
+
const cards = document.querySelectorAll('.template-card');
|
| 84 |
+
cards.forEach((card, index) => {
|
| 85 |
+
card.style.opacity = '0';
|
| 86 |
+
card.style.transform = 'translateY(20px)';
|
| 87 |
+
|
| 88 |
+
setTimeout(() => {
|
| 89 |
+
card.style.transition = 'all 0.4s ease';
|
| 90 |
+
card.style.opacity = '1';
|
| 91 |
+
card.style.transform = 'translateY(0)';
|
| 92 |
+
}, 200 + (index * 50));
|
| 93 |
+
});
|
| 94 |
+
});
|