Spaces:
Running
Running
Download script.js from JOWilkins/shuttlestats-express: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/JOWilkins/shuttlestats-express/resolve/main/script.js
- Command line
-
hf download hf://spaces/JOWilkins/shuttlestats-express/script.js
-
curl -L -o script.js https://huggingface.co/spaces/JOWilkins/shuttlestats-express/resolve/main/script.js
1.15 kB
| document.addEventListener('DOMContentLoaded', () => { | |
| // Initialize tooltips | |
| const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | |
| tooltipTriggerList.map(function (tooltipTriggerEl) { | |
| return new bootstrap.Tooltip(tooltipTriggerEl); | |
| }); | |
| // Animate elements on scroll | |
| const animateOnScroll = () => { | |
| const elements = document.querySelectorAll('.fade-in, .slide-up'); | |
| elements.forEach(el => { | |
| const elementPosition = el.getBoundingClientRect().top; | |
| const screenPosition = window.innerHeight / 1.2; | |
| if(elementPosition < screenPosition) { | |
| el.style.opacity = '1'; | |
| el.style.transform = 'translateY(0)'; | |
| } | |
| }); | |
| }; | |
| window.addEventListener('scroll', animateOnScroll); | |
| animateOnScroll(); // Run once on load | |
| }); | |
| // Format currency | |
| function formatCurrency(amount) { | |
| return new Intl.NumberFormat('en-US', { | |
| style: 'currency', | |
| currency: 'USD', | |
| minimumFractionDigits: 0, | |
| maximumFractionDigits: 0 | |
| }).format(amount); | |
| } |