Spaces:
Sleeping
Sleeping
Download usage.js from kalanosdev/lerobot-grader: direct link, hf CLI and curl.
- Browser
- Download file 2.11 kB
-
https://huggingface.co/spaces/kalanosdev/lerobot-grader/resolve/main/usage.js
- Command line
-
hf download hf://spaces/kalanosdev/lerobot-grader/usage.js
-
curl -L -o usage.js https://huggingface.co/spaces/kalanosdev/lerobot-grader/resolve/main/usage.js
2.11 kB
| // Executed inside Gradio's load hook. No cookies, IDs, dataset names or card content | |
| // leave the page. Clipboard text is used locally and never sent as telemetry. | |
| if (!window.kalanosUsage) { | |
| const enabled = location.origin === 'https://kalanosdev-lerobot-grader.hf.space'; | |
| const emit = (event) => { | |
| if (!enabled) return; | |
| fetch('https://hub.kalanos.ai/api/events/hf-space', { | |
| method: 'POST', credentials: 'omit', referrerPolicy: 'no-referrer', | |
| headers: {'Content-Type': 'text/plain'}, body: JSON.stringify({event}), keepalive: true | |
| }).catch(() => {}); | |
| }; | |
| const copy = async (text, button, status) => { | |
| if (!text) return; | |
| try { | |
| await navigator.clipboard.writeText(text); | |
| emit('hf_card_copied'); | |
| if (status) status.textContent = 'Copied'; | |
| if (button) { button.title = 'Copied'; button.setAttribute('aria-label', 'Copied'); } | |
| } catch { | |
| if (status) status.textContent = 'Clipboard unavailable. Select the Markdown and copy manually.'; | |
| if (button) { button.title = 'Copy unavailable — select the Markdown and copy manually'; button.setAttribute('aria-label', button.title); } | |
| } | |
| }; | |
| window.kalanosUsage = {emit, copy}; | |
| emit('hf_space_viewed'); | |
| document.addEventListener('toggle', (e) => { | |
| if (e.target.matches?.('details.k-hf-card') && e.target.open) emit('hf_card_previewed'); | |
| }, true); | |
| document.addEventListener('click', (e) => { | |
| const button = e.target.closest?.('.k-copy-card'); | |
| if (button) { | |
| const panel = button.closest('.k-hf-card'); | |
| copy(panel.querySelector('textarea').value, button, panel.querySelector('.k-copy-status')); | |
| } | |
| const link = e.target.closest?.('.k-card a[href]'); | |
| if (link) { | |
| const url = new URL(link.href); | |
| if (url.origin === 'https://hub.kalanos.ai' && url.pathname.startsWith('/d/')) emit('hf_report_opened'); | |
| } | |
| }); | |
| document.addEventListener('copy', (e) => { | |
| const input = e.target.closest?.('.k-hf-card textarea'); | |
| if (input && input.selectionStart !== input.selectionEnd && !e.defaultPrevented) emit('hf_card_copied'); | |
| }); | |
| } | |