Skip to content

Commit 6d34737

Browse files
kaixubuildsclaude
andcommitted
feat: gallery auto-advances every 3s; stops on category click; add Instruction label
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2d81bc3 commit 6d34737

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

assets/js/main.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,33 @@ function initTaxonomy() {
372372
showTask(CAT_TASKS[cat][0]);
373373
}
374374

375+
const allTaskKeys = Object.keys(TASKS);
376+
let autoIdx = 0;
377+
let autoTimer = null;
378+
379+
function stopAuto() {
380+
if (autoTimer) { clearInterval(autoTimer); autoTimer = null; }
381+
}
382+
383+
function startAuto() {
384+
autoTimer = setInterval(() => {
385+
autoIdx = (autoIdx + 1) % allTaskKeys.length;
386+
const key = allTaskKeys[autoIdx];
387+
const cat = Object.entries(CAT_TASKS).find(([, tasks]) => tasks.includes(key))?.[0];
388+
if (cat) showCat(cat);
389+
else showTask(key);
390+
}, 3000);
391+
}
392+
375393
catBtns.forEach(btn => {
376-
btn.addEventListener("click", () => showCat(btn.dataset.cat));
394+
btn.addEventListener("click", () => { stopAuto(); showCat(btn.dataset.cat); });
377395
});
378396
taskBtns.forEach(btn => {
379397
btn.addEventListener("click", () => showTask(btn.dataset.task));
380398
});
381399

382400
showCat("geo");
401+
startAuto();
383402
}
384403

385404
/* ── Heatmap ─────────────────────────────────────────────────── */

index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ <h2 class="sec-title">20 tasks across 4 categories.<br>Infinitely scalable.</h2>
252252
<img id="ex-answer" src="assets/img/ex_translation_answer.png" alt="Ground truth" />
253253
<img id="ex-output" src="assets/img/ex_translation_output.png" alt="Model output" />
254254
</div>
255-
<div class="ex-instruction" id="ex-instr"></div>
255+
<div class="instruction-block" style="margin-top:14px">
256+
<div class="label">Instruction</div>
257+
<div id="ex-instr"></div>
258+
</div>
256259
</div>
257260
</div>
258261
</div>

0 commit comments

Comments
 (0)