forked from DhaniOfficiall/api-dhani
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1205 lines (1055 loc) · 39.4 KB
/
index.html
File metadata and controls
1205 lines (1055 loc) · 39.4 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>
<head>
<title>SXTREAM API</title>
<!-- Meta Tags -->
<meta name="description" content="Test and integrate our API endpoints directly in your browser with real-time results." />
<meta name="keywords" content="RestAPI" />
<meta name="author" content="SXTREAM" />
<meta name="theme-color" content="#000000" />
<!-- Open Graph / Facebook -->
<meta property="og:title" content="API SXTREAM - Explore the Power of Our API" />
<meta property="og:description" content="Test and integrate our API endpoints directly in your browser with real-time results" />
<meta property="og:image" content="https://i.imgur.com/giAV3We.jpeg" />
<meta property="og:url" content="https://api.sxtream.xyz/" />
<meta property="og:type" content="website" />
<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="SXTREAM - Explore the Power of Our API" />
<meta name="twitter:description" content="Test and integrate our API endpoints directly in your browser with real-time results" />
<meta name="twitter:image" content="https://i.imgur.com/giAV3We.jpeg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
<style>
html {
scroll-behavior: smooth;
}
body {
font-family: 'Inter', sans-serif;
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.glass-effect {
background: rgba(30, 41, 59, 0.8);
backdrop-filter: blur(10px);
border: 1px solid rgba(148, 163, 184, 0.1);
}
.collapsible {
max-height: 0;
overflow: hidden;
transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.collapsible.expanded {
max-height: 2000px;
}
/* NEW: Category content scrolling */
.category-content {
max-height: 600px; /* Limit height for scrolling */
overflow-y: auto;
overflow-x: hidden;
}
.category-content.expanded {
max-height: 600px; /* Keep consistent height when expanded */
}
/* Enhanced scrollbar for category content */
.category-content::-webkit-scrollbar {
width: 8px;
}
.category-content::-webkit-scrollbar-track {
background: rgba(30, 41, 59, 0.3);
border-radius: 4px;
}
.category-content::-webkit-scrollbar-thumb {
background: linear-gradient(180deg, #10b981, #059669);
border-radius: 4px;
}
.category-content::-webkit-scrollbar-thumb:hover {
background: linear-gradient(180deg, #059669, #047857);
}
/* Scroll indicators for categories */
.category-scroll-indicator {
position: absolute;
right: 16px;
top: 50%;
transform: translateY(-50%);
background: rgba(16, 185, 129, 0.8);
color: white;
padding: 4px 8px;
border-radius: 12px;
font-size: 10px;
pointer-events: none;
opacity: 0;
transition: opacity 0.3s ease;
z-index: 10;
}
.category-content:hover + .category-scroll-indicator,
.category-content:focus-within + .category-scroll-indicator {
opacity: 1;
}
.sidebar {
transform: translateX(-100%);
transition: transform 0.3s ease;
}
.sidebar.open {
transform: translateX(0);
}
.sidebar-overlay {
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.sidebar-overlay.active {
opacity: 1;
visibility: visible;
}
.hamburger span {
width: 25px;
height: 3px;
background-color: #10b981;
margin: 3px 0;
transition: 0.3s;
border-radius: 2px;
}
.hamburger.active span:nth-child(1) {
transform: rotate(-45deg) translate(-5px, 6px);
}
.hamburger.active span:nth-child(2) {
opacity: 0;
}
.hamburger.active span:nth-child(3) {
transform: rotate(45deg) translate(-5px, -6px);
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.loading-spinner {
animation: spin 0.6s linear infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.gradient-border {
background: linear-gradient(45deg, #10b981, #3b82f6);
padding: 1px;
border-radius: 0.75rem;
}
.gradient-border-content {
background: #1e293b;
border-radius: 0.6875rem;
}
/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
width: 6px;
height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #1e293b;
border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #10b981;
border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #059669;
}
.custom-scrollbar::-webkit-scrollbar-corner {
background: #1e293b;
}
/* Response container with scroll */
.response-container {
max-height: 400px;
max-width: 100%;
overflow: auto;
border: 1px solid #374151;
background: #000;
border-radius: 0.5rem;
position: relative;
}
.response-content {
width: 100%;
padding: 1rem;
font-family: 'Courier New', monospace;
font-size: 0.875rem;
line-height: 1.5;
color: #e5e7eb;
white-space: pre-wrap;
word-wrap: break-word;
overflow-wrap: break-word;
word-break: break-word;
}
/* Scroll indicators */
.response-container::before {
content: '';
position: absolute;
top: 0;
right: 0;
width: 20px;
height: 20px;
background: linear-gradient(45deg, transparent 50%, rgba(16, 185, 129, 0.3) 50%);
pointer-events: none;
opacity: 0;
transition: opacity 0.3s ease;
}
.response-container:hover::before {
opacity: 1;
}
.response-container::after {
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 20px;
height: 20px;
background: linear-gradient(-135deg, transparent 50%, rgba(16, 185, 129, 0.3) 50%);
pointer-events: none;
opacity: 0;
transition: opacity 0.3s ease;
}
.response-container:hover::after {
opacity: 1;
}
/* JSON syntax highlighting */
.json-key {
color: #60a5fa;
}
.json-string {
color: #34d399;
}
.json-number {
color: #fbbf24;
}
.json-boolean {
color: #f87171;
}
.json-null {
color: #9ca3af;
}
/* Desktop optimizations */
@media (min-width: 1024px) {
.desktop-grid {
display: grid;
grid-template-columns: 280px 1fr;
min-height: 100vh;
}
.main-content {
max-width: none;
padding: 2rem;
}
.stats-grid {
grid-template-columns: repeat(4, 1fr);
gap: 1.5rem;
}
.endpoint-card {
transition: all 0.3s ease;
}
.endpoint-card:hover {
transform: translateY(-2px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}
/* Larger category content on desktop */
.category-content {
max-height: 800px;
}
}
@media (max-width: 768px) {
.floating-whatsapp {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 1000;
}
.response-container {
max-height: 300px;
}
/* Smaller category content on mobile */
.category-content {
max-height: 400px;
}
}
/* Enhanced animations */
.fade-in {
animation: fadeIn 0.6s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.slide-in {
animation: slideIn 0.4s ease-out;
}
@keyframes slideIn {
from { transform: translateX(-20px); opacity: 0; }
to { transform: translateX(0); opacity: 1); }
}
@keyframes shake-slow {
0%, 90%, 100% {
transform: rotate(-3deg) translateX(0);
}
92% { transform: rotate(-3deg) translateX(-4px); }
94% { transform: rotate(-3deg) translateX(4px); }
96% { transform: rotate(-3deg) translateX(-2px); }
98% { transform: rotate(-3deg) translateX(2px); }
99% { transform: rotate(-3deg) translateX(0); }
}
.animate-shake-custom {
animation: shake-slow 5s ease-in-out infinite;
animation-delay: 2s;
animation-iteration-count: infinite;
}
/* Empty state styling */
.empty-response {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 2rem;
color: #6b7280;
min-height: 120px;
}
.empty-response i {
font-size: 2rem;
margin-bottom: 0.5rem;
opacity: 0.5;
}
/* Media content styling */
.media-content {
text-align: center;
padding: 1rem;
max-width: 100%;
}
.media-content img,
.media-content video {
border-radius: 0.5rem;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
max-width: 100%;
height: auto;
margin: 0 auto;
}
/* Error styling */
.error-response {
color: #ef4444;
background: rgba(239, 68, 68, 0.1);
border: 1px solid rgba(239, 68, 68, 0.3);
}
/* NEW: Smooth scroll behavior for category navigation */
.category-item {
scroll-margin-top: 2rem;
}
/* NEW: Category header sticky positioning */
.category-header {
position: sticky;
top: 0;
background: rgba(30, 41, 59, 0.95);
backdrop-filter: blur(10px);
z-index: 5;
}
/* NEW: Endpoint item spacing for better scrolling */
.endpoint-item {
scroll-margin-top: 1rem;
}
</style>
</head>
<body class="text-white min-h-screen">
<!-- Mobile Sidebar Overlay -->
<div id="sidebarOverlay" class="sidebar-overlay fixed inset-0 bg-black bg-opacity-50 z-40 lg:hidden" onclick="toggleSidebar()"></div>
<div class="desktop-grid">
<!-- Sidebar -->
<aside id="sidebar" class="sidebar fixed left-0 top-0 w-72 h-full glass-effect z-50 lg:transform-none lg:sticky lg:top-0 lg:h-screen lg:w-auto">
<div class="flex flex-col h-full p-6">
<div class="flex items-center justify-between mb-8">
<div class="gradient-border">
<div class="gradient-border-content px-4 py-2">
<h1 class="text-xl font-bold text-emerald-400">SXTREAM</h1>
</div>
</div>
<button class="lg:hidden text-gray-400 hover:text-white" onclick="toggleSidebar()">
<i class="fas fa-times"></i>
</button>
</div>
<nav class="space-y-2 flex-1">
<a href="/" class="flex items-center gap-3 py-3 px-4 rounded-lg hover:bg-gray-700/50 transition group">
<i class="fas fa-home text-emerald-400 group-hover:scale-110 transition-transform"></i>
<span>Home</span>
</a>
<a href="/docs" class="flex items-center gap-3 py-3 px-4 rounded-lg hover:bg-gray-700/50 transition group">
<i class="fas fa-book text-blue-400 group-hover:scale-110 transition-transform"></i>
<span>Documentation</span>
</a>
<a href="/contributors" class="flex items-center gap-3 py-3 px-4 rounded-lg hover:bg-gray-700/50 transition group">
<i class="fas fa-info-circle text-purple-400 group-hover:scale-110 transition-transform"></i>
<span>Contributor</span>
</a>
</nav>
<div class="mt-auto pt-6 border-t border-gray-700">
<div class="text-center">
<p class="text-sm text-gray-400">© 2025 SXTREAM API</p>
<p class="text-xs text-gray-500 mt-1">v1.0.0</p>
</div>
</div>
</div>
</aside>
<!-- Main Content -->
<div class="min-h-screen flex flex-col">
<!-- Header -->
<header class="glass-effect border-b border-gray-700/50 px-6 py-4 flex items-center justify-between sticky top-0 z-30">
<div class="flex items-center gap-4">
<button id="hamburger" class="hamburger lg:hidden flex flex-col cursor-pointer" onclick="toggleSidebar()">
<span></span>
<span></span>
<span></span>
</button>
<div class="flex items-center gap-3">
<div class="w-8 h-8 bg-gradient-to-r from-emerald-400 to-blue-400 rounded-lg flex items-center justify-center">
<i class="fas fa-code text-sm text-white"></i>
</div>
<h1 class="text-xl font-semibold bg-gradient-to-r from-emerald-400 to-blue-400 bg-clip-text text-transparent">
API Playground
</h1>
</div>
</div>
<div class="flex items-center gap-4">
<a href="https://whatsapp.com/channel/0029Vavzy6tIiRordrPfQ13d" target="_blank"
class="hidden sm:flex w-11 h-11 bg-gradient-to-r from-emerald-500 to-emerald-600 hover:from-emerald-600 hover:to-emerald-700 rounded-xl items-center justify-center transition shadow-lg hover:shadow-emerald-500/25">
<i class="fab fa-whatsapp text-lg"></i>
</a>
<!-- icon user -->
<div id="userButton" class="w-10 h-10 bg-gradient-to-r from-blue-500 to-purple-500 rounded-full flex items-center justify-center cursor-pointer">
<i class="fas fa-user text-sm text-white"></i>
</div>
<!-- dropdown -->
<div id="dropdownMenu" class="absolute top-12 right-0 mt-2 w-40 bg-white dark:bg-gray-800 shadow-lg rounded-xl py-2 hidden z-50">
<a href="#" class="block px-4 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700">Profile</a>
<a href="#" class="block px-4 py-2 text-sm text-red-600 hover:bg-gray-100 dark:hover:bg-gray-700">Logout</a>
</div>
</div>
</header>
<!-- Main Content -->
<main class="flex-1 main-content custom-scrollbar mx-auto px-4">
<!-- Hero Section -->
<div class="text-center mt-10 mb-10 fade-in">
<div class="inline-block mb-4">
<div class="bg-gradient-to-r from-emerald-500 to-cyan-500 text-black font-bold text-sm px-4 py-2 rounded-full shadow-lg glow inline-block animate-shake-custom">
<i class="fas fa-bolt mr-2"></i>SXTREAM API PLAYGROUND
</div>
</div>
<h2 class="text-3xl font-bold mb-4">
Test & Integrate
<span class="bg-gradient-to-r from-emerald-400 to-blue-400 bg-clip-text text-transparent">
API Endpoints
</span>
</h2>
<p class="text-gray-400 text-lg max-w-2xl mx-auto">
Powerful API testing interface with real-time results and comprehensive documentation
</p>
</div>
<!-- Stats -->
<div class="stats-grid grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
<div class="glass-effect p-6 rounded-xl text-center endpoint-card">
<div class="w-5 h-5 bg-emerald-500/20 rounded-lg flex items-center justify-center mx-auto mb-3">
<i class="fas fa-chart-line text-emerald-400 text-xl"></i>
</div>
<div id="request" class="text-emerald-400 text-md font-bold">0</div>
<div class="text-gray-400 text-sm">Requests Today</div>
</div>
<div class="glass-effect p-6 rounded-xl text-center endpoint-card">
<div class="w-5 h-5 bg-blue-500/20 rounded-lg flex items-center justify-center mx-auto mb-3">
<i class="fas fa-clock text-blue-400 text-xl"></i>
</div>
<div id="uptime" class="text-blue-400 text-md font-bold">0s</div>
<div class="text-gray-400 text-sm">Server Uptime</div>
</div>
<div class="glass-effect p-6 rounded-xl text-center endpoint-card">
<div class="w-5 h-5 bg-purple-500/20 rounded-lg flex items-center justify-center mx-auto mb-3">
<i class="fas fa-globe text-purple-400 text-xl"></i>
</div>
<div id="ip" class="text-purple-400 text-md font-bold">...</div>
<div class="text-gray-400 text-sm">Your IP Address</div>
</div>
<div class="glass-effect p-6 rounded-xl text-center endpoint-card">
<div class="w-5 h-5 bg-orange-500/20 rounded-lg flex items-center justify-center mx-auto mb-3">
<i class="fas fa-calendar-day text-orange-400 text-xl"></i>
</div>
<div id="current_time" class="text-orange-400 text-md font-bold">00:00:00</div>
<div class="text-gray-400 text-sm">Current Time</div>
</div>
</div>
<!-- Search -->
<div class="mb-8">
<div class="relative max-w-md mx-auto">
<input id="searchInput" type="text" placeholder="Search endpoints..." oninput="filterEndpoints()"
class="w-full glass-effect border border-gray-600/50 rounded-xl px-6 py-4 pl-12 focus:outline-none focus:border-emerald-400 transition text-lg" />
<i class="fas fa-search absolute left-4 top-5 text-gray-400"></i>
</div>
</div>
<!-- Endpoints -->
<div id="menuContainer" class="space-y-4">
<div class="text-center py-12">
<div class="w-12 h-12 border-4 border-emerald-400 border-t-transparent rounded-full loading-spinner mx-auto"></div>
<p class="mt-4 text-gray-400">Loading endpoints...</p>
</div>
</div>
<!-- Footer -->
<footer class="text-center text-sm text-gray-400 mt-12 mb-8">
<p>© 2025 SXTREAM API</p>
<p class="text-xs text-gray-500 mt-1">v1.0.0</p>
</footer>
</main>
</div>
</div>
<!-- Mobile WhatsApp Button -->
<a href="https://whatsapp.com/channel/0029Vavzy6tIiRordrPfQ13d" target="_blank"
class="floating-whatsapp sm:hidden w-14 h-14 bg-gradient-to-r from-emerald-500 to-emerald-600 hover:from-emerald-600 hover:to-emerald-700 rounded-full flex items-center justify-center shadow-lg transition">
<i class="fab fa-whatsapp text-xl"></i>
</a>
<script>
let allData = [];
// Dropdown user
document.addEventListener('DOMContentLoaded', function() {
const userButton = document.getElementById('userButton');
const dropdownMenu = document.getElementById('dropdownMenu');
userButton.addEventListener('click', (e) => {
e.stopPropagation();
dropdownMenu.classList.toggle('hidden');
});
document.addEventListener('click', (e) => {
if (!dropdownMenu.contains(e.target) && !userButton.contains(e.target)) {
dropdownMenu.classList.add('hidden');
}
});
});
function toggleSidebar() {
const sidebar = document.getElementById('sidebar');
const overlay = document.getElementById('sidebarOverlay');
const hamburger = document.getElementById('hamburger');
sidebar.classList.toggle('open');
overlay.classList.toggle('active');
hamburger.classList.toggle('active');
}
// ENHANCED: Toggle section with smooth scrolling
function toggleSection(sectionId, iconId) {
const section = document.getElementById(sectionId);
const icon = document.getElementById(iconId);
section.classList.toggle('expanded');
if (section.classList.contains('expanded')) {
icon.classList.remove('fa-chevron-down');
icon.classList.add('fa-chevron-up');
// Smooth scroll to the expanded section after animation
setTimeout(() => {
section.scrollIntoView({
behavior: 'smooth',
block: 'nearest'
});
}, 200);
} else {
icon.classList.remove('fa-chevron-up');
icon.classList.add('fa-chevron-down');
}
}
// Close sidebar when selecting menu (mobile)
document.querySelectorAll('aside nav a').forEach(link => {
link.addEventListener('click', () => {
if (window.innerWidth < 1024) {
toggleSidebar();
}
});
});
// Enhanced JSON formatter with syntax highlighting
function formatJSON(obj) {
const jsonString = JSON.stringify(obj, null, 2);
return jsonString
.replace(/(".*?")(\s*:\s*)/g, '<span class="json-key">$1</span>$2')
.replace(/:\s*(".*?")/g, ': <span class="json-string">$1</span>')
.replace(/:\s*(\d+\.?\d*)/g, ': <span class="json-number">$1</span>')
.replace(/:\s*(true|false)/g, ': <span class="json-boolean">$1</span>')
.replace(/:\s*(null)/g, ': <span class="json-null">$1</span>');
}
// Execute function with enhanced scrolling
function execute(method, url, paramKey, inputId, resultId, timeId, mediaType, _, queryKey = '', hasModel = false, hasStyle = false) {
const base = location.origin;
const resultBox = document.getElementById(resultId);
const timeBox = document.getElementById(timeId);
const start = Date.now();
let fullUrl = base + url;
const params = new URLSearchParams();
// Collect parameters
if (paramKey) {
const keys = paramKey.split(',');
const inputWrapper = document.getElementById(`${inputId}-wrapper`);
if (inputWrapper) {
const inputs = inputWrapper.querySelectorAll('input');
inputs.forEach((input, index) => {
const key = keys[index] || `param${index + 1}`;
const val = input.value.trim();
if (val) params.append(key.trim(), val);
});
}
}
const modelVal = hasModel ? document.getElementById(`${inputId}-model`)?.value || '' : '';
const styleVal = hasStyle ? document.getElementById(`${inputId}-style`)?.value || '' : '';
const queryVal = queryKey ? document.getElementById(`${inputId}-query`)?.value || '' : '';
if (hasModel && modelVal) params.append('model', modelVal);
if (hasStyle && styleVal) params.append('style', styleVal);
if (queryKey && queryVal) params.append(queryKey, queryVal);
const execBtn = event.currentTarget;
const playIcon = execBtn.querySelector('.play-icon');
const spinner = execBtn.querySelector('.exec-spinner');
playIcon.style.display = 'none';
spinner.style.display = 'block';
execBtn.disabled = true;
resultBox.innerHTML =
`<div class="response-container custom-scrollbar">
<div class="flex justify-center items-center py-8">
<div class="w-8 h-8 border-3 border-emerald-400 border-t-transparent rounded-full loading-spinner"></div>
<span class="ml-3 text-gray-400">Processing request...</span>
</div>
</div>`;
timeBox.innerHTML = '<i class="fas fa-spinner fa-spin text-yellow-400"></i> Loading...';
const fetchOptions = {
method,
headers: { 'Content-Type': 'application/json' }
};
if (method === 'POST' && params.toString()) {
fetchOptions.body = JSON.stringify(Object.fromEntries(params));
} else if (method === 'GET') {
fullUrl += '?' + params.toString();
}
fetch(fullUrl, fetchOptions)
.then(async res => {
const end = Date.now();
const responseTime = end - start;
const statusColor = res.ok ? 'text-green-400' : 'text-red-400';
timeBox.innerHTML = `<i class="fas fa-clock ${statusColor}"></i> ${responseTime}ms`;
if (mediaType === 'jpeg' || mediaType === 'png' || mediaType === 'gif') {
const blob = await res.blob();
const imgURL = URL.createObjectURL(blob);
resultBox.innerHTML =
`<div class="response-container custom-scrollbar">
<div class="media-content">
<img src="${imgURL}" alt="Result" class="rounded-lg shadow-lg max-w-full h-auto mx-auto" />
</div>
</div>`;
} else if (mediaType === 'mp4') {
const blob = await res.blob();
const videoURL = URL.createObjectURL(blob);
resultBox.innerHTML =
`<div class="response-container custom-scrollbar">
<div class="media-content">
<video controls class="rounded-lg shadow-lg max-w-full h-auto mx-auto">
<source src="${videoURL}" type="video/mp4">
</video>
</div>
</div>`;
} else {
const data = await res.json();
const formattedJson = formatJSON(data);
resultBox.innerHTML =
`<div class="response-container custom-scrollbar">
<div class="response-content">
<div class="flex items-center justify-between mb-2 sticky top-0 bg-black/90 pb-2 border-b border-gray-700">
<span class="text-xs text-gray-400 font-medium">JSON Response</span>
<button onclick="copyToClipboard('${JSON.stringify(data).replace(/'/g, "\\'")}', this)"
class="text-xs text-gray-400 hover:text-emerald-400 transition flex items-center gap-1">
<i class="fas fa-copy"></i> Copy
</button>
</div>
<pre class="whitespace-pre-wrap break-words">${formattedJson}</pre>
</div>
</div>`;
}
})
.catch(err => {
timeBox.innerHTML = '<i class="fas fa-exclamation-triangle text-red-400"></i> Error';
resultBox.innerHTML =
`<div class="response-container custom-scrollbar error-response">
<div class="response-content">
<div class="flex items-center gap-2 mb-2">
<i class="fas fa-exclamation-triangle text-red-400"></i>
<span class="text-sm font-medium">Error Response</span>
</div>
<pre class="whitespace-pre-wrap break-words">${JSON.stringify({ error: err.message }, null, 2)}</pre>
</div>
</div>`;
})
.finally(() => {
spinner.style.display = 'none';
playIcon.style.display = 'inline';
execBtn.disabled = false;
// Enhanced scroll to result
setTimeout(() => {
resultBox.scrollIntoView({
behavior: 'smooth',
block: 'nearest',
inline: 'nearest'
});
}, 100);
});
}
// Copy to clipboard function
function copyToClipboard(text, button) {
navigator.clipboard.writeText(text).then(() => {
const originalText = button.innerHTML;
button.innerHTML = '<i class="fas fa-check"></i> Copied!';
button.classList.add('text-green-400');
setTimeout(() => {
button.innerHTML = originalText;
button.classList.remove('text-green-400');
}, 2000);
}).catch(err => {
console.error('Failed to copy: ', err);
});
}
// Update URL preview function
function updateUrlPreview(base, url, param, value, previewId, inputId, hasModel, hasStyle, queryKey) {
const preview = document.getElementById(previewId);
if (!preview) return;
const params = new URLSearchParams();
if (param) {
const keys = param.split(',');
const inputWrapper = document.getElementById(`${inputId}-wrapper`);
if (inputWrapper) {
const inputs = inputWrapper.querySelectorAll('input');
inputs.forEach((input, index) => {
const key = keys[index] || `param${index + 1}`;
const val = input.value.trim();
if (val) params.append(key.trim(), val);
});
}
}
if (hasModel) {
const modelVal = document.getElementById(`${inputId}-model`)?.value || '';
if (modelVal) params.append('model', modelVal);
}
if (hasStyle) {
const styleVal = document.getElementById(`${inputId}-style`)?.value || '';
if (styleVal) params.append('style', styleVal);
}
if (queryKey) {
const queryVal = document.getElementById(`${inputId}-query`)?.value || '';
if (queryVal) params.append(queryKey, queryVal);
}
const queryString = params.toString();
preview.textContent = `${base}${url}${queryString ? '?' + queryString : ''}`;
}
// ENHANCED: Create menu structure with scrollable categories
function createMenuStructure(data) {
const grouped = {};
data.forEach(item => {
const cat = item.category.toUpperCase();
if (!grouped[cat]) grouped[cat] = [];
grouped[cat].push(item);
});
const container = document.getElementById("menuContainer");
container.innerHTML = "";
const base = location.origin;
Object.entries(grouped).forEach(([category, endpoints], i) => {
const menuId = `menuSection${i}`;
const iconId = `menuIcon${i}`;
const scrollIndicatorId = `scrollIndicator${i}`;
const menu = document.createElement("div");
menu.className = "glass-effect border border-gray-600/30 rounded-xl overflow-hidden endpoint-card slide-in category-item";
const categoryIcons = {
'ARTIFICIAL INTELLIGENCE': 'fas fa-brain text-purple-500',
'AI IMAGE': 'fas fa-image text-indigo-400',
'DOWNLOADER': 'fas fa-download text-blue-400',
'TOOLS': 'fas fa-wrench text-amber-500',
'STALKER': 'fas fa-user-secret text-red-500',
'NSFW': 'fas fa-eye-slash text-rose-500',
'GAMES': 'fas fa-gamepad text-green-500',
'SEARCH': 'fas fa-search text-yellow-400',
'GALLERY': 'fas fa-images text-pink-400',
'MAKER': 'fas fa-pen text-fuchsia-500',
'AUDIO': 'fas fa-music text-sky-500',
'RANDOM TEXT': 'fas fa-random text-lime-500'
};
const categoryIcon = categoryIcons[category] || 'fas fa-folder text-gray-400';
menu.innerHTML =
`<div class="category-header flex items-center justify-between p-4 cursor-pointer hover:bg-gray-700/30 transition group" onclick="toggleSection('${menuId}', '${iconId}')">
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-gray-700/50 rounded-lg flex items-center justify-center group-hover:scale-110 transition-transform">
<i class="${categoryIcon}"></i>
</div>
<span class="font-semibold text-lg">${category}</span>
<span class="bg-gray-700/50 text-gray-400 text-xs px-2 py-1 rounded-full">${endpoints.length}</span>
</div>
<div class="flex items-center gap-2">
<div class="text-xs text-gray-400 hidden lg:block">
${endpoints.length > 3 ? 'Scrollable' : ''}
</div>
<i id="${iconId}" class="fas fa-chevron-down text-gray-400 transition-transform"></i>
</div>
</div>
<div id="${menuId}" class="collapsible border-t border-gray-600/30 relative">
<div class="category-content custom-scrollbar">
${endpoints.map((item, j) => {
const subId = `${category.toLowerCase()}Section${i}_${j}`;
const subIconId = `${category.toLowerCase()}Icon${i}_${j}`;
const inputId = `${category.toLowerCase()}Input${i}_${j}`;
const resultId = `${category.toLowerCase()}Result${i}_${j}`;
const timeId = `${category.toLowerCase()}Time${i}_${j}`;
const previewId = `urlPreview-${i}-${j}`;
return `
<div class="endpoint-item p-6 border-b border-gray-600/20 last:border-b-0">
<div class="flex items-center justify-between cursor-pointer mb-6 group" onclick="toggleSection('${subId}', '${subIconId}')">
<div class="flex items-center gap-4">
<div class="flex items-center gap-3">
<span class="${item.method === 'GET' ? 'bg-emerald-500/20 text-emerald-400 border-emerald-400/30' : 'bg-blue-500/20 text-blue-400 border-blue-400/30'} px-3 py-1 rounded-lg text-sm font-mono border">${item.method}</span>
<span class="font-medium text-lg">${item.nama}</span>
</div>
</div>
<i id="${subIconId}" class="fas fa-chevron-down text-gray-400 transition-transform group-hover:text-white"></i>
</div>
<div id="${subId}" class="collapsible space-y-6">
${item.param ?
`<div id="${inputId}-wrapper" class="space-y-2">
<h4 class="font-medium text-gray-300 flex items-center gap-2">
<i class="fas fa-cogs text-emerald-400"></i>
Parameters
</h4>
<div class="grid gap-4 ${item.param.split(',').length > 1 ? 'lg:grid-cols-2' : ''}">
${item.param.split(',').map(key =>
`<div>
<label class="block text-sm font-medium mb-2 text-gray-300">
${key.trim()} <span class="text-red-400">*</span>
</label>
<input type="text" placeholder="Enter ${key.trim()}..."
class="w-full glass-effect border border-gray-600/50 rounded-lg px-4 py-3 focus:outline-none focus:border-emerald-400 transition"
oninput="updateUrlPreview('${base}', '${item.url}', '${item.param}', '', '${previewId}', '${inputId}', ${!!item.model}, ${!!item.style}, '${item.query || ''}')" />
</div>`
).join('')}
</div>
</div>`
: ''}
${item.model ?
`<div>
<label class="block text-sm font-medium mb-2 text-gray-300 flex items-center gap-2">
<i class="fas fa-cube text-blue-400"></i>
Model
</label>
<select id="${inputId}-model"
onchange="updateUrlPreview('${base}', '${item.url}', '${item.param || ''}', '', '${previewId}', '${inputId}', true, ${!!item.style}, '${item.query || ''}')"
class="w-full glass-effect border border-gray-600/50 rounded-lg px-4 py-3 focus:outline-none focus:border-emerald-400 transition">
${item.model.map(m => `<option value="${m}">${m}</option>`).join('')}
</select>
</div>`
: ''}
${item.style ?
`<div>
<label class="block text-sm font-medium mb-2 text-gray-300 flex items-center gap-2">
<i class="fas fa-palette text-purple-400"></i>
Style
</label>
<select id="${inputId}-style"
onchange="updateUrlPreview('${base}', '${item.url}', '${item.param || ''}', '', '${previewId}', '${inputId}', ${!!item.model}, true, '${item.query || ''}')"
class="w-full glass-effect border border-gray-600/50 rounded-lg px-4 py-3 focus:outline-none focus:border-emerald-400 transition">
${item.style.map(s => `<option value="${s}">${s}</option>`).join('')}
</select>
</div>`
: ''}
<div class="glass-effect p-4 rounded-lg">
<div class="flex items-center justify-between mb-2">
<span class="text-sm font-medium text-gray-300 flex items-center gap-2">
<i class="fas fa-link text-yellow-400"></i>
Request URL
</span>
<button onclick="navigator.clipboard.writeText(document.getElementById('${previewId}').textContent)"
class="text-gray-400 hover:text-emerald-400 transition">
<i class="fas fa-copy"></i>
</button>
</div>
<code id="${previewId}" class="text-sm text-emerald-400 break-all block bg-gray-800/50 p-3 rounded overflow-x-auto max-w-full whitespace-pre-wrap">${base}${item.url}</code>
</div>
<div class="flex items-center justify-between">
<button onclick="execute('${item.method}', '${item.url}', '${item.param || ''}', '${inputId}', '${resultId}', '${timeId}', '${item.media_type}', '', '${item.query || ''}', ${!!item.model}, ${!!item.style})"
class="bg-gradient-to-r from-emerald-500 to-emerald-600 hover:from-emerald-600 hover:to-emerald-700 text-white px-6 btn-sm py-3 rounded-lg flex items-center gap-3 transition shadow-lg hover:shadow-emerald-500/25">
<i class="fas fa-play play-icon"></i>
<div class="exec-spinner w-4 h-4 border-2 border-white border-t-transparent rounded-full loading-spinner" style="display: none;"></div>
Execute Request
</button>
<span id="${timeId}" class="text-sm text-gray-400 flex items-center gap-2">
<i class="fas fa-clock"></i>
—