forked from UnluckyNinja/SBTI-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
732 lines (719 loc) · 20.8 KB
/
index.html
File metadata and controls
732 lines (719 loc) · 20.8 KB
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>SBTI 人格测试</title>
<style>
:root {
--bg: #f6faf6;
--panel: #ffffff;
--text: #1e2a22;
--muted: #6a786f;
--line: #dbe8dd;
--soft: #edf6ef;
--accent: #6c8d71;
--accent-strong: #4d6a53;
--shadow: 0 12px 32px rgba(47, 73, 55, 0.08);
--radius: 20px;
--safe-b: env(safe-area-inset-bottom, 0px);
--safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
background: radial-gradient(circle at top left, #f8fff8 0, #f6faf6 40%, #f2f7f3 100%);
color: var(--text);
min-height: 100vh;
min-height: 100dvh;
padding-top: var(--safe-t);
}
.shell {
max-width: 560px;
margin: 0 auto;
padding: 16px 14px calc(24px + var(--safe-b));
}
.card {
background: var(--panel);
border: 1px solid var(--line);
border-radius: var(--radius);
box-shadow: var(--shadow);
}
.screen { display: none; }
.screen.active { display: block; }
/* —— 首页 —— */
.hero {
padding: 28px 20px 24px;
text-align: center;
}
.hero h1 {
font-size: clamp(1.45rem, 5.5vw, 2rem);
line-height: 1.25;
letter-spacing: -0.02em;
margin: 0 0 20px;
}
.intro-actions-row {
display: flex;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
}
.intro-actions-row .btn-primary,
.intro-actions-row .btn-secondary {
flex: 1;
min-width: 132px;
max-width: 100%;
}
.intro-history {
margin-top: 16px;
text-align: left;
border: 1px solid var(--line);
border-radius: 14px;
padding: 0 12px 12px;
background: linear-gradient(180deg, #fbfffb, #f5faf6);
}
.intro-history summary {
cursor: pointer;
list-style: none;
font-size: 0.95rem;
font-weight: 700;
color: var(--accent-strong);
padding: 14px 4px 12px;
}
.intro-history summary::-webkit-details-marker { display: none; }
/* 历史区内:最近一次人格卡片(布局同结果页 result-top) */
.intro-latest-wrap { margin-bottom: 12px; }
.intro-latest-wrap .poster-image { max-height: 240px; }
.intro-latest-wrap .intro-history-view-btn {
margin-top: 12px;
margin-bottom: 0;
}
/* 完整结果入口,低调次要样式 */
.intro-history-view-btn {
width: 100%;
background: var(--panel);
color: var(--muted);
border: 1px solid var(--line);
padding: 10px 14px;
border-radius: 12px;
font-size: 0.875rem;
font-weight: 600;
min-height: 44px;
box-shadow: none;
text-align: center;
}
.intro-history-view-btn:hover {
color: var(--accent-strong);
border-color: #c5d8c9;
background: #fafcfb;
}
.intro-history-list {
margin: 0;
padding: 0;
list-style: none;
}
.intro-history-list li { margin-top: 8px; }
.history-item-row {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 12px;
border-radius: 12px;
border: 1px solid var(--line);
background: var(--soft);
}
.history-item-meta {
flex: 1;
min-width: 0;
font-size: 0.85rem;
color: var(--text);
line-height: 1.35;
}
.history-item-view-btn {
flex-shrink: 0;
padding: 8px 14px;
border-radius: 10px;
border: 1px solid var(--line);
background: var(--panel);
color: var(--accent-strong);
font: inherit;
font-size: 0.8rem;
font-weight: 600;
min-height: 36px;
touch-action: manipulation;
}
.history-item-view-btn:active {
opacity: 0.92;
}
/* 历史区块下方:低调红色描边,清除本机数据 */
.intro-clear-all-btn {
display: block;
width: 100%;
margin-top: 12px;
padding: 8px 12px;
border-radius: 10px;
border: 1px solid rgba(180, 55, 50, 0.38);
background: #fff;
color: #9e2a2a;
font: inherit;
font-size: 0.8rem;
font-weight: 600;
box-shadow: none;
touch-action: manipulation;
}
.intro-clear-all-btn:hover {
background: #fff8f7;
border-color: rgba(180, 55, 50, 0.5);
}
.intro-clear-all-btn:active {
opacity: 0.92;
}
.intro-privacy-note {
margin: 10px 0 0;
font-size: 0.78rem;
line-height: 1.55;
color: var(--muted);
text-align: center;
}
.intro-gallery-row {
margin-top: 14px;
text-align: center;
}
.intro-gallery-row + .intro-gallery-row {
margin-top: 6px;
}
.intro-gallery-link {
display: inline-block;
font-size: 0.9rem;
font-weight: 600;
color: var(--accent-strong);
text-decoration: none;
padding: 6px 4px;
border-radius: 8px;
}
.intro-gallery-link:hover {
text-decoration: underline;
text-underline-offset: 3px;
}
.author-note {
margin-top: 1.5rem;
font-size: 0.9rem;
color: var(--muted);
line-height: 1.6;
}
.intro-author-original-link {
margin-left: 0.25em;
color: var(--accent-strong);
font-weight: 600;
text-decoration: none;
}
.intro-author-original-link:hover {
text-decoration: underline;
text-underline-offset: 3px;
}
button {
border: 0;
cursor: pointer;
transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease;
font: inherit;
touch-action: manipulation;
}
button:disabled { cursor: not-allowed; opacity: 0.5; }
button:active:not(:disabled) { transform: scale(0.98); }
.btn-primary {
background: var(--accent-strong);
color: #fff;
padding: 14px 22px;
border-radius: 14px;
box-shadow: 0 10px 24px rgba(77, 106, 83, 0.2);
font-weight: 700;
min-height: 48px;
}
.btn-secondary {
background: #fff;
color: var(--accent-strong);
padding: 14px 20px;
border-radius: 14px;
border: 1px solid var(--line);
font-weight: 700;
min-height: 48px;
}
.btn-ghost {
background: transparent;
color: var(--muted);
padding: 10px 12px;
font-size: 0.9rem;
min-height: 44px;
}
/* —— 向导 —— */
.wizard-card-wrap {
padding-bottom: 8px;
}
.wizard-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 14px;
flex-wrap: wrap;
}
.wizard-head .wizard-prev-top {
padding: 10px 14px;
min-height: 40px;
font-size: 0.88rem;
border-radius: 12px;
}
.wizard-progress-track {
height: 8px;
background: #edf3ee;
border-radius: 999px;
overflow: hidden;
margin-bottom: 10px;
}
.wizard-progress-track > span {
display: block;
height: 100%;
width: 0;
background: linear-gradient(90deg, #97b59c, #5b7a62);
border-radius: inherit;
transition: width .2s ease;
}
.wizard-progress-label {
font-size: 13px;
color: var(--muted);
margin-bottom: 16px;
}
.question-card {
padding: 4px 2px 8px;
}
.question-meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 12px;
font-size: 12px;
color: var(--muted);
}
.badge {
display: inline-flex;
align-items: center;
padding: 6px 11px;
border-radius: 999px;
background: var(--soft);
border: 1px solid var(--line);
font-weight: 600;
color: var(--accent-strong);
}
.question-title {
font-size: 1.05rem;
line-height: 1.65;
margin: 0 0 16px;
white-space: pre-wrap;
font-weight: 650;
}
.options {
display: flex;
flex-direction: column;
gap: 10px;
--option-selected-bg: #e8f1ea;
/* --option-fill-ms 由内联样式与 JS 中 ADVANCE_DELAY_MS 同步 */
}
.option {
position: relative;
display: flex;
align-items: flex-start;
gap: 12px;
padding: 14px 14px;
min-height: 52px;
border-radius: 14px;
border: 1px solid var(--line);
background: #fff;
cursor: pointer;
overflow: hidden;
transition: border-color 0.18s ease, background 0.18s ease;
}
/* 选中且未在播放:整卡已是浅绿底 */
.option:has(input:checked):not(.option--progress) {
border-color: rgba(77, 106, 83, 0.22);
background: var(--option-selected-bg);
}
/* 播放进度中:底为白,浅绿由 fill 从左向右铺满 */
.option.option--progress:has(input:checked) {
border-color: var(--line);
background: #fff;
}
.option-fill {
position: absolute;
inset: 0;
width: 100%;
transform: scaleX(0);
transform-origin: left center;
border-radius: inherit;
background: var(--option-selected-bg);
pointer-events: none;
z-index: 0;
}
.option--progress .option-fill {
animation: option-fill-wipe var(--option-fill-ms, 560ms) linear forwards;
}
@keyframes option-fill-wipe {
from {
transform: scaleX(0);
}
to {
transform: scaleX(1);
}
}
.option.option--progress:has(input:checked) .option-code {
color: #3d5a42;
}
.option.option--progress:has(input:checked) .option-text {
font-weight: 600;
color: var(--text);
}
.option:has(input:checked):not(.option--progress) .option-code {
color: #3d5a42;
}
.option:has(input:checked):not(.option--progress) .option-text {
font-weight: 600;
color: var(--text);
}
.option input,
.option .option-code,
.option .option-text {
position: relative;
z-index: 1;
}
.option input {
margin-top: 3px;
accent-color: var(--accent-strong);
width: 1.15rem;
height: 1.15rem;
flex-shrink: 0;
}
.option-code {
font-weight: 800;
min-width: 1.25rem;
flex-shrink: 0;
}
/* 未选中:字母不用深绿,避免与选中/进度形成第三种强调色 */
.option:not(:has(input:checked)) .option-code {
color: var(--muted);
}
.option-text {
flex: 1;
line-height: 1.55;
font-size: 0.95rem;
}
.wizard-hint {
font-size: 13px;
color: var(--muted);
line-height: 1.6;
margin: 18px 0 8px;
min-height: 2.6em;
}
/* —— 结果 —— */
.result-wrap { padding: 18px 16px 24px; }
.result-top {
display: flex;
flex-direction: column;
gap: 16px;
}
.poster-box {
border: 1px solid var(--line);
border-radius: 18px;
padding: 14px;
background: linear-gradient(180deg, #ffffff, #f7fbf8);
overflow: hidden;
}
.poster-type-banner {
text-align: center;
margin-bottom: 12px;
}
.poster-type-lead {
font-size: 14px;
color: #5a6b62;
margin-bottom: 6px;
line-height: 1.35;
}
.poster-type-name {
font-size: clamp(1.1rem, 4vw, 1.45rem);
font-weight: 800;
color: var(--text);
line-height: 1.2;
}
.poster-type-code {
font-size: clamp(1.2rem, 4.2vw, 1.6rem);
font-weight: 800;
color: var(--accent-strong);
letter-spacing: 0.02em;
margin-top: 4px;
}
.poster-figure {
border-radius: 12px;
overflow: hidden;
background: rgba(255, 255, 255, 0.85);
}
.poster-box.no-image .poster-figure { display: none; }
.poster-image {
width: 100%;
max-height: 320px;
object-fit: contain;
border-radius: 12px;
background: transparent;
display: block;
}
.poster-caption {
margin-top: 12px;
font-size: 14px;
color: var(--muted);
line-height: 1.7;
}
.type-box {
border: 1px solid var(--line);
border-radius: 18px;
padding: 16px;
background: linear-gradient(180deg, #ffffff, #fbfdfb);
}
.type-kicker {
font-size: 12px;
color: var(--accent-strong);
margin-bottom: 6px;
letter-spacing: 0.04em;
}
.type-name {
font-size: clamp(1.35rem, 5vw, 1.85rem);
line-height: 1.15;
font-weight: 800;
letter-spacing: -0.02em;
}
.match {
margin-top: 14px;
display: inline-block;
padding: 8px 12px;
border-radius: 999px;
background: var(--soft);
border: 1px solid var(--line);
color: var(--accent-strong);
font-weight: 700;
font-size: 13px;
line-height: 1.4;
}
.type-subname {
margin-top: 10px;
color: var(--muted);
font-size: 14px;
line-height: 1.65;
}
.analysis-box, .dim-box, .note-box {
margin-top: 16px;
border: 1px solid var(--line);
border-radius: 18px;
padding: 16px;
background: linear-gradient(180deg, #ffffff, #fbfdfb);
}
.analysis-box h3, .dim-box h3, .note-box h3 {
margin: 0 0 12px;
font-size: 16px;
}
.analysis-box p {
margin: 0;
font-size: 15px;
line-height: 1.85;
color: #304034;
white-space: pre-wrap;
}
.dim-list { display: flex; flex-direction: column; gap: 10px; }
.dim-item {
border: 1px solid var(--line);
border-radius: 14px;
padding: 12px 14px;
background: #fff;
}
.dim-item-top {
display: flex;
justify-content: space-between;
gap: 10px;
flex-wrap: wrap;
margin-bottom: 6px;
}
.dim-item-name { font-size: 14px; font-weight: 700; }
.dim-item-score { font-size: 14px; font-weight: 800; color: var(--accent-strong); }
.dim-item p {
margin: 0;
font-size: 13px;
color: var(--muted);
line-height: 1.75;
}
.note-box p {
margin: 0;
font-size: 13px;
color: var(--muted);
line-height: 1.75;
}
details.author-box {
margin-top: 16px;
border: 1px solid var(--line);
border-radius: 18px;
background: linear-gradient(180deg, #ffffff, #fbfdfb);
overflow: hidden;
}
.author-box summary {
list-style: none;
cursor: pointer;
padding: 16px;
font-weight: 700;
display: flex;
justify-content: space-between;
align-items: center;
}
.author-box summary::-webkit-details-marker { display: none; }
.author-box summary::after {
content: '展开';
font-size: 12px;
color: var(--accent-strong);
}
.author-box[open] summary::after { content: '收起'; }
#authorContent {
border-top: 1px solid var(--line);
padding: 0 16px 16px;
font-size: 14px;
line-height: 1.85;
color: #304034;
}
#authorContent p { margin: 12px 0 0; }
.result-actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 20px;
}
.result-actions button { flex: 1; min-width: 140px; }
@media (min-width: 480px) {
.shell { padding-left: 20px; padding-right: 20px; }
}
</style>
</head>
<body>
<div class="shell">
<section id="intro" class="screen active">
<div class="hero card">
<h1 id="introTitle">SBTI</h1>
<div class="intro-actions-row" id="introActionsRow">
<button type="button" id="continueResumeBtn" class="btn-primary" hidden>继续测试</button>
<button type="button" id="startBtn" class="btn-secondary">开始测试</button>
</div>
<p class="intro-gallery-row">
<a class="intro-gallery-link" href="./wiki.html">SBTI 人格图鉴 · 浏览全部类型</a>
</p>
<p class="intro-gallery-row">
<a class="intro-gallery-link" href="./sbpki.html">SBKPI 图鉴 · 卡面展示</a>
</p>
<details class="intro-history" id="introHistory" hidden>
<summary id="introHistorySummary">历次结果</summary>
<div id="introLatestWrap" class="intro-latest-wrap" hidden>
<div class="result-top">
<div class="poster-box" id="introLatestPosterBox">
<div class="poster-type-banner">
<div class="poster-type-lead" id="introPosterTypeLead"></div>
<div class="poster-type-name" id="introPosterDisplayName"></div>
<div class="poster-type-code" id="introPosterCodeLabel"></div>
</div>
<div class="poster-figure">
<img id="introLatestPosterImg" class="poster-image" alt="" />
</div>
<div id="introLatestPosterCaption" class="poster-caption"></div>
</div>
<div class="type-box">
<div class="type-kicker" id="introLatestKicker"></div>
<div class="type-name" id="introLatestTypeName"></div>
<div class="match" id="introLatestBadge"></div>
<div class="type-subname" id="introLatestSub"></div>
</div>
</div>
<button type="button" id="viewLatestHistoryBtn" class="intro-history-view-btn" title="">
查看完整结果
</button>
</div>
<ul id="introHistoryList" class="intro-history-list"></ul>
</details>
<button type="button" id="clearAllLocalBtn" class="intro-clear-all-btn" hidden>
清除所有记录
</button>
<p class="intro-privacy-note" id="introPrivacyNote"></p>
<div class="author-note">
<span id="authorLine"></span><span class="author-note-sep" aria-hidden="true"> · </span><a id="authorOriginalLink" class="intro-author-original-link" href="#" target="_blank" rel="noopener noreferrer"></a>
</div>
</div>
</section>
<section id="wizard" class="screen">
<div class="wizard-card-wrap">
<div class="card" style="padding: 16px 16px 8px;">
<div class="wizard-head">
<button type="button" id="wizardBackHome" class="btn-ghost">← 首页</button>
<button type="button" id="wizardPrev" class="btn-secondary wizard-prev-top">上一题</button>
</div>
<div class="wizard-progress-track"><span id="wizardProgressBar"></span></div>
<div class="wizard-progress-label" id="wizardProgressText">0 / 0</div>
<div id="wizardQuestionHost"></div>
<p class="wizard-hint" id="wizardHint"></p>
</div>
</div>
</section>
<section id="result" class="screen">
<div class="result-wrap card">
<div class="result-top">
<div class="poster-box" id="posterBox">
<div class="poster-type-banner">
<div class="poster-type-lead" id="posterTypeLead"></div>
<div class="poster-type-name" id="posterTypeDisplayName"></div>
<div class="poster-type-code" id="posterTypeCodeLabel"></div>
</div>
<div class="poster-figure">
<img id="posterImage" class="poster-image" alt="" />
</div>
<div id="posterCaption" class="poster-caption"></div>
</div>
<div class="type-box">
<div class="type-kicker" id="resultModeKicker"></div>
<div class="type-name" id="resultTypeName"></div>
<div class="match" id="matchBadge"></div>
<div class="type-subname" id="resultTypeSub"></div>
</div>
</div>
<div class="analysis-box">
<h3 id="analysisTitle">该人格的简单解读</h3>
<p id="resultDesc"></p>
</div>
<div class="dim-box">
<h3 id="dimTitle">十五维度评分</h3>
<div id="dimList" class="dim-list"></div>
</div>
<div class="note-box">
<h3 id="noteTitle">友情提示</h3>
<p id="funNote"></p>
</div>
<details class="author-box">
<summary id="authorSummary">作者的话</summary>
<div id="authorContent"></div>
</details>
<div class="result-actions">
<button type="button" id="restartBtn" class="btn-secondary">再测一次</button>
<button type="button" id="toTopBtn" class="btn-primary">回到首页</button>
</div>
</div>
</section>
</div>
<script type="module" src="./js/sbti-app.js"></script>
<script>
window.addEventListener('load', function () {
if (!window.__sbtiAppLoaded) {
var t = document.getElementById('introTitle');
var b = document.getElementById('startBtn');
if (t) t.textContent = '无法加载测验脚本,请用本地 HTTP 服务打开本目录(如 npx serve)。';
if (b) b.disabled = true;
}
});
</script>