Spaces:
Running
Running
Download script.js from Vdphacker/sos-homefix: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/spaces/Vdphacker/sos-homefix/resolve/main/script.js
- Command line
-
hf download hf://spaces/Vdphacker/sos-homefix/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Vdphacker/sos-homefix/resolve/main/script.js
1.67 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize Feather Icons | |
| if (window.feather) { | |
| feather.replace(); | |
| } | |
| // Mobile menu toggle functionality | |
| const mobileMenuButton = document.querySelector('[data-mobile-menu-button]'); | |
| const mobileMenu = document.querySelector('[data-mobile-menu]'); | |
| if (mobileMenuButton && mobileMenu) { | |
| mobileMenuButton.addEventListener('click', () => { | |
| const isExpanded = mobileMenuButton.getAttribute('aria-expanded') === 'true'; | |
| mobileMenuButton.setAttribute('aria-expanded', !isExpanded); | |
| mobileMenu.classList.toggle('hidden'); | |
| }); | |
| } | |
| // Service cards hover effect | |
| const serviceCards = document.querySelectorAll('.service-card'); | |
| serviceCards.forEach(card => { | |
| card.addEventListener('mouseenter', () => { | |
| card.classList.add('shadow-lg'); | |
| card.classList.remove('shadow-md'); | |
| }); | |
| card.addEventListener('mouseleave', () => { | |
| card.classList.remove('shadow-lg'); | |
| card.classList.add('shadow-md'); | |
| }); | |
| }); | |
| // Form validation helper | |
| const forms = document.querySelectorAll('form'); | |
| forms.forEach(form => { | |
| form.addEventListener('submit', (e) => { | |
| const requiredFields = form.querySelectorAll('[required]'); | |
| let isValid = true; | |
| requiredFields.forEach(field => { | |
| if (!field.value.trim()) { | |
| field.classList.add('border-red-500'); | |
| isValid = false; | |
| } else { | |
| field.classList.remove('border-red-500'); | |
| } | |
| }); | |
| if (!isValid) { | |
| e.preventDefault(); | |
| alert('Please fill in all required fields.'); | |
| } | |
| }); | |
| }); | |
| }); |