File size: 3,536 Bytes
162159b af8e0d2 fcbe0a7 eab8c12 4170a1a c105cd4 4170a1a c105cd4 762f0e1 c105cd4 762f0e1 c105cd4 5d4437b eab8c12 581b5d8 c105cd4 af8e0d2 bcfe4b6 | 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
// Shared JavaScript across all pages
document.addEventListener('DOMContentLoaded', () => {
// Handle support form submission
const supportForm = document.getElementById('supportForm');
if (supportForm) {
supportForm.addEventListener('submit', function(e) {
e.preventDefault();
const formData = {
name: document.getElementById('name').value,
email: document.getElementById('email').value,
phone: document.getElementById('phone').value,
message: document.getElementById('message').value,
urgent: document.getElementById('urgent').checked
};
// In a real implementation, you would send formData to your backend
console.log('Support request submitted:', formData);
// Show success message
const successMsg = document.getElementById('formSuccess');
if (successMsg) {
successMsg.classList.remove('hidden');
supportForm.reset();
successMsg.scrollIntoView({ behavior: 'smooth' });
// Hide after 5 seconds
setTimeout(() => {
successMsg.classList.add('hidden');
}, 5000);
}
});
}
// Load Google Translate iframe styles
const loadTranslateStyles = () => {
const iframe = document.querySelector('.goog-te-menu-frame');
if (!iframe) return;
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const style = iframeDoc.createElement('style');
style.textContent = `
.goog-te-menu2 {
font-family: 'Montserrat', sans-serif !important;
background-color: #111827 !important;
border: 1px solid #e3b341 !important;
}
.goog-te-menu2-item div, .goog-te-menu2-item-selected div {
color: white !important;
padding: 8px 16px !important;
}
.goog-te-menu2-item-selected {
background-color: rgba(227, 179, 65, 0.2) !important;
}
.goog-te-menu2-item:hover {
background-color: rgba(227, 179, 65, 0.1) !important;
}
`;
iframeDoc.head.appendChild(style);
};
// Check for Google Translate iframe periodically
const translateInterval = setInterval(() => {
if (document.querySelector('.goog-te-menu-frame')) {
loadTranslateStyles();
clearInterval(translateInterval);
}
}, 100);
// Create twinkling stars
const starsCount = 200;
for (let i = 0; i < starsCount; i++) {
const star = document.createElement('div');
star.className = 'star';
star.style.width = `${Math.random() * 3 + 1}px`;
star.style.height = star.style.width;
star.style.left = `${Math.random() * 100}%`;
star.style.top = `${Math.random() * 100}%`;
star.style.animationDelay = `${Math.random() * 3}s`;
document.body.appendChild(star);
}
// 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'
});
});
});
}); |