const input=document.getElementById('model-search'),tables=[...document.querySelectorAll('table.board')],count=document.getElementById('ranking-count'); // the two tabs rank different line-ups (Text-to-Scene re-run vs the paper's Image-to-Scene), so count the visible one const visible=()=>tables.find(t=>t.offsetParent!==null)||tables[0]; function filter(){const q=input.value.trim().toLowerCase();for(const table of tables){let rank=0;for(const row of table.tBodies[0].rows){row.hidden=!row.dataset.search.includes(q);if(!row.hidden)row.cells[0].textContent=++rank;}} const rows=[...visible().tBodies[0].rows],shown=rows.filter(r=>!r.hidden).length;count.textContent=q?shown+' of '+rows.length+' configurations':rows.length+' configurations';} input.addEventListener('input',filter);tables.forEach(t=>t.querySelectorAll('th[data-k]').forEach(th=>th.addEventListener('click',filter))); document.querySelectorAll('.seg[data-for=leaderboard] button').forEach(b=>b.addEventListener('click',()=>setTimeout(filter)));