-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
849 lines (758 loc) · 54.6 KB
/
index.html
File metadata and controls
849 lines (758 loc) · 54.6 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
<!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, maximum-scale=1.0, user-scalable=no">
<title>订阅转换</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg t='1775239517919' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='1080' width='16' height='16'%3E%3Cpath d='M64.781017 322.002011v335.425585c0 56.431786 34.440654 65.831271 34.440654 65.831271l363.188943 244.517396c56.353312 37.624097 40.702036-43.884608 40.702036-43.884608v-307.209692L64.781017 322.002011z' fill='%2337474F' p-id='1081'%3E%3C/path%3E%3Cpath d='M947.601905 327.653909v335.429073c0 56.426555-34.440654 65.831271-34.440654 65.831271s-306.832143 206.899402-363.188071 244.517395c-56.357672 37.618866-40.702036-43.887223-40.702036-43.887223V622.329501L947.601033 327.653909z' fill='%23455A64' p-id='1082'%3E%3C/path%3E%3Cpath d='M941.950007 322.002011v335.425585c0 56.431786-34.441526 65.831271-34.441526 65.831271s-306.834759 206.902018-363.188071 244.517396c-56.353312 37.624097-40.702036-43.884608-40.702036-43.884608v-307.209692L941.950007 322.002011z' fill='%23455A64' p-id='1083'%3E%3C/path%3E%3Cpath d='M544.093707 40.778668c-25.068199-15.663483-62.657419-15.663483-84.586644 0L83.577371 297.6488c-25.062096 15.668714-25.062096 43.85845 0 59.518445l375.929692 260.011722c25.05948 15.659995 62.657419 15.659995 84.586644 0l379.057331-263.141977c25.068199-15.659995 25.068199-43.85845 0-59.518445l-379.057331-253.739877z' fill='%23546E7A' p-id='1084'%3E%3C/path%3E%3Cpath d='M503.365512 982.930534c-18.833847 0-31.389745-12.041455-31.389745-27.099813v-337.300251c0-15.049639 12.555898-27.099813 31.389745-27.099813s31.389745 12.050174 31.389745 27.099813v334.283347c0 18.075262-12.555898 30.116717-31.389745 30.116717z' fill='%23546E7A' p-id='1085'%3E%3C/path%3E%3Cpath d='M816.321272 535.55691c0 31.363587 3.121536 43.902046-31.293833 65.85743l-78.221501 50.171276c-34.415368 21.955383-46.927669 3.138975-46.927669-25.085638v-81.534863c0-6.26923 0-9.408204-9.390765-15.677434-81.351756-56.449225-394.236889-272.820482-450.556195-313.583555L343.86201 115.352855c40.675878 25.087382 337.910607 222.649206 459.938241 307.314325 6.26051 3.138975 9.390765 9.408204 9.390765 12.547178v100.342552z' fill='%2399AAB5' p-id='1086'%3E%3C/path%3E%3Cpath d='M807.15721 425.945664c-125.201486-84.612802-422.558286-282.035117-460.112629-307.10506l-56.341977 34.471172L199.931309 215.983146c56.340233 40.745633 369.343949 253.838406 450.721863 310.244035 6.26051 3.130255 6.26051 6.26923 6.26051 9.399484l153.373783-106.550746s0-3.130255-3.130255-3.130255z' fill='%23CCD6DD' p-id='1087'%3E%3C/path%3E%3Cpath d='M817.17577 535.173258v-97.037909c0-6.26051-3.138975-9.390765-9.408204-12.521021-125.410751-84.525608-423.273275-281.73081-460.906092-306.773724L281.021484 162.664177c106.603062 71.995868 391.927127 259.819896 467.175321 313.034233 9.408204 6.26051 9.408204 12.521021 9.408204 15.651276V622.820402l31.354868-21.911786c31.354868-21.911786 28.215893-37.563062 28.215893-65.735358z' fill='%23CCD6DD' p-id='1088'%3E%3C/path%3E%3Cpath d='M807.000261 425.71896C681.763897 341.167194 384.337342 143.892237 346.765561 118.840604l-65.744077 43.841011c106.446114 72.022026 391.351648 259.90709 466.49521 313.138866l3.130255 3.130256 65.744078-46.971266c-6.26051-3.130255-6.26051-6.26051-9.390766-6.260511z' fill='%23E1E8ED' p-id='1089'%3E%3C/path%3E%3C/svg%3E">
<meta name="theme-color" content="#eef0f8" id="theme-meta">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<style>
:root {
--bg: #eef0f8;
--bg-card: rgba(255,255,255,0.78);
--bg-glass: rgba(255,255,255,0.55);
--bg-input: rgba(255,255,255,0.65);
--bg-input-hov: rgba(255,255,255,0.92);
--border: rgba(90,80,180,0.10);
--border-subtle: rgba(0,0,0,0.055);
--border-focus: rgba(99,102,241,0.50);
--text-primary: #16161e;
--text-secondary: #555570;
--text-muted: #9898b0;
--text-placeholder:#b0b0c8;
--accent: #5b5ef4;
--accent-2: #8b5cf6;
--accent-3: #06b6d4;
--accent-light: rgba(91,94,244,0.10);
--accent-glow: rgba(91,94,244,0.28);
--success: #10b981;
--success-light: rgba(16,185,129,0.1);
--orb-a: rgba(91,94,244,0.14);
--orb-b: rgba(139,92,246,0.10);
--orb-c: rgba(6,182,212,0.08);
--btn-shadow: 0 8px 28px -6px rgba(91,94,244,0.42);
--btn-shadow-hov: 0 14px 36px -8px rgba(91,94,244,0.58);
--card-shadow: 0 32px 72px -20px rgba(60,50,140,0.12), 0 2px 8px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.7);
--input-shadow-f: 0 0 0 3.5px rgba(91,94,244,0.13);
--result-bg: rgba(91,94,244,0.04);
--result-bg-hov: rgba(91,94,244,0.08);
--toast-success: rgba(16,185,129,0.93);
--toast-error: rgba(239,68,68,0.93);
--toast-warn: rgba(245,158,11,0.93);
--radius-card: 26px;
--radius-input: 13px;
--radius-btn: 13px;
--transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}
html.dark {
--bg: #0c0d15;
--bg-card: rgba(18,19,32,0.85);
--bg-glass: rgba(255,255,255,0.03);
--bg-input: rgba(255,255,255,0.045);
--bg-input-hov: rgba(255,255,255,0.08);
--border: rgba(140,130,255,0.12);
--border-subtle: rgba(255,255,255,0.06);
--border-focus: rgba(130,133,252,0.50);
--text-primary: #eeeef5;
--text-secondary: #9898b8;
--text-muted: #555570;
--text-placeholder:#3a3a52;
--orb-a: rgba(91,94,244,0.18);
--orb-b: rgba(139,92,246,0.14);
--orb-c: rgba(6,182,212,0.07);
--accent-light: rgba(91,94,244,0.14);
--accent-glow: rgba(91,94,244,0.22);
--btn-shadow: 0 8px 28px -6px rgba(91,94,244,0.35);
--btn-shadow-hov: 0 14px 36px -8px rgba(91,94,244,0.48);
--card-shadow: 0 32px 72px -20px rgba(0,0,0,0.5), 0 2px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
--input-shadow-f: 0 0 0 3.5px rgba(91,94,244,0.16);
--result-bg: rgba(91,94,244,0.06);
--result-bg-hov: rgba(91,94,244,0.12);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html { background-color: var(--bg); min-height: 100%; transition: background-color 0.4s; }
body {
font-family: 'Sora', -apple-system, sans-serif; font-size: 14.5px;
color: var(--text-primary); background: transparent; min-height: 100dvh;
display: flex; align-items: center; justify-content: center;
padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
position: relative; overflow-x: hidden; -webkit-tap-highlight-color: transparent;
transition: color 0.4s;
}
body::after {
content: ''; position: fixed; inset: 0; z-index: 0;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
background-size: 128px 128px; opacity: 0.6; pointer-events: none;
}
body::before {
content: ''; position: fixed; inset: 0; z-index: 0;
background-image: radial-gradient(circle, var(--border-subtle) 1px, transparent 1px);
background-size: 28px 28px; opacity: 1; pointer-events: none; transition: opacity 0.4s;
}
.orb { position: fixed; border-radius: 50%; pointer-events: none; z-index: 0; filter: blur(90px); }
.orb-a { width: min(60vw, 420px); height: min(60vw, 420px); top: -14%; right: -8%; background: radial-gradient(circle, var(--orb-a), transparent 68%); animation: driftA 18s ease-in-out infinite; }
.orb-b { width: min(70vw, 480px); height: min(70vw, 480px); bottom: -18%; left: -14%; background: radial-gradient(circle, var(--orb-b), transparent 68%); animation: driftB 22s ease-in-out infinite; }
.orb-c { width: min(40vw, 280px); height: min(40vw, 280px); top: 50%; left: 50%; transform: translate(-50%,-50%); background: radial-gradient(circle, var(--orb-c), transparent 68%); animation: driftC 14s ease-in-out infinite; }
@keyframes driftA { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(-20px,30px) scale(1.06); } 66% { transform: translate(15px,-20px) scale(0.96); } }
@keyframes driftB { 0%,100% { transform: translate(0,0) scale(1); } 40% { transform: translate(30px,-25px) scale(1.08); } 70% { transform: translate(-10px,20px) scale(0.94); } }
@keyframes driftC { 0%,100% { transform: translate(-50%,-50%) scale(1); opacity: 0.6; } 50% { transform: translate(-50%,-50%) scale(1.15); opacity: 1; } }
.card {
position: relative; z-index: 10; width: 100%; max-width: 468px;
background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card);
padding: 38px 34px 34px; box-shadow: var(--card-shadow);
backdrop-filter: blur(32px) saturate(1.8); -webkit-backdrop-filter: blur(32px) saturate(1.8);
animation: cardIn 0.55s cubic-bezier(0.22,1,0.36,1) both;
}
@media (max-width: 480px) { .card { padding: 30px 22px 26px; border-radius: 20px; } }
@keyframes cardIn { from { opacity:0; transform:translateY(22px) scale(0.97); } to { opacity:1; transform:translateY(0) scale(1); } }
.card::before {
content: ''; position: absolute; top: 0; left: 16px; right: 16px; height: 1px;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.65), transparent); border-radius: 1px;
}
html.dark .card::before { background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent); }
.header { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 34px; }
.logo-wrap { position: relative; }
.logo-icon {
width: 54px; height: 54px; background: linear-gradient(145deg, var(--accent) 0%, var(--accent-2) 100%);
border-radius: 16px; display: flex; align-items: center; justify-content: center;
box-shadow: 0 8px 24px -6px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.25); position: relative; z-index: 1;
}
.logo-icon svg { width: 26px; height: 26px; stroke: #fff; }
.logo-glow {
position: absolute; inset: -8px; border-radius: 22px;
background: radial-gradient(circle, var(--accent-glow), transparent 70%);
animation: logoGlow 3s ease-in-out infinite; z-index: 0;
}
@keyframes logoGlow { 0%,100% { opacity: 0.5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.1); } }
.header-text { text-align: center; }
.title {
font-size: 21px; font-weight: 700; letter-spacing: -0.4px;
background: linear-gradient(130deg, var(--accent) 0%, var(--accent-2) 55%, var(--accent-3) 100%);
-webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.2;
}
.subtitle { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-top: 4px; letter-spacing: 0.15px; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border-subtle) 30%, var(--border-subtle) 70%, transparent); margin: 0 -4px 26px; }
.field { margin-bottom: 18px; }
.label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 9px; user-select: none; }
.label-dot { width: 5px; height: 5px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.input-wrap { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; transition: color var(--transition); }
.input-icon svg { width: 15px; height: 15px; stroke: currentColor; }
input[type="url"] {
width: 100%; height: 48px; padding: 0 54px 0 40px; background: var(--bg-input);
border: 1.5px solid var(--border); border-radius: var(--radius-input); color: var(--text-primary);
font-family: inherit; font-size: 13.5px; outline: none; transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); -webkit-appearance: none;
}
input[type="url"]::placeholder { color: var(--text-placeholder); }
input[type="url"]:focus { border-color: var(--border-focus); background: var(--bg-input-hov); box-shadow: var(--input-shadow-f); }
input[type="url"]:focus + .input-icon, .input-wrap:focus-within .input-icon { color: var(--accent); }
input[type="url"].has-value { background: var(--bg-input-hov); }
.input-action-btn {
position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 500;
color: var(--text-muted); background: var(--bg-glass); border: 1px solid var(--border-subtle);
border-radius: 6px; padding: 4px 8px; cursor: pointer; transition: all var(--transition); user-select: none;
backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); letter-spacing: 0.2px; display: flex; align-items: center; justify-content: center;
}
.input-action-btn:hover { color: var(--accent); border-color: var(--border-focus); background: var(--accent-light); }
.input-action-btn svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.5; }
.clear-mode { border-radius: 50%; padding: 4px; border-color: transparent; background: transparent; backdrop-filter: none; }
.clear-mode:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: transparent; }
.url-info { display: none; align-items: center; gap: 8px; margin-top: 9px; padding: 9px 13px; background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.18); border-radius: 10px; font-size: 12px; font-weight: 400; color: #c57d00; animation: slideDown 0.22s ease; }
html.dark .url-info { color: #f5c045; background: rgba(245,158,11,0.08); }
.url-info.show { display: flex; }
@keyframes slideDown { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }
.select-wrap { position: relative; }
.select-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 48px; padding: 0 14px; background: var(--bg-input); border: 1.5px solid var(--border); border-radius: var(--radius-input); cursor: pointer; font-family: inherit; font-size: 13.5px; color: var(--text-primary); user-select: none; transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); }
.select-trigger:focus { border-color: var(--border-focus); box-shadow: var(--input-shadow-f); }
.select-trigger.open { border-color: var(--border-focus); background: var(--bg-input-hov); box-shadow: var(--input-shadow-f); }
.select-trigger.disabled { opacity: 0.42; cursor: not-allowed; pointer-events: none; }
.select-left { display: flex; align-items: center; gap: 10px; }
.client-icon { width: 24px; height: 24px; border-radius: 5px; object-fit: cover; flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.08); transition: transform var(--transition); }
html.dark .client-icon { box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.select-trigger.open .client-icon { transform: scale(0.95); }
.chevron-wrap { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--border-subtle); flex-shrink: 0; transition: background var(--transition), transform var(--transition); }
.select-trigger.open .chevron-wrap { background: var(--accent-light); transform: rotate(180deg); }
.chevron-wrap svg { width: 12px; height: 12px; stroke: var(--text-secondary); }
.dropdown { position: absolute; top: calc(100% + 7px); left: 0; right: 0; z-index: 50; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 5px; box-shadow: 0 20px 48px -10px rgba(0,0,0,0.20), 0 2px 8px rgba(0,0,0,0.06); backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6); opacity: 0; visibility: hidden; transform: translateY(-8px) scale(0.97); transform-origin: top center; transition: opacity 0.18s, transform 0.22s cubic-bezier(0.34,1.3,0.64,1), visibility 0.18s; }
.dropdown.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; font-size: 13px; font-weight: 400; color: var(--text-secondary); cursor: pointer; transition: background var(--transition), color var(--transition), transform 0.2s; opacity: 0; transform: translateY(-4px); }
.dropdown.open .option { opacity: 1; transform: translateY(0); }
.dropdown.open .option:nth-child(1) { transition-delay: 0.03s; }
.dropdown.open .option:nth-child(2) { transition-delay: 0.06s; }
.dropdown.open .option:nth-child(3) { transition-delay: 0.09s; }
.dropdown.open .option:nth-child(4) { transition-delay: 0.12s; }
.dropdown.open .option:nth-child(5) { transition-delay: 0.15s; }
.dropdown.open .option:nth-child(6) { transition-delay: 0.18s; }
.option:hover { background: var(--accent-light); color: var(--accent); }
.option.selected { color: var(--accent); font-weight: 600; background: var(--accent-light); }
.option-icon { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: transparent; border: none; box-shadow: 0 2px 6px rgba(0,0,0,0.06); transition: transform var(--transition), box-shadow var(--transition); }
html.dark .option-icon { box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.option-icon img { width: 100%; height: 100%; border-radius: 6px; object-fit: cover; display: block; }
.option:hover .option-icon { transform: scale(1.05); }
.option.selected .option-icon { transform: scale(1.1); box-shadow: 0 4px 12px rgba(91,94,244,0.3); }
.option-label { flex: 1; }
.option-desc { font-size: 10.5px; font-weight: 400; color: var(--text-muted); display: block; line-height: 1; margin-top: 2px; }
.option.selected .option-desc { color: rgba(91,94,244,0.6); }
.check-icon { width: 15px; height: 15px; stroke: var(--accent); flex-shrink: 0; opacity: 0; transform: scale(0.6); transition: opacity 0.15s, transform 0.18s cubic-bezier(0.34,1.56,0.64,1); }
.option.selected .check-icon { opacity: 1; transform: scale(1); }
.btn-convert { position: relative; overflow: hidden; width: 100%; height: 50px; margin-top: 10px; background: linear-gradient(130deg, var(--accent) 0%, var(--accent-2) 100%); border: none; border-radius: var(--radius-btn); color: #fff; font-family: inherit; font-size: 14.5px; font-weight: 600; letter-spacing: 0.1px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s; box-shadow: var(--btn-shadow); }
.btn-convert:not(:disabled):hover { transform: translateY(-2px); box-shadow: var(--btn-shadow-hov); }
.btn-convert:not(:disabled):active { transform: translateY(1px) scale(0.988); box-shadow: 0 4px 14px -4px var(--accent-glow); }
.btn-convert:disabled { opacity: 0.46; cursor: not-allowed; }
.btn-convert::before { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.26) 50%, transparent 70%); transform: translateX(-120%); transition: transform 0s; }
.btn-convert:not(:disabled):hover::before { transform: translateX(120%); transition: transform 0.65s ease; }
.btn-convert::after { content: ''; position: absolute; top: 0; left: 10%; right: 10%; height: 1px; background: rgba(255,255,255,0.35); border-radius: 1px; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.28); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track { height: 3px; background: var(--border-subtle); border-radius: 3px; margin-top: 12px; overflow: hidden; opacity: 0; transition: opacity 0.2s; position: relative; }
.progress-track.active { opacity: 1; }
.progress-bar { position: absolute; left: 0; top: 0; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 3px; transition: width 2.8s cubic-bezier(0.4,0,0.2,1); }
.progress-bar::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 30px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8)); filter: blur(2px); border-radius: 3px; }
.result-wrap { margin-top: 20px; display: none; animation: resultIn 0.3s cubic-bezier(0.34,1.2,0.64,1) both; }
@keyframes resultIn { from { opacity:0; transform:translateY(8px) scale(0.98); } to { opacity:1; transform:translateY(0) scale(1); } }
.result-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.result-status { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #10b981; opacity: 0; animation: fadeIn 0.3s 0.15s ease both; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); } 50% { box-shadow: 0 0 0 4px rgba(16,185,129,0); } }
.result-box { position: relative; display: flex; align-items: center; gap: 10px; padding: 13px 48px 13px 14px; background: var(--result-bg); border: 1.5px solid var(--border); border-radius: var(--radius-input); cursor: pointer; transition: all var(--transition); }
.result-box:hover { border-color: var(--border-focus); background: var(--result-bg-hov); box-shadow: var(--input-shadow-f); }
.result-url { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; line-height: 1.65; color: var(--text-secondary); word-break: break-all; flex: 1; user-select: all; }
.result-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.action-btn { flex: 1 1 calc(33.333% - 6px); min-width: 90px; display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 4px; background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 10px; font-family: inherit; font-size: 12px; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.action-btn:hover { background: var(--accent-light); border-color: var(--border-focus); color: var(--accent); transform: translateY(-1px); }
.action-btn:active { transform: scale(0.96); }
.action-btn svg { width: 14px; height: 14px; stroke: currentColor; transition: transform var(--transition); }
.copy-success { background: var(--success-light) !important; color: var(--success) !important; border-color: var(--success) !important; }
.copy-btn { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 8px; color: var(--text-muted); cursor: pointer; transition: all var(--transition); }
.copy-btn:hover { border-color: var(--border-focus); color: var(--accent); background: var(--accent-light); }
.copy-btn:active { transform: translateY(-50%) scale(0.9); }
.copy-btn svg { width: 14px; height: 14px; stroke: currentColor; }
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.22s, visibility 0.22s; }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; padding: 28px 24px; box-shadow: 0 32px 80px -20px rgba(0,0,0,0.35); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); max-width: 280px; width: calc(100% - 40px); text-align: center; transform: translateY(12px) scale(0.96); transition: transform 0.25s cubic-bezier(0.34,1.2,0.64,1); }
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 18px; }
#qr-canvas { border-radius: 10px; max-width: 100%; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.modal-close { margin-top: 18px; width: 100%; height: 38px; background: var(--accent-light); border: 1px solid var(--border-focus); border-radius: 10px; color: var(--accent); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.modal-close:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.theme-btn { position: fixed; top: max(18px, env(safe-area-inset-top, 18px)); right: 18px; z-index: 100; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.2s, box-shadow 0.2s, background 0.35s, border-color 0.35s; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.theme-btn:hover { transform: scale(1.1) rotate(12deg); box-shadow: 0 4px 18px rgba(0,0,0,0.14); }
.theme-btn:active { transform: scale(0.92); }
.theme-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sun { display: block; } .icon-moon { display: none; }
html.dark .icon-sun { display: none; } html.dark .icon-moon { display: block; }
#toast-container { position: fixed; bottom: max(22px, env(safe-area-inset-bottom, 22px)); left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 7px; align-items: center; width: max-content; max-width: calc(100vw - 36px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; padding: 10px 17px; border-radius: 40px; font-size: 13px; font-weight: 500; color: #fff; backdrop-filter: blur(14px); box-shadow: 0 6px 24px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.18); animation: toastIn 0.38s cubic-bezier(0.34,1.56,0.64,1) both; white-space: nowrap; }
.toast.out { animation: toastOut 0.28s ease forwards; }
.toast-icon { flex-shrink: 0; line-height: 1; font-size: 14px; }
@keyframes toastIn { from { opacity:0; transform:translateY(14px) scale(0.88); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0) scale(1); } to { opacity:0; transform:translateY(-10px) scale(0.9); } }
.footer { margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.footer-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); opacity: 0.5; }
</style>
</head>
<body>
<div class="orb orb-a"></div>
<div class="orb orb-b"></div>
<div class="orb orb-c"></div>
<button class="theme-btn" id="theme-toggle" aria-label="切换主题">
<svg class="icon-sun" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="4.5"/>
<line x1="12" y1="2" x2="12" y2="4"/><line x1="12" y1="20" x2="12" y2="22"/>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
<line x1="2" y1="12" x2="4" y2="12"/><line x1="20" y1="12" x2="22" y2="12"/>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
<svg class="icon-moon" viewBox="0 0 24 24">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
</svg>
</button>
<div id="toast-container"></div>
<div class="modal-overlay" id="modal-overlay">
<div class="modal">
<div class="modal-title">扫码导入订阅</div>
<canvas id="qr-canvas" width="200" height="200"></canvas>
<button class="modal-close" id="modal-close">关闭</button>
</div>
</div>
<div class="card">
<div class="header">
<div class="logo-wrap">
<div class="logo-glow"></div>
<div class="logo-icon">
<svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
</svg>
</div>
</div>
<div class="header-text">
<h1 class="title">订阅转换</h1>
<p class="subtitle">将订阅链接转换为指定客户端格式</p>
</div>
</div>
<div class="divider"></div>
<div class="field">
<label class="label" for="sub-url">
<span class="label-dot"></span>
原始订阅链接
</label>
<div class="input-wrap">
<span class="input-icon">
<svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
</svg>
</span>
<input type="url" id="sub-url" placeholder="粘贴订阅链接 https://…" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false">
<div class="input-action-btn" id="input-action" title="粘贴">粘贴</div>
</div>
<div class="url-info" id="url-info">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
检测到短链接,将自动解析重定向地址
</div>
</div>
<div class="field">
<label class="label">
<span class="label-dot"></span>
目标客户端
</label>
<div class="select-wrap">
<div class="select-trigger disabled" id="select-trigger" tabindex="0">
<div class="select-left">
<img class="client-icon" id="client-icon" src="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/Clash.png" alt="icon">
<span id="selected-text">Clash (Meta)</span>
</div>
<div class="chevron-wrap">
<svg viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"/>
</svg>
</div>
</div>
<div class="dropdown" id="dropdown">
<div class="option selected" data-value="c" data-img="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/Clash.png">
<div class="option-icon"><img src="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/Clash.png" alt="Clash"></div>
<div class="option-label">Clash (Meta)</div>
<svg class="check-icon" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
</div>
<div class="option" data-value="x" data-img="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/sing-box.png">
<div class="option-icon"><img src="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/sing-box.png" alt="Sing-Box"></div>
<div class="option-label">Sing-Box</div>
<svg class="check-icon" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
</div>
<div class="option" data-value="gc" data-img="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/Surge.png">
<div class="option-icon"><img src="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/Surge.png" alt="Surge"></div>
<div class="option-label">Surge</div>
<svg class="check-icon" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
</div>
<div class="option" data-value="s" data-img="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/Shadowrocket.png">
<div class="option-icon"><img src="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/Shadowrocket.png" alt="Shadowrocket"></div>
<div class="option-label">Shadowrocket</div>
<svg class="check-icon" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
</div>
<div class="option" data-value="l" data-img="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/Loon.png">
<div class="option-icon"><img src="https://gh-proxy.org/https://github.com/henryard/subx-frontend/raw/main/images/Loon.png" alt="Loon"></div>
<div class="option-label">Loon</div>
<svg class="check-icon" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
</div>
</div>
<input type="hidden" id="client-value" value="c">
</div>
</div>
<button class="btn-convert" id="convert-btn" disabled tabindex="0">
<div class="spinner" id="spinner"></div>
<span id="btn-text" style="display:flex; align-items:center;">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="margin-right:6px;">
<polyline points="5 12 3 12 12 3 21 12 19 12"/>
<polyline points="5 12 5 20 19 20 19 12"/>
</svg>
生成订阅链接
</span>
</button>
<div class="progress-track" id="progress-track">
<div class="progress-bar" id="progress-bar"></div>
</div>
<div class="result-wrap" id="result-wrap">
<div class="result-label">
<label class="label" style="margin-bottom:0">
<span class="label-dot"></span>
生成结果
</label>
<div class="result-status" id="result-status">
<div class="status-dot"></div>
<span id="node-count-text">已就绪</span>
</div>
</div>
<div class="result-box" id="result-box" tabindex="0">
<code class="result-url" id="result-url"></code>
<button class="copy-btn" id="copy-btn" title="复制链接">
<svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
</button>
</div>
<div class="result-actions">
<button class="action-btn" id="copy-full-btn" tabindex="0">
<svg class="icon-copy" viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
<span>复制链接</span>
</button>
<button class="action-btn" id="qr-btn" tabindex="0">
<svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/>
<rect x="5" y="5" width="3" height="3" fill="currentColor"/><rect x="16" y="5" width="3" height="3" fill="currentColor"/><rect x="5" y="16" width="3" height="3" fill="currentColor"/>
<path d="M14 14h3v3h-3z M17 14h3 M17 17v3 M14 20h3"/>
</svg>
显示二维码
</button>
<button class="action-btn" id="import-btn" tabindex="0">
<svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"/>
</svg>
<span>一键导入</span>
</button>
</div>
</div>
<div class="footer">
<span>订阅转换服务</span>
<span class="footer-dot"></span>
<span>仅供学习研究</span>
</div>
</div>
<script>
const THEME_COLORS = { light: '#eef0f8', dark: '#0c0d15' };
const themeMeta = document.getElementById('theme-meta');
function applyThemeColor(isDark) {
const color = isDark ? THEME_COLORS.dark : THEME_COLORS.light;
themeMeta.setAttribute('content', '#000000');
requestAnimationFrame(() => themeMeta.setAttribute('content', color));
}
function setTheme(isDark, save = true) {
document.documentElement.classList.toggle('dark', isDark);
if (save) localStorage.setItem('theme', isDark ? 'dark' : 'light');
applyThemeColor(isDark);
}
(function initTheme() {
const saved = localStorage.getItem('theme');
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
setTheme(saved === 'dark' || (!saved && prefersDark), false);
})();
document.getElementById('theme-toggle').addEventListener('click', () => {
setTheme(!document.documentElement.classList.contains('dark'));
});
const SHORT_DOMAINS = [
'suo.yt','t.cn','bit.ly','tinyurl.com','short.link','dwz.cn',
'u.nu','gg.gg','is.gd','v.gd','cutt.ly','rebrand.ly','t.co',
'goo.gl','v1.mk','d1.mk','dlj.tf','sub.cm'
];
function isValidUrl(s) {
if (!s || !s.trim().toLowerCase().startsWith('http')) return false;
try { new URL(s); return true; } catch { return false; }
}
function isShortLink(url) {
try {
const h = new URL(url).hostname.toLowerCase();
return SHORT_DOMAINS.some(d => h === d || h.endsWith('.' + d));
} catch { return false; }
}
function getOS() {
const ua = navigator.userAgent || navigator.vendor || window.opera;
if (/windows phone/i.test(ua)) return 'Windows Phone';
if (/android/i.test(ua)) return 'Android';
if (/iPad|iPhone|iPod/.test(ua) && !window.MSStream) return 'iOS';
if (/Macintosh|Mac OS X/.test(ua)) return 'Mac';
if (/Windows/.test(ua)) return 'Windows';
if (/Linux/.test(ua)) return 'Linux';
return 'Unknown';
}
const TOAST_CONFIG = {
success: { bg: 'rgba(16,185,129,0.93)', icon: '✓' },
error: { bg: 'rgba(239,68,68,0.93)', icon: '✕' },
warning: { bg: 'rgba(245,158,11,0.93)', icon: '⚠' },
};
const toastContainer = document.getElementById('toast-container');
function showToast(msg, type = 'success') {
if (type === 'warning') {
toastContainer.querySelectorAll('.toast[data-type="warning"]').forEach(t => t.remove());
}
const cfg = TOAST_CONFIG[type] || TOAST_CONFIG.success;
const el = document.createElement('div');
el.className = 'toast';
el.dataset.type = type;
el.style.background = cfg.bg;
el.innerHTML = `<span class="toast-icon">${cfg.icon}</span><span>${msg}</span>`;
toastContainer.appendChild(el);
setTimeout(() => {
el.classList.add('out');
setTimeout(() => el.remove(), 300);
}, 2800);
}
const subInput = document.getElementById('sub-url');
const urlInfo = document.getElementById('url-info');
const convertBtn = document.getElementById('convert-btn');
const spinner = document.getElementById('spinner');
const btnText = document.getElementById('btn-text');
const resultWrap = document.getElementById('result-wrap');
const resultUrl = document.getElementById('result-url');
const resultBox = document.getElementById('result-box');
const copyBtn = document.getElementById('copy-btn');
const copyFullBtn = document.getElementById('copy-full-btn');
const qrBtn = document.getElementById('qr-btn');
const importBtn = document.getElementById('import-btn');
const clientValue = document.getElementById('client-value');
const inputAction = document.getElementById('input-action');
const progressTrack = document.getElementById('progress-track');
const progressBar = document.getElementById('progress-bar');
const nodeCountText = document.getElementById('node-count-text');
const resultStatus = document.getElementById('result-status');
function updateInputAction() {
if (subInput.value.length > 0) {
inputAction.innerHTML = '<svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>';
inputAction.className = 'input-action-btn clear-mode';
inputAction.title = "清空";
} else {
inputAction.innerHTML = '粘贴';
inputAction.className = 'input-action-btn';
inputAction.title = "粘贴";
}
}
inputAction.addEventListener('click', async () => {
if (subInput.value.length > 0) {
subInput.value = '';
subInput.dispatchEvent(new Event('input'));
subInput.focus();
} else {
try {
const text = await navigator.clipboard.readText();
if (isValidUrl(text)) {
subInput.value = text;
subInput.dispatchEvent(new Event('input'));
showToast('已从剪贴板粘贴');
} else {
showToast('剪贴板内容不是有效链接', 'error');
}
} catch {
showToast('无法访问剪贴板,请手动粘贴', 'error');
}
}
});
subInput.addEventListener('input', () => {
const url = subInput.value.trim();
const valid = isValidUrl(url);
subInput.classList.toggle('has-value', url.length > 0);
convertBtn.disabled = !valid;
selectTrigger.classList.toggle('disabled', !valid);
resultWrap.style.display = 'none';
urlInfo.classList.toggle('show', valid && isShortLink(url));
updateInputAction();
});
const selectTrigger = document.getElementById('select-trigger');
const dropdown = document.getElementById('dropdown');
const selText = document.getElementById('selected-text');
const clientIcon = document.getElementById('client-icon');
const options = dropdown.querySelectorAll('.option');
function closeDropdown() {
selectTrigger.classList.remove('open');
dropdown.classList.remove('open');
}
selectTrigger.addEventListener('click', (e) => {
e.stopPropagation();
if (selectTrigger.classList.contains('disabled')) return;
const willOpen = !dropdown.classList.contains('open');
selectTrigger.classList.toggle('open', willOpen);
dropdown.classList.toggle('open', willOpen);
});
selectTrigger.addEventListener('keydown', (e) => {
if(e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
selectTrigger.click();
}
});
options.forEach(opt => {
opt.addEventListener('click', (e) => {
e.stopPropagation();
options.forEach(o => o.classList.remove('selected'));
opt.classList.add('selected');
selText.textContent = opt.querySelector('.option-label').firstChild.textContent.trim();
clientIcon.src = opt.dataset.img;
clientValue.value = opt.dataset.value;
closeDropdown();
});
});
document.addEventListener('click', closeDropdown);
function startProgress() {
progressTrack.classList.add('active');
progressBar.style.width = '0%';
progressBar.style.transition = 'none';
requestAnimationFrame(() => {
requestAnimationFrame(() => {
progressBar.style.transition = 'width 2.8s cubic-bezier(0.4,0,0.2,1)';
progressBar.style.width = '85%';
});
});
}
function finishProgress(success) {
progressBar.style.transition = 'width 0.35s ease';
progressBar.style.width = success ? '100%' : '0%';
setTimeout(() => {
progressTrack.classList.remove('active');
progressBar.style.width = '0%';
}, 500);
}
convertBtn.addEventListener('click', async () => {
const url = subInput.value.trim();
if (!isValidUrl(url)) { showToast('请检查订阅链接是否有效', 'error'); return; }
showToast('正在生成订阅链接…', 'warning');
startProgress();
spinner.style.display = 'block';
btnText.style.display = 'none';
convertBtn.disabled = true;
selectTrigger.classList.add('disabled');
resultWrap.style.display = 'none';
try {
const res = await fetch('/api/shorten', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url, client: clientValue.value }),
});
const data = await res.json();
if (res.ok) {
toastContainer.querySelectorAll('.toast[data-type="warning"]').forEach(t => t.remove());
resultUrl.textContent = data.shortUrl;
resultStatus.style.opacity = '1';
const nc = data.nodeCount ?? 0;
nodeCountText.textContent = nc > 0 ? `${nc} 个节点` : '已就绪';
// 取消了对 Loon 导入按钮的显示限制
importBtn.style.display = '';
resultWrap.style.display = 'block';
finishProgress(true);
navigator.clipboard.writeText(data.shortUrl)
.then(() => showToast(`转换成功 · ${nc} 节点,已自动复制`))
.catch(() => showToast('转换成功,请手动复制链接', 'success'));
} else {
finishProgress(false);
showToast(data.message || '生成失败,未知错误', 'error');
}
} catch {
finishProgress(false);
showToast('请求失败,请检查网络或联系管理员', 'error');
} finally {
spinner.style.display = 'none';
btnText.style.display = 'flex';
if (isValidUrl(subInput.value.trim())) {
convertBtn.disabled = false;
selectTrigger.classList.remove('disabled');
}
}
});
function setCopySuccessState(btnEl, isIconOnly = false) {
if (!btnEl) return;
const originalHTML = btnEl.innerHTML;
const checkSvg = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>`;
btnEl.classList.add('copy-success');
if (isIconOnly) {
btnEl.innerHTML = checkSvg;
} else {
btnEl.innerHTML = checkSvg + `<span>已复制</span>`;
}
setTimeout(() => {
btnEl.classList.remove('copy-success');
btnEl.innerHTML = originalHTML;
}, 2000);
}
function doCopy(e, triggerBtn) {
e && e.stopPropagation();
const text = resultUrl.textContent;
if (!text) return;
navigator.clipboard.writeText(text)
.then(() => {
showToast('链接已复制到剪贴板');
if (triggerBtn) {
setCopySuccessState(triggerBtn, triggerBtn.id === 'copy-btn');
}
})
.catch(() => showToast('复制失败,请手动选择复制', 'error'));
}
resultBox.addEventListener('click', (e) => doCopy(e, copyBtn));
copyBtn.addEventListener('click', (e) => doCopy(e, copyBtn));
copyFullBtn.addEventListener('click', (e) => doCopy(e, copyFullBtn));
/* ─── 一键导入客户端 ──── */
importBtn.addEventListener('click', () => {
const url = resultUrl.textContent;
if (!url) return;
const client = clientValue.value;
const os = getOS();
const encUrl = encodeURIComponent(url);
// 此处的 target.scheme 定义了 Loon 正确的一键导入唤起协议
const clientMap = {
'c': { name: 'Clash', scheme: `clash://install-config?url=${encUrl}`, os: ['Windows', 'Mac', 'Android', 'iOS', 'Linux'] },
'x': { name: 'Sing-Box', scheme: `sing-box://import-remote-profile?url=${encUrl}#Subscription`, os: ['Windows', 'Mac', 'Android', 'iOS', 'Linux'] },
'gc': { name: 'Surge', scheme: `surge:///install-config?url=${encUrl}`, os: ['iOS', 'Mac'] },
's': { name: 'Shadowrocket', scheme: `shadowrocket://add/sub://${btoa(url)}`, os: ['iOS', 'Mac'] },
'l': { name: 'Loon', scheme: `loon://import?sub=${encUrl}`, os: ['iOS', 'Mac'] }
};
const target = clientMap[client];
if (!target) {
showToast('未知客户端,无法一键导入', 'error');
return;
}
if (os !== 'Unknown' && !target.os.includes(os)) {
showToast(`${target.name} 通常不支持当前系统 (${os})`, 'warning');
} else {
showToast(`正在唤起 ${target.name}...`);
}
setTimeout(() => {
window.location.href = target.scheme;
}, 300);
});
const modalOverlay = document.getElementById('modal-overlay');
const qrCanvas = document.getElementById('qr-canvas');
const modalClose = document.getElementById('modal-close');
qrBtn.addEventListener('click', () => {
const url = resultUrl.textContent;
if (!url) return;
drawQR(url);
modalOverlay.classList.add('open');
});
modalClose.addEventListener('click', () => modalOverlay.classList.remove('open'));
modalOverlay.addEventListener('click', (e) => {
if (e.target === modalOverlay) modalOverlay.classList.remove('open');
});
function drawQR(text) {
const ctx = qrCanvas.getContext('2d');
const isDark = document.documentElement.classList.contains('dark');
const bg = isDark ? '181920' : 'FFFFFF';
const fg = isDark ? 'A5B4FC' : '5B5EF4';
ctx.fillStyle = isDark ? '#121320' : '#f8fafc';
ctx.fillRect(0,0,200,200);
ctx.fillStyle = isDark ? '#555570' : '#94a3b8';
ctx.font = '13px sans-serif';
ctx.textAlign = 'center';
ctx.fillText('正在生成二维码...', 100, 105);
const img = new Image();
img.crossOrigin = 'anonymous';
img.onload = () => {
ctx.clearRect(0,0,200,200);
ctx.drawImage(img, 0, 0, 200, 200);
};
img.onerror = () => {
ctx.fillStyle = isDark ? '#121320' : '#f8fafc';
ctx.fillRect(0,0,200,200);
ctx.fillStyle = '#ef4444';
ctx.fillText('二维码加载失败', 100, 105);
};
img.src = `https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(text)}&size=200x200&color=${fg}&bgcolor=${bg}&margin=10&qzone=2`;
}
</script>
</body>
</html>