Download script.js from demonsom/globalship-admin-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 2.13 kB
-
https://huggingface.co/spaces/demonsom/globalship-admin-dashboard/resolve/main/script.js
- Command line
-
hf download hf://spaces/demonsom/globalship-admin-dashboard/script.js
-
curl -L -o script.js https://huggingface.co/spaces/demonsom/globalship-admin-dashboard/resolve/main/script.js
2.13 kB
| // Mobile Navigation Toggle | |
| const navToggle = document.querySelector('.nav-toggle'); | |
| const navMenu = document.querySelector('.nav-menu'); | |
| if (navToggle && navMenu) { | |
| navToggle.addEventListener('click', () => { | |
| navMenu.classList.toggle('active'); | |
| navToggle.classList.toggle('is-active'); | |
| }); | |
| } | |
| // Tracking Form Example | |
| const trackingExamples = document.querySelectorAll('.tracking-example'); | |
| const trackingInput = document.getElementById('tracking-number'); | |
| if (trackingExamples.length > 0 && trackingInput) { | |
| trackingExamples.forEach(button => { | |
| button.addEventListener('click', () => { | |
| trackingInput.value = button.getAttribute('data-tracking'); | |
| }); | |
| }); | |
| } | |
| // Form Submission | |
| const forms = document.querySelectorAll('form'); | |
| forms.forEach(form => { | |
| form.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| // In a real app, you would submit the form data here | |
| alert('Form submitted successfully!'); | |
| }); | |
| }); | |
| // Dashboard Stats Animation | |
| const statCards = document.querySelectorAll('.stat-card'); | |
| statCards.forEach((card, index) => { | |
| setTimeout(() => { | |
| card.style.opacity = '1'; | |
| card.style.transform = 'translateY(0)'; | |
| }, 300 * index); | |
| }); | |
| // Shipment Actions | |
| const actionButtons = document.querySelectorAll('.table-actions button'); | |
| actionButtons.forEach(button => { | |
| button.addEventListener('click', (e) => { | |
| e.stopPropagation(); | |
| const action = e.currentTarget.querySelector('i').getAttribute('data-feather'); | |
| const row = e.currentTarget.closest('tr'); | |
| const trackingId = row.cells[1].textContent; | |
| switch(action) { | |
| case 'eye': | |
| alert(`Viewing details for shipment ${trackingId}`); | |
| break; | |
| case 'edit': | |
| alert(`Editing shipment ${trackingId}`); | |
| break; | |
| case 'trash': | |
| if (confirm(`Are you sure you want to delete shipment ${trackingId}?`)) { | |
| row.remove(); | |
| } | |
| break; | |
| } | |
| }); | |
| }); |