Spaces:
Running

File size: 34,358 Bytes
f866dfc
01bac75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b3fb0df
 
 
 
01bac75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b3fb0df
01bac75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b3fb0df
01bac75
 
 
b3fb0df
 
 
 
 
 
 
 
 
 
 
01bac75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f866dfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>Edit Blind Review</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap">
<style>
/* One task per screen: instruction, source, four anonymous results (A-D) each with S/P/F buttons and a "best" toggle. */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --fg: #1b1f24; --muted: #5d6673; --line: #d9dde3;
  --pick: #1f6feb; --pick-soft: #e3edfd;
  --ok: #1a7f37; --ok-soft: #dcf3e2; --mid: #9a6700; --mid-soft: #fbefcf; --bad: #b42318; --bad-soft: #fde4e1;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #101317; --panel: #181c22; --fg: #e6e9ee; --muted: #9aa3ae; --line: #2c333c;
  --pick: #5b9dff; --pick-soft: #1a2a44;
  --ok: #4ac26b; --ok-soft: #12301c; --mid: #e3b341; --mid-soft: #3a2e10; --bad: #ff7b72; --bad-soft: #3d1a18; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #101317; --panel: #181c22; --fg: #e6e9ee; --muted: #9aa3ae; --line: #2c333c;
  --pick: #5b9dff; --pick-soft: #1a2a44;
  --ok: #4ac26b; --ok-soft: #12301c; --mid: #e3b341; --mid-soft: #3a2e10; --bad: #ff7b72; --bad-soft: #3d1a18; color-scheme: dark }
* { box-sizing: border-box }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.5 }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--panel) }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 16px 48px }
header.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line) }
header.bar .in { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 10px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap }
h1 { font-size: 17px; font-weight: 600; margin: 0 }
.prog { flex: 1; min-width: 120px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden }
.prog > i { display: block; height: 100%; background: var(--pick); width: 0 }
.count { font-family: var(--mono); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums }
.save { font-size: 12px; color: var(--muted) }
details.rules { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px }
details.rules summary { cursor: pointer; font-weight: 500 }
details.rules ul { margin: 8px 0 0; padding-left: 20px }
.who { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 2px }
.who input { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); min-width: 0; width: 220px; max-width: 100% }
.task { display: grid; gap: 14px }
.instr { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px }
.instr .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 4px }
.instr .text { font-size: 18px; font-weight: 500; text-wrap: balance }
.instr .spec { font-size: 13px; color: var(--muted); margin-top: 6px }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px }
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 6px; min-width: 0; display: grid; gap: 6px; align-content: start }
.card img { display: block; width: 100%; height: auto; border-radius: 4px; cursor: zoom-in }
.card.src { border-style: dashed }
.imgbox { position: relative }
.peek { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 4px; display: none; pointer-events: none }
.imgbox.peeking .peek { display: block }
.imgbox.peeking img { outline: 3px solid var(--mid); outline-offset: -3px }
.card.best { border-color: var(--pick); background: var(--pick-soft) }
.lab { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-family: var(--mono); font-size: 14px; padding: 0 2px }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px }
.seg button, .bestbtn { font: inherit; font-size: 13px; padding: 7px 4px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; min-height: 36px }
.seg button[data-v="S"].on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 600 }
.seg button[data-v="P"].on { background: var(--mid-soft); border-color: var(--mid); color: var(--mid); font-weight: 600 }
.seg button[data-v="F"].on { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); font-weight: 600 }
.bestbtn.on { background: var(--pick); border-color: var(--pick); color: #fff; font-weight: 600 }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center }
button.b { font: inherit; font-weight: 500; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer }
button.b.primary { background: var(--pick); border-color: var(--pick); color: #fff }
button.b.on { background: var(--bad-soft); border-color: var(--bad); color: var(--bad) }
button.b:disabled { opacity: .45; cursor: default }
button:focus-visible { outline: 3px solid var(--pick); outline-offset: 2px }
.hint { font-size: 12px; color: var(--muted) }
.jump { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 14px }
.jump button { font-family: var(--mono); font-size: 11px; width: 30px; height: 26px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 4px; cursor: pointer; padding: 0 }
.jump button.part { border-color: var(--mid) }
.jump button.done { background: var(--pick-soft); color: var(--fg); border-color: var(--pick) }
.jump button.cur { outline: 2px solid var(--fg) }
.done-box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 8px; margin-top: 14px }
textarea { width: 100%; min-height: 90px; font-family: var(--mono); font-size: 11px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 6px }
.lb { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 20; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)) }
.lb[hidden] { display: none }
.lb .pair { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 100%; overflow: auto }
.lb figure { margin: 0; flex: 1 1 420px; max-width: min(760px, 100%) }
.lb img { width: 100%; height: auto; border-radius: 4px }
.lb figcaption { color: #ddd; font-size: 13px; text-align: center; font-family: var(--mono) }
.lb .close { color: #fff; background: transparent; border: 1px solid #888; border-radius: 6px; padding: 6px 14px; font: inherit; cursor: pointer }
@media (prefers-reduced-motion: no-preference) { .prog > i { transition: width .2s } }
</style>
</head>
<body>

<header class="bar"><div class="in">
  <h1>编辑结果盲评 · Blind review</h1>
  <div class="prog" aria-hidden="true"><i id="progbar"></i></div>
  <span class="count" id="count">0 / 63</span>
  <span class="save" id="save">进度存在本机浏览器</span>
  <button class="b" id="dltop" type="button" style="padding:5px 12px;font-size:13px">下载结果</button>
</div></header>

<div class="wrap">
  <details class="rules" id="rules" open>
    <summary>怎么判 · How to judge(看一次就行)</summary>
    <ul>
      <li>每题有一张原图、一句修改指令、4 张修改结果 A–D。4 张来自 4 个不同方法,顺序每题随机打乱,看不出是谁做的。<br><span class="hint">Each task: a source image, an instruction, and 4 edited results from 4 different methods in random order.</span></li>
      <li><b>每张结果点一个:</b>「对」= 指令要求的都做到了,没要求改的地方也没变;「部分」= 大体对但有明显毛病(量不对、位置偏、别处有小损坏);「错」= 没改、改错了,或者画面坏了。<br><span class="hint">Rate each result: Success / Partial / Fail.</span></li>
      <li><b>再点「最好」:</b>选出最好的那张;几张一样好可以多选(算并列);4 张都不行就点「都不行」。<br><span class="hint">Then mark the best one(s); several = tie; "None" if all fail.</span></li>
      <li><b>鼠标放在结果图上会临时变回原图,移开再变回结果</b>(手机上按住不放)。来回切几次,就能看出改了哪里、有没有改到别处。<br><span class="hint">Hover over a result to flip it to the source image (press and hold on a phone).</span></li>
      <li>点图片可以把它和原图并排放大看。← → 键翻题。进度自动存在这个浏览器里,可以随时关掉页面,下次用同一个浏览器接着做。</li>
      <li><b>做完后点右上角「下载结果」,把文件发给组织者。</b><br><span class="hint">When finished, click "下载结果" (Download) at the top right and send the file to the organizer.</span></li>
    </ul>
    <div class="who"><label for="who">你的代号(可不填)· Your tag (optional)</label><input id="who" maxlength="40" autocomplete="off"></div>
  </details>

  <div class="task" id="task"></div>
  <div class="jump" id="jump" aria-label="跳到某题"></div>
  <div id="donewrap"></div>
</div>

<div class="lb" id="lb" hidden>
  <div class="pair">
    <figure><img id="lbsrc" alt="原图"><figcaption>原图 source</figcaption></figure>
    <figure><img id="lbres" alt="编辑结果"><figcaption id="lbcap">结果</figcaption></figure>
  </div>
  <button class="close" id="lbclose" type="button">关闭(Esc)</button>
</div>

<script>
const TASKS = [{"n": 0, "task_id": "resize-0074", "etype": "Resize Object", "instruction": "Make the fruit bowl about 1.2 times as big, keeping its base where it is now. Do not change anything else."}, {"n": 1, "task_id": "add-0037", "etype": "Add Object", "instruction": "Add a range of snow-capped mountains in the distant background along the horizon, behind the tree line on the left and above the calm lake, keeping the existing sky, clouds, trees, rocks, and water unchanged."}, {"n": 2, "task_id": "remove-0047", "etype": "Remove Object", "instruction": "Remove the small cube-shaped piece of cheese on top of the central stack of cheese, and fill the revealed area with the vest and shirt behind it."}, {"n": 3, "task_id": "replace-0105", "etype": "Replace Object", "instruction": "Replace the brown leather-like hat on the person's head with a dark green knitted beanie, keeping the sunglasses, face, and background unchanged."}, {"n": 4, "task_id": "resize-0043", "etype": "Resize Object", "instruction": "Make the tea cup about 1.3 times as big, keeping its base where it is now. Do not change anything else."}, {"n": 5, "task_id": "move-0042", "etype": "Move Object", "instruction": "Move the tan dog walking in the middle of the image to the empty dirt ground on the right side."}, {"n": 6, "task_id": "appearance-0404", "etype": "Change Object Appearance", "instruction": "Change the model's facial expression so she has a gentle, natural smile, keeping her face identity, eyes, hair, hood, blue rain jacket, and backpack unchanged."}, {"n": 7, "task_id": "text-0396", "etype": "Text", "instruction": "Change the colour of the word \"Diner\" on the wall sign at the upper right to bright red, keeping the letters and script font unchanged."}, {"n": 8, "task_id": "text-0023", "etype": "Text", "instruction": "Add the white sans-serif text \"GO TEAM\" in the clear blue sky at the upper right of the photo, above the tree line."}, {"n": 9, "task_id": "add-0129", "etype": "Add Object", "instruction": "Add a large traditional building with ornate red and gray details prominently in the foreground, placed on the open ground in the lower part of the scene and matching the existing lighting and winter atmosphere."}, {"n": 10, "task_id": "replace-0373", "etype": "Replace Object", "instruction": "Replace the two gold armchairs, one at the lower left and one at the lower right of the room, with two simple wooden chairs with beige cushions, keeping the sofa, coffee table, rugs, columns, and the rest of the room unchanged."}, {"n": 11, "task_id": "remove-0114", "etype": "Remove Object", "instruction": "Remove the man wearing the 'Sealed Power Piston Rings' hat who is giving a thumbs up in the foreground, and fill the area behind him with the matching background, car, foliage, and sky."}, {"n": 12, "task_id": "appearance-0344", "etype": "Change Object Appearance", "instruction": "Change the man's facial expression to look frightened, with wide eyes, raised eyebrows, and a tense mouth, while keeping his identity, hair, jacket, the robot, and the background unchanged."}, {"n": 13, "task_id": "text-0086", "etype": "Text", "instruction": "Add the words \"Open Daily\" in small white sans-serif capital letters on the flat grey paving slab in the lower right of the image."}, {"n": 14, "task_id": "replace-0002", "etype": "Replace Object", "instruction": "Replace the large green dragon in the center-left of the image with a dark, armored warrior holding a flaming mace and a large sword, keeping the red cape in place and the surrounding landscape unchanged."}, {"n": 15, "task_id": "appearance-0456", "etype": "Change Object Appearance", "instruction": "Change the man's facial expression so he looks excited: wide open eyes, raised eyebrows, and a broad open-mouthed smile. Keep his identity, beard, hat, jacket, pose, hands, compass, and the dark background unchanged."}, {"n": 16, "task_id": "move-0058", "etype": "Move Object", "instruction": "Move the brown duck swimming in the middle of the pond to the open water on the left side of the pond."}, {"n": 17, "task_id": "resize-0035", "etype": "Resize Object", "instruction": "Make the metal bottle about half its current size, keeping its center where it is now. Do not change anything else."}, {"n": 18, "task_id": "add-0316", "etype": "Add Object", "instruction": "Add a small price tag displaying $5.99 attached to the green braided bracelet in the foreground."}, {"n": 19, "task_id": "add-0413", "etype": "Add Object", "instruction": "Add a man with a shaved head and black shirt sitting in the background."}, {"n": 20, "task_id": "move-0076", "etype": "Move Object", "instruction": "Move the brown grazing horse to the open grass on the right side of the hillside."}, {"n": 21, "task_id": "text-0225", "etype": "Text", "instruction": "Remove the yellow word \"PAR\" located between the white \"18\" and the yellow \"4\" on the dark wooden sign, and rebuild the dark wood-grain background."}, {"n": 22, "task_id": "remove-0379", "etype": "Remove Object", "instruction": "Remove the stacked stainless steel double wall oven unit from the tall cabinet tower on the right, including both the upper oven/microwave unit and the lower oven, and fill the opening with matching light oak cabinetry consistent with the surrounding panels."}, {"n": 23, "task_id": "replace-0404", "etype": "Replace Object", "instruction": "Replace the bluebells with a cluster of yellow daffodils with green stems."}, {"n": 24, "task_id": "resize-0034", "etype": "Resize Object", "instruction": "Make the coffee cup about 60% of its current size, keeping its base where it is now. Do not change anything else."}, {"n": 25, "task_id": "replace-0043", "etype": "Replace Object", "instruction": "Replace the purple crystal formation centerpiece on the dining table with a bouquet of red roses and tulips arranged in a clear glass vase."}, {"n": 26, "task_id": "add-0089", "etype": "Add Object", "instruction": "Add a large island in the center of the lake, covered with trees and patches of snow."}, {"n": 27, "task_id": "remove-0165", "etype": "Remove Object", "instruction": "Remove the clear plastic water bottle standing on the table in front of the woman in the white shirt, and fill the area with the table surface and papers behind it."}, {"n": 28, "task_id": "resize-0004", "etype": "Resize Object", "instruction": "Make the blue notebook about 1.3 times as big, keeping its base where it is now. Do not change anything else."}, {"n": 29, "task_id": "remove-0457", "etype": "Remove Object", "instruction": "Remove the framed portrait on the left of a girl with shoulder-length brown hair, red and black plaid shirt, gold vest, and pearl necklace, and fill the vacated area with the red wall and the surrounding gallery background."}, {"n": 30, "task_id": "appearance-0052", "etype": "Change Object Appearance", "instruction": "Change the color of the white ceramic Buddha-head vase to blue, keeping its glossy finish, sculpted details, and the flower stems unchanged."}, {"n": 31, "task_id": "move-0095", "etype": "Move Object", "instruction": "Move the red loveseat against the back wall to the empty tiled floor on the left side of the room."}, {"n": 32, "task_id": "move-0021", "etype": "Move Object", "instruction": "Move the black convertible car on the road to the empty road surface on the right side of the image."}, {"n": 33, "task_id": "move-0034", "etype": "Move Object", "instruction": "Move the striped squirrel standing on the rock to the empty rock ledge on the right side of the photo."}, {"n": 34, "task_id": "move-0087", "etype": "Move Object", "instruction": "Move the silver fork on the left side of the table to the empty green table surface to the right of it, just left of the blue letter M."}, {"n": 35, "task_id": "appearance-0223", "etype": "Change Object Appearance", "instruction": "Recolor the Roman armor from metallic gray to a white color scheme, keeping the same armor shapes, edges, rivets, and lighting, and leaving the blue tunic, sword, skin, boots, and street background unchanged."}, {"n": 36, "task_id": "add-0001", "etype": "Add Object", "instruction": "Add a few palm trees in the foreground on the right side of the image, matching the painting's style, lighting, and perspective."}, {"n": 37, "task_id": "appearance-0348", "etype": "Change Object Appearance", "instruction": "Change the man's facial expression to look confused: furrowed brows, a slightly tilted head, and a puzzled, uncertain mouth. Keep his glasses, hairstyle, clothing, backpack, held books, and the colorful background unchanged."}, {"n": 38, "task_id": "add-0366", "etype": "Add Object", "instruction": "Add a young woman with shoulder-length light brown hair, wearing a dark brown three-quarter sleeve shirt, white undershirt, and black pants, standing in front of the white wall and smiling."}, {"n": 39, "task_id": "resize-0018", "etype": "Resize Object", "instruction": "Make the water bottle about 70% of its current size, keeping its base where it is now. Do not change anything else."}, {"n": 40, "task_id": "replace-0291", "etype": "Replace Object", "instruction": "Replace the golden wheat field in the foreground with a sandy beach and ocean, keeping the sky, clouds, mountains, and distant tree line unchanged."}, {"n": 41, "task_id": "text-0161", "etype": "Text", "instruction": "Replace the word \"JAVA\" on the left advertising board with \"NOVA\", keeping the same green lettering, font, size and place."}, {"n": 42, "task_id": "text-0249", "etype": "Text", "instruction": "Remove the small \"restaurant\" line on the hanging wooden sign and rebuild the dark wood slat background behind it."}, {"n": 43, "task_id": "remove-0490", "etype": "Remove Object", "instruction": "Remove the brown log lying on the grass in the foreground and fill the area with matching grass and ground."}, {"n": 44, "task_id": "replace-0021", "etype": "Replace Object", "instruction": "Replace the dark floral blouse with a simple, dark scoop-neck top, keeping the woman's pose, hair, face, and background unchanged."}, {"n": 45, "task_id": "add-0425", "etype": "Add Object", "instruction": "Add a body of calm water in the center of the scene, with a reflection of the trees and sky on its surface."}, {"n": 46, "task_id": "resize-0039", "etype": "Resize Object", "instruction": "Make the yellow vase about 1.3 times as big, keeping its base where it is now. Do not change anything else."}, {"n": 47, "task_id": "text-0254", "etype": "Text", "instruction": "Remove the word \"BAYNES\" printed in small capitals above the centre of the clock dial, rebuilding the plain white dial surface behind it."}, {"n": 48, "task_id": "text-0270", "etype": "Text", "instruction": "On the bottom of the blue card, remove the word \"SIGNATURE\" under the VISA logo and rebuild the plain blue surface behind it."}, {"n": 49, "task_id": "appearance-0373", "etype": "Change Object Appearance", "instruction": "Change the woman's facial expression to look annoyed, with a furrowed brow, tightened eyes, and pressed lips, while keeping her pose, hair, clothing, book, candelabra, and background unchanged."}, {"n": 50, "task_id": "text-0028", "etype": "Text", "instruction": "Add the small grey sans-serif text \"FLIGHT TEST\" on the plain white fuselage to the left of the NASA logo, below the cockpit windows."}, {"n": 51, "task_id": "add-0305", "etype": "Add Object", "instruction": "Add three gray stone torso sculptures inside the glass pavilion, standing on the visible interior floor behind the glass, matching the scene's lighting, perspective, and shadows."}, {"n": 52, "task_id": "remove-0310", "etype": "Remove Object", "instruction": "Remove the light blue plastic container from the table on the left, and fill the area with the table surface and newspaper beneath it."}, {"n": 53, "task_id": "resize-0065", "etype": "Resize Object", "instruction": "Make the orange bottle about 1.2 times as big, keeping its base where it is now. Do not change anything else."}, {"n": 54, "task_id": "remove-0304", "etype": "Remove Object", "instruction": "Remove the small yellow building in the middle of the industrial area."}, {"n": 55, "task_id": "replace-0351", "etype": "Replace Object", "instruction": "Replace the medieval castle in the center of the image with a modern, multi-story lodge-style building with a horizontal, rectangular shape and a natural wood and stone exterior, keeping the surrounding trees, lake, lawn, and landscape unchanged."}, {"n": 56, "task_id": "remove-0500", "etype": "Remove Object", "instruction": "Remove the small songbird perched on the left part of the branch, and fill the area behind it with the matching grey winter background and branch."}, {"n": 57, "task_id": "appearance-0483", "etype": "Change Object Appearance", "instruction": "Change the young woman's facial expression so she is crying, with visible tears on her cheeks and a sad expression, while keeping her identity, hair, clothing, earring, pose, and the background unchanged."}, {"n": 58, "task_id": "move-0030", "etype": "Move Object", "instruction": "Move the red ladybird-patterned hot-air balloon to the empty blue sky on its right, left of the lamp post."}, {"n": 59, "task_id": "appearance-0170", "etype": "Change Object Appearance", "instruction": "Change the color of the red price tag held by the man to purple, keeping its text, barcodes, and shape unchanged."}, {"n": 60, "task_id": "move-0071", "etype": "Move Object", "instruction": "Move the silver sedan on the bridge deck to the empty stretch of road on the left, between the guardrail and the wooden bridge structure."}, {"n": 61, "task_id": "resize-0047", "etype": "Resize Object", "instruction": "Make the small speaker about 1.4 times as big, keeping its base where it is now. Do not change anything else."}, {"n": 62, "task_id": "replace-0192", "etype": "Replace Object", "instruction": "Replace the Earth globe head of the painted briefcase-carrying figure with a large silver euro coin head facing forward, keeping the body, suit, briefcase, and mural style unchanged."}];
const SPEC = {
  "Add Object": "新物体在、是要求的那个、在要求的位置,大小、透视、光影合理;其他不变。",
  "Remove Object": "目标完全去掉(包括影子、倒影);没去掉别的东西;背景自然接上。",
  "Replace Object": "换对了物体,整个物体都变成要求的新物体;其他不变。",
  "Change Object Appearance": "改对了物体,整个物体都是要求的外观;其他不变。",
  "Move Object": "物体到了新位置,并且原位置上已经没有它;其他不变。",
  "Resize Object": "物体大小按要求变了(倍数大致对),位置合理;其他不变。",
  "Text": "文字逐字和要求一样、在要求的位置(或按要求删干净、风格改对);其他文字不动。"
};
const L = ["A", "B", "C", "D"];
const RATE = [["S", "对 Success"], ["P", "部分 Partial"], ["F", "错 Fail"]];
const LS = "hs63_v1";
const pad = n => String(n).padStart(2, "0");
const $ = id => document.getElementById(id);

// state: votes[n] = {r: {A:"S",...}, best: ["A"], none: false, t}
let state = { who: "", votes: {} };
try { const s = JSON.parse(localStorage.getItem(LS) || "null"); if (s && s.votes) state = s } catch (e) {}
if (!state.id) state.id = (crypto.randomUUID ? crypto.randomUUID() : (Date.now().toString(36) + "-" + Math.random().toString(36).slice(2, 12))).toLowerCase();
function lsSave() { try { localStorage.setItem(LS, JSON.stringify(state)) } catch (e) {} }

let cur = 0, ref = null, writing = false, dirty = false, timer = null, lastOk = null;

const empty = () => ({ r: {}, best: [], none: false, t: 0 });
const V = n => state.votes[pad(n)] || empty();
const rated = v => L.filter(x => v.r && v.r[x]).length;
const isDone = n => { const v = V(n); return rated(v) === 4 && (v.none || v.best.length > 0) };
const isPart = n => { const v = V(n); return rated(v) > 0 || v.none || v.best.length > 0 };

function render() {
  const t = TASKS[cur], v = V(cur);
  const box = $("task");
  box.replaceChildren();
  const ins = document.createElement("div");
  ins.className = "instr";
  ins.innerHTML = `<div class="meta"></div><div class="text"></div><div class="spec"></div>`;
  ins.querySelector(".meta").textContent = `第 ${cur + 1} 题 / ${TASKS.length} · ${t.etype}`;
  ins.querySelector(".text").textContent = t.instruction;
  ins.querySelector(".spec").textContent = "这一类要看:" + (SPEC[t.etype] || SPEC.Text);
  box.appendChild(ins);

  const grid = document.createElement("div");
  grid.className = "grid";
  const src = document.createElement("div");
  src.className = "card src";
  src.innerHTML = `<img alt="原图" src="img/${pad(cur)}_src.jpg"><div class="lab"><b>原图 source</b></div>`;
  src.querySelector("img").onclick = () => openLB(null);
  grid.appendChild(src);
  L.forEach(x => {
    const c = document.createElement("div");
    const isBest = v.best.includes(x);
    c.className = "card" + (isBest ? " best" : "");
    c.innerHTML = `<div class="imgbox"><img alt="结果 ${x}" src="img/${pad(cur)}_${x}.jpg"><span class="peek">原图 source</span></div>
      <div class="lab"><b>${x}</b><button type="button" class="bestbtn${isBest ? " on" : ""}" aria-pressed="${isBest}">${isBest ? "✓ 最好 best" : "最好 best"}</button></div>
      <div class="seg" role="group" aria-label="结果 ${x} 打分"></div>`;
    c.querySelector("img").onclick = () => openLB(x);
    { // hover (or press and hold on a phone): show the source in place, to see what changed
      const box = c.querySelector(".imgbox"), im = box.querySelector("img");
      const resSrc = im.getAttribute("src"), srcSrc = `img/${pad(cur)}_src.jpg`;
      const on = () => { im.setAttribute("src", srcSrc); box.classList.add("peeking") };
      const off = () => { im.setAttribute("src", resSrc); box.classList.remove("peeking") };
      box.addEventListener("mouseenter", on);
      box.addEventListener("mouseleave", off);
      box.addEventListener("touchstart", on, { passive: true });
      box.addEventListener("touchend", off);
      box.addEventListener("touchcancel", off);
    }
    c.querySelector(".bestbtn").onclick = () => toggleBest(x);
    const seg = c.querySelector(".seg");
    RATE.forEach(([k, lab]) => {
      const b = document.createElement("button");
      b.type = "button";
      b.dataset.v = k;
      b.textContent = lab;
      const on = v.r && v.r[x] === k;
      b.className = on ? "on" : "";
      b.setAttribute("aria-pressed", on ? "true" : "false");
      b.onclick = () => rate(x, k);
      seg.appendChild(b);
    });
    grid.appendChild(c);
  });
  box.appendChild(grid);

  const act = document.createElement("div");
  act.className = "actions";
  act.innerHTML = `<button class="b" id="prev" type="button">← 上一题</button>
    <button class="b${v.none ? " on" : ""}" id="none" type="button">都不行 None</button>
    <button class="b primary" id="next" type="button"></button>
    <span class="hint" id="state"></span>`;
  box.appendChild(act);
  $("prev").disabled = cur === 0;
  $("prev").onclick = () => go(cur - 1);
  $("next").onclick = () => go(cur + 1);
  $("next").textContent = cur === TASKS.length - 1 ? "完成 →" : "下一题 →";
  $("none").onclick = toggleNone;
  const miss = 4 - rated(v);
  $("state").textContent = isDone(cur) ? "这题判完了" : (miss ? `还有 ${miss} 张没打分` : "") + (!v.none && !v.best.length ? (miss ? "," : "") + "还没选最好" : "");
  renderProgress();
}

function renderProgress() {
  const done = TASKS.filter((_, n) => isDone(n)).length;
  $("count").textContent = `${done} / ${TASKS.length}`;
  $("progbar").style.width = (100 * done / TASKS.length) + "%";
  const j = $("jump");
  j.replaceChildren();
  TASKS.forEach((_, n) => {
    const b = document.createElement("button");
    b.type = "button";
    b.textContent = n + 1;
    b.className = (isDone(n) ? "done" : isPart(n) ? "part" : "") + (n === cur ? " cur" : "");
    b.setAttribute("aria-label", `第 ${n + 1} 题` + (isDone(n) ? ",已判完" : ""));
    b.onclick = () => go(n);
    j.appendChild(b);
  });
  const w = $("donewrap");
  if (done === TASKS.length) {
    if (!w.firstChild) {
      w.innerHTML = `<div class="done-box"><b>63 题都判完了,谢谢!</b><span class="hint" id="donemsg"></span>
        <div class="actions"><button class="b" id="dl" type="button">下载结果 Download</button><button class="b" id="copy" type="button">复制结果 Copy</button><span class="hint" id="copied"></span></div>
        <textarea id="dump" readonly></textarea></div>`;
      $("dl").onclick = download;
      $("copy").onclick = async () => {
        try { await navigator.clipboard.writeText($("dump").value); $("copied").textContent = "已复制" }
        catch (e) { $("dump").select(); $("copied").textContent = "请手动 Ctrl/Cmd+C 复制框里的文字" }
      };
    }
    $("donemsg").textContent = ref ? "结果已经存到这个页面的数据库里,不用再做别的。" : "这个页面现在连不上数据库,结果只存在你的浏览器里:请点「复制结果」,把文字发给组织者。";
    $("dump").value = JSON.stringify(state);
  } else w.replaceChildren();
}

function download() {
  const a = document.createElement("a");
  const done = TASKS.filter((_, n) => isDone(n)).length;
  a.href = URL.createObjectURL(new Blob([JSON.stringify(state)], { type: "application/json" }));
  a.download = "human_study_" + (state.who || state.id.slice(0, 8)).replace(/[^\w\u4e00-\u9fff-]/g, "_") + "_" + done + "of63.json";
  document.body.appendChild(a); a.click(); a.remove();
}
$("dltop").onclick = download;

function edit(fn) {
  const k = pad(cur);
  const v = JSON.parse(JSON.stringify(V(cur)));
  fn(v);
  v.t = Date.now();
  state.votes[k] = v;
  lsSave();
  queueWrite();
  render();
}
function rate(x, k) { edit(v => { v.r = v.r || {}; v.r[x] = v.r[x] === k ? undefined : k; if (!v.r[x]) delete v.r[x] }) }
function toggleBest(x) { edit(v => { v.best = v.best.includes(x) ? v.best.filter(y => y !== x) : v.best.concat(x).sort(); if (v.best.length) v.none = false }) }
function toggleNone() { edit(v => { v.none = !v.none; if (v.none) v.best = [] }) }

// one write at a time to this viewer's own doc; batch rapid clicks
function queueWrite() {
  if (!ref) return;
  dirty = true;
  clearTimeout(timer);
  timer = setTimeout(flush, 700);
}
async function flush() { dirty = false }

function go(n) {
  if (n < 0) return;
  if (n >= TASKS.length) {
    const first = TASKS.findIndex((_, k) => !isDone(k));
    if (first < 0) { renderProgress(); $("donewrap").scrollIntoView({ block: "center" }); return }
    n = first;
  }
  cur = n;
  render();
  window.scrollTo({ top: 0 });
}

function openLB(x) {
  $("lbsrc").src = `img/${pad(cur)}_src.jpg`;
  $("lbres").src = x ? `img/${pad(cur)}_${x}.jpg` : `img/${pad(cur)}_src.jpg`;
  $("lbcap").textContent = x ? "结果 " + x : "原图 source";
  $("lb").hidden = false;
  $("lbclose").focus();
}
function closeLB() { $("lb").hidden = true }
$("lbclose").onclick = closeLB;
$("lb").addEventListener("click", e => { if (e.target === $("lb") || e.target.closest(".pair")) closeLB() });
document.addEventListener("keydown", e => {
  if (!$("lb").hidden) { if (e.key === "Escape") closeLB(); return }
  if (["INPUT", "TEXTAREA"].includes(e.target.tagName)) return;
  if (e.key === "ArrowRight") go(cur + 1);
  else if (e.key === "ArrowLeft") go(cur - 1);
});

$("who").value = state.who || "";
$("who").addEventListener("change", () => { state.who = $("who").value.trim(); lsSave(); queueWrite() });

{ const first = TASKS.findIndex((_, k) => !isDone(k)); cur = first < 0 ? 0 : first }
render();

$("save").textContent = "进度存在本机浏览器";
</script>
</body>
</html>