Spaces:
Running
Running
Download script.js from snw321/autofuchsia-masters: direct link, hf CLI and curl.
- Browser
- Download file 2.54 kB
-
https://huggingface.co/spaces/snw321/autofuchsia-masters/resolve/main/script.js
- Command line
-
hf download hf://spaces/snw321/autofuchsia-masters/script.js
-
curl -L -o script.js https://huggingface.co/spaces/snw321/autofuchsia-masters/resolve/main/script.js
2.54 kB
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| const targetId = this.getAttribute('href'); | |
| if (targetId === '#') return; | |
| const targetElement = document.querySelector(targetId); | |
| if (targetElement) { | |
| window.scrollTo({ | |
| top: targetElement.offsetTop - 80, | |
| behavior: 'smooth' | |
| }); | |
| } | |
| }); | |
| }); | |
| // Mobile menu toggle functionality | |
| document.addEventListener('DOMContentLoaded', () => { | |
| 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'); | |
| // Toggle icon | |
| const icon = mobileMenuButton.querySelector('svg'); | |
| if (icon) { | |
| if (isExpanded) { | |
| icon.setAttribute('data-feather', 'menu'); | |
| } else { | |
| icon.setAttribute('data-feather', 'x'); | |
| } | |
| feather.replace(); | |
| } | |
| }); | |
| } | |
| // Initialize feather icons | |
| feather.replace(); | |
| // Form submission handling | |
| const forms = document.querySelectorAll('form'); | |
| forms.forEach(form => { | |
| form.addEventListener('submit', async (e) => { | |
| e.preventDefault(); | |
| const formData = new FormData(form); | |
| const submitButton = form.querySelector('button[type="submit"]'); | |
| const originalText = submitButton.textContent; | |
| // Show loading state | |
| submitButton.disabled = true; | |
| submitButton.innerHTML = '<i data-feather="loader" class="animate-spin mr-2"></i> Отправка...'; | |
| feather.replace(); | |
| try { | |
| // Simulate API call | |
| await new Promise(resolve => setTimeout(resolve, 1500)); | |
| // Show success message | |
| const successMessage = document.createElement('div'); | |
| successMessage.className = 'mt-4 p-4 bg-green-500/20 text-green-500 |