Spaces:
Running
Running
File size: 2,005 Bytes
fefe669 |
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 |
// Invite code validation
function validateInviteCode(code) {
// This is a placeholder - in a real app, you'd validate against a database
return code.length === 6 && /^[A-Z0-9]+$/.test(code);
}
// Phone number validation for Saudi numbers
function validateSaudiPhoneNumber(phone) {
return /^05\d{8}$/.test(phone);
}
// Password strength validation
function validatePasswordStrength(password) {
return password.length >= 8 && /[A-Z]/.test(password) && /[0-9]/.test(password);
}
// 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'
});
});
});
// Generate random username
function generateUsername() {
const adjectives = ['شبح', 'سري', 'مجهول', 'خفيف', 'ظل', 'ليل', 'غامض'];
const nouns = ['محارب', 'قناص', 'شخص', 'زائر', 'مستكشف', 'راوي'];
return `${adjectives[Math.floor(Math.random() * adjectives.length)]}-${nouns[Math.floor(Math.random() * nouns.length)]}`;
}
// Animation on scroll
const animateOnScroll = () => {
const elements = document.querySelectorAll('.feature-card, .testimonial');
elements.forEach(element => {
const elementPosition = element.getBoundingClientRect().top;
const screenPosition = window.innerHeight / 1.3;
if (elementPosition < screenPosition) {
element.style.opacity = '1';
element.style.transform = 'translateY(0)';
}
});
};
// Set initial state for animation
document.querySelectorAll('.feature-card, .testimonial').forEach(element => {
element.style.opacity = '0';
element.style.transform = 'translateY(20px)';
element.style.transition = 'all 0.5s ease';
});
window.addEventListener('scroll', animateOnScroll);
window.addEventListener('load', animateOnScroll); |