Spaces:
Running
Running
darren.zhang Claude Opus 5 (1M context) commited on
Commit ·
ebb302b
1
Parent(s): 0f8fa12
teleopSample: step list on the older pages matches the pick-and-place layout
Browse filesSame row format as the new pages (time range · duration · frame count · success
marker, then the numbered title and the token), coloured left border per step,
and the chip row is gone — the timeline over the scrubber already carries it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- teleopSample/enhance.js +22 -2
teleopSample/enhance.js
CHANGED
|
@@ -32,6 +32,7 @@
|
|
| 32 |
const DUR = S.t ? S.t[S.n - 1] : (S.n - 1) / S.fps;
|
| 33 |
const END = S.end || S.end_pos; // [n][6] = left xyz, right xyz
|
| 34 |
const frameAt = t => Math.max(0, Math.min(S.n - 1, Math.round(t * S.fps)));
|
|
|
|
| 35 |
|
| 36 |
// ---------- styles
|
| 37 |
const css = document.createElement('style');
|
|
@@ -54,7 +55,10 @@
|
|
| 54 |
.x-annot p{margin:0 0 6px;line-height:1.6;font-size:13.5px;color:#dfe4ec}
|
| 55 |
.x-sgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:7px 26px;margin-top:10px}
|
| 56 |
.x-sg{display:flex;justify-content:space-between;border-bottom:1px dashed #232733;padding-bottom:3px;font-size:12.5px}
|
| 57 |
-
.x-sg .k{color:#9aa1ad}.x-sg .v{font-variant-numeric:tabular-nums}
|
|
|
|
|
|
|
|
|
|
| 58 |
document.head.appendChild(css);
|
| 59 |
|
| 60 |
// ---------- instruction header
|
|
@@ -79,7 +83,6 @@
|
|
| 79 |
const videos = [...document.querySelectorAll('video')];
|
| 80 |
const master = videos[0];
|
| 81 |
const seek = t => videos.forEach(v => { try { v.currentTime = t; } catch (e) {} });
|
| 82 |
-
const num = (st, i) => (st.id != null ? st.id : i + 1); // keep the page's own numbering
|
| 83 |
STEPS.forEach((st, i) => {
|
| 84 |
const sg = document.createElement('div');
|
| 85 |
sg.className = 'seg';
|
|
@@ -155,6 +158,23 @@
|
|
| 155 |
function at(t) { for (let i = 0; i < STEPS.length; i++) if (t >= STEPS[i].start_s && t < STEPS[i].end_s) return i; return t < STEPS[0].start_s ? 0 : STEPS.length - 1; }
|
| 156 |
(function tick() { if (master) render(at(master.currentTime), master.currentTime); requestAnimationFrame(tick); })();
|
| 157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
// ---------- wording: spans / subtask -> steps
|
| 159 |
document.querySelectorAll('.spans-head').forEach(e => {
|
| 160 |
e.textContent = e.textContent.replace(/temporal spans/i, 'annotated steps').replace(/spans/gi, 'steps');
|
|
|
|
| 32 |
const DUR = S.t ? S.t[S.n - 1] : (S.n - 1) / S.fps;
|
| 33 |
const END = S.end || S.end_pos; // [n][6] = left xyz, right xyz
|
| 34 |
const frameAt = t => Math.max(0, Math.min(S.n - 1, Math.round(t * S.fps)));
|
| 35 |
+
const num = (st, i) => (st.id != null ? st.id : i + 1); // keep the page's own numbering
|
| 36 |
|
| 37 |
// ---------- styles
|
| 38 |
const css = document.createElement('style');
|
|
|
|
| 55 |
.x-annot p{margin:0 0 6px;line-height:1.6;font-size:13.5px;color:#dfe4ec}
|
| 56 |
.x-sgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:7px 26px;margin-top:10px}
|
| 57 |
.x-sg{display:flex;justify-content:space-between;border-bottom:1px dashed #232733;padding-bottom:3px;font-size:12.5px}
|
| 58 |
+
.x-sg .k{color:#9aa1ad}.x-sg .v{font-variant-numeric:tabular-nums}
|
| 59 |
+
.span-item .x-t{font-size:11px;color:#8890a0;font-variant-numeric:tabular-nums}
|
| 60 |
+
.span-item .x-title{font-size:13.5px;margin:2px 0;line-height:1.35}
|
| 61 |
+
.span-item .x-tok{font-size:10.5px;color:#6f92c8;font-family:ui-monospace,monospace}`;
|
| 62 |
document.head.appendChild(css);
|
| 63 |
|
| 64 |
// ---------- instruction header
|
|
|
|
| 83 |
const videos = [...document.querySelectorAll('video')];
|
| 84 |
const master = videos[0];
|
| 85 |
const seek = t => videos.forEach(v => { try { v.currentTime = t; } catch (e) {} });
|
|
|
|
| 86 |
STEPS.forEach((st, i) => {
|
| 87 |
const sg = document.createElement('div');
|
| 88 |
sg.className = 'seg';
|
|
|
|
| 158 |
function at(t) { for (let i = 0; i < STEPS.length; i++) if (t >= STEPS[i].start_s && t < STEPS[i].end_s) return i; return t < STEPS[0].start_s ? 0 : STEPS.length - 1; }
|
| 159 |
(function tick() { if (master) render(at(master.currentTime), master.currentTime); requestAnimationFrame(tick); })();
|
| 160 |
|
| 161 |
+
// ---------- sidebar: same step rows as the pick-and-place pages, and drop the chip row
|
| 162 |
+
// (the timeline above the scrubber already carries the colour key)
|
| 163 |
+
const chips = document.getElementById('chips') || document.querySelector('.chips');
|
| 164 |
+
if (chips) chips.remove();
|
| 165 |
+
document.querySelectorAll('.span-item').forEach((el, i) => {
|
| 166 |
+
const st = STEPS[i];
|
| 167 |
+
if (!st) return;
|
| 168 |
+
const a = frameAt(st.start_s), b = frameAt(st.end_s);
|
| 169 |
+
el.style.borderLeftColor = col(i);
|
| 170 |
+
el.innerHTML =
|
| 171 |
+
`<div class="x-t">${st.start_s.toFixed(2)}s – ${st.end_s.toFixed(2)}s · ` +
|
| 172 |
+
`${(st.end_s - st.start_s).toFixed(2)}s · ${b - a + 1}f` +
|
| 173 |
+
(st.success_s != null ? ` · ✓ ${st.success_s.toFixed(2)}s` : '') + `</div>` +
|
| 174 |
+
`<div class="x-title">${num(st, i)}. ${st.title}</div>` +
|
| 175 |
+
(st.token ? `<div class="x-tok">${st.token}</div>` : '');
|
| 176 |
+
});
|
| 177 |
+
|
| 178 |
// ---------- wording: spans / subtask -> steps
|
| 179 |
document.querySelectorAll('.spans-head').forEach(e => {
|
| 180 |
e.textContent = e.textContent.replace(/temporal spans/i, 'annotated steps').replace(/spans/gi, 'steps');
|