Initial AI-generated site

This commit is contained in:
2026-09-02 20:14:57 +00:00
parent 9763430cca
commit 0c65b5e2d1
4 changed files with 2112 additions and 0 deletions
+188
View File
@@ -0,0 +1,188 @@
(function() {
'use strict';
// Mobile Navigation Toggle
const navToggle = document.querySelector('.nav-toggle');
const navLinks = document.querySelector('.nav-links');
if (navToggle && navLinks) {
navToggle.addEventListener('click', function() {
const isExpanded = this.getAttribute('aria-expanded') === 'true';
this.setAttribute('aria-expanded', !isExpanded);
navLinks.classList.toggle('is-open');
});
// Close menu when clicking a link
navLinks.querySelectorAll('a').forEach(function(link) {
link.addEventListener('click', function() {
navToggle.setAttribute('aria-expanded', 'false');
navLinks.classList.remove('is-open');
});
});
// Close menu when clicking outside
document.addEventListener('click', function(e) {
if (!navToggle.contains(e.target) && !navLinks.contains(e.target)) {
navToggle.setAttribute('aria-expanded', 'false');
navLinks.classList.remove('is-open');
}
});
}
// Scroll Reveal Animation
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (!prefersReducedMotion) {
const revealElements = document.querySelectorAll(
'.about-content, .about-visual, .service-card, .advantage-item, ' +
'.testimonial-card, .partner-logo, .section-header, .hero-content, ' +
'.hero-stats, .info-card, .contact-form'
);
revealElements.forEach(function(el) {
el.classList.add('reveal');
});
const observerOptions = {
root: null,
rootMargin: '0px 0px -50px 0px',
threshold: 0.1
};
const revealObserver = new IntersectionObserver(function(entries) {
entries.forEach(function(entry) {
if (entry.isIntersecting) {
entry.target.classList.add('is-visible');
revealObserver.unobserve(entry.target);
}
});
}, observerOptions);
revealElements.forEach(function(el) {
revealObserver.observe(el);
});
}
// Contact Form Handling with Validation
const contactForm = document.getElementById('contactForm');
const formSuccess = document.getElementById('formSuccess');
if (contactForm && formSuccess) {
const validators = {
name: {
validate: function(value) { return value.trim().length >= 2; },
message: 'נא להזין שם מלא'
},
email: {
validate: function(value) { return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value); },
message: 'נא להזין כתובת אימייל תקינה'
},
phone: {
validate: function(value) { return /^[\d\-\+\s]{9,}$/.test(value); },
message: 'נא להזין מספר טלפון תקין'
},
message: {
validate: function(value) { return value.trim().length >= 10; },
message: 'נא להזין הודעה (לפחות 10 תווים)'
}
};
function validateField(field) {
const validator = validators[field.name];
if (!validator) return true;
const errorEl = field.parentElement.querySelector('.form-error');
const isValid = validator.validate(field.value);
if (!isValid) {
field.classList.add('is-invalid');
if (errorEl) errorEl.textContent = validator.message;
} else {
field.classList.remove('is-invalid');
if (errorEl) errorEl.textContent = '';
}
return isValid;
}
// Real-time validation on blur
Object.keys(validators).forEach(function(fieldName) {
const field = contactForm.querySelector('[name="' + fieldName + '"]');
if (field) {
field.addEventListener('blur', function() {
validateField(this);
});
field.addEventListener('input', function() {
if (this.classList.contains('is-invalid')) {
validateField(this);
}
});
}
});
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
let isFormValid = true;
Object.keys(validators).forEach(function(fieldName) {
const field = contactForm.querySelector('[name="' + fieldName + '"]');
if (field && !validateField(field)) {
isFormValid = false;
}
});
if (!isFormValid) {
const firstInvalid = contactForm.querySelector('.is-invalid');
if (firstInvalid) firstInvalid.focus();
return;
}
const submitBtn = contactForm.querySelector('button[type="submit"]');
const originalText = submitBtn.textContent;
submitBtn.textContent = 'שולח...';
submitBtn.disabled = true;
setTimeout(function() {
contactForm.hidden = true;
formSuccess.hidden = false;
}, 1000);
});
}
// Smooth scroll for anchor links with header offset
document.querySelectorAll('a[href^="#"]').forEach(function(anchor) {
anchor.addEventListener('click', function(e) {
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
e.preventDefault();
const headerHeight = document.querySelector('.site-header').offsetHeight;
const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset - headerHeight - 20;
window.scrollTo({
top: targetPosition,
behavior: prefersReducedMotion ? 'auto' : 'smooth'
});
}
});
});
// Header background enhancement on scroll
const header = document.querySelector('.site-header');
if (header) {
window.addEventListener('scroll', function() {
const currentScroll = window.pageYOffset;
if (currentScroll > 100) {
header.style.background = 'rgba(10, 22, 40, 0.98)';
} else {
header.style.background = 'rgba(10, 22, 40, 0.95)';
}
}, { passive: true });
}
})();