document.addEventListener('DOMContentLoaded', () => { // Schema.org микроразметка const schemaOrg = { "@context": "https://schema.org", "@type": "WebApplication", "name": "Secret Gift - цифровые подарки", "description": "Создавайте персонализированные цифровые подарки с фото и текстом", "applicationCategory": "LifestyleApplication", "offers": { "@type": "Offer", "price": "0", "priceCurrency": "RUB" } }; const script = document.createElement('script'); script.type = 'application/ld+json'; script.text = JSON.stringify(schemaOrg); document.head.appendChild(script); // Example of a simple greeting based on time of day const updateGreeting = () => { const hour = new Date().getHours(); let greeting; if (hour < 12) greeting = 'Good morning'; else if (hour < 18) greeting = 'Good afternoon'; else greeting = 'Good evening'; const greetingElement = document.getElementById('greeting'); if (greetingElement) { greetingElement.textContent = greeting; } }; updateGreeting(); // Initialize tooltips for Feather icons document.querySelectorAll('[data-feather]').forEach(icon => { const title = icon.getAttribute('title'); if (title) { icon.setAttribute('data-tooltip', title); icon.removeAttribute('title'); } }); }); // Function to handle form submissions async function handleCreateFormSubmit(event) { event.preventDefault(); // In a real app, this would send data to your backend const formData = new FormData(event.target); const formValues = Object.fromEntries(formData.entries()); console.log('Form submitted with values:', formValues); // Show success message alert('Your gift website has been created! You will be redirected to view it.'); window.location.href = '/preview.html'; } // Template selection functionality function setupTemplateSelection() { const templates = document.querySelectorAll('.template-card'); if (!templates) return; templates.forEach(template => { template.addEventListener('click', function() { templates.forEach(t => t.classList.remove('ring-2', 'ring-primary-500')); this.classList.add('ring-2', 'ring-primary-500'); }); }); } // Initialize animations function initAnimations() { const animatedElements = document.querySelectorAll('.fade-in'); animatedElements.forEach((el, index) => { el.style.opacity = '0'; el.classList.add(`delay-${(index % 3 + 1) * 100}`); }); } document.addEventListener('DOMContentLoaded', () => { // Existing code... setupTemplateSelection(); initAnimations(); }); // Export functions if needed export { handleCreateFormSubmit, setupTemplateSelection };