samirerty commited on
Commit
abe3648
·
verified ·
1 Parent(s): 8092a61

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +3 -1192
index.html CHANGED
@@ -1,1192 +1,3 @@
1
- <!DOCTYPE html>
2
- <html lang="fa" dir="rtl">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>چت روم ساده | گفتگوی آنلاین</title>
7
-
8
- <!-- Persian Font: Vazirmatn -->
9
- <link rel="preconnect" href="https://fonts.googleapis.com">
10
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
- <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
12
-
13
- <!-- Icons -->
14
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
15
-
16
- <style>
17
- :root {
18
- --primary: #6366f1;
19
- --primary-dark: #4f46e5;
20
- --secondary: #ec4899;
21
- --background: #0f172a;
22
- --surface: rgba(30, 41, 59, 0.7);
23
- --text: #f8fafc;
24
- --text-muted: #94a3b8;
25
- --border: rgba(148, 163, 184, 0.1);
26
- --success: #10b981;
27
- --warning: #f59e0b;
28
- --glass: rgba(255, 255, 255, 0.05);
29
- --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
30
- }
31
-
32
- [data-theme="light"] {
33
- --background: #f1f5f9;
34
- --surface: rgba(255, 255, 255, 0.8);
35
- --text: #1e293b;
36
- --text-muted: #64748b;
37
- --border: rgba(148, 163, 184, 0.2);
38
- --glass: rgba(255, 255, 255, 0.6);
39
- }
40
-
41
- * {
42
- margin: 0;
43
- padding: 0;
44
- box-sizing: border-box;
45
- }
46
-
47
- html {
48
- scroll-behavior: smooth;
49
- }
50
-
51
- body {
52
- font-family: 'Vazirmatn', sans-serif;
53
- background: var(--background);
54
- color: var(--text);
55
- min-height: 100vh;
56
- overflow-x: hidden;
57
- transition: background 0.3s ease, color 0.3s ease;
58
- }
59
-
60
- /* Animated Background */
61
- .bg-animation {
62
- position: fixed;
63
- top: 0;
64
- left: 0;
65
- width: 100%;
66
- height: 100%;
67
- z-index: -1;
68
- overflow: hidden;
69
- }
70
-
71
- .bg-animation .circle {
72
- position: absolute;
73
- border-radius: 50%;
74
- filter: blur(80px);
75
- opacity: 0.4;
76
- animation: float 20s infinite ease-in-out;
77
- }
78
-
79
- .circle:nth-child(1) {
80
- width: 400px;
81
- height: 400px;
82
- background: var(--primary);
83
- top: -100px;
84
- right: -100px;
85
- animation-delay: 0s;
86
- }
87
-
88
- .circle:nth-child(2) {
89
- width: 300px;
90
- height: 300px;
91
- background: var(--secondary);
92
- bottom: -50px;
93
- left: -50px;
94
- animation-delay: 5s;
95
- }
96
-
97
- .circle:nth-child(3) {
98
- width: 250px;
99
- height: 250px;
100
- background: var(--success);
101
- top: 50%;
102
- left: 50%;
103
- animation-delay: 10s;
104
- }
105
-
106
- @keyframes float {
107
- 0%, 100% { transform: translate(0, 0) scale(1); }
108
- 33% { transform: translate(30px, -50px) scale(1.1); }
109
- 66% { transform: translate(-20px, 20px) scale(0.9); }
110
- }
111
-
112
- /* Header */
113
- header {
114
- position: fixed;
115
- top: 0;
116
- width: 100%;
117
- padding: 1rem 2rem;
118
- background: var(--glass);
119
- backdrop-filter: blur(12px);
120
- border-bottom: 1px solid var(--border);
121
- z-index: 1000;
122
- display: flex;
123
- justify-content: space-between;
124
- align-items: center;
125
- }
126
-
127
- .logo {
128
- font-size: 1.5rem;
129
- font-weight: 900;
130
- background: linear-gradient(135deg, var(--primary), var(--secondary));
131
- -webkit-background-clip: text;
132
- -webkit-text-fill-color: transparent;
133
- display: flex;
134
- align-items: center;
135
- gap: 0.5rem;
136
- }
137
-
138
- .header-actions {
139
- display: flex;
140
- gap: 1rem;
141
- align-items: center;
142
- }
143
-
144
- .built-with {
145
- font-size: 0.75rem;
146
- color: var(--text-muted);
147
- text-decoration: none;
148
- padding: 0.5rem 1rem;
149
- border-radius: 2rem;
150
- background: var(--glass);
151
- border: 1px solid var(--border);
152
- transition: all 0.3s ease;
153
- }
154
-
155
- .built-with:hover {
156
- background: var(--primary);
157
- color: white;
158
- transform: translateY(-2px);
159
- }
160
-
161
- .theme-toggle {
162
- background: var(--glass);
163
- border: 1px solid var(--border);
164
- color: var(--text);
165
- width: 40px;
166
- height: 40px;
167
- border-radius: 50%;
168
- cursor: pointer;
169
- display: flex;
170
- align-items: center;
171
- justify-content: center;
172
- transition: all 0.3s ease;
173
- }
174
-
175
- .theme-toggle:hover {
176
- transform: rotate(180deg);
177
- background: var(--primary);
178
- }
179
-
180
- /* Main Container */
181
- .container {
182
- max-width: 1200px;
183
- margin: 0 auto;
184
- padding: 6rem 2rem 2rem;
185
- }
186
-
187
- /* Hero Section */
188
- .hero {
189
- text-align: center;
190
- padding: 4rem 0;
191
- animation: fadeInUp 1s ease;
192
- }
193
-
194
- @keyframes fadeInUp {
195
- from {
196
- opacity: 0;
197
- transform: translateY(30px);
198
- }
199
- to {
200
- opacity: 1;
201
- transform: translateY(0);
202
- }
203
- }
204
-
205
- .hero h1 {
206
- font-size: clamp(2rem, 5vw, 4rem);
207
- font-weight: 900;
208
- margin-bottom: 1rem;
209
- line-height: 1.2;
210
- }
211
-
212
- .hero h1 .emoji {
213
- display: inline-block;
214
- animation: bounce 2s infinite;
215
- }
216
-
217
- @keyframes bounce {
218
- 0%, 100% { transform: translateY(0); }
219
- 50% { transform: translateY(-10px); }
220
- }
221
-
222
- .subtitle {
223
- font-size: 1.25rem;
224
- color: var(--text-muted);
225
- margin-bottom: 2rem;
226
- font-weight: 300;
227
- }
228
-
229
- /* Features Grid */
230
- .features {
231
- display: grid;
232
- grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
233
- gap: 2rem;
234
- margin: 4rem 0;
235
- perspective: 1000px;
236
- }
237
-
238
- .feature {
239
- background: var(--surface);
240
- backdrop-filter: blur(10px);
241
- border: 1px solid var(--border);
242
- border-radius: 1.5rem;
243
- padding: 2rem;
244
- text-align: center;
245
- transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
246
- position: relative;
247
- overflow: hidden;
248
- }
249
-
250
- .feature::before {
251
- content: '';
252
- position: absolute;
253
- top: 0;
254
- left: 0;
255
- width: 100%;
256
- height: 100%;
257
- background: linear-gradient(135deg, transparent, rgba(255,255,255,0.05));
258
- opacity: 0;
259
- transition: opacity 0.3s;
260
- }
261
-
262
- .feature:hover {
263
- transform: translateY(-10px) rotateX(5deg);
264
- box-shadow: var(--shadow);
265
- border-color: var(--primary);
266
- }
267
-
268
- .feature:hover::before {
269
- opacity: 1;
270
- }
271
-
272
- .icon {
273
- font-size: 3rem;
274
- margin-bottom: 1rem;
275
- display: inline-block;
276
- transition: transform 0.3s;
277
- }
278
-
279
- .feature:hover .icon {
280
- transform: scale(1.2) rotate(10deg);
281
- }
282
-
283
- .feature h3 {
284
- font-size: 1.25rem;
285
- margin-bottom: 0.5rem;
286
- color: var(--text);
287
- }
288
-
289
- .feature p {
290
- color: var(--text-muted);
291
- font-size: 0.95rem;
292
- line-height: 1.6;
293
- }
294
-
295
- /* CTA Section */
296
- .cta {
297
- display: flex;
298
- gap: 1rem;
299
- justify-content: center;
300
- flex-wrap: wrap;
301
- margin: 3rem 0;
302
- }
303
-
304
- .btn {
305
- padding: 1rem 2.5rem;
306
- border-radius: 2rem;
307
- font-family: inherit;
308
- font-size: 1rem;
309
- font-weight: 700;
310
- cursor: pointer;
311
- transition: all 0.3s ease;
312
- border: none;
313
- text-decoration: none;
314
- display: inline-flex;
315
- align-items: center;
316
- gap: 0.5rem;
317
- position: relative;
318
- overflow: hidden;
319
- }
320
-
321
- .btn-primary {
322
- background: linear-gradient(135deg, var(--primary), var(--primary-dark));
323
- color: white;
324
- box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
325
- }
326
-
327
- .btn-secondary {
328
- background: var(--glass);
329
- color: var(--text);
330
- border: 2px solid var(--border);
331
- backdrop-filter: blur(10px);
332
- }
333
-
334
- .btn:hover {
335
- transform: translateY(-3px);
336
- box-shadow: 0 10px 25px rgba(0,0,0,0.2);
337
- }
338
-
339
- .btn:active {
340
- transform: translateY(-1px);
341
- }
342
-
343
- .btn::after {
344
- content: '';
345
- position: absolute;
346
- top: 50%;
347
- left: 50%;
348
- width: 0;
349
- height: 0;
350
- border-radius: 50%;
351
- background: rgba(255,255,255,0.3);
352
- transform: translate(-50%, -50%);
353
- transition: width 0.6s, height 0.6s;
354
- }
355
-
356
- .btn:active::after {
357
- width: 300px;
358
- height: 300px;
359
- }
360
-
361
- /* Modal Styles */
362
- .modal {
363
- display: none;
364
- position: fixed;
365
- top: 0;
366
- left: 0;
367
- width: 100%;
368
- height: 100%;
369
- background: rgba(0,0,0,0.8);
370
- backdrop-filter: blur(5px);
371
- z-index: 2000;
372
- justify-content: center;
373
- align-items: center;
374
- opacity: 0;
375
- transition: opacity 0.3s;
376
- }
377
-
378
- .modal.active {
379
- display: flex;
380
- opacity: 1;
381
- }
382
-
383
- .modal-content {
384
- background: var(--surface);
385
- border: 1px solid var(--border);
386
- border-radius: 2rem;
387
- padding: 2.5rem;
388
- width: 90%;
389
- max-width: 450px;
390
- position: relative;
391
- transform: scale(0.9);
392
- transition: transform 0.3s;
393
- box-shadow: var(--shadow);
394
- }
395
-
396
- .modal.active .modal-content {
397
- transform: scale(1);
398
- }
399
-
400
- .close-modal {
401
- position: absolute;
402
- top: 1rem;
403
- left: 1rem;
404
- background: none;
405
- border: none;
406
- color: var(--text-muted);
407
- font-size: 1.5rem;
408
- cursor: pointer;
409
- width: 40px;
410
- height: 40px;
411
- border-radius: 50%;
412
- display: flex;
413
- align-items: center;
414
- justify-content: center;
415
- transition: all 0.3s;
416
- }
417
-
418
- .close-modal:hover {
419
- background: var(--glass);
420
- color: var(--text);
421
- transform: rotate(90deg);
422
- }
423
-
424
- .form-group {
425
- margin-bottom: 1.5rem;
426
- }
427
-
428
- .form-group label {
429
- display: block;
430
- margin-bottom: 0.5rem;
431
- color: var(--text);
432
- font-weight: 500;
433
- }
434
-
435
- .form-group input {
436
- width: 100%;
437
- padding: 0.75rem 1rem;
438
- border: 2px solid var(--border);
439
- border-radius: 1rem;
440
- background: var(--glass);
441
- color: var(--text);
442
- font-family: inherit;
443
- font-size: 1rem;
444
- transition: all 0.3s;
445
- }
446
-
447
- .form-group input:focus {
448
- outline: none;
449
- border-color: var(--primary);
450
- box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
451
- }
452
-
453
- .form-submit {
454
- width: 100%;
455
- margin-top: 1rem;
456
- }
457
-
458
- /* Chat Application Interface */
459
- #chat-app {
460
- display: none;
461
- height: calc(100vh - 80px);
462
- margin-top: 80px;
463
- }
464
-
465
- .chat-container {
466
- display: grid;
467
- grid-template-columns: 300px 1fr;
468
- height: 100%;
469
- gap: 1rem;
470
- padding: 1rem;
471
- }
472
-
473
- .sidebar {
474
- background: var(--surface);
475
- border: 1px solid var(--border);
476
- border-radius: 1.5rem;
477
- padding: 1.5rem;
478
- display: flex;
479
- flex-direction: column;
480
- gap: 1rem;
481
- backdrop-filter: blur(10px);
482
- }
483
-
484
- .user-profile {
485
- text-align: center;
486
- padding-bottom: 1rem;
487
- border-bottom: 1px solid var(--border);
488
- }
489
-
490
- .avatar {
491
- width: 80px;
492
- height: 80px;
493
- border-radius: 50%;
494
- background: linear-gradient(135deg, var(--primary), var(--secondary));
495
- display: flex;
496
- align-items: center;
497
- justify-content: center;
498
- font-size: 2rem;
499
- margin: 0 auto 0.5rem;
500
- border: 3px solid var(--border);
501
- }
502
-
503
- .rooms-list {
504
- flex: 1;
505
- overflow-y: auto;
506
- }
507
-
508
- .room-item {
509
- padding: 1rem;
510
- margin-bottom: 0.5rem;
511
- border-radius: 1rem;
512
- cursor: pointer;
513
- transition: all 0.3s;
514
- display: flex;
515
- align-items: center;
516
- gap: 0.75rem;
517
- border: 1px solid transparent;
518
- }
519
-
520
- .room-item:hover, .room-item.active {
521
- background: var(--glass);
522
- border-color: var(--primary);
523
- }
524
-
525
- .room-item.active {
526
- background: rgba(99, 102, 241, 0.1);
527
- }
528
-
529
- .chat-area {
530
- background: var(--surface);
531
- border: 1px solid var(--border);
532
- border-radius: 1.5rem;
533
- display: flex;
534
- flex-direction: column;
535
- overflow: hidden;
536
- backdrop-filter: blur(10px);
537
- }
538
-
539
- .chat-header {
540
- padding: 1.5rem;
541
- border-bottom: 1px solid var(--border);
542
- display: flex;
543
- justify-content: space-between;
544
- align-items: center;
545
- }
546
-
547
- .chat-messages {
548
- flex: 1;
549
- overflow-y: auto;
550
- padding: 1.5rem;
551
- display: flex;
552
- flex-direction: column;
553
- gap: 1rem;
554
- }
555
-
556
- .message {
557
- max-width: 70%;
558
- padding: 1rem 1.25rem;
559
- border-radius: 1.25rem;
560
- position: relative;
561
- animation: messageSlide 0.3s ease;
562
- }
563
-
564
- @keyframes messageSlide {
565
- from {
566
- opacity: 0;
567
- transform: translateY(10px);
568
- }
569
- to {
570
- opacity: 1;
571
- transform: translateY(0);
572
- }
573
- }
574
-
575
- .message.sent {
576
- align-self: flex-start;
577
- background: linear-gradient(135deg, var(--primary), var(--primary-dark));
578
- color: white;
579
- border-bottom-right-radius: 0.25rem;
580
- }
581
-
582
- .message.received {
583
- align-self: flex-end;
584
- background: var(--glass);
585
- border: 1px solid var(--border);
586
- border-bottom-left-radius: 0.25rem;
587
- }
588
-
589
- .message-author {
590
- font-size: 0.75rem;
591
- opacity: 0.8;
592
- margin-bottom: 0.25rem;
593
- font-weight: 700;
594
- }
595
-
596
- .message-time {
597
- font-size: 0.7rem;
598
- opacity: 0.6;
599
- margin-top: 0.5rem;
600
- display: block;
601
- }
602
-
603
- .chat-input {
604
- padding: 1.5rem;
605
- border-top: 1px solid var(--border);
606
- display: flex;
607
- gap: 1rem;
608
- }
609
-
610
- .chat-input input {
611
- flex: 1;
612
- padding: 0.75rem 1.25rem;
613
- border: 2px solid var(--border);
614
- border-radius: 2rem;
615
- background: var(--glass);
616
- color: var(--text);
617
- font-family: inherit;
618
- font-size: 1rem;
619
- }
620
-
621
- .chat-input input:focus {
622
- outline: none;
623
- border-color: var(--primary);
624
- }
625
-
626
- .send-btn {
627
- width: 50px;
628
- height: 50px;
629
- border-radius: 50%;
630
- background: var(--primary);
631
- color: white;
632
- border: none;
633
- cursor: pointer;
634
- display: flex;
635
- align-items: center;
636
- justify-content: center;
637
- transition: all 0.3s;
638
- font-size: 1.25rem;
639
- }
640
-
641
- .send-btn:hover {
642
- background: var(--primary-dark);
643
- transform: scale(1.1);
644
- }
645
-
646
- /* Responsive */
647
- @media (max-width: 768px) {
648
- .chat-container {
649
- grid-template-columns: 1fr;
650
- position: relative;
651
- }
652
-
653
- .sidebar {
654
- position: absolute;
655
- right: -100%;
656
- top: 0;
657
- height: 100%;
658
- width: 280px;
659
- z-index: 100;
660
- transition: right 0.3s;
661
- box-shadow: var(--shadow);
662
- }
663
-
664
- .sidebar.open {
665
- right: 0;
666
- }
667
-
668
- .mobile-menu-btn {
669
- display: block !important;
670
- }
671
-
672
- .features {
673
- grid-template-columns: 1fr;
674
- }
675
- }
676
-
677
- .mobile-menu-btn {
678
- display: none;
679
- background: var(--glass);
680
- border: 1px solid var(--border);
681
- color: var(--text);
682
- padding: 0.5rem 1rem;
683
- border-radius: 0.5rem;
684
- cursor: pointer;
685
- }
686
-
687
- /* Scrollbar */
688
- ::-webkit-scrollbar {
689
- width: 8px;
690
- }
691
-
692
- ::-webkit-scrollbar-track {
693
- background: transparent;
694
- }
695
-
696
- ::-webkit-scrollbar-thumb {
697
- background: var(--border);
698
- border-radius: 4px;
699
- }
700
-
701
- ::-webkit-scrollbar-thumb:hover {
702
- background: var(--primary);
703
- }
704
-
705
- /* Loading Animation */
706
- .typing-indicator {
707
- display: none;
708
- align-self: flex-start;
709
- background: var(--glass);
710
- padding: 1rem 1.5rem;
711
- border-radius: 1.25rem;
712
- border-bottom-right-radius: 0.25rem;
713
- }
714
-
715
- .typing-indicator.active {
716
- display: flex;
717
- gap: 0.25rem;
718
- }
719
-
720
- .typing-dot {
721
- width: 8px;
722
- height: 8px;
723
- background: var(--text-muted);
724
- border-radius: 50%;
725
- animation: typing 1.4s infinite;
726
- }
727
-
728
- .typing-dot:nth-child(2) { animation-delay: 0.2s; }
729
- .typing-dot:nth-child(3) { animation-delay: 0.4s; }
730
-
731
- @keyframes typing {
732
- 0%, 60%, 100% { transform: translateY(0); }
733
- 30% { transform: translateY(-10px); }
734
- }
735
- </style>
736
- </head>
737
- <body>
738
- <!-- Animated Background -->
739
- <div class="bg-animation">
740
- <div class="circle"></div>
741
- <div class="circle"></div>
742
- <div class="circle"></div>
743
- </div>
744
-
745
- <!-- Header -->
746
- <header>
747
- <div class="logo">
748
- <i class="fas fa-comments"></i>
749
- <span>چت روم</span>
750
- </div>
751
- <div class="header-actions">
752
- <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="built-with">
753
- <i class="fas fa-code"></i> Built with anycoder
754
- </a>
755
- <button class="theme-toggle" onclick="toggleTheme()" title="تغییر تم">
756
- <i class="fas fa-moon"></i>
757
- </button>
758
- </div>
759
- </header>
760
-
761
- <!-- Landing Page -->
762
- <div id="landing" class="container">
763
- <div class="hero">
764
- <h1><span class="emoji">💬</span> چت روم ساده</h1>
765
- <p class="subtitle">محلی امن و سریع برای گفتگو با دوستان و همکاران</p>
766
- </div>
767
-
768
- <div class="features">
769
- <div class="feature" onclick="showRegister()">
770
- <div class="icon">🔐</div>
771
- <h3>ثبت‌نام آسان</h3>
772
- <p>با چند کلیک ساده ثبت‌نام کنید و بلافاصله شروع به چت کنید</p>
773
- </div>
774
-
775
- <div class="feature" onclick="showRegister()">
776
- <div class="icon">👥</div>
777
- <h3>اتاق‌های گفتگو</h3>
778
- <p>تا ۳ اتاق مختلف بسازید و گروه‌های خصوصی ایجاد کنید</p>
779
- </div>
780
-
781
- <div class="feature" onclick="showRegister()">
782
- <div class="icon">⚡</div>
783
- <h3>چت زنده</h3>
784
- <p>ارسال پیام فوری با قابلیت مشاهده وضعیت تایپ</p>
785
- </div>
786
- </div>
787
-
788
- <div class="cta">
789
- <button onclick="showRegister()" class="btn btn-primary">
790
- <i class="fas fa-rocket"></i>
791
- شروع کنید
792
- </button>
793
- <button onclick="showLogin()" class="btn btn-secondary">
794
- <i class="fas fa-sign-in-alt"></i>
795
- ورود
796
- </button>
797
- </div>
798
- </div>
799
-
800
- <!-- Auth Modals -->
801
- <div id="login-modal" class="modal">
802
- <div class="modal-content">
803
- <button class="close-modal" onclick="closeModals()">
804
- <i class="fas fa-times"></i>
805
- </button>
806
- <h2 style="margin-bottom: 1.5rem; text-align: center;">
807
- <i class="fas fa-sign-in-alt" style="color: var(--primary);"></i>
808
- ورود به حساب
809
- </h2>
810
- <form onsubmit="handleLogin(event)">
811
- <div class="form-group">
812
- <label>شماره موبایل</label>
813
- <input type="tel" placeholder="09*********" required pattern="09[0-9]{9}">
814
- </div>
815
- <div class="form-group">
816
- <label>رمز عبور</label>
817
- <input type="password" placeholder="••••••••" required>
818
- </div>
819
- <button type="submit" class="btn btn-primary form-submit">
820
- ورود
821
- </button>
822
- </form>
823
- <p style="text-align: center; margin-top: 1rem; color: var(--text-muted);">
824
- حساب ندارید؟
825
- <a href="#" onclick="closeModals(); showRegister();" style="color: var(--primary); text-decoration: none;">ثبت‌نام کنید</a>
826
- </p>
827
- </div>
828
- </div>
829
-
830
- <div id="register-modal" class="modal">
831
- <div class="modal-content">
832
- <button class="close-modal" onclick="closeModals()">
833
- <i class="fas fa-times"></i>
834
- </button>
835
- <h2 style="margin-bottom: 1.5rem; text-align: center;">
836
- <i class="fas fa-user-plus" style="color: var(--secondary);"></i>
837
- ایجاد حساب جدید
838
- </h2>
839
- <form onsubmit="handleRegister(event)">
840
- <div class="form-group">
841
- <label>نام کامل</label>
842
- <input type="text" placeholder="نام و نام خانوادگی" required>
843
- </div>
844
- <div class="form-group">
845
- <label>شماره موبایل</label>
846
- <input type="tel" placeholder="09*********" required pattern="09[0-9]{9}">
847
- </div>
848
- <div class="form-group">
849
- <label>رمز عبور</label>
850
- <input type="password" placeholder="حداقل ۸ کاراکتر" required minlength="8">
851
- </div>
852
- <button type="submit" class="btn btn-primary form-submit">
853
- ثبت‌نام
854
- </button>
855
- </form>
856
- </div>
857
- </div>
858
-
859
- <!-- Chat Application -->
860
- <div id="chat-app">
861
- <div class="chat-container">
862
- <aside class="sidebar" id="sidebar">
863
- <div class="user-profile">
864
- <div class="avatar" id="user-avatar">👤</div>
865
- <h3 id="user-name">کاربر مهمان</h3>
866
- <p style="color: var(--text-muted); font-size: 0.875rem;">آنلاین</p>
867
- </div>
868
-
869
- <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;">
870
- <h4 style="font-size: 0.875rem; color: var(--text-muted);">اتاق‌های شما</h4>
871
- <button onclick="createNewRoom()" style="background: var(--primary); color: white; border: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer;">
872
- <i class="fas fa-plus"></i>
873
- </button>
874
- </div>
875
-
876
- <div class="rooms-list" id="rooms-list">
877
- <div class="room-item active" onclick="switchRoom(0)">
878
- <i class="fas fa-hashtag" style="color: var(--primary);"></i>
879
- <div>
880
- <div style="font-weight: 700;">عمومی</div>
881
- <div style="font-size: 0.75rem; color: var(--text-muted);">۱۲ عضو آنلاین</div>
882
- </div>
883
- </div>
884
- <div class="room-item" onclick="switchRoom(1)">
885
- <i class="fas fa-lock" style="color: var(--secondary);"></i>
886
- <div>
887
- <div style="font-weight: 700;">خصوصی</div>
888
- <div style="font-size: 0.75rem; color: var(--text-muted);">۳ عضو</div>
889
- </div>
890
- </div>
891
- </div>
892
-
893
- <button onclick="logout()" class="btn btn-secondary" style="width: 100%; margin-top: auto;">
894
- <i class="fas fa-sign-out-alt"></i>
895
- خروج
896
- </button>
897
- </aside>
898
-
899
- <main class="chat-area">
900
- <div class="chat-header">
901
- <div style="display: flex; align-items: center; gap: 1rem;">
902
- <button class="mobile-menu-btn" onclick="toggleSidebar()">
903
- <i class="fas fa-bars"></i>
904
- </button>
905
- <div>
906
- <h3 id="current-room-name">اتاق عمومی</h3>
907
- <p style="font-size: 0.875rem; color: var(--text-muted);">
908
- <span class="online-count">۱۲</span> عضو آنلاین
909
- </p>
910
- </div>
911
- </div>
912
- <div style="display: flex; gap: 0.5rem;">
913
- <button style="background: var(--glass); border: 1px solid var(--border); color: var(--text); width: 40px; height: 40px; border-radius: 50%; cursor: pointer;">
914
- <i class="fas fa-search"></i>
915
- </button>
916
- <button style="background: var(--glass); border: 1px solid var(--border); color: var(--text); width: 40px; height: 40px; border-radius: 50%; cursor: pointer;">
917
- <i class="fas fa-ellipsis-v"></i>
918
- </button>
919
- </div>
920
- </div>
921
-
922
- <div class="chat-messages" id="chat-messages">
923
- <div class="message received">
924
- <div class="message-author">پشتیبانی</div>
925
- به چت روم خوش آمدید! 👋
926
- <span class="message-time">۱۰:۳۰</span>
927
- </div>
928
- </div>
929
-
930
- <div class="typing-indicator" id="typing-indicator">
931
- <div class="typing-dot"></div>
932
- <div class="typing-dot"></div>
933
- <div class="typing-dot"></div>
934
- </div>
935
-
936
- <div class="chat-input">
937
- <button style="background: none; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer;">
938
- <i class="fas fa-paperclip"></i>
939
- </button>
940
- <input type="text" id="message-input" placeholder="پیام خود را بنویسید..." onkeypress="handleKeyPress(event)">
941
- <button class="send-btn" onclick="sendMessage()">
942
- <i class="fas fa-paper-plane"></i>
943
- </button>
944
- </div>
945
- </main>
946
- </div>
947
- </div>
948
-
949
- <script>
950
- // State Management
951
- let currentUser = null;
952
- let currentRoom = 0;
953
- let rooms = [
954
- { name: 'عمومی', messages: [], online: 12 },
955
- { name: 'خصوصی', messages: [], online: 3 }
956
- ];
957
-
958
- // Theme Toggle
959
- function toggleTheme() {
960
- const html = document.documentElement;
961
- const currentTheme = html.getAttribute('data-theme');
962
- const newTheme = currentTheme === 'light' ? 'dark' : 'light';
963
- html.setAttribute('data-theme', newTheme);
964
- localStorage.setItem('theme', newTheme);
965
-
966
- const icon = document.querySelector('.theme-toggle i');
967
- icon.className = newTheme === 'light' ? 'fas fa-sun' : 'fas fa-moon';
968
- }
969
-
970
- // Initialize Theme
971
- const savedTheme = localStorage.getItem('theme') || 'dark';
972
- document.documentElement.setAttribute('data-theme', savedTheme);
973
- document.querySelector('.theme-toggle i').className = savedTheme === 'light' ? 'fas fa-sun' : 'fas fa-moon';
974
-
975
- // Modal Functions
976
- function showLogin() {
977
- document.getElementById('login-modal').classList.add('active');
978
- }
979
-
980
- function showRegister() {
981
- document.getElementById('register-modal').classList.add('active');
982
- }
983
-
984
- function closeModals() {
985
- document.querySelectorAll('.modal').forEach(modal => {
986
- modal.classList.remove('active');
987
- });
988
- }
989
-
990
- // Close modal on outside click
991
- document.querySelectorAll('.modal').forEach(modal => {
992
- modal.addEventListener('click', (e) => {
993
- if (e.target === modal) closeModals();
994
- });
995
- });
996
-
997
- // Auth Functions
998
- function handleLogin(e) {
999
- e.preventDefault();
1000
- const phone = e.target.querySelector('input[type="tel"]').value;
1001
- const name = 'کاربر ' + phone.slice(-4);
1002
- loginUser(name);
1003
- }
1004
-
1005
- function handleRegister(e) {
1006
- e.preventDefault();
1007
- const name = e.target.querySelector('input[type="text"]').value;
1008
- loginUser(name);
1009
- }
1010
-
1011
- function loginUser(name) {
1012
- currentUser = name;
1013
- document.getElementById('user-name').textContent = name;
1014
- document.getElementById('user-avatar').textContent = name.charAt(0);
1015
-
1016
- closeModals();
1017
- document.getElementById('landing').style.display = 'none';
1018
- document.getElementById('chat-app').style.display = 'block';
1019
-
1020
- // Add welcome message
1021
- setTimeout(() => {
1022
- addMessage('system', `خوش آمدید ${name}! 🎉`);
1023
- }, 500);
1024
- }
1025
-
1026
- function logout() {
1027
- currentUser = null;
1028
- document.getElementById('chat-app').style.display = 'none';
1029
- document.getElementById('landing').style.display = 'block';
1030
- document.getElementById('landing').style.animation = 'fadeInUp 1s ease';
1031
- }
1032
-
1033
- // Chat Functions
1034
- function switchRoom(index) {
1035
- currentRoom = index;
1036
-
1037
- // Update UI
1038
- document.querySelectorAll('.room-item').forEach((item, i) => {
1039
- item.classList.toggle('active', i === index);
1040
- });
1041
-
1042
- document.getElementById('current-room-name').textContent = rooms[index].name;
1043
- document.querySelector('.online-count').textContent = rooms[index].online;
1044
-
1045
- // Clear and load messages
1046
- const messagesContainer = document.getElementById('chat-messages');
1047
- messagesContainer.innerHTML = '';
1048
-
1049
- // Load room messages
1050
- if (rooms[index].messages.length === 0) {
1051
- const defaultMessages = [
1052
- { author: 'پشتیبانی', text: `به اتاق ${rooms[index].name} خوش آمدید!`, time: '۱۰:۳۰', type: 'received' }
1053
- ];
1054
- rooms[index].messages = defaultMessages;
1055
- }
1056
-
1057
- rooms[index].messages.forEach(msg => {
1058
- appendMessageToDOM(msg);
1059
- });
1060
-
1061
- // Mobile: close sidebar
1062
- if (window.innerWidth <= 768) {
1063
- document.getElementById('sidebar').classList.remove('open');
1064
- }
1065
- }
1066
-
1067
- function createNewRoom() {
1068
- if (rooms.length >= 3) {
1069
- alert('حداکثر ۳ اتاق می‌توانید داشته باشید!');
1070
- return;
1071
- }
1072
-
1073
- const name = prompt('نام اتاق جدید:');
1074
- if (name) {
1075
- rooms.push({ name, messages: [], online: 1 });
1076
-
1077
- const roomHtml = `
1078
- <div class="room-item" onclick="switchRoom(${rooms.length - 1})">
1079
- <i class="fas fa-hashtag" style="color: var(--success);"></i>
1080
- <div>
1081
- <div style="font-weight: 700;">${name}</div>
1082
- <div style="font-size: 0.75rem; color: var(--text-muted);">۱ عضو</div>
1083
- </div>
1084
- </div>
1085
- `;
1086
-
1087
- document.getElementById('rooms-list').insertAdjacentHTML('beforeend', roomHtml);
1088
- switchRoom(rooms.length - 1);
1089
- }
1090
- }
1091
-
1092
- function sendMessage() {
1093
- const input = document.getElementById('message-input');
1094
- const text = input.value.trim();
1095
-
1096
- if (!text) return;
1097
-
1098
- const message = {
1099
- author: currentUser,
1100
- text: text,
1101
- time: new Date().toLocaleTimeString('fa-IR', { hour: '2-digit', minute: '2-digit' }),
1102
- type: 'sent'
1103
- };
1104
-
1105
- rooms[currentRoom].messages.push(message);
1106
- appendMessageToDOM(message);
1107
- input.value = '';
1108
-
1109
- // Simulate received message
1110
- showTyping();
1111
- setTimeout(() => {
1112
- hideTyping();
1113
- const reply = {
1114
- author: 'کاربر تصادفی',
1115
- text: 'پیام شما دریافت شد! 👍',
1116
- time: new Date().toLocaleTimeString('fa-IR', { hour: '2-digit', minute: '2-digit' }),
1117
- type: 'received'
1118
- };
1119
- rooms[currentRoom].messages.push(reply);
1120
- appendMessageToDOM(reply);
1121
- }, 2000);
1122
-
1123
- scrollToBottom();
1124
- }
1125
-
1126
- function addMessage(author, text) {
1127
- const message = {
1128
- author: author === 'system' ? 'سیستم' : author,
1129
- text: text,
1130
- time: new Date().toLocaleTimeString('fa-IR', { hour: '2-digit', minute: '2-digit' }),
1131
- type: author === currentUser ? 'sent' : 'received'
1132
- };
1133
- rooms[currentRoom].messages.push(message);
1134
- appendMessageToDOM(message);
1135
- scrollToBottom();
1136
- }
1137
-
1138
- function appendMessageToDOM(message) {
1139
- const container = document.getElementById('chat-messages');
1140
- const div = document.createElement('div');
1141
- div.className = `message ${message.type}`;
1142
- div.innerHTML = `
1143
- <div class="message-author">${message.author}</div>
1144
- ${message.text}
1145
- <span class="message-time">${message.time}</span>
1146
- `;
1147
- container.appendChild(div);
1148
- scrollToBottom();
1149
- }
1150
-
1151
- function showTyping() {
1152
- document.getElementById('typing-indicator').classList.add('active');
1153
- scrollToBottom();
1154
- }
1155
-
1156
- function hideTyping() {
1157
- document.getElementById('typing-indicator').classList.remove('active');
1158
- }
1159
-
1160
- function scrollToBottom() {
1161
- const container = document.getElementById('chat-messages');
1162
- container.scrollTop = container.scrollHeight;
1163
- }
1164
-
1165
- function handleKeyPress(e) {
1166
- if (e.key === 'Enter') {
1167
- sendMessage();
1168
- }
1169
- }
1170
-
1171
- function toggleSidebar() {
1172
- document.getElementById('sidebar').classList.toggle('open');
1173
- }
1174
-
1175
- // Initialize first room
1176
- switchRoom(0);
1177
-
1178
- // Simulate random activity
1179
- setInterval(() => {
1180
- if (currentUser && Math.random() > 0.7) {
1181
- const roomIndex = Math.floor(Math.random() * rooms.length);
1182
- rooms[roomIndex].online += Math.random() > 0.5 ? 1 : -1;
1183
- if (rooms[roomIndex].online < 1) rooms[roomIndex].online = 1;
1184
-
1185
- if (roomIndex === currentRoom) {
1186
- document.querySelector('.online-count').textContent = rooms[roomIndex].online;
1187
- }
1188
- }
1189
- }, 10000);
1190
- </script>
1191
- </body>
1192
- </html>
 
1
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="built-with">
2
+ <i class="fas fa-code"></i> Built with anycoder
3
+ </a>