Spaces:
Running
Running
Download assets/task-tabs.js from SimWorld-AI/Code4Scene: direct link, hf CLI and curl.
- Browser
- Download file 649 Bytes
-
https://huggingface.co/spaces/SimWorld-AI/Code4Scene/resolve/main/assets/task-tabs.js
- Command line
-
hf download hf://spaces/SimWorld-AI/Code4Scene/assets/task-tabs.js
-
curl -L -o task-tabs.js https://huggingface.co/spaces/SimWorld-AI/Code4Scene/resolve/main/assets/task-tabs.js
649 Bytes
| const tabs=[...document.querySelectorAll('.task-tabs [role=tab]')]; | |
| function select(tab){ | |
| for(const b of tabs){const on=b===tab;b.setAttribute('aria-selected',String(on));b.tabIndex=on?0:-1;document.getElementById(b.getAttribute('aria-controls')).hidden=!on;} | |
| document.dispatchEvent(new CustomEvent('taskchange')); | |
| } | |
| tabs.forEach((b,i)=>{b.addEventListener('click',()=>select(b));b.addEventListener('keydown',e=>{if(!['ArrowLeft','ArrowRight','Home','End'].includes(e.key))return;e.preventDefault();const j=e.key==='Home'?0:e.key==='End'?tabs.length-1:(i+(e.key==='ArrowRight'?1:-1)+tabs.length)%tabs.length;select(tabs[j]);tabs[j].focus();});}); | |