[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: script.js
document.addEventListener('DOMContentLoaded', function() { // Preloader const preloader = document.getElementById('preloader'); if (preloader) { // Show preloader preloader.classList.remove('hidden'); // Hide preloader when page is loaded window.addEventListener('load', function() { setTimeout(function() { preloader.classList.add('hidden'); // Enable animations after preloader is hidden initAOS(); }, 500); }); } // Mobile Menu Toggle const menuToggle = document.getElementById('menu-toggle'); const mobileMenu = document.getElementById('mobile-menu'); const navLinks = document.querySelectorAll('.mobile-nav-link'); if (menuToggle && mobileMenu) { menuToggle.addEventListener('click', function() { menuToggle.classList.toggle('active'); mobileMenu.classList.toggle('active'); document.body.classList.toggle('menu-open'); }); // Close mobile menu when a nav link is clicked navLinks.forEach(function(link) { link.addEventListener('click', function() { menuToggle.classList.remove('active'); mobileMenu.classList.remove('active'); document.body.classList.remove('menu-open'); }); }); } // Sticky Header const header = document.getElementById('header'); if (header) { window.addEventListener('scroll', function() { if (window.scrollY > 50) { header.classList.add('scrolled'); } else { header.classList.remove('scrolled'); } }); } // Portfolio Filtering const filterButtons = document.querySelectorAll('.filter-btn'); const portfolioItems = document.querySelectorAll('.portfolio-item'); if (filterButtons.length > 0 && portfolioItems.length > 0) { filterButtons.forEach(function(button) { button.addEventListener('click', function() { // Remove active class from all buttons filterButtons.forEach(function(btn) { btn.classList.remove('active'); }); // Add active class to clicked button this.classList.add('active'); const filterValue = this.getAttribute('data-filter'); // Filter portfolio items portfolioItems.forEach(function(item) { const itemCategory = item.getAttribute('data-category'); if (filterValue === 'all' || filterValue === itemCategory) { item.style.display = 'block'; setTimeout(function() { item.style.opacity = '1'; item.style.transform = 'scale(1)'; }, 50); } else { item.style.opacity = '0'; item.style.transform = 'scale(0.8)'; setTimeout(function() { item.style.display = 'none'; }, 300); } }); }); }); } // Testimonials Slider const testimonialSlider = document.getElementById('testimonials-slider'); const testimonialDots = document.getElementById('testimonials-dots'); const testimonialCards = document.querySelectorAll('.testimonial-card'); if (testimonialSlider && testimonialDots && testimonialCards.length > 0) { // Create dots based on number of testimonials testimonialCards.forEach(function(_, index) { const dot = document.createElement('span'); dot.classList.add('testimonials-dot'); if (index === 0) dot.classList.add('active'); dot.setAttribute('data-index', index); testimonialDots.appendChild(dot); dot.addEventListener('click', function() { const dotIndex = this.getAttribute('data-index'); scrollToTestimonial(dotIndex); // Update active dot document.querySelectorAll('.testimonials-dot').forEach(function(d) { d.classList.remove('active'); }); this.classList.add('active'); }); }); // Scroll to testimonial function function scrollToTestimonial(index) { const testimonialWidth = testimonialCards[0].offsetWidth; const gap = parseInt(window.getComputedStyle(testimonialSlider).columnGap || 16); const scrollPosition = index * (testimonialWidth + gap); testimonialSlider.scrollTo({ left: scrollPosition, behavior: 'smooth' }); } // Update dots on scroll testimonialSlider.addEventListener('scroll', function() { const scrollPosition = testimonialSlider.scrollLeft; const testimonialWidth = testimonialCards[0].offsetWidth; const gap = parseInt(window.getComputedStyle(testimonialSlider).columnGap || 16); const currentIndex = Math.round(scrollPosition / (testimonialWidth + gap)); document.querySelectorAll('.testimonials-dot').forEach(function(dot, index) { if (index === currentIndex) { dot.classList.add('active'); } else { dot.classList.remove('active'); } }); }); } // Smooth Scrolling for Anchor Links const anchorLinks = document.querySelectorAll('a[href^="#"]:not([href="#"])'); anchorLinks.forEach(function(link) { link.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('href'); const targetElement = document.querySelector(targetId); if (targetElement) { const headerHeight = document.querySelector('.header').offsetHeight; const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset - headerHeight; window.scrollTo({ top: targetPosition, behavior: 'smooth' }); } }); }); // Active Navigation Link on Scroll const sections = document.querySelectorAll('section[id]'); const navItems = document.querySelectorAll('.nav-link'); function setActiveNavLink() { const scrollPosition = window.scrollY; sections.forEach(function(section) { const sectionTop = section.offsetTop - 100; const sectionHeight = section.offsetHeight; const sectionId = section.getAttribute('id'); if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight) { navItems.forEach(function(item) { item.classList.remove('active'); if (item.getAttribute('href') === '#' + sectionId) { item.classList.add('active'); } }); } }); } window.addEventListener('scroll', throttle(setActiveNavLink, 100)); // Contact Form Submission const contactForm = document.getElementById('contact-form'); const formMessage = document.getElementById('form-message'); if (contactForm) { contactForm.addEventListener('submit', function(e) { e.preventDefault(); const submitBtn = contactForm.querySelector('button[type="submit"]'); const formData = new FormData(contactForm); // Disable submit button and show loading state submitBtn.disabled = true; submitBtn.innerHTML = 'Sending...'; fetch('process_contact.php', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { formMessage.innerHTML = '<div class="success-message">Your message has been sent successfully!</div>'; contactForm.reset(); } else { formMessage.innerHTML = '<div class="error-message">Failed to send message. Please try again.</div>'; } }) .catch(error => { formMessage.innerHTML = '<div class="error-message">An error occurred. Please try again later.</div>'; console.error('Error:', error); }) .finally(() => { // Re-enable submit button submitBtn.disabled = false; submitBtn.innerHTML = 'Send Message'; // Clear message after 5 seconds setTimeout(() => { formMessage.innerHTML = ''; }, 5000); }); }); } // Newsletter Form Submission const newsletterForm = document.getElementById('newsletter-form'); if (newsletterForm) { newsletterForm.addEventListener('submit', function(e) { e.preventDefault(); const emailInput = newsletterForm.querySelector('input[type="email"]'); const email = emailInput.value.trim(); if (email) { // Here you would typically send the email to your server // For now, just show a success message alert('Thank you for subscribing to our newsletter!'); newsletterForm.reset(); } }); } // Animation on Scroll function initAOS() { const animatedElements = document.querySelectorAll('[data-aos]'); const observerOptions = { root: null, rootMargin: '0px', threshold: 0.1 }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('aos-animate'); observer.unobserve(entry.target); // Stop observing once animated } }); }, observerOptions); animatedElements.forEach(element => { observer.observe(element); }); } // Touch Interactions const touchElements = document.querySelectorAll('.btn, .nav-link, .filter-btn, .portfolio-item, .service-card'); touchElements.forEach(function(element) { element.addEventListener('touchstart', function() { this.classList.add('touch-active'); }, { passive: true }); element.addEventListener('touchend', function() { this.classList.remove('touch-active'); }, { passive: true }); }); // Utility Functions function throttle(func, delay) { let lastCall = 0; return function(...args) { const now = new Date().getTime(); if (now - lastCall < delay) { return; } lastCall = now; return func(...args); }; } });
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.69 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002