Spaces:
Running
Running
Download script.js from NIROOXX/pixelpulse-ui-designer: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/spaces/NIROOXX/pixelpulse-ui-designer/resolve/main/script.js
- Command line
-
hf download hf://spaces/NIROOXX/pixelpulse-ui-designer/script.js
-
curl -L -o script.js https://huggingface.co/spaces/NIROOXX/pixelpulse-ui-designer/resolve/main/script.js
2.57 kB
| // Theme management | |
| document.addEventListener('DOMContentLoaded', () => { | |
| // Initialize feather icons | |
| feather.replace(); | |
| // Mobile menu toggle | |
| const mobileMenuToggle = document.querySelector('.mobile-menu-toggle'); | |
| const mobileMenu = document.querySelector('.mobile-menu'); | |
| if (mobileMenuToggle && mobileMenu) { | |
| mobileMenuToggle.addEventListener('click', () => { | |
| mobileMenu.classList.toggle('hidden'); | |
| }); | |
| } | |
| // WhatsApp button functionality | |
| const whatsappButtons = document.querySelectorAll('.whatsapp-button'); | |
| whatsappButtons.forEach(button => { | |
| button.addEventListener('click', () => { | |
| window.open('https://wa.me/212600000000', '_blank'); | |
| }); | |
| }); | |
| // Tracking form submission | |
| const trackingForms = document.querySelectorAll('.tracking-form'); | |
| trackingForms.forEach(form => { | |
| form.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| const trackingNumber = form.querySelector('input').value; | |
| if (trackingNumber) { | |
| window.location.href = `track.html?number=${trackingNumber}`; | |
| } | |
| }); | |
| }); | |
| // Login/Register form submission | |
| const authForms = document.querySelectorAll('.auth-form'); | |
| authForms.forEach(form => { | |
| form.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| // In a real app, this would validate and send to backend | |
| window.location.href = 'dashboard.html'; | |
| }); | |
| }); | |
| // Contact form submission | |
| const contactForm = document.querySelector('.contact-form'); | |
| if (contactForm) { | |
| contactForm.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| alert('Thank you for your message! We will contact you soon.'); | |
| contactForm.reset(); | |
| }); | |
| } | |
| }); | |
| // Simulate tracking data (would be replaced with real API calls) | |
| function getTrackingStatus(trackingNumber) { | |
| const statuses = [ | |
| { status: 'pending', location: 'Casablanca Hub', time: new Date() }, | |
| { status: 'in-transit', location: 'Rabat Distribution Center', time: new Date(Date.now() - 3600000) }, | |
| { status: 'delivered', location: 'Customer Address', time: new Date(Date.now() - 7200000) } | |
| ]; | |
| return { | |
| trackingNumber, | |
| origin: 'Casablanca', | |
| destination: 'Rabat', | |
| estimatedDelivery: new Date(Date.now() + 86400000).toLocaleDateString(), | |
| status: 'in-transit', | |
| history: statuses | |
| }; | |
| } |