Download script.js from adilmalik7364/packseal-analytics-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 1.72 kB
-
https://huggingface.co/spaces/adilmalik7364/packseal-analytics-dashboard/resolve/main/script.js
- Command line
-
hf download hf://spaces/adilmalik7364/packseal-analytics-dashboard/script.js
-
curl -L -o script.js https://huggingface.co/spaces/adilmalik7364/packseal-analytics-dashboard/resolve/main/script.js
1.72 kB
| // Initialize any interactive components or animations | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Tooltips for table headers | |
| const tableHeaders = document.querySelectorAll('th'); | |
| tableHeaders.forEach(header => { | |
| header.addEventListener('mouseenter', function() { | |
| const description = this.getAttribute('data-tooltip'); | |
| if (description) { | |
| // Create and show tooltip | |
| const tooltip = document.createElement('div'); | |
| tooltip.className = 'absolute z-10 bg-black text-white text-xs rounded py-1 px-2'; | |
| tooltip.textContent = description; | |
| const rect = this.getBoundingClientRect(); | |
| tooltip.style.top = `${rect.bottom + window.scrollY}px`; | |
| tooltip.style.left = `${rect.left + window.scrollX}px`; | |
| document.body.appendChild(tooltip); | |
| this._tooltip = tooltip; | |
| } | |
| }); | |
| header.addEventListener('mouseleave', function() { | |
| if (this._tooltip) { | |
| document.body.removeChild(this._tooltip); | |
| delete this._tooltip; | |
| } | |
| }); | |
| }); | |
| // Calculate and update dynamic metrics | |
| function updateMetrics() { | |
| const production = 6700; | |
| const limit = 1920; | |
| const efficiency = ((limit / production) * 100).toFixed(2); | |
| const savings = 4780 * 5; | |
| document.querySelector('[data-efficiency]').textContent = `${100 - efficiency}%`; | |
| document.querySelector('[data-savings]').textContent = `₹${savings.toLocaleString()}`; | |
| } | |
| updateMetrics(); | |
| }); |