|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
simulateTelegramBot(); |
|
|
|
|
|
document.querySelectorAll('a[href^="#"]').forEach(anchor => { |
|
|
anchor.addEventListener('click', function(e) { |
|
|
e.preventDefault(); |
|
|
document.querySelector(this.getAttribute('href')).scrollIntoView({ |
|
|
behavior: 'smooth' |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const animateOnScroll = function() { |
|
|
const elements = document.querySelectorAll('.feature-card, .testimonial-card, .pricing-card'); |
|
|
|
|
|
elements.forEach(element => { |
|
|
const elementPosition = element.getBoundingClientRect().top; |
|
|
const screenPosition = window.innerHeight / 1.3; |
|
|
|
|
|
if (elementPosition < screenPosition) { |
|
|
element.classList.add('animate-fade-in'); |
|
|
} |
|
|
}); |
|
|
}; |
|
|
|
|
|
window.addEventListener('scroll', animateOnScroll); |
|
|
animateOnScroll(); |
|
|
|
|
|
|
|
|
const videoModal = document.getElementById('video-modal'); |
|
|
const videoThumbnail = document.querySelector('.video-thumbnail'); |
|
|
const closeModal = document.querySelector('.close-modal'); |
|
|
|
|
|
if (videoThumbnail) { |
|
|
videoThumbnail.addEventListener('click', function() { |
|
|
videoModal.classList.remove('hidden'); |
|
|
document.body.style.overflow = 'hidden'; |
|
|
}); |
|
|
} |
|
|
|
|
|
if (closeModal) { |
|
|
closeModal.addEventListener('click', function() { |
|
|
videoModal.classList.add('hidden'); |
|
|
document.body.style.overflow = 'auto'; |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
window.addEventListener('click', function(e) { |
|
|
if (e.target === videoModal) { |
|
|
videoModal.classList.add('hidden'); |
|
|
document.body.style.overflow = 'auto'; |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
function simulateTelegramBot() { |
|
|
const telegramBtn = document.createElement('div'); |
|
|
telegramBtn.innerHTML = ` |
|
|
<a href="https://telegram.org" target="_blank" class="fixed bottom-6 right-6 bg-blue-500 text-white p-4 rounded-full shadow-lg hover:bg-blue-600 transition duration-300 z-50"> |
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> |
|
|
<path d="M21 5L2 12.5L9 13.5M21 5L18.5 20L9 13.5M21 5L9 13.5M9 13.5V19L12.5 15.5"/> |
|
|
</svg> |
|
|
</a> |
|
|
`; |
|
|
document.body.appendChild(telegramBtn); |
|
|
} |
|
|
|
|
|
|
|
|
function validateNewsletterForm() { |
|
|
const emailInput = document.getElementById('newsletter-email'); |
|
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; |
|
|
|
|
|
if (!emailRegex.test(emailInput.value)) { |
|
|
alert('Please enter a valid email address'); |