Download script.js from raqesh/secureflow-checkpoint-portal: direct link, hf CLI and curl.
- Browser
- Download file 2.63 kB
-
https://huggingface.co/spaces/raqesh/secureflow-checkpoint-portal/resolve/main/script.js
- Command line
-
hf download hf://spaces/raqesh/secureflow-checkpoint-portal/script.js
-
curl -L -o script.js https://huggingface.co/spaces/raqesh/secureflow-checkpoint-portal/resolve/main/script.js
2.63 kB
| // Smooth scroll to elements | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Toggle dark mode | |
| const toggleDarkMode = () => { | |
| const html = document.documentElement; | |
| html.classList.toggle('dark'); | |
| localStorage.setItem('darkMode', html.classList.contains('dark')); | |
| }; | |
| // Check for saved dark mode preference | |
| if (localStorage.getItem('darkMode') === 'true') { | |
| document.documentElement.classList.add('dark'); | |
| } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { | |
| document.documentElement.classList.add('dark'); | |
| } | |
| // Form submission handling | |
| document.querySelectorAll('form').forEach(form => { | |
| form.addEventListener('submit', async (e) => { | |
| e.preventDefault(); | |
| const submitBtn = form.querySelector('button[type="submit"]'); | |
| const originalText = submitBtn.innerHTML; | |
| // Show loading state | |
| submitBtn.innerHTML = ` | |
| <span class="flex items-center justify-center"> | |
| <svg class="animate-spin -ml-1 mr-2 h-4 w-4 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> | |
| <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> | |
| <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> | |
| </svg> | |
| Processing... | |
| </span> | |
| `; | |
| submitBtn.disabled = true; | |
| // Simulate API call | |
| await new Promise(resolve => setTimeout(resolve, 1500)); | |
| // Reset button | |
| submitBtn.innerHTML = originalText; | |
| submitBtn.disabled = false; | |
| // Show success message | |
| const successMsg = document.createElement('div'); | |
| successMsg.className = 'mt-4 p-3 bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 rounded-md'; | |
| successMsg.innerHTML = ` | |
| <div class="flex items-center"> | |
| <i data-feather="check-circle" class="mr-2"></i> | |
| Verification request submitted successfully! | |
| </div> | |
| `; | |
| form.appendChild(successMsg); | |
| feather.replace(); | |
| // Remove message after 5 seconds | |
| setTimeout(() => successMsg.remove(), 5000); | |
| }); | |
| }); |