Repository navigation
Expand file tree
/
Copy pathnewtoken.html
More file actions
846 lines (754 loc) · 30.2 KB
/
Copy pathnewtoken.html
File metadata and controls
846 lines (754 loc) · 30.2 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>NewTokenClub API</title>
<style>
:root {
--primary-color: #2c7da0;
--primary-light: #5fa7c2;
--text-secondary: #547c93;
--text-muted: #8aaec2;
--card-bg: rgba(255, 255, 255, 0.58);
--border-light: #e2ecf5;
--tag-bg: #eef3fc;
--price-color: #bc6f3c;
--warning-color: #f59e0b;
--danger-color: #ef4444;
}
@media (prefers-color-scheme: dark) {
:root {
--primary-color: #5fa7c2;
--primary-light: #8fc1d6;
--text-secondary: #a8c4d8;
--text-muted: #7e9eb5;
--card-bg: rgba(30, 40, 50, 0.66);
--border-light: rgba(80, 120, 140, 0.3);
--tag-bg: rgba(47, 85, 105, 0.5);
--price-color: #e8935c;
--warning-color: #fbbf24;
--danger-color: #f87171;
}
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: transparent;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 1.25rem 1rem;
color: #1f2937;
}
.hero-card {
max-width: 1280px;
width: 100%;
margin: 0 auto;
background: transparent;
}
.accent-line {
height: 4px;
width: 100%;
border-radius: 4px 4px 0 0;
background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--primary-color));
}
.content-shell {
padding: 1rem 1.35rem 1.05rem;
background: transparent;
}
.top-badges,
.contact-row,
.footer,
.footer-links {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.75rem;
}
.top-badges {
justify-content: space-between;
margin-bottom: 0.8rem;
}
.pill {
background: var(--tag-bg);
color: var(--primary-color);
border: 0.5px solid var(--border-light);
border-radius: 60px;
font-size: 0.75rem;
font-weight: 600;
padding: 0.3rem 1rem;
overflow-wrap: anywhere;
}
.pill.small {
font-size: 0.7rem;
font-weight: 500;
padding: 0.2rem 0.8rem;
}
.title-block {
margin-bottom: 0.8rem;
}
h1 {
font-size: clamp(1.85rem, 3.2vw, 2.25rem);
font-weight: 700;
line-height: 1.15;
letter-spacing: 0;
margin-bottom: 0.45rem;
}
.gradient-title {
background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.subtitle {
font-size: 0.9rem;
color: var(--text-secondary);
border-left: 2px solid var(--primary-color);
padding-left: 1rem;
margin-top: 0.25rem;
overflow-wrap: anywhere;
}
.value-grid,
.video-notice {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 1rem;
}
.value-grid {
margin: 0.9rem 0 0.75rem;
}
.video-notice {
margin-bottom: 1rem;
}
.value-card,
.contact-card,
.video-notice-card {
background: var(--card-bg);
border: 1px solid var(--border-light);
border-radius: 1rem;
backdrop-filter: blur(2px);
}
.value-card {
padding: 0.75rem 0.9rem;
}
.contact-card {
padding: 0.85rem 1rem;
margin-bottom: 0.75rem;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0.75rem;
}
.contact-row + .contact-row {
margin-top: 0.65rem;
}
.contact-card > .contact-row + .contact-row {
margin-top: 0;
}
.icon-bubble {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
background: var(--tag-bg);
border: 0.5px solid var(--border-light);
border-radius: 50%;
font-size: 1.2rem;
}
.label {
font-size: 0.7rem;
text-transform: uppercase;
color: var(--text-muted);
margin-bottom: 0.5rem;
}
.value {
font-size: 1.35rem;
font-weight: 700;
color: var(--price-color);
overflow-wrap: anywhere;
}
.value.primary {
color: var(--primary-color);
}
.note {
font-size: 0.75rem;
color: var(--text-secondary);
margin-top: 0.3rem;
overflow-wrap: anywhere;
}
a.action,
button.action {
background: var(--tag-bg);
border: 0.5px solid var(--border-light);
border-radius: 60px;
color: var(--primary-color);
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 0.85rem;
font-weight: 500;
padding: 0.3rem 1rem;
text-decoration: none;
white-space: nowrap;
}
button.action {
background: transparent;
cursor: pointer;
font-size: 0.7rem;
padding: 0.2rem 0.8rem;
}
.video-notice-card {
padding: 0.75rem 0.85rem;
min-width: 0;
}
.notice-head {
display: flex;
justify-content: space-between;
gap: 0.75rem;
align-items: flex-start;
margin-bottom: 0.65rem;
}
.notice-kicker {
font-size: 0.66rem;
line-height: 1.2;
color: var(--text-muted);
text-transform: uppercase;
margin-bottom: 0.18rem;
}
.notice-title {
color: var(--primary-color);
font-size: 0.95rem;
font-weight: 700;
line-height: 1.28;
}
.notice-badge {
flex: 0 0 auto;
background: var(--tag-bg);
border: 0.5px solid var(--border-light);
border-radius: 999px;
color: var(--primary-color);
font-size: 0.68rem;
font-weight: 600;
line-height: 1;
padding: 0.32rem 0.55rem;
}
.notice-list {
display: grid;
gap: 0.32rem;
list-style: none;
color: var(--text-secondary);
font-size: 0.72rem;
line-height: 1.38;
}
.notice-list li {
position: relative;
padding-left: 0.85rem;
}
.notice-list li::before {
content: "";
width: 0.38rem;
height: 0.38rem;
border-radius: 50%;
background: var(--warning-color);
position: absolute;
left: 0;
top: 0.46rem;
}
.notice-list.danger li::before {
background: var(--danger-color);
}
.notice-detail {
margin-top: 0.45rem;
color: var(--text-muted);
font-size: 0.7rem;
line-height: 1.38;
}
.notice-detail summary {
color: var(--primary-color);
cursor: pointer;
font-weight: 600;
list-style-position: inside;
}
.notice-detail p {
margin-top: 0.35rem;
}
.footer {
justify-content: space-between;
font-size: 0.7rem;
color: var(--text-muted);
padding-top: 0.5rem;
border-top: 1px solid var(--border-light);
}
.footer a {
color: var(--primary-color);
text-decoration: none;
}
@media (prefers-color-scheme: dark) {
body {
color: #e5edf4;
}
}
@media (max-width: 640px) {
body {
padding: 0.85rem;
}
.content-shell {
padding: 1rem;
}
.top-badges {
margin-bottom: 0.95rem;
}
.value-grid,
.video-notice,
.contact-card {
grid-template-columns: 1fr;
}
h1 {
font-size: 1.9rem;
}
}
@media (max-height: 820px) and (min-width: 760px) {
body {
align-items: flex-start;
}
.content-shell {
padding-top: 1rem;
padding-bottom: 1rem;
}
.value-grid {
margin: 1rem 0 0.85rem;
}
.contact-card,
.video-notice {
margin-bottom: 0.75rem;
}
}
</style>
</head>
<body>
<div class="hero-card">
<div class="accent-line"></div>
<div class="content-shell">
<div class="top-badges">
<div class="pill" data-i18n="badgeMain"></div>
<div class="pill small" data-i18n="badgeSla"></div>
</div>
<div class="title-block">
<h1><span class="gradient-title" data-i18n-html="heroTitle"></span></h1>
<div class="subtitle" data-i18n="heroSubtitle"></div>
</div>
<div class="value-grid">
<div class="value-card">
<div class="label" data-i18n="pricingLabel"></div>
<div class="value" data-i18n="pricingTitle"></div>
<div class="note" data-i18n="pricingNote"></div>
</div>
<div class="value-card">
<div class="label" data-i18n="promiseLabel"></div>
<div class="value primary" data-i18n="promiseTitle"></div>
<div class="note" data-i18n="promiseNote"></div>
</div>
</div>
<div class="contact-card">
<div class="contact-row">
<div class="icon-bubble">✈️</div>
<div style="flex: 1;">
<div class="label" data-i18n="supportLabel"></div>
<div class="contact-row">
<a class="action" href="https://t.me/newtoken_club" target="_blank" rel="noopener noreferrer">Telegram: @newtoken_club</a>
<button class="action" type="button" onclick="copyToClipboard('newtoken_club', 'tg')" data-i18n="copyAccount"></button>
</div>
</div>
</div>
<div class="contact-row">
<div class="icon-bubble">🌐</div>
<div style="flex: 1;">
<div class="label" data-i18n="apiLabel"></div>
<div class="contact-row">
<a class="action" href="https://api.newtoken.club" target="_blank" rel="noopener noreferrer" style="font-family: monospace; font-size: 0.8rem;">https://api.newtoken.club</a>
<button class="action" type="button" onclick="copyToClipboard('https://api.newtoken.club', 'api')" data-i18n="copyLink"></button>
</div>
</div>
</div>
</div>
<div class="video-notice" data-i18n-aria="videoNoticeAria">
<section class="video-notice-card">
<div class="notice-head">
<div>
<div class="notice-kicker">video-xxx-xxx</div>
<div class="notice-title" data-i18n="videoTitle"></div>
</div>
<span class="notice-badge" data-i18n="videoBadge"></span>
</div>
<ul class="notice-list">
<li data-i18n-html="videoTip1"></li>
<li data-i18n-html="videoTip2"></li>
<li data-i18n-html="videoTip3"></li>
</ul>
<details class="notice-detail">
<summary data-i18n="videoMore"></summary>
<p data-i18n="videoMoreText"></p>
</details>
</section>
<section class="video-notice-card">
<div class="notice-head">
<div>
<div class="notice-kicker">Google Omni / VEO</div>
<div class="notice-title" data-i18n="moderationTitle"></div>
</div>
<span class="notice-badge" data-i18n="moderationBadge"></span>
</div>
<ul class="notice-list danger">
<li data-i18n-html="moderationTip1"></li>
<li data-i18n="moderationTip2"></li>
<li data-i18n="moderationTip3"></li>
</ul>
<details class="notice-detail">
<summary data-i18n="moderationMore"></summary>
<p data-i18n="moderationMoreText"></p>
</details>
</section>
</div>
<div class="footer">
<div class="footer-links">
<span data-i18n="footerSupport"></span>
<span data-i18n="footerStable"></span>
<span data-i18n="footerContact"></span>
</div>
<div class="footer-links">
<span>© 2026 Mirrmart Inc. All rights reserved.</span>
<a href="legal/terms.html" target="_blank" rel="noopener noreferrer">Terms of Service</a>
<a href="legal/privacy.html" target="_blank" rel="noopener noreferrer">Privacy Policy</a>
</div>
</div>
</div>
</div>
<script>
const TRANSLATIONS = {
"zh-CN": {
title: "NewTokenClub API",
badgeMain: "官方 API · 源头直供",
badgeSla: "SLA 99.99%",
heroTitle: "官方 API<br>源头供应",
heroSubtitle: "不追逐最低价格,只交付可靠的 API 架构",
pricingLabel: "定价策略",
pricingTitle: "不是最便宜",
pricingNote: "价值优先 · 拒绝牺牲稳定性换低价",
promiseLabel: "核心承诺",
promiseTitle: "一定更稳定",
promiseNote: "企业级自建池 · 7x24h 高可用链路",
supportLabel: "专属客服通道",
apiLabel: "API 接入端点",
copyAccount: "复制账号",
copyLink: "复制链接",
videoNoticeAria: "视频生成注意事项",
videoTitle: "失败优化建议",
videoBadge: "先排查再重试",
videoTip1: "<strong>版权/品牌/IP</strong>:避免知名品牌、logo、影视角色,使用原创或已授权素材。",
videoTip2: "<strong>CONTENT_MODERATION</strong>:检查提示词和参考图,删除敏感、违规或擦边描述。",
videoTip3: "<strong>素材问题</strong>:链接保持长期有效;图片/视频使用公网可直连地址,比例和尺寸符合模型要求。",
videoMore: "更多常见原因",
videoMoreText: "真人不合规、人脸过于写实、素材上传失败、参数错误、素材预处理失败、ASPECT_UNSUPPORTED 都可能导致失败;更换合规素材、调整比例或精简提示词后成功率更高。",
moderationTitle: "内容审核避坑",
moderationBadge: "改内容才有效",
moderationTip1: "遇到 <strong>didn't pass content review</strong> 通常不是网络波动,重复提交或换账号帮助不大。",
moderationTip2: "避开真人正脸、名人、未成年人、性/暴力/危险、品牌 IP、医疗病症、政治宗教等主题。",
moderationTip3: "更稳写法:非写实风格、虚构主体、侧面/背面/远景、无版权且健康的参考素材。",
moderationMore: "提交前快速自检",
moderationMoreText: "如果包含真人照片、具名角色、品牌标识或敏感场景,请先改成原创通用描述;参考图也要同步更换,否则仍可能被拒。",
footerSupport: "企业级支持",
footerStable: "长期稳定承诺",
footerContact: "有事联系客服",
copiedAccount: "已复制 Telegram ID",
copiedApi: "已复制 API 地址",
manualCopy: "手动复制:"
},
en: {
title: "NewTokenClub API",
badgeMain: "Official API · Direct supply",
badgeSla: "SLA 99.99%",
heroTitle: "Official API<br>Direct Supply",
heroSubtitle: "We do not chase the lowest price. We deliver reliable API infrastructure.",
pricingLabel: "Pricing",
pricingTitle: "Not the cheapest",
pricingNote: "Value first · No stability trade-offs for bargain pricing",
promiseLabel: "Core promise",
promiseTitle: "Built for stability",
promiseNote: "Enterprise-grade private pools · 24/7 high-availability routes",
supportLabel: "Dedicated support",
apiLabel: "API endpoint",
copyAccount: "Copy account",
copyLink: "Copy link",
videoNoticeAria: "Video generation notes",
videoTitle: "Failure recovery tips",
videoBadge: "Check before retrying",
videoTip1: "<strong>Copyright/brand/IP</strong>: Avoid famous brands, logos, and media characters. Use original or licensed assets.",
videoTip2: "<strong>CONTENT_MODERATION</strong>: Review prompts and references, then remove sensitive, unsafe, or borderline content.",
videoTip3: "<strong>Asset issues</strong>: Keep links durable and public. Make sure image/video ratios and sizes match model requirements.",
videoMore: "More common causes",
videoMoreText: "Real-person compliance, overly realistic faces, failed uploads, invalid parameters, asset preprocessing failures, and ASPECT_UNSUPPORTED can all cause failures. Use compliant assets, adjust ratios, or simplify prompts to improve success rate.",
moderationTitle: "Content review guidance",
moderationBadge: "Change the content",
moderationTip1: "When you see <strong>didn't pass content review</strong>, it is usually not a network issue. Repeating the same request or switching accounts rarely helps.",
moderationTip2: "Avoid front-facing real people, celebrities, minors, sexual/violent/dangerous topics, brand IP, medical conditions, politics, and religion.",
moderationTip3: "Safer approach: non-photorealistic style, fictional subjects, side/back/distant views, and healthy copyright-safe references.",
moderationMore: "Quick pre-submit check",
moderationMoreText: "If the request contains real-person photos, named characters, brand marks, or sensitive scenes, rewrite it as an original generic description and replace the reference images too.",
footerSupport: "Enterprise support",
footerStable: "Long-term stability",
footerContact: "Contact support anytime",
copiedAccount: "Telegram ID copied",
copiedApi: "API address copied",
manualCopy: "Copy manually:"
}
};
const LANG_ALIASES = {
zh: "zh-CN",
"zh-cn": "zh-CN",
"zh-hans": "zh-CN",
"zh-sg": "zh-CN",
cn: "zh-CN",
en: "en",
"en-us": "en",
"en-gb": "en"
};
const BILINGUAL_TRANSLATION = {
title: "NewTokenClub API",
badgeMain: "官方 API · 源头直供 / Official API · Direct supply",
badgeSla: "SLA 99.99%",
heroTitle: "官方 API · 源头供应<br>Official API · Direct Supply",
heroSubtitle: "不追逐最低价格,只交付可靠的 API 架构 / We do not chase the lowest price. We deliver reliable API infrastructure.",
pricingLabel: "定价策略 / Pricing",
pricingTitle: "不是最便宜 / Not the cheapest",
pricingNote: "价值优先,不牺牲稳定性换低价 / Value first, no stability trade-offs for bargain pricing",
promiseLabel: "核心承诺 / Core promise",
promiseTitle: "一定更稳定 / Built for stability",
promiseNote: "企业级自建池,7x24h 高可用链路 / Enterprise-grade private pools, 24/7 high-availability routes",
supportLabel: "专属客服通道 / Dedicated support",
apiLabel: "API 接入端点 / API endpoint",
copyAccount: "复制账号 / Copy",
copyLink: "复制链接 / Copy",
videoNoticeAria: "视频生成注意事项 / Video generation notes",
videoTitle: "失败优化建议 / Failure recovery tips",
videoBadge: "先排查再重试 / Check first",
videoTip1: "<strong>版权/品牌/IP / Copyright/brand/IP</strong>:避免知名品牌、logo、影视角色;use original or licensed assets.",
videoTip2: "<strong>内容审核 / CONTENT_MODERATION</strong>:检查提示词和参考图;remove sensitive, unsafe, or borderline content.",
videoTip3: "<strong>素材问题 / Asset issues</strong>:链接长期有效且公网可直连;make sure ratios and sizes match model requirements.",
videoMore: "更多常见原因 / More common causes",
videoMoreText: "真人合规、人脸写实、上传失败、参数错误、预处理失败、ASPECT_UNSUPPORTED 都可能导致失败;use compliant assets, adjust ratios, or simplify prompts to improve success rate.",
moderationTitle: "内容审核避坑 / Content review guidance",
moderationBadge: "改内容才有效 / Change content",
moderationTip1: "遇到 <strong>didn't pass content review</strong> 通常不是网络波动;repeating the same request or switching accounts rarely helps.",
moderationTip2: "避开真人正脸、名人、未成年人、性/暴力/危险、品牌 IP、医疗病症、政治宗教等主题 / Avoid real faces, celebrities, minors, unsafe topics, brand IP, medical conditions, politics, and religion.",
moderationTip3: "更稳写法:非写实风格、虚构主体、侧面/背面/远景、无版权且健康的参考素材 / Safer approach: non-photorealistic style, fictional subjects, distant views, and copyright-safe references.",
moderationMore: "提交前快速自检 / Quick pre-submit check",
moderationMoreText: "如果包含真人照片、具名角色、品牌标识或敏感场景,请改成原创通用描述并同步更换参考图 / Rewrite as an original generic description and replace reference images too.",
footerSupport: "企业级支持 / Enterprise support",
footerStable: "长期稳定承诺 / Long-term stability",
footerContact: "有事联系客服 / Contact support anytime",
copiedAccount: "已复制 Telegram ID / Telegram ID copied",
copiedApi: "已复制 API 地址 / API address copied",
manualCopy: "手动复制 / Copy manually:"
};
let currentLang = "zh-CN";
function normalizeLang(value) {
if (!value || typeof value !== "string") return "";
const key = value.trim().toLowerCase().replace("_", "-");
return LANG_ALIASES[key] || LANG_ALIASES[key.split("-")[0]] || "";
}
function getQueryLang() {
const params = new URLSearchParams(window.location.search);
return normalizeLang(params.get("lang") || params.get("locale") || params.get("lng"));
}
function getHashLang() {
const raw = window.location.hash.replace(/^#/, "");
if (!raw) return "";
const params = new URLSearchParams(raw.includes("=") ? raw : `lang=${raw}`);
return normalizeLang(params.get("lang") || params.get("locale") || raw);
}
function getReferrerLang() {
try {
if (!document.referrer) return "";
const url = new URL(document.referrer);
const fromQuery = normalizeLang(
url.searchParams.get("lang") ||
url.searchParams.get("locale") ||
url.searchParams.get("lng")
);
if (fromQuery) return fromQuery;
const fromHash = normalizeLang(url.hash.replace(/^#/, ""));
if (fromHash) return fromHash;
const path = url.pathname.toLowerCase();
if (/(^|\/)(en|en-us|en-gb)(\/|$)/.test(path)) return "en";
if (/(^|\/)(zh|zh-cn|zh-hans|cn)(\/|$)/.test(path)) return "zh-CN";
} catch (_) {}
return "";
}
function getCookieLang() {
const candidates = [
"i18next",
"i18nextLng",
"NEXT_LOCALE",
"locale",
"lang",
"language"
];
const cookies = document.cookie.split(";").map((item) => item.trim());
for (const name of candidates) {
const prefix = `${name}=`;
const found = cookies.find((item) => item.startsWith(prefix));
if (!found) continue;
const normalized = normalizeLang(decodeURIComponent(found.slice(prefix.length)));
if (normalized) return normalized;
}
return "";
}
function getReadableParentLang() {
try {
const lang = window.parent?.document?.documentElement?.lang;
return normalizeLang(lang);
} catch (_) {
return "";
}
}
function getFrameTitleLang() {
try {
const title = window.frameElement?.getAttribute?.("title") || "";
const normalizedTitle = title.trim().toLowerCase();
if (!normalizedTitle) return "";
if (normalizedTitle.includes("custom home")) return "en";
if (normalizedTitle.includes("自定义主页") || normalizedTitle.includes("首頁") || normalizedTitle.includes("主页")) {
return "zh-CN";
}
} catch (_) {}
return "";
}
function detectInitialLang() {
const fromUrl = getQueryLang() || getHashLang();
if (fromUrl) return fromUrl;
const fromReferrer = getReferrerLang();
if (fromReferrer) return fromReferrer;
const fromFrameTitle = getFrameTitleLang();
if (fromFrameTitle) return fromFrameTitle;
const fromParent = getReadableParentLang();
if (fromParent) return fromParent;
const fromCookie = getCookieLang();
if (fromCookie) return fromCookie;
try {
const saved = localStorage.getItem("newtoken_locale");
const normalized = normalizeLang(saved);
if (normalized) return normalized;
} catch (_) {}
return normalizeLang(navigator.language) || "zh-CN";
}
function render(lang) {
const nextLang = "zh-CN";
const t = BILINGUAL_TRANSLATION;
currentLang = nextLang;
document.documentElement.lang = "zh-CN";
document.title = t.title;
document.querySelectorAll("[data-i18n]").forEach((node) => {
const key = node.getAttribute("data-i18n");
node.textContent = t[key] || "";
});
document.querySelectorAll("[data-i18n-html]").forEach((node) => {
const key = node.getAttribute("data-i18n-html");
node.innerHTML = t[key] || "";
});
document.querySelectorAll("[data-i18n-aria]").forEach((node) => {
const key = node.getAttribute("data-i18n-aria");
node.setAttribute("aria-label", t[key] || "");
});
try {
localStorage.setItem("newtoken_locale", nextLang);
} catch (_) {}
}
function extractMessageLang(data) {
if (!data) return "";
if (typeof data === "string") return normalizeLang(data);
return normalizeLang(data.lang || data.locale || data.language || data.i18n);
}
window.addEventListener("message", (event) => {
const allowedOrigins = new Set([
"https://www.newtoken.club",
"https://newtoken.club",
window.location.origin
]);
if (!allowedOrigins.has(event.origin)) return;
const lang = extractMessageLang(event.data);
if (lang) render(lang);
});
window.addEventListener("hashchange", () => {
const lang = getHashLang();
if (lang) render(lang);
});
function logLanguageProbe() {
const params = new URLSearchParams(window.location.search);
if (!params.has("debugLang") && !params.has("debug_lang")) return;
console.info("[newtoken] language probe", {
currentLang,
query: getQueryLang(),
hash: getHashLang(),
referrer: document.referrer,
referrerLang: getReferrerLang(),
frameTitleLang: getFrameTitleLang(),
parentLang: getReadableParentLang(),
cookieLang: getCookieLang(),
navigatorLanguage: navigator.language
});
}
setInterval(() => {
const lang = getQueryLang() || getHashLang() || getReferrerLang() || getFrameTitleLang() || getReadableParentLang() || getCookieLang();
if (lang) render(lang);
logLanguageProbe();
}, 1000);
window.copyToClipboard = function(content, type) {
const finalCopy = type === "tg" ? content.replace(/^@/, "") : content;
const t = BILINGUAL_TRANSLATION;
const showMessage = (msg) => {
let toast = document.querySelector(".dynamic-toast");
if (toast) toast.remove();
toast = document.createElement("div");
toast.className = "dynamic-toast";
toast.textContent = msg;
toast.style.position = "fixed";
toast.style.bottom = "24px";
toast.style.left = "50%";
toast.style.transform = "translateX(-50%)";
toast.style.backgroundColor = "#1e2f3c";
toast.style.color = "white";
toast.style.padding = "0.5rem 1.2rem";
toast.style.borderRadius = "40px";
toast.style.fontSize = "0.8rem";
toast.style.zIndex = "9999";
toast.style.fontFamily = "system-ui, sans-serif";
document.body.appendChild(toast);
setTimeout(() => toast.remove(), 2000);
};
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(finalCopy).then(() => {
showMessage(type === "tg" ? t.copiedAccount : t.copiedApi);
}).catch(() => {
alert(`${t.manualCopy} ${finalCopy}`);
});
} else {
const textarea = document.createElement("textarea");
textarea.value = finalCopy;
document.body.appendChild(textarea);
textarea.select();
document.execCommand("copy");
document.body.removeChild(textarea);
showMessage(type === "tg" ? t.copiedAccount : t.copiedApi);
}
};
render(detectInitialLang());
</script>
</body>
</html>