Download script.js from yashisgoat/midnight-stride-tracker: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/spaces/yashisgoat/midnight-stride-tracker/resolve/main/script.js
- Command line
-
hf download hf://spaces/yashisgoat/midnight-stride-tracker/script.js
-
curl -L -o script.js https://huggingface.co/spaces/yashisgoat/midnight-stride-tracker/resolve/main/script.js
1.5 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Step tracking simulation | |
| function updateStepData() { | |
| // Simulate step data (in a real app, this would come from device sensors) | |
| const steps = Math.floor(Math.random() * 10000); | |
| const distance = Math.floor(steps * 0.762); // avg step length in meters | |
| const calories = Math.floor(steps * 0.04); // avg calories per step | |
| const percent = Math.min(100, Math.floor((steps / 10000) * 100)); | |
| document.getElementById('steps-count').textContent = steps.toLocaleString(); | |
| document.getElementById('distance').textContent = distance.toLocaleString(); | |
| document.getElementById('calories').textContent = calories.toLocaleString(); | |
| document.getElementById('steps-percent').textContent = percent; | |
| document.getElementById('steps-progress').style.width = `${percent}%`; | |
| // Update sync time | |
| const now = new Date(); | |
| document.getElementById('last-sync').textContent = now.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}); | |
| } | |
| // Initial update | |
| updateStepData(); | |
| // Update every 5 seconds | |
| setInterval(updateStepData, 5000); | |
| // Mobile menu toggle functionality will be handled by the navbar component | |
| }); | |
| // Simple analytics tracking | |
| function trackEvent(eventName) { | |
| if (typeof gtag !== 'undefined') { | |
| gtag('event', eventName); | |
| } | |
| console.log(`Event tracked: ${eventName}`); | |
| } |