update: refine landing page with a more premium visual style
هذا الالتزام موجود في:
70
script.js
70
script.js
@@ -1,9 +1,65 @@
|
||||
(function () {
|
||||
(function () {
|
||||
const reveals = document.querySelectorAll('.reveal');
|
||||
const menuToggle = document.querySelector('.menu-toggle');
|
||||
const navMenu = document.querySelector('.nav');
|
||||
|
||||
if (menuToggle && navMenu) {
|
||||
menuToggle.addEventListener('click', function () {
|
||||
const isOpen = navMenu.classList.toggle('is-open');
|
||||
menuToggle.classList.toggle('is-open', isOpen);
|
||||
menuToggle.setAttribute('aria-expanded', String(isOpen));
|
||||
});
|
||||
|
||||
navMenu.querySelectorAll('a').forEach((link) => {
|
||||
link.addEventListener('click', function () {
|
||||
navMenu.classList.remove('is-open');
|
||||
menuToggle.classList.remove('is-open');
|
||||
menuToggle.setAttribute('aria-expanded', 'false');
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
if (!navMenu.classList.contains('is-open')) return;
|
||||
if (navMenu.contains(event.target) || menuToggle.contains(event.target)) return;
|
||||
|
||||
navMenu.classList.remove('is-open');
|
||||
menuToggle.classList.remove('is-open');
|
||||
menuToggle.setAttribute('aria-expanded', 'false');
|
||||
});
|
||||
}
|
||||
|
||||
if ('IntersectionObserver' in window) {
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.add('is-visible');
|
||||
observer.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
}, { threshold: 0.16 });
|
||||
|
||||
reveals.forEach((item) => observer.observe(item));
|
||||
} else {
|
||||
reveals.forEach((item) => item.classList.add('is-visible'));
|
||||
}
|
||||
|
||||
const faqItems = document.querySelectorAll('.faq-item');
|
||||
faqItems.forEach((item) => {
|
||||
item.addEventListener('toggle', function () {
|
||||
if (!item.open) return;
|
||||
faqItems.forEach((other) => {
|
||||
if (other !== item) {
|
||||
other.open = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const form = document.getElementById('contactForm');
|
||||
if (!form) return;
|
||||
|
||||
const submitButton = form.querySelector('button[type="submit"]');
|
||||
const defaultSubmitLabel = submitButton ? submitButton.textContent : 'Send';
|
||||
const defaultSubmitLabel = submitButton ? submitButton.textContent : 'إرسال الرسالة';
|
||||
const fallbackApi = 'https://app.tabeley.com/api';
|
||||
const configuredBase = window.TABELEY_API_BASE_URL;
|
||||
const originBase = `${window.location.origin}/api`;
|
||||
@@ -37,13 +93,13 @@
|
||||
const message = getFieldValue('textarea');
|
||||
|
||||
if (message.length < 5) {
|
||||
alert('Please enter at least 5 characters.');
|
||||
alert('يرجى كتابة رسالة أوضح قبل الإرسال.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (submitButton) {
|
||||
submitButton.disabled = true;
|
||||
submitButton.textContent = 'Sending...';
|
||||
submitButton.textContent = 'جارٍ الإرسال...';
|
||||
}
|
||||
|
||||
const payload = { message, name, email };
|
||||
@@ -72,11 +128,11 @@
|
||||
|
||||
if (sent) {
|
||||
form.reset();
|
||||
alert('Feedback sent successfully.');
|
||||
alert('تم إرسال رسالتك بنجاح.');
|
||||
return;
|
||||
}
|
||||
|
||||
console.error('Feedback send failed:', lastError);
|
||||
alert('Unable to send feedback now. Please try again later.');
|
||||
alert('تعذر إرسال الرسالة حالياً. حاول مرة أخرى لاحقاً.');
|
||||
});
|
||||
})();
|
||||
})();
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم