Download app.js from Setoka/SPARC: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/spaces/Setoka/SPARC/resolve/main/app.js
- Command line
-
hf download hf://spaces/Setoka/SPARC/app.js
-
curl -L -o app.js https://huggingface.co/spaces/Setoka/SPARC/resolve/main/app.js
1.57 kB
| const tabs = Array.from(document.querySelectorAll('[role="tab"]')); | |
| function selectTab(tab) { | |
| for (const item of tabs) { | |
| const selected = item === tab; | |
| item.setAttribute('aria-selected', String(selected)); | |
| item.tabIndex = selected ? 0 : -1; | |
| const panel = document.getElementById(item.dataset.panel); | |
| panel.hidden = !selected; | |
| if (!selected) panel.querySelectorAll('video').forEach(video => video.pause()); | |
| } | |
| } | |
| tabs.forEach((tab, index) => { | |
| tab.addEventListener('click', () => selectTab(tab)); | |
| tab.addEventListener('keydown', event => { | |
| let next; | |
| if (event.key === 'ArrowRight') next = (index + 1) % tabs.length; | |
| if (event.key === 'ArrowLeft') next = (index + tabs.length - 1) % tabs.length; | |
| if (event.key === 'Home') next = 0; | |
| if (event.key === 'End') next = tabs.length - 1; | |
| if (next === undefined) return; | |
| event.preventDefault(); | |
| selectTab(tabs[next]); | |
| tabs[next].focus(); | |
| }); | |
| }); | |
| document.getElementById('copy-citation').addEventListener('click', async () => { | |
| const text = document.getElementById('bibtex').textContent; | |
| const status = document.getElementById('copy-status'); | |
| try { | |
| await navigator.clipboard.writeText(text); | |
| status.textContent = 'BibTeX copied.'; | |
| } catch { | |
| const selection = window.getSelection(); | |
| const range = document.createRange(); | |
| range.selectNodeContents(document.getElementById('bibtex')); | |
| selection.removeAllRanges(); | |
| selection.addRange(range); | |
| status.textContent = 'Citation selected. Use your browser’s Copy command.'; | |
| } | |
| }); | |