-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton.html
More file actions
1682 lines (1609 loc) · 72.7 KB
/
Copy pathbutton.html
File metadata and controls
1682 lines (1609 loc) · 72.7 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">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.5, user-scalable=yes, viewport-fit=cover">
<title>QQ机器人 · 按钮生成器</title>
<style>
:root {
--brand: #09F;
--brand-hover: #0086e0;
--brand-light: rgba(0, 153, 255, 0.10);
--success: #15D173;
--warning: #FFB300;
--error: #F74C30;
--text-primary: rgba(0, 0, 0, 0.9);
--text-secondary: rgba(60, 60, 67, 0.56);
--text-tertiary: rgba(60, 60, 67, 0.3);
--bg-page: #eff9ff;
--bg-card: #FFFFFF;
--bg-subtle: #F0F0F2;
--border: rgba(0, 0, 0, 0.1);
--border-light: rgba(0, 0, 0, 0.06);
--radius-lg: 16px;
--radius-md: 14px;
--radius-sm: 10px;
--shadow-card: 0 4px 12px rgba(174, 184, 191, 0.15);
--shadow-card-hover: 0 8px 24px rgba(120, 145, 165, 0.2);
}
* { box-sizing: border-box; margin: 0; }
.ic {
width: 1.15em;
height: 1.15em;
flex: 0 0 auto;
vertical-align: -0.2em;
pointer-events: none;
}
body {
background: linear-gradient(180deg, #e5f6ff 0%, #eff9ff 240px, #eff9ff 100%) fixed;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Roboto', system-ui, sans-serif;
padding: 32px 16px 48px;
color: var(--text-primary);
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
.container { max-width: 1080px; margin: 0 auto; }
h1 {
font-size: clamp(1.5rem, 5vw, 2.1rem);
font-weight: 700;
color: var(--text-primary);
letter-spacing: -0.02em;
margin-bottom: 4px;
}
h2 {
margin: 0;
font-size: clamp(1.1rem, 4vw, 1.3rem);
font-weight: 600;
color: var(--text-primary);
white-space: nowrap;
display: flex;
align-items: center;
gap: 8px;
}
h2::before {
content: '';
width: 4px;
height: 1.1em;
border-radius: 3px;
background: linear-gradient(180deg, var(--brand), #4db8ff);
}
.warning {
display: flex;
align-items: flex-start;
gap: 10px;
background: linear-gradient(180deg, #e5f6ff, #ffffff);
border: 1px solid rgba(0, 153, 255, 0.15);
padding: 14px 16px;
border-radius: var(--radius-md);
margin: 18px 0;
font-size: 0.88rem;
color: var(--text-secondary);
box-shadow: var(--shadow-card);
}
.warning-icon {
flex: 0 0 auto;
width: 20px;
height: 20px;
color: var(--brand);
margin-top: 1px;
}
.warning strong { color: var(--text-primary); font-weight: 600; }
.warning code {
background: rgba(0, 153, 255, 0.08);
color: var(--brand);
padding: 2px 6px;
border-radius: 5px;
font-size: 0.85em;
font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
}
.btn {
display: inline-flex;
align-items: center;
gap: 6px;
background: var(--brand);
color: #fff;
border: none;
border-radius: var(--radius-sm);
padding: 10px 20px;
font-weight: 600;
cursor: pointer;
margin-right: 8px;
margin-bottom: 8px;
font-size: 0.9rem;
box-shadow: 0 2px 8px rgba(0, 153, 255, 0.25);
transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn .ic { width: 1em; height: 1em; vertical-align: middle; }
.btn:hover { background: var(--brand-hover); box-shadow: 0 4px 14px rgba(0, 153, 255, 0.35); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 4px rgba(0, 153, 255, 0.25); }
.btn-secondary {
background: var(--bg-card);
color: var(--text-primary);
border: 1px solid var(--border);
box-shadow: none;
}
.btn-secondary:hover { background: var(--bg-subtle); box-shadow: none; }
.btn-lg { padding: 12px 28px; font-size: 0.98rem; border-radius: 12px; }
.output-section {
background: var(--bg-card);
border: 2px solid #fff;
border-radius: var(--radius-lg);
padding: 20px;
margin: 20px 0;
box-shadow: var(--shadow-card);
}
.output-toolbar {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-bottom: 4px;
}
.output {
background: #1E2430;
color: #E6EDF3;
border-radius: var(--radius-md);
padding: 18px;
font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
white-space: pre-wrap;
margin-top: 12px;
font-size: 0.85rem;
line-height: 1.6;
overflow-x: auto;
}
.button-row-editor {
background: var(--bg-card);
border: 2px solid #fff;
border-radius: var(--radius-lg);
padding: 18px;
margin-bottom: 16px;
box-shadow: var(--shadow-card);
transition: box-shadow 0.2s;
}
.button-row-editor:hover { box-shadow: var(--shadow-card-hover); }
.row-header {
display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
flex-wrap: wrap;
}
.row-header strong {
white-space: nowrap;
background: linear-gradient(135deg, var(--brand), #4db8ff);
padding: 5px 16px;
border-radius: 20px;
color: #fff;
font-size: 0.85rem;
font-weight: 600;
box-shadow: 0 2px 6px rgba(0, 153, 255, 0.25);
}
.button-item {
background: linear-gradient(180deg, #f7fbff, #ffffff);
border-radius: var(--radius-md);
padding: 16px;
margin: 12px 0;
border: 1px solid rgba(0, 153, 255, 0.1);
}
.small-btn { padding: 6px 14px; font-size: 0.82rem; }
.field-group {
display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
margin-right: 14px; margin-bottom: 8px;
}
.field-group label {
font-weight: 600; color: var(--text-primary); min-width: 64px; font-size: 0.85rem;
}
.field-group input, .field-group select {
padding: 7px 12px;
border-radius: var(--radius-sm);
border: 1px solid var(--border);
background: var(--bg-card);
font-size: 0.88rem;
color: var(--text-primary);
transition: border-color 0.15s, box-shadow 0.15s;
}
.field-group input:focus, .field-group select:focus {
outline: none;
border-color: var(--brand);
box-shadow: 0 0 0 3px var(--brand-light);
}
.hint-note {
color: var(--text-secondary); font-size: 0.75rem; margin-left: 4px; white-space: nowrap;
}
.warn-note {
color: #b7791f; font-size: 0.75rem; margin-left: 4px; white-space: nowrap;
}
.auto-prefix-note { font-size: 0.75rem; color: var(--brand); margin-left: 6px; display: inline-flex; align-items: center; gap: 2px; }
.auto-prefix-note .ic { width: 0.9em; height: 0.9em; }
.error-text { color: var(--error); font-weight: 500; }
.error-text:empty { display: none; }
.error-text .ic { width: 1em; height: 1em; vertical-align: -0.15em; margin-right: 4px; }
.success-tip {
background: rgba(21, 209, 115, 0.12); color: #0e8f4d; padding: 8px 16px; border-radius: 20px;
font-weight: 600; display: inline-flex; align-items: center; gap: 5px; margin-left: 16px;
opacity: 0; transition: opacity 0.2s;
font-size: 0.85rem;
}
.success-tip.show { opacity: 1; }
.success-tip .ic { width: 1.05em; height: 1.05em; }
.status-msg {
display: inline-flex; align-items: center; gap: 5px;
padding: 5px 12px; border-radius: 16px; font-size: 0.82rem; font-weight: 500;
}
.status-msg .ic { width: 1.05em; height: 1.05em; }
.status-msg.is-success { background: rgba(21, 209, 115, 0.12); color: #0e8f4d; }
.status-msg.is-error { background: rgba(247, 76, 48, 0.12); color: var(--error); }
.import-result { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.import-warn {
display: inline-flex; align-items: flex-start; gap: 6px;
background: rgba(199, 123, 30, 0.1); color: #c77b1e;
padding: 7px 12px; border-radius: 10px; font-size: 0.82rem; line-height: 1.5;
}
.import-warn .ic { width: 1.05em; height: 1.05em; flex: 0 0 auto; margin-top: 1px; }
.add-row-section {
margin: 16px 0 20px;
display: flex;
align-items: center;
gap: 16px;
}
.add-row-section span { color: var(--text-secondary); font-size: 0.85rem; }
.row-footer {
margin-top: 12px;
padding-top: 10px;
border-top: 1px solid var(--border-light);
display: flex;
justify-content: flex-end;
}
.preview-section {
background: var(--bg-card);
border: 2px solid #fff;
border-radius: var(--radius-lg);
padding: 20px;
margin: 18px 0 20px;
box-shadow: var(--shadow-card);
}
.preview-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
margin-bottom: 12px;
}
.preview-container {
background: var(--bg-subtle);
border: 1px solid var(--border-light);
border-radius: var(--radius-md);
padding: 12px;
max-width: 460px;
min-height: 72px;
}
.preview-container.small-font .preview-button {
height: 19px;
border-radius: 4px;
font-size: 0.62rem;
padding: 0 6px;
}
.chat-preview {
background: var(--bg-subtle);
border: 1px solid var(--border-light);
border-radius: var(--radius-md);
max-width: 460px;
overflow: hidden;
}
.chat-header {
background: var(--bg-card);
border-bottom: 1px solid var(--border-light);
padding: 11px 14px;
color: var(--text-primary);
font-weight: 600;
font-size: 0.9rem;
}
.chat-body {
padding: 12px;
min-height: 160px;
}
.markdown-preview {
background: var(--bg-card);
border-radius: var(--radius-sm);
padding: 10px 12px;
margin: 0 0 8px;
color: var(--text-primary);
box-shadow: var(--shadow-card);
font-size: 0.9rem;
}
.preview-container.small-font .markdown-preview {
font-size: 0.78rem;
}
.chat-message {
max-width: 82%;
width: fit-content;
background: var(--bg-card);
border-radius: var(--radius-md);
padding: 10px 12px;
margin-bottom: 10px;
color: var(--text-primary);
box-shadow: var(--shadow-card);
font-size: 0.9rem;
}
.chat-message.user {
margin-left: auto;
background: var(--brand);
color: #fff;
}
.chat-message.status {
margin-left: auto;
margin-right: auto;
background: #FFF8E6;
color: #7a5a00;
font-size: 0.82rem;
}
.chat-message.success {
background: rgba(21, 209, 115, 0.12);
color: #0e8f4d;
}
.chat-spinner {
display: inline-block;
width: 12px;
height: 12px;
border: 2px solid rgba(0, 0, 0, 0.1);
border-top-color: var(--brand);
border-radius: 50%;
margin-right: 6px;
vertical-align: -2px;
animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.chat-input-bar {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
background: var(--bg-card);
border-top: 1px solid var(--border-light);
}
.chat-input {
flex: 1;
min-height: 34px;
border: 1px solid var(--border);
border-radius: 18px;
color: var(--text-secondary);
padding: 8px 12px;
background: var(--bg-page);
font-size: 0.85rem;
}
.chat-send-btn {
border: none;
border-radius: 18px;
padding: 8px 14px;
background: var(--brand);
color: #fff;
font-weight: 600;
cursor: pointer;
}
.chat-send-btn:hover { background: var(--brand-hover); }
.subscribe-modal-mask {
position: fixed;
inset: 0;
background: rgba(15, 23, 42, 0.35);
display: none;
align-items: center;
justify-content: center;
z-index: 1000;
padding: 20px;
}
.subscribe-modal-mask.show { display: flex; }
.subscribe-modal {
width: min(360px, 100%);
background: var(--bg-card);
border-radius: var(--radius-lg);
padding: 20px;
box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
color: var(--text-primary);
}
.subscribe-modal h3 {
margin: 0 0 8px;
color: var(--text-primary);
font-size: 1.1rem;
font-weight: 600;
}
.subscribe-modal p {
margin: 0 0 16px;
color: var(--text-secondary);
font-size: 0.9rem;
}
.subscribe-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
}
.preview-empty {
color: var(--text-secondary);
text-align: center;
padding: 16px;
font-size: 0.9rem;
}
.preview-row {
display: flex;
gap: 6px;
margin-bottom: 6px;
}
.preview-row:last-child { margin-bottom: 0; }
.preview-button {
flex: 1 1 0;
min-width: 0;
height: 38px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--bg-card);
color: var(--text-primary);
display: flex;
align-items: center;
justify-content: center;
padding: 0 10px;
font-size: 0.9rem;
line-height: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
transition: opacity 0.15s, filter 0.15s, transform 0.1s;
position: relative;
}
.preview-button:hover { transform: translateY(-1px); }
.preview-button.style-0 {
border-color: var(--border);
color: var(--text-primary);
background: var(--bg-card);
}
.preview-button.style-1 {
border-color: rgba(0, 153, 255, 0.4);
color: var(--brand);
background: var(--bg-card);
}
.preview-button.style-2 {
border-color: var(--border);
color: var(--text-primary);
background: var(--bg-card);
gap: 4px;
}
.preview-ai-icon {
width: 16px;
height: 16px;
flex: 0 0 auto;
}
.preview-container.small-font .preview-ai-icon {
width: 10px;
height: 10px;
}
.preview-button.style-3 {
border-color: rgba(247, 76, 48, 0.4);
color: var(--error);
background: var(--bg-card);
}
.preview-button.style-4 {
border-color: var(--brand);
color: #fff;
background: var(--brand);
}
.preview-button.visited {
opacity: 0.85;
}
.preview-button.disabled {
opacity: 0.45;
filter: grayscale(1);
pointer-events: none;
}
.required-hint { color: var(--error); margin-left: 4px; }
.future-note {
background: #FFF8E6;
color: #7a5a00;
font-size: 0.7rem;
padding: 2px 8px;
border-radius: 20px;
margin-left: 6px;
}
.panel {
margin: 12px 0 18px;
background: var(--bg-card);
border: 2px solid #fff;
border-radius: var(--radius-lg);
padding: 16px 18px;
box-shadow: var(--shadow-card);
transition: box-shadow 0.2s;
}
.panel:hover { box-shadow: var(--shadow-card-hover); }
.panel > summary {
font-weight: 600;
font-size: 1rem;
cursor: pointer;
color: var(--text-primary);
list-style: none;
display: flex;
align-items: center;
gap: 8px;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after {
content: '›';
margin-left: auto;
display: inline-block;
transition: transform 0.2s;
color: var(--text-tertiary);
font-size: 1.3em;
transform: rotate(90deg);
}
.panel[open] > summary::after { transform: rotate(-90deg); }
.panel p { color: var(--text-secondary); }
.panel code {
background: rgba(0, 153, 255, 0.08);
color: var(--brand);
padding: 1px 5px;
border-radius: 5px;
font-size: 0.85em;
font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
}
.panel label {
display: flex;
flex-direction: column;
gap: 5px;
font-size: 0.82rem;
font-weight: 600;
color: var(--text-secondary);
}
.panel select, .panel input {
padding: 8px 12px;
border-radius: var(--radius-sm);
border: 1px solid var(--border);
background: var(--bg-card);
font-size: 0.88rem;
color: var(--text-primary);
font-weight: 400;
transition: border-color 0.15s, box-shadow 0.15s;
}
.panel select:focus, .panel input:focus {
outline: none;
border-color: var(--brand);
box-shadow: 0 0 0 3px var(--brand-light);
}
.header-bar {
display: flex;
align-items: center;
gap: 20px;
flex-wrap: wrap;
margin: 24px 0 14px;
}
.app-header {
background: linear-gradient(135deg, #09F 0%, #4db8ff 100%);
border-radius: 20px;
padding: 24px 26px;
margin-bottom: 20px;
color: #fff;
box-shadow: 0 8px 24px rgba(0, 153, 255, 0.28);
position: relative;
overflow: hidden;
}
.app-header::after {
content: '';
position: absolute;
right: -40px;
top: -60px;
width: 200px;
height: 200px;
background: rgba(255, 255, 255, 0.12);
border-radius: 50%;
}
.app-header h1 {
color: #fff;
margin-bottom: 6px;
position: relative;
}
.app-header .subtitle {
color: rgba(255, 255, 255, 0.9);
font-size: 0.9rem;
position: relative;
}
.header-bar label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.toolbar-select {
padding: 7px 12px;
border-radius: var(--radius-sm);
border: 1px solid var(--border);
background: var(--bg-card);
font-size: 0.88rem;
color: var(--text-primary);
}
.import-textarea {
width: 100%;
min-height: 150px;
border-radius: var(--radius-sm);
border: 1px solid var(--border);
padding: 12px;
font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
font-size: 0.85rem;
box-sizing: border-box;
color: var(--text-primary);
background: var(--bg-page);
resize: vertical;
}
.import-textarea:focus {
outline: none;
border-color: var(--brand);
box-shadow: 0 0 0 3px var(--brand-light);
}
.note {
color: var(--text-secondary);
font-size: 0.85rem;
margin: 16px 0 4px;
}
footer {
color: var(--text-tertiary);
font-size: 0.8rem;
margin-top: 8px;
padding-bottom: 12px;
display: flex;
align-items: center;
gap: 5px;
}
@media (max-width: 640px) {
body { padding: 12px 8px; }
.field-group { width: 100%; }
.field-group label { min-width: 80px; }
.btn { padding: 8px 14px; font-size: 0.85rem; }
.hint-note { white-space: normal; }
.preview-container { max-width: none; }
.chat-preview { max-width: none; }
.preview-button { font-size: 0.82rem; padding: 0 6px; }
}
</style>
</head>
<body>
<svg width="0" height="0" style="position:absolute; overflow:hidden;" aria-hidden="true" focusable="false">
<symbol id="ic-robot" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<rect x="4" y="8" width="16" height="12" rx="3"></rect>
<path d="M12 8V4M12 4h-1.5M12 4h1.5"></path>
<circle cx="9" cy="14" r="1.2" fill="currentColor" stroke="none"></circle>
<circle cx="15" cy="14" r="1.2" fill="currentColor" stroke="none"></circle>
<path d="M2.5 12v3M21.5 12v3"></path>
</symbol>
<symbol id="ic-info" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="9"></circle>
<path d="M12 11v5M12 8h.01"></path>
</symbol>
<symbol id="ic-import" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 3v11m0 0l-4-4m4 4l4-4"></path>
<path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"></path>
</symbol>
<symbol id="ic-settings" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="3"></circle>
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
</symbol>
<symbol id="ic-eye" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"></path>
<circle cx="12" cy="12" r="3"></circle>
</symbol>
<symbol id="ic-plus" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 5v14M5 12h14"></path>
</symbol>
<symbol id="ic-trash" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"></path>
<path d="M10 11v6M14 11v6"></path>
</symbol>
<symbol id="ic-copy" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="12" height="12" rx="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</symbol>
<symbol id="ic-sparkle" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3z"></path>
<path d="M19 15l.8 1.9 1.9.8-1.9.8L19 20.4l-.8-1.9-1.9-.8 1.9-.8L19 15z"></path>
</symbol>
<symbol id="ic-download" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 4v10m0 0l-3.5-3.5M12 14l3.5-3.5"></path>
<path d="M5 18h14"></path>
</symbol>
<symbol id="ic-font" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 18l4.5-12h1L15 18M6.6 14h6.8"></path>
<path d="M15 18l2.7-7h.6L21 18M16.1 15.5h4.3"></path>
</symbol>
<symbol id="ic-bolt" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M13 2L4.5 13.5H11l-1 8.5L19.5 10H13l0-8z"></path>
</symbol>
<symbol id="ic-warn" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M10.3 3.9L1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"></path>
<path d="M12 9v4M12 17h.01"></path>
</symbol>
<symbol id="ic-leaf" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10z"></path>
<path d="M2 21c0-3 1.85-5.36 5.08-6"></path>
</symbol>
<symbol id="ic-check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="9"></circle>
<path d="M8 12.5l2.5 2.5L16 9.5"></path>
</symbol>
<symbol id="ic-x" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="9"></circle>
<path d="M15 9l-6 6M9 9l6 6"></path>
</symbol>
<symbol id="message_ai_24_icon" viewBox="0 0 24 24">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.82532 18.3693C3.44835 16.8851 1.85693 14.1719 1.85693 11.0707C1.85693 6.37686 5.50261 2.57178 9.99978 2.57178H13.4283C17.9255 2.57178 21.5712 6.37686 21.5712 11.0707C21.5712 15.3281 18.5718 18.8544 14.6582 19.4733L14.6548 19.4754L14.6538 19.4794C14.6559 19.4918 14.6595 19.5072 14.6642 19.5255C14.7176 19.7286 14.9295 20.2817 15.1773 20.9025C15.2021 20.9646 15.2203 21.0267 15.2324 21.0882L15.2368 21.1121C15.252 21.2005 15.2548 21.2876 15.2466 21.372C15.1844 22.0119 14.4924 22.4951 13.831 22.185L6.78031 18.8794L5.82532 18.3693ZM12.9598 19.7431L12.9617 19.7546C12.9712 19.8128 12.9118 19.8607 12.8584 19.8356L7.49573 17.3215L6.73321 16.9151C4.85648 15.7433 3.57116 13.5789 3.57116 11.0706C3.57116 7.2537 6.51773 4.28601 9.99973 4.28601H13.4283C16.9103 4.28601 19.8568 7.2537 19.8568 11.0706C19.8568 14.5267 17.4298 17.3002 14.3886 17.7802C13.4602 17.9268 12.8115 18.7987 12.9598 19.7431Z" fill="url(#message_ai_paint0)"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.9439 12.3955C12.8887 12.4166 12.845 12.4601 12.8237 12.5152L12.0385 14.5461C11.9697 14.7239 11.7181 14.7239 11.6493 14.5461L10.8641 12.5152C10.8428 12.4601 10.7991 12.4166 10.7439 12.3955L8.70358 11.6168C8.52459 11.5485 8.52459 11.2953 8.70358 11.227L10.7439 10.4482C10.7991 10.4272 10.8428 10.3837 10.8641 10.3286L11.6493 8.2977C11.7181 8.11984 11.9697 8.11984 12.0385 8.2977L12.8237 10.3286C12.845 10.3837 12.8887 10.4272 12.9439 10.4482L14.9842 11.227C15.1632 11.2953 15.1632 11.5485 14.9842 11.6168L12.9439 12.3955Z" fill="url(#message_ai_paint1)"></path>
<defs>
<radialGradient id="message_ai_paint0" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(33.3938 28.0782) rotate(-144.727) scale(44.1686 48.1906)">
<stop stop-color="#9AFF35"></stop>
<stop offset="0.326433" stop-color="#FF9254"></stop>
<stop offset="0.564139" stop-color="#CB69FF"></stop>
<stop offset="0.9021" stop-color="#6F57FF"></stop>
</radialGradient>
<radialGradient id="message_ai_paint1" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(33.3937 28.0784) rotate(-144.727) scale(44.1686 48.1906)">
<stop stop-color="#9AFF35"></stop>
<stop offset="0.326433" stop-color="#FF9254"></stop>
<stop offset="0.564139" stop-color="#CB69FF"></stop>
<stop offset="0.9021" stop-color="#6F57FF"></stop>
</radialGradient>
</defs>
</symbol>
</svg>
<div class="container">
<header class="app-header">
<h1><svg class="ic"><use href="#ic-robot"></use></svg> 按钮生成器</h1>
<div class="subtitle">QQ 机器人 Markdown 键盘按钮可视化编辑 · 生成 / 导入 / 预览</div>
</header>
<div class="warning">
<svg class="ic warning-icon"><use href="#ic-info"></use></svg>
<div><strong>必须携带 Markdown!</strong> 平台禁止单独发送键盘。<br>
<code>this.e.reply([segment.markdown('群主是人机'), keyboard])</code></div>
</div>
<!-- 标题 + 格式/小字体/预填 -->
<div class="header-bar">
<h2>动态多行按钮编辑</h2>
<div style="display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-left:auto;">
<label>输出格式:
<select id="outputFormat" class="toolbar-select">
<option value="segment">框架代码 (segment.raw)</option>
<option value="json">通用 JSON</option>
</select>
</label>
<label><svg class="ic"><use href="#ic-font"></use></svg> 全局小字体:
<select id="globalSmallFont" class="toolbar-select">
<option value="no" selected>默认大小</option>
<option value="small">small (小字体)</option>
</select>
</label>
<label style="display:flex; align-items:center; gap:4px;">
<input type="checkbox" id="prefillSample" checked> 预填示例
</label>
</div>
</div>
<!-- 通用 JSON 导入 -->
<details class="panel" id="importSection">
<summary><svg class="ic"><use href="#ic-import"></use></svg> 通用 JSON 导入 (转为按钮并可继续编辑)</summary>
<p style="font-size:0.85rem; margin:12px 0;">粘贴按钮 JSON,支持 <code>{"rows":[...]}</code>、<code>{"content":{"rows":[...]}}</code>、<code>{"type":"keyboard","content":{"rows":[...]}}</code>,也支持客户端返回的数字字段 protobuf 结构(含最外层 <code>"53"</code> 包裹)。导入后会转成可视化按钮继续编辑。</p>
<textarea id="importInput" class="import-textarea" placeholder='{"rows":[{"buttons":[{"id":"btn_1","render_data":{"label":"日签","visited_label":"已签到","style":1},"action":{"type":2,"permission":{"type":2},"data":"#签到","unsupport_tips":"请升级QQ版本"}}]}]}'></textarea>
<div style="margin-top:10px; display:flex; align-items:center; gap:10px; flex-wrap:wrap;">
<button class="btn" id="importBtn"><svg class="ic"><use href="#ic-import"></use></svg> 导入并预览</button>
<button class="btn btn-secondary" id="importCurrentBtn"><svg class="ic"><use href="#ic-download"></use></svg> 载入当前按钮JSON</button>
<span id="importMsg" style="font-size:0.85rem;"></span>
</div>
</details>
<!-- 动态按钮编辑区域 -->
<div id="rowsContainer"></div>
<!-- 添加一行按钮 -->
<div class="add-row-section">
<button class="btn" id="addRowBtn"><svg class="ic"><use href="#ic-plus"></use></svg> 添加一行</button>
<span>按钮最多五行</span>
</div>
<!-- 全局默认属性 -->
<details class="panel">
<summary><svg class="ic"><use href="#ic-settings"></use></svg> 全局默认属性 (新按钮预填)</summary>
<div style="display:grid; grid-template-columns:repeat(auto-fill, minmax(180px,1fr)); gap:12px; margin-top:16px;">
<label>样式: <select id="defaultStyle">
<option value="0">0 灰框</option><option value="1" selected>1 蓝框</option><option value="2">2 智能体(推荐回复)</option><option value="3">3 红框</option><option value="4">4 蓝底白字</option>
</select></label>
<label>类型: <select id="defaultType">
<option value="0">0 链接</option><option value="1">1 回调</option><option value="2" selected>2 指令</option><option value="3">3 native</option><option value="4">4 订阅</option><option value="5">5 自定义</option>
</select></label>
<label>权限: <select id="defaultPerm">
<option value="0">0 指定用户</option><option value="1">1 管理员</option><option value="2" selected>2 所有人</option><option value="3">3 身份组</option>
</select></label>
<label>enter: <select id="defaultEnter"><option value="false">否</option><option value="true">是</option></select></label>
<label>reply: <select id="defaultReply"><option value="false">否</option><option value="true">是</option></select></label>
<label>不支持提示: <input id="defaultUnsupport" placeholder="unsupport_tips" value="请升级QQ版本"></label>
<label>点击限制: <input id="defaultClickLimit" type="number" placeholder="可选"></label>
<label>anchor: <select id="defaultAnchor"><option value="0">0 无</option><option value="1">1 选图器</option></select></label>
</div>
</details>
<section class="preview-section">
<div class="preview-header">
<h2>按钮预览</h2>
<button class="btn btn-secondary small-btn" id="resetPreviewBtn">重置预览状态</button>
</div>
<div class="chat-preview">
<div class="chat-header">QQ 聊天预览</div>
<div class="chat-body" id="chatPreviewBody">
</div>
<div class="preview-container" id="buttonPreview">
<div class="markdown-preview">操作提示</div>
<div class="preview-empty">暂无按钮</div>
</div>
<div class="chat-input-bar">
<div class="chat-input" id="chatInputPreview">点击按钮后,这里会模拟输入或发送结果</div>
<button type="button" class="chat-send-btn" id="chatSendPreviewBtn">发送</button>
</div>
</div>
</section>
<div class="subscribe-modal-mask" id="subscribeModal">
<div class="subscribe-modal">
<h3>订阅提醒</h3>
<p id="subscribeModalText">是否订阅该按钮消息?</p>
<div class="subscribe-actions">
<button class="btn btn-secondary small-btn" id="cancelSubscribeBtn">取消</button>
<button class="btn small-btn" id="confirmSubscribeBtn">订阅</button>
</div>
</div>
</div>
<section class="output-section">
<div class="output-toolbar">
<button class="btn btn-lg" id="genBtn"><svg class="ic"><use href="#ic-sparkle"></use></svg> 生成代码</button>
<button class="btn btn-secondary" id="copyBtn"><svg class="ic"><use href="#ic-copy"></use></svg> 复制</button>
<span id="successMessage" class="success-tip"><svg class="ic"><use href="#ic-check"></use></svg><span>生成成功!可点击复制</span></span>
</div>
<div id="errorMsg" class="error-text" style="min-height:24px;"></div>
<div class="output" id="outputCode">// 点击生成按钮显示代码</div>
</section>
<p class="note">群主一定是机器人,嘿群主壳,人群主机</p>
<footer><svg class="ic"><use href="#ic-leaf"></use></svg> QQBot-Plugin</footer>
</div>
<script>
(function(){
let rows = [];
const prefillCheck = document.getElementById('prefillSample');
const successMsg = document.getElementById('successMessage');
const previewContainer = document.getElementById('buttonPreview');
const chatBody = document.getElementById('chatPreviewBody');
const chatInputPreview = document.getElementById('chatInputPreview');
const subscribeModal = document.getElementById('subscribeModal');
const subscribeModalText = document.getElementById('subscribeModalText');
let previewState = { clickedButtons: {}, selectedGroups: {} };
let pendingSubscribeButton = null;
let successTimer = null;
function icon(id) {
return '<svg class="ic"><use href="#' + id + '"></use></svg>';
}
// 在目标元素渲染带图标的状态徽章
function setStatus(el, type, text) {
if (!text) { el.className = el.id === 'importMsg' ? '' : 'error-text'; el.innerHTML = ''; return; }
const ic = type === 'success' ? 'ic-check' : 'ic-x';
el.className = 'status-msg is-' + type;
el.innerHTML = icon(ic) + '<span>' + text + '</span>';
}
function setError(text) {
const el = document.getElementById('errorMsg');
if (!text) { el.innerHTML = ''; return; }
el.innerHTML = icon('ic-x') + text;
}
function showSuccessTip(message = '生成成功!可点击复制') {
if (successTimer) clearTimeout(successTimer);
successMsg.innerHTML = icon('ic-check') + '<span>' + message + '</span>';
successMsg.classList.add('show');
successTimer = setTimeout(() => successMsg.classList.remove('show'), 2500);
}
// 生成订阅默认模板ID: appid_时间戳
function generateDefaultTemplateId() {
return 'appid_' + Date.now();
}
function createDefaultButton() {
const useSample = prefillCheck.checked;
const defType = document.getElementById('defaultType').value;
let defaultData = '#签到';
if (defType === '0') defaultData = 'https://www.qq.com';
else if (defType === '3') defaultData = 'mqqapi://';
return {
id: 'btn_' + Date.now() + '_' + Math.random().toString(36).substr(2,6),
label: useSample ? '日签' : '',
visited_label: useSample ? '已签到' : '',
style: document.getElementById('defaultStyle').value,
actionType: defType,
data: useSample ? defaultData : '',
permissionType: document.getElementById('defaultPerm').value,
specifyIds: '',
useModal: false,
modalContent: '确认执行?',
modalConfirm: '✔️确认',
modalCancel: '❌取消',
templateId: generateDefaultTemplateId(), // 订阅模板ID
templateIdType: 'custom_template_id', // 订阅模板ID类型: custom_template_id | template_id
unsupportTips: document.getElementById('defaultUnsupport').value,
enter: document.getElementById('defaultEnter').value === 'true',
reply: document.getElementById('defaultReply').value === 'true',
atBotList: false,
clickLimit: document.getElementById('defaultClickLimit').value,
groupId: '',
anchor: document.getElementById('defaultAnchor').value,
};
}
function initDefaultRows() {
rows = [{ buttons: [createDefaultButton()] }];
renderRows();
}
// 将通用按钮 JSON 解析为编辑器内部按钮模型
function actionButtonToModel(btn) {
const model = createDefaultButton();
btn = btn || {};
const render = btn.render_data || {};
const action = btn.action || {};
const perm = action.permission || {};
model.id = btn.id || model.id;
model.label = render.label != null ? String(render.label) : '';
model.visited_label = render.visited_label != null ? String(render.visited_label) : '';
model.style = render.style != null ? String(render.style) : '0';
model.actionType = action.type != null ? String(action.type) : '2';
model.data = action.data != null ? String(action.data) : '';
model.permissionType = perm.type != null ? String(perm.type) : '2';
if (Array.isArray(perm.specify_user_ids)) model.specifyIds = perm.specify_user_ids.join(',');
else if (Array.isArray(perm.specify_role_ids)) model.specifyIds = perm.specify_role_ids.join(',');
else model.specifyIds = '';
model.unsupportTips = action.unsupport_tips != null ? String(action.unsupport_tips) : '';
model.enter = action.enter === true;
model.reply = action.reply === true;
model.atBotList = action.at_bot_show_channel_list === true;
model.clickLimit = action.click_limit != null ? String(action.click_limit) : '';
model.anchor = action.anchor != null ? String(action.anchor) : '0';
if (action.modal && typeof action.modal === 'object') {
model.useModal = true;
if (action.modal.content != null) model.modalContent = String(action.modal.content);
if (action.modal.confirm_text != null) model.modalConfirm = String(action.modal.confirm_text);
if (action.modal.cancel_text != null) model.modalCancel = String(action.modal.cancel_text);
} else {
model.useModal = false;
}
const tpl = action.subscribe_data?.template_ids?.[0];
if (tpl && typeof tpl === 'object') {
if (tpl.template_id != null) {
model.templateIdType = 'template_id';
model.templateId = String(tpl.template_id);
} else if (tpl.custom_template_id != null) {
model.templateIdType = 'custom_template_id';
model.templateId = String(tpl.custom_template_id);
}
}
if (btn.group_id != null) model.groupId = String(btn.group_id);
return model;
}
// ---- 客户端 protobuf 数字字段结构 → 通用按钮 JSON ----
// 字段号映射(据客户端解析实测):
// button: 1=id, 2=render_data, 3=action, 4=group_id
// render_data: 1=label, 2=visited_label, 3=style
// action: 1=type, 2=permission, 3=click_limit, 4=unsupport_tips, 5=data,
// 6=at_bot_show_channel_list, 7=reply, 8=enter, 9=anchor, 10=subscribe_data, 12=modal
// (群聊环境不支持 enter, field 8 会被平台丢弃; reply/field 7 群聊私聊均保留)
// permission: 1=type, 2=specify_role_ids[], 3=specify_user_ids
// modal: 1=content, 2=confirm_text, 3=cancel_text
// subscribe_data: 1=template_ids[0] {1=template_id, 2=custom_template_id}
// keyboard: 1=rows(单行时为对象,多行为数组), 3=style {1=font_size, 如 "small"(小按钮)}