Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
3998 lines (3505 loc) · 190 KB
/
Copy pathindex.html
File metadata and controls
3998 lines (3505 loc) · 190 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
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="zh-CN" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>N度关系图生成器 / N-Degree Relationship Diagram Generator</title>
<script>
(function () {
// Apply saved theme before first paint to avoid FOUC / 首帧前应用已保存主题,避免闪烁
try {
var savedTheme = localStorage.getItem('selectedTheme');
var allowed = ['system', 'light', 'dark'];
var theme = allowed.indexOf(savedTheme) !== -1 ? savedTheme : 'light';
document.documentElement.setAttribute('data-theme', theme);
} catch (e) {
document.documentElement.setAttribute('data-theme', 'light');
}
})();
</script>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: var(--bg-color);
color: var(--text-color);
min-height: 100vh;
overflow: hidden; /* Use desktop layout for all devices / 所有设备均使用桌面端布局 */
transition: background-color 0.3s ease, color 0.3s ease;
}
/* Theme color variables / 主题颜色变量 */
:root {
--bg-color: #f5f5f5;
--text-color: #333;
--panel-bg: #f8f9fa;
--param-group-bg: #fdfdfd;
--ring-params-bg: #f0f8ff;
--ring-params-border: #d6e9ff;
--border-color: #e0e0e0;
--input-bg: #ffffff;
--button-bg: #007bff;
--button-hover: #0056b3;
--accent-color: #007bff;
}
/* Touch-friendly global styles / 触摸友好的全局样式 */
* {
/* Prevent callout menus on long press / 防止长按显示菜单 */
-webkit-touch-callout: none;
/* Prevent text selection on touch / 防止触摸时选择文本 */
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Allow text selection for input elements / 允许输入元素选择文本 */
input, textarea, select {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
/* Disable tap highlight on touch devices / 在触摸设备上禁用点击高亮 */
* {
-webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] {
--bg-color: #1a1a1a;
--text-color: #e0e0e0;
--panel-bg: #2d2d2d;
--param-group-bg: #383838;
--ring-params-bg: #2a3a4a;
--ring-params-border: #4a5a6a;
--border-color: #555;
--input-bg: #404040;
--button-bg: #0056b3;
--button-hover: #007bff;
--accent-color: #007bff;
}
@media (prefers-color-scheme: dark) {
[data-theme="system"] {
--bg-color: #1a1a1a;
--text-color: #e0e0e0;
--panel-bg: #2d2d2d;
--param-group-bg: #383838;
--ring-params-bg: #2a3a4a;
--ring-params-border: #4a5a6a;
--border-color: #555;
--input-bg: #404040;
--button-bg: #0056b3;
--button-hover: #007bff;
}
}
.main-container {
display: flex;
min-height: 100vh;
flex-direction: row; /* Always use desktop row layout / 始终使用桌面端的行布局 */
}
.preview-panel {
width: 100vh;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
background-color: var(--input-bg);
padding: 20px;
box-sizing: border-box;
position: relative;
}
.repo-link {
position: absolute;
top: 12px;
left: 16px;
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 8px;
color: var(--text-color);
text-decoration: none;
font-size: 13px;
z-index: 10;
}
.repo-link:hover { text-decoration: underline; }
.repo-link svg { display: block; }
/* Transient success toast / 短暂的成功提示浮标 */
.app-toast {
position: fixed;
left: 50%;
bottom: 24px;
transform: translateX(-50%) translateY(8px);
background-color: var(--panel-bg);
color: var(--text-color);
border: 1px solid var(--border-color);
border-radius: 6px;
padding: 10px 16px;
font-size: 14px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
z-index: 2000;
}
.app-toast.show {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(0);
}
.params-panel {
flex: 1;
background-color: var(--panel-bg);
padding: 20px;
overflow-y: auto;
border-left: 1px solid var(--border-color);
height: 100vh;
scrollbar-width: thin;
scrollbar-color: var(--text-color) var(--panel-bg);
min-width: 400px; /* Ensure minimum width for usability / 确保最小宽度以保证可用性 */
}
.params-panel::-webkit-scrollbar {
width: 8px;
}
.params-panel::-webkit-scrollbar-track {
background: #f1f1f1;
}
.params-panel::-webkit-scrollbar-thumb {
background: #888;
border-radius: 4px;
}
.params-panel::-webkit-scrollbar-thumb:hover {
background: #555;
}
h1 {
color: var(--text-color);
text-align: center;
margin-bottom: 30px;
font-size: 24px;
}
#svg-container {
background-color: transparent;
padding: 0;
width: 100%;
height: calc(100% - 140px);
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
#svg-container svg {
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
}
.controls {
display: flex;
align-items: center;
width: 100%;
height: 60px;
padding: 0;
margin-top: 20px;
position: relative;
}
#ringHoverTooltip {
position: absolute;
top: 0;
left: 0;
display: none;
pointer-events: none;
z-index: 20;
padding: 4px 8px;
border-radius: 6px;
font-size: 12px;
line-height: 1.3;
white-space: nowrap;
background-color: var(--panel-bg);
color: var(--text-color);
border: 1px solid var(--border-color);
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
will-change: transform;
}
#ringTooltipTitle {
font-weight: 600;
margin-bottom: 2px;
}
.controls button {
padding: 12px 20px; /* Increased padding for better touch targets / 增加padding以提供更好的触摸目标 */
border: none;
border-radius: 5px;
background-color: var(--button-bg);
color: white;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s ease;
min-height: 44px; /* iOS recommended minimum touch target size / iOS推荐的最小触摸目标尺寸 */
min-width: 44px; /* Minimum touch target width / 最小触摸目标宽度 */
touch-action: manipulation; /* Prevent double-tap zoom / 防止双击缩放 */
}
.controls button:hover {
background-color: var(--button-hover);
}
/* Touch-specific styles / 触摸专用样式 */
.controls button:active {
transform: scale(0.95); /* Touch feedback / 触摸反馈 */
background-color: var(--button-hover);
}
@media (hover: none) and (pointer: coarse) {
/* Touch device specific styles / 触摸设备专用样式 */
.controls button {
padding: 14px 22px; /* Even larger touch targets on touch devices / 触摸设备上更大的触摸目标 */
font-size: 16px;
min-height: 48px;
}
}
.controls .left-btn {
position: absolute;
left: 33.33%;
transform: translateX(-50%);
}
.controls .right-btn {
position: absolute;
left: 66.67%;
transform: translateX(-50%);
}
/* Desktop styles - wide aspect ratio with sufficient width / 桌面端样式 - 宽比高大且有足够宽度的情况 */
@media (min-aspect-ratio: 1/1) and (min-width: calc(100vh + 400px)) {
body {
overflow: hidden; /* Desktop doesn't need scrolling / 桌面端不需要滚动 */
}
.main-container {
flex-direction: row;
}
.preview-panel {
width: 100vh;
height: 100vh;
position: relative;
margin-top: 0;
}
.params-panel {
flex: 1;
border-left: 1px solid var(--border-color);
border-top: none;
height: 100vh;
margin-top: 0;
min-width: 400px;
padding-bottom: 20px;
position: static;
overflow-y: auto;
}
}
/* All narrow layouts - mobile portrait and desktop with insufficient width / 所有窄屏布局 - 移动端竖屏和桌面宽度不足 */
@media (max-aspect-ratio: 9999/10000), (min-aspect-ratio: 1/1) and (max-width: calc(100vh + 400px)) {
body {
overflow: auto;
}
.main-container {
flex-direction: column;
min-height: 100vh;
height: auto;
overflow: visible;
}
.preview-panel {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 60vh;
height: 60svh; /* Use small viewport units to avoid mobile browser address bar effects / 使用小视口单位避免移动端浏览器地址栏影响 */
z-index: 1000;
background: var(--input-bg);
overflow: hidden;
}
.params-panel {
position: fixed;
top: 60vh;
top: 60svh; /* Use small viewport units to avoid mobile browser address bar effects / 使用小视口单位避免移动端浏览器地址栏影响 */
left: 0;
right: 0;
bottom: 0;
border-left: none;
border-top: 1px solid var(--border-color);
overflow-y: auto;
overflow-x: hidden;
background-color: var(--panel-bg);
margin: 0;
padding: 15px;
padding-bottom: max(25px, env(safe-area-inset-bottom) + 15px);
/* Ensure content can scroll properly / 确保内容可以正确滚动 */
box-sizing: border-box;
-webkit-overflow-scrolling: touch;
/* Improved scrollbar styles / 改进滚动条样式 */
scrollbar-width: thin;
scrollbar-color: rgba(136, 136, 136, 0.5) transparent;
/* Reset desktop properties / 重置桌面端属性 */
flex: none;
height: auto;
min-width: auto;
}
/* Narrow layout scrollbar styles / 窄屏布局滚动条样式 */
.params-panel::-webkit-scrollbar {
width: 6px;
}
.params-panel::-webkit-scrollbar-track {
background: transparent;
border-radius: 3px;
}
.params-panel::-webkit-scrollbar-thumb {
background: rgba(136, 136, 136, 0.5);
border-radius: 3px;
border: none;
}
.params-panel::-webkit-scrollbar-thumb:hover {
background: rgba(136, 136, 136, 0.7);
}
.params-panel::-webkit-scrollbar-thumb:active {
background: rgba(136, 136, 136, 0.9);
}
h1 {
font-size: 20px;
margin-bottom: 15px;
}
}
.param-group {
margin-bottom: 20px;
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 15px;
background-color: var(--param-group-bg);
}
.param-group h3 {
margin: 0 0 15px 0;
color: var(--text-color);
font-size: 16px;
}
.param-row {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
flex-wrap: wrap;
}
/* 图例行样式 / Legend row styles */
.legend-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
margin-bottom: 10px;
flex-wrap: wrap;
}
.legend-checkbox {
display: flex;
align-items: center;
gap: 10px;
}
.legend-position {
display: flex;
align-items: center;
gap: 10px;
}
/* 语言与主题选择行样式 / Language and theme row styles */
.language-theme-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
margin-bottom: 10px;
flex-wrap: wrap;
}
.language-select,
.theme-select {
display: flex;
align-items: center;
gap: 10px;
}
/* Configuration row styles / 配置行样式 */
.config-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid var(--border-color);
flex-wrap: wrap;
}
.param-group .config-row button {
padding: 12px 20px; /* Increased padding for better touch targets / 增加padding以提供更好的触摸目标 */
border: 1px solid var(--border-color);
border-radius: 4px;
background: var(--bg-color);
color: var(--text-color);
cursor: pointer;
font-size: 14px;
transition: all 0.3s ease;
flex: 1;
min-width: 120px;
min-height: 44px; /* iOS recommended minimum touch target size / iOS推荐的最小触摸目标尺寸 */
touch-action: manipulation; /* Prevent double-tap zoom / 防止双击缩放 */
}
.param-group .config-row button:hover {
background: var(--accent-color);
color: white;
transform: translateY(-1px);
}
/* Touch feedback for config buttons / 配置按钮的触摸反馈 */
.param-group .config-row button:active {
transform: scale(0.95); /* Touch feedback / 触摸反馈 */
}
/* Basic-params header row: title + inline config buttons / 基本参数标题行:标题 + 内联配置按钮 */
.param-group-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-bottom: 15px;
}
.param-group-header h3 {
margin: 0;
}
/* Header config row: no separator, compact / 标题行配置行:无分隔线、紧凑 */
.param-group-header .config-row {
border-top: none;
margin-top: 0;
padding-top: 0;
gap: 6px;
}
/* Shrink header config buttons (override .param-group .config-row button) / 缩小标题行配置按钮 */
.param-group-header .config-row button {
padding: 4px 8px;
font-size: 12px;
min-width: 0;
min-height: 0;
flex: 0 0 auto;
}
/* Touch device specific config button styles / 触摸设备专用配置按钮样式 */
@media (hover: none) and (pointer: coarse) {
.param-group .config-row button {
padding: 14px 24px; /* Even larger padding on touch devices / 触摸设备上更大的padding */
font-size: 16px;
min-height: 48px;
}
.param-group-header .config-row button {
padding: 4px 8px;
font-size: 12px;
min-width: 0;
min-height: 0;
flex: 0 0 auto;
}
}
.param-row label {
min-width: 100px;
font-weight: bold;
color: var(--text-color);
}
.param-row input,
.param-row select,
.param-row textarea {
padding: 10px 12px; /* Increased padding for better touch targets / 增加padding以提供更好的触摸目标 */
border: 1px solid var(--border-color);
border-radius: 4px;
font-size: 14px;
background-color: var(--input-bg);
color: var(--text-color);
min-height: 20px; /* Ensure minimum touch height / 确保最小触摸高度 */
touch-action: manipulation; /* Prevent double-tap zoom / 防止双击缩放 */
}
/* Touch device specific input styles / 触摸设备专用输入样式 */
@media (hover: none) and (pointer: coarse) {
.param-row input,
.param-row select,
.param-row textarea {
padding: 12px 16px; /* Even larger padding on touch devices / 触摸设备上更大的padding */
font-size: 16px; /* Prevent zoom on iOS / 防止iOS缩放 */
min-height: 24px;
}
}
.param-row textarea {
width: 200px;
resize: vertical;
font-family: Arial, sans-serif;
line-height: 1.4;
}
.param-row input[type="number"] {
width: 45px;
}
.param-row input[type="number"].rotation-input {
width: 50px;
}
.rotation-control {
display: flex;
align-items: center;
gap: 8px;
}
.rotation-slider {
width: 120px;
height: 8px; /* Increased height for better touch target / 增加高度以提供更好的触摸目标 */
border-radius: 4px;
background: #ddd;
outline: none;
-webkit-appearance: none;
appearance: none;
touch-action: manipulation; /* Prevent double-tap zoom / 防止双击缩放 */
}
.rotation-slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px; /* Increased size for better touch target / 增加尺寸以提供更好的触摸目标 */
height: 20px;
border-radius: 50%;
background: #888;
cursor: pointer;
border: 2px solid #fff;
box-shadow: 0 0 3px rgba(0,0,0,0.3);
}
.rotation-slider::-moz-range-thumb {
width: 20px; /* Increased size for better touch target / 增加尺寸以提供更好的触摸目标 */
height: 20px;
border-radius: 50%;
background: #888;
cursor: pointer;
border: 2px solid #fff;
box-shadow: 0 0 3px rgba(0,0,0,0.3);
}
/* Touch device specific slider styles / 触摸设备专用滑块样式 */
@media (hover: none) and (pointer: coarse) {
.rotation-slider {
height: 12px; /* Even thicker track on touch devices / 触摸设备上更粗的轨道 */
}
.rotation-slider::-webkit-slider-thumb {
width: 28px; /* Even larger thumb on touch devices / 触摸设备上更大的滑块 */
height: 28px;
}
.rotation-slider::-moz-range-thumb {
width: 28px;
height: 28px;
}
}
.rotation-slider.solid-color::-webkit-slider-thumb {
background: var(--slider-color, #888);
}
.rotation-slider.solid-color::-moz-range-thumb {
background: var(--slider-color, #888);
}
.param-row input[type="color"] {
width: 60px; /* Increased size for better touch target / 增加尺寸以提供更好的触摸目标 */
height: 44px; /* iOS recommended minimum touch target height / iOS推荐的最小触摸目标高度 */
padding: 2px;
border: 1px solid #ddd;
border-radius: 4px;
cursor: pointer;
touch-action: manipulation; /* Prevent double-tap zoom / 防止双击缩放 */
}
/* Touch device specific color input styles / 触摸设备专用颜色输入样式 */
@media (hover: none) and (pointer: coarse) {
.param-row input[type="color"] {
width: 70px; /* Even larger on touch devices / 触摸设备上更大 */
height: 50px;
}
}
.ring-params {
display: flex;
align-items: stretch;
padding: 0;
border-radius: 6px;
border: 1px solid var(--ring-params-border);
margin-bottom: 15px;
background: var(--ring-params-bg);
position: relative;
}
/* Ring number column, digits upright and centered / 圈序号栏,数字正立居中 */
.ring-index {
flex: 0 0 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: bold;
color: var(--text-color);
background: var(--ring-params-border);
border-radius: 6px 0 0 6px;
}
/* Ring card content area / 圈卡片内容区 */
.ring-body {
flex: 1;
min-width: 0;
padding: 15px;
}
/* Balance inner padding: drop trailing margins on last children / 平衡内边距:去除末尾元素的下外边距 */
.param-group > :last-child { margin-bottom: 0; }
.ring-body > :last-child { margin-bottom: 0; }
.ring-params:last-child { margin-bottom: 0; }
.ring-params::after {
content: '';
position: absolute;
bottom: -8px;
left: 50%;
transform: translateX(-50%);
width: 80%;
height: 1px;
background: linear-gradient(to right, transparent, #ccc, transparent);
}
.ring-params:last-child::after {
display: none;
}
.error-message {
color: #dc3545;
font-size: 12px;
margin-top: 5px;
}
.param-group button {
padding: 12px 24px; /* Increased padding for better touch targets / 增加padding以提供更好的触摸目标 */
border: none;
border-radius: 5px;
background-color: var(--button-bg);
color: white;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s ease;
min-height: 44px; /* iOS recommended minimum touch target size / iOS推荐的最小触摸目标尺寸 */
min-width: 44px; /* Minimum touch target width / 最小触摸目标宽度 */
touch-action: manipulation; /* Prevent double-tap zoom / 防止双击缩放 */
}
.param-group button:hover {
background-color: var(--button-hover);
}
/* Touch feedback for param-group buttons / param-group按钮的触摸反馈 */
.param-group button:active {
transform: scale(0.95); /* Touch feedback / 触摸反馈 */
background-color: var(--button-hover);
}
.manual-input {
margin-top: 10px;
padding: 10px;
border: 1px solid var(--border-color);
border-radius: 4px;
background-color: var(--param-group-bg);
color: var(--text-color);
}
.manual-input label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.manual-input input {
width: 100%;
margin-bottom: 10px;
padding: 10px 12px;
border: 1px solid var(--border-color);
border-radius: 4px;
background-color: var(--input-bg);
color: var(--text-color);
}
</style>
</head>
<body>
<div id="appToast" class="app-toast" role="status" aria-live="polite"></div>
<div class="main-container">
<div class="preview-panel">
<a class="repo-link" href="https://github.com/fengdonglu/OpenC5" aria-label="GitHub repository" title="GitHub repository" target="_blank" rel="noopener">
<svg viewBox="0 0 16 16" width="18" height="18" aria-hidden="true" focusable="false"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>
<span>fengdonglu/OpenC5</span>
</a>
<h1 id="mainTitle">N-Degree Relationship Diagram Generator</h1>
<div id="svg-container">
<!-- SVG will be generated here by JavaScript / SVG将由JavaScript在这里生成 -->
</div>
<div id="ringHoverTooltip" role="tooltip" aria-hidden="true">
<div id="ringTooltipTitle"></div>
<div class="ring-tooltip-hint" id="ringTooltipHint"></div>
</div>
<div class="controls">
<button class="left-btn" onclick="copySVG()" id="copyBtn">复制 / Copy</button>
<button class="right-btn" onclick="downloadSVG()" id="downloadBtn">下载 / Download</button>
</div>
</div>
<div class="params-panel">
<div class="param-group">
<div class="param-group-header">
<h3 id="basicParamsTitle">基本参数 / Basic Parameters</h3>
<div class="config-row">
<button id="saveConfigBtn" onclick="saveConfiguration()">💾 Save</button>
<input type="file" id="loadConfigFile" accept=".json" style="display: none;" onchange="loadConfiguration(event)">
<button id="loadConfigBtn" onclick="document.getElementById('loadConfigFile').click()">📂 Load</button>
</div>
</div>
<div class="param-row language-theme-row">
<div class="language-select">
<label for="language" id="languageLabel">语言 / Language:</label>
<select id="language" onchange="switchLanguage(this.value)">
<option value="zh">🇨🇳 中文</option>
<option value="en" selected>🇺🇸 English</option>
</select>
</div>
<div class="theme-select">
<label for="theme" id="themeLabel">主题 / Theme:</label>
<select id="theme" onchange="switchTheme(this.value)">
<option value="system" id="themeSystemOption">跟随系统 / Follow System</option>
<option value="light" id="themeLightOption" selected>浅色 / Light</option>
<option value="dark" id="themeDarkOption">暗色 / Dark</option>
</select>
</div>
</div>
<div class="param-row">
<label for="centerName" id="nameLabel">名称 / Name:</label>
<textarea id="centerName" rows="3" placeholder="输入中心文字" onchange="updateCenterName(this.value)"
oninput="updateCenterName(this.value, true)"></textarea>
</div>
<div class="param-row">
<label for="ringCount" id="ringCountLabel">圈数 / Ring Count:</label>
<input type="number" id="ringCount" min="1" max="99" value="8" onchange="validateAndUpdateRings()">
<div id="ringCountError" class="error-message"></div>
</div>
<div class="param-row legend-row">
<div class="legend-checkbox">
<label for="showLegend" id="showLegendLabel">📊 显示图例 / Show Legend:</label>
<input type="checkbox" id="showLegend" checked onchange="updateLegendVisibility(this.checked)">
</div>
<div class="legend-position">
<label for="legendPosition" id="legendPositionLabel">📍 图例位置 / Legend Position:</label>
<select id="legendPosition" onchange="updateLegendPosition(this.value)">
<option value="right" id="legendRightOption">右侧 / Right Side</option>
<option value="bottomRight" id="legendBottomRightOption" selected>右下角 / Bottom Right</option>
</select>
</div>
</div>
</div>
<div class="param-group">
<h3 id="ringConfigTitle">圈层配置 / Ring Configuration</h3>
<div id="ringParams">
<!-- Dynamically generated ring parameters will be displayed here / 动态生成的圈层参数将在这里显示 -->
</div>
</div>
</div>
</div>
<script>
// Internationalization configuration / 国际化配置
// =================================================================
// 🌍 INTERNATIONALIZATION MANAGER MODULE / 国际化管理模块
// =================================================================
const InternationalizationManager = {
// Module metadata / 模块元数据
metadata: {
defaultLanguage: 'en',
fallbackLanguage: 'en'
},
// Module state / 模块状态
state: {
currentLanguage: 'en',
observers: new Set(),
cache: new Map()
},
// Language configuration / 语言配置
languageConfig: {
supportedLanguages: ['zh', 'en']
},
// Translation data / 翻译数据
translations: {
zh: {
// Page basic info / 页面基础信息
title: 'N度关系图生成器',
// Basic parameters section / 基础参数区
basicParams: '⚙️ 基本参数',
language: '🌍 语言',
name: '📝 名称',
namePlaceholder: '输入中心文字',
ringCount: '🔢 圈数',
invalidInteger: '请输入整数',
ringCountRange: '圈数需在 1–99 之间',
// Theme related / 主题相关
theme: '🌓 主题',
themeSystem: '跟随系统',
themeLight: '浅色',
themeDark: '暗色',
// Legend related / 图例相关
showLegend: '📊 显示图例',
legendPosition: '📍 图例位置',
legendRight: '右侧',
legendBottomRight: '右下角',
legendRing: '圈层',
legendContent: '内容',
// Configuration management / 配置管理
saveConfig: '💾 保存',
loadConfig: '📂 载入',
loadConfigSuccess: '配置载入成功!',
// Segment type names / 分段类型名称
segmentTypes: {
tiangan: '天干',
dizhi: '地支',
solarTerms: '节气',
xiantianBagua: '先天八卦',
houtianBagua: '后天八卦',
meridian: '时辰',
major: '大调',
minor: '小调',
zodiac: '星座',
animal: '属相',
manual: '手工输入'
},
// Action buttons / 操作按钮
downloadSVG: '💾 下载',
copySVG: '📋 复制',
copySuccess: 'SVG代码已复制到剪贴板!',
copyError: '复制失败,请手动复制',
// Ring configuration / 圈层配置
ringConfig: '🎯 圈层配置',
segmentType: '🏷️ 分段类型',
colorType: '🎨 颜色类型',
solid: '纯色',
segments: '多色',
color: '🔴 颜色',
rotation: '🔄 旋转角度',
segmentName: '分段名称',
segmentLabels: '扇区标签',
segmentLabelsHint: '用逗号分隔,如需输入逗号请使用 \\, 转义',
dragRotateHint: '✋ 按住并拖动可旋转'
},
en: {
// Page basic info / 页面基础信息
title: 'N-Degree Relationship Diagram Generator',
// Basic parameters section / 基础参数区
basicParams: '⚙️ Basic Parameters',
language: '🌍 Language',
name: '📝 Name',
namePlaceholder: 'Enter center text',
ringCount: '🔢 Ring Count',
invalidInteger: 'Please enter an integer',
ringCountRange: 'Ring count must be between 1 and 99',
// Theme related / 主题相关
theme: '🌓 Theme',
themeSystem: 'Follow System',
themeLight: 'Light',
themeDark: 'Dark',
// Legend related / 图例相关
showLegend: '📊 Show Legend',
legendPosition: '📍 Legend Position',
legendRight: 'Right Side',
legendBottomRight: 'Bottom Right',
legendRing: 'Ring',
legendContent: 'Content',
// Configuration management / 配置管理
saveConfig: '💾 Save',
loadConfig: '📂 Load',
loadConfigSuccess: 'Configuration loaded successfully!',