Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- index.html +578 -755
index.html
CHANGED
|
@@ -1,764 +1,587 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="fa" dir="rtl">
|
| 3 |
-
|
| 4 |
<head>
|
| 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 |
-
background: none;
|
| 315 |
-
border: none;
|
| 316 |
-
color: #818cf8;
|
| 317 |
-
cursor: pointer;
|
| 318 |
-
font-family: var(--font-main);
|
| 319 |
-
font-weight: 700;
|
| 320 |
-
padding: 0 5px;
|
| 321 |
-
position: relative;
|
| 322 |
-
transition: var(--transition);
|
| 323 |
-
}
|
| 324 |
-
|
| 325 |
-
.switch-mode button::after {
|
| 326 |
-
content: '';
|
| 327 |
-
position: absolute;
|
| 328 |
-
width: 0;
|
| 329 |
-
height: 2px;
|
| 330 |
-
bottom: -2px;
|
| 331 |
-
right: 0;
|
| 332 |
-
background-color: #818cf8;
|
| 333 |
-
transition: width 0.3s;
|
| 334 |
-
}
|
| 335 |
-
|
| 336 |
-
.switch-mode button:hover::after {
|
| 337 |
-
width: 100%;
|
| 338 |
-
}
|
| 339 |
-
|
| 340 |
-
/* مدیریت نمایش فرمها (انیمیشن) */
|
| 341 |
-
.form-wrapper {
|
| 342 |
-
transition: opacity 0.4s ease, transform 0.4s ease;
|
| 343 |
-
}
|
| 344 |
-
|
| 345 |
-
.hidden {
|
| 346 |
-
display: none;
|
| 347 |
-
opacity: 0;
|
| 348 |
-
transform: translateY(10px);
|
| 349 |
-
}
|
| 350 |
-
|
| 351 |
-
.fade-in {
|
| 352 |
-
animation: fadeIn 0.5s forwards;
|
| 353 |
-
}
|
| 354 |
-
|
| 355 |
-
@keyframes fadeIn {
|
| 356 |
-
from {
|
| 357 |
-
opacity: 0;
|
| 358 |
-
transform: translateY(10px);
|
| 359 |
-
}
|
| 360 |
-
|
| 361 |
-
to {
|
| 362 |
-
opacity: 1;
|
| 363 |
-
transform: translateY(0);
|
| 364 |
-
}
|
| 365 |
-
}
|
| 366 |
-
|
| 367 |
-
/* Toast بهبود یافته */
|
| 368 |
-
.toast-container {
|
| 369 |
-
position: fixed;
|
| 370 |
-
bottom: 30px;
|
| 371 |
-
left: 50%;
|
| 372 |
-
transform: translateX(-50%);
|
| 373 |
-
z-index: 1000;
|
| 374 |
-
display: flex;
|
| 375 |
-
flex-direction: column;
|
| 376 |
-
align-items: center;
|
| 377 |
-
gap: 10px;
|
| 378 |
-
width: 90%;
|
| 379 |
-
max-width: 350px;
|
| 380 |
-
pointer-events: none; /* اجازه کلیک روی فضای خالی */
|
| 381 |
-
}
|
| 382 |
-
|
| 383 |
-
.toast {
|
| 384 |
-
background: rgba(30, 41, 59, 0.95);
|
| 385 |
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 386 |
-
backdrop-filter: blur(10px);
|
| 387 |
-
padding: 14px 20px;
|
| 388 |
-
border-radius: 12px;
|
| 389 |
-
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
|
| 390 |
-
color: var(--text-color);
|
| 391 |
-
font-size: 0.9rem;
|
| 392 |
-
display: flex;
|
| 393 |
-
align-items: center;
|
| 394 |
-
gap: 12px;
|
| 395 |
-
width: 100%;
|
| 396 |
-
animation: toastUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
| 397 |
-
pointer-events: auto;
|
| 398 |
-
}
|
| 399 |
-
|
| 400 |
-
.toast.success {
|
| 401 |
-
border-right: 4px solid #22c55e;
|
| 402 |
-
}
|
| 403 |
-
|
| 404 |
-
.toast.error {
|
| 405 |
-
border-right: 4px solid #ef4444;
|
| 406 |
-
}
|
| 407 |
-
|
| 408 |
-
@keyframes toastUp {
|
| 409 |
-
from {
|
| 410 |
-
transform: translateY(50px);
|
| 411 |
-
opacity: 0;
|
| 412 |
-
}
|
| 413 |
-
|
| 414 |
-
to {
|
| 415 |
-
transform: translateY(0);
|
| 416 |
-
opacity: 1;
|
| 417 |
-
}
|
| 418 |
-
}
|
| 419 |
-
|
| 420 |
-
/* --- بخش رسپانسیو (Responsive) --- */
|
| 421 |
-
@media (max-width: 480px) {
|
| 422 |
-
.container {
|
| 423 |
-
padding: 30px 20px;
|
| 424 |
-
}
|
| 425 |
-
|
| 426 |
-
.form-header h2 {
|
| 427 |
-
font-size: 1.5rem;
|
| 428 |
-
}
|
| 429 |
-
|
| 430 |
-
.input-group label {
|
| 431 |
-
font-size: 0.8rem;
|
| 432 |
-
}
|
| 433 |
-
|
| 434 |
-
/* بهینهسازی کپچا برای موبایل */
|
| 435 |
-
.captcha-container {
|
| 436 |
-
justify-content: space-between;
|
| 437 |
-
gap: 8px;
|
| 438 |
-
}
|
| 439 |
-
|
| 440 |
-
canvas {
|
| 441 |
-
width: 90px;
|
| 442 |
-
height: 38px;
|
| 443 |
-
}
|
| 444 |
-
|
| 445 |
-
.captcha-container input {
|
| 446 |
-
flex: 1;
|
| 447 |
-
font-size: 1rem;
|
| 448 |
-
}
|
| 449 |
-
|
| 450 |
-
.header-link {
|
| 451 |
-
font-size: 0.75rem;
|
| 452 |
-
padding: 6px 10px;
|
| 453 |
-
}
|
| 454 |
-
}
|
| 455 |
-
|
| 456 |
-
@media (max-width: 360px) {
|
| 457 |
-
.container {
|
| 458 |
-
padding: 25px 15px;
|
| 459 |
-
}
|
| 460 |
-
|
| 461 |
-
.submit-btn {
|
| 462 |
-
font-size: 0.9rem;
|
| 463 |
-
}
|
| 464 |
-
|
| 465 |
-
/* اگر صفحه خیلی کوچک باشد، ورودی کپچا تمام عرض شود */
|
| 466 |
-
.captcha-container {
|
| 467 |
-
flex-direction: column;
|
| 468 |
-
align-items: stretch;
|
| 469 |
-
}
|
| 470 |
-
|
| 471 |
-
.captcha-container > div {
|
| 472 |
-
display: flex;
|
| 473 |
-
justify-content: space-between;
|
| 474 |
-
width: 100%;
|
| 475 |
-
}
|
| 476 |
-
|
| 477 |
-
canvas {
|
| 478 |
-
width: 100%;
|
| 479 |
-
}
|
| 480 |
-
}
|
| 481 |
-
</style>
|
| 482 |
</head>
|
| 483 |
-
|
| 484 |
<body>
|
| 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 |
</div>
|
| 531 |
-
|
| 532 |
-
<button type="submit" class="submit-btn">
|
| 533 |
-
<span>ورود به حساب</span>
|
| 534 |
-
<svg class="icon" viewBox="0 0 24 24"><path d="M11 7L9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5-5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8v14z"/></svg>
|
| 535 |
-
</button>
|
| 536 |
-
|
| 537 |
-
<div class="switch-mode">
|
| 538 |
-
حساب کاربری ندارید؟
|
| 539 |
-
<button type="button" onclick="switchForm('register')">ثبت نام کنید</button>
|
| 540 |
-
</div>
|
| 541 |
-
</form>
|
| 542 |
</div>
|
| 543 |
|
| 544 |
-
<!--
|
| 545 |
-
<div
|
| 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 |
-
btn.disabled = false;
|
| 744 |
-
btn.innerHTML = originalContent;
|
| 745 |
-
btn.style.opacity = '1';
|
| 746 |
-
showToast('ورود با موفقیت انجام شد!', 'success');
|
| 747 |
-
}, 1500);
|
| 748 |
-
}
|
| 749 |
-
|
| 750 |
-
function handleRegister(e) {
|
| 751 |
-
e.preventDefault();
|
| 752 |
-
const u = document.getElementById('reg-username').value;
|
| 753 |
-
const p = document.getElementById('reg-password').value;
|
| 754 |
-
const cp = document.getElementById('reg-confirm-password').value;
|
| 755 |
-
const c = document.getElementById('reg-captcha').value.toUpperCase();
|
| 756 |
-
|
| 757 |
-
if(!u || !p || !cp) return showToast('لطفاً همه فیلدها را پر کنید', 'error');
|
| 758 |
-
if(p.length < 6) return showToast('رمز عبور باید حداقل ۶ کاراکتر باشد', 'error');
|
| 759 |
-
if(p !== cp) return showToast('تکرار رمز عبور مطابقت ندارد', 'error');
|
| 760 |
-
if(c !== currentCaptchaReg) return showToast('کد امنیتی اشتباه است', 'error');
|
| 761 |
-
|
| 762 |
-
const btn = e.target.querySelector('.submit-btn');
|
| 763 |
-
const originalContent = btn.innerHTML;
|
| 764 |
-
btn
|
|
|
|
| 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>ورود به چت روم | Chat Room Login</title>
|
| 7 |
+
<!-- استفاده از FontAwesome برای آیکونها -->
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
|
| 10 |
+
<style>
|
| 11 |
+
/* تنظیمات کلی و متغیرهای رنگی */
|
| 12 |
+
:root {
|
| 13 |
+
--bg-color: #0f172a;
|
| 14 |
+
--card-bg: rgba(30, 41, 59, 0.6);
|
| 15 |
+
--primary: #6366f1; /* رنگ اصلی بنفش-آبی */
|
| 16 |
+
--primary-hover: #4f46e5;
|
| 17 |
+
--text-main: #f8fafc;
|
| 18 |
+
--text-muted: #94a3b8;
|
| 19 |
+
--border-color: rgba(148, 163, 184, 0.2);
|
| 20 |
+
--error: #ef4444;
|
| 21 |
+
--success: #10b981;
|
| 22 |
+
--font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
* {
|
| 26 |
+
box-sizing: border-box;
|
| 27 |
+
margin: 0;
|
| 28 |
+
padding: 0;
|
| 29 |
+
outline: none;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
body {
|
| 33 |
+
font-family: var(--font-family);
|
| 34 |
+
background-color: var(--bg-color);
|
| 35 |
+
background-image:
|
| 36 |
+
radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%),
|
| 37 |
+
radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%),
|
| 38 |
+
radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
|
| 39 |
+
color: var(--text-main);
|
| 40 |
+
height: 100vh;
|
| 41 |
+
display: flex;
|
| 42 |
+
flex-direction: column;
|
| 43 |
+
justify-content: center;
|
| 44 |
+
align-items: center;
|
| 45 |
+
overflow: hidden;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/* هدر و لینک anycoder */
|
| 49 |
+
header {
|
| 50 |
+
position: absolute;
|
| 51 |
+
top: 20px;
|
| 52 |
+
width: 100%;
|
| 53 |
+
text-align: center;
|
| 54 |
+
z-index: 10;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.anycoder-link {
|
| 58 |
+
color: var(--text-muted);
|
| 59 |
+
text-decoration: none;
|
| 60 |
+
font-size: 0.9rem;
|
| 61 |
+
transition: color 0.3s ease;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.anycoder-link:hover {
|
| 65 |
+
color: var(--primary);
|
| 66 |
+
text-shadow: 0 0 8px var(--primary);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/* کانتینر اصلی کارت */
|
| 70 |
+
.container {
|
| 71 |
+
width: 100%;
|
| 72 |
+
max-width: 420px;
|
| 73 |
+
padding: 20px;
|
| 74 |
+
perspective: 1000px;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.card {
|
| 78 |
+
background: var(--card-bg);
|
| 79 |
+
backdrop-filter: blur(12px);
|
| 80 |
+
-webkit-backdrop-filter: blur(12px);
|
| 81 |
+
border: 1px solid var(--border-color);
|
| 82 |
+
border-radius: 20px;
|
| 83 |
+
padding: 40px 30px;
|
| 84 |
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
| 85 |
+
animation: fadeIn 0.8s ease-out;
|
| 86 |
+
position: relative;
|
| 87 |
+
overflow: hidden;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
@keyframes fadeIn {
|
| 91 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 92 |
+
to { opacity: 1; transform: translateY(0); }
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/* تبهای سوئیچ */
|
| 96 |
+
.tabs {
|
| 97 |
+
display: flex;
|
| 98 |
+
justify-content: center;
|
| 99 |
+
margin-bottom: 30px;
|
| 100 |
+
position: relative;
|
| 101 |
+
border-bottom: 1px solid var(--border-color);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.tab-btn {
|
| 105 |
+
background: transparent;
|
| 106 |
+
border: none;
|
| 107 |
+
color: var(--text-muted);
|
| 108 |
+
font-family: inherit;
|
| 109 |
+
font-size: 1rem;
|
| 110 |
+
padding: 10px 20px;
|
| 111 |
+
cursor: pointer;
|
| 112 |
+
transition: all 0.3s ease;
|
| 113 |
+
position: relative;
|
| 114 |
+
z-index: 1;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
.tab-btn.active {
|
| 118 |
+
color: var(--text-main);
|
| 119 |
+
font-weight: bold;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
.tab-btn.active::after {
|
| 123 |
+
content: '';
|
| 124 |
+
position: absolute;
|
| 125 |
+
bottom: -1px;
|
| 126 |
+
left: 0;
|
| 127 |
+
width: 100%;
|
| 128 |
+
height: 3px;
|
| 129 |
+
background: var(--primary);
|
| 130 |
+
border-radius: 3px 3px 0 0;
|
| 131 |
+
box-shadow: 0 -2px 10px var(--primary);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
/* فرمها */
|
| 135 |
+
.form-wrapper {
|
| 136 |
+
position: relative;
|
| 137 |
+
min-height: 320px; /* ارتفاع ثابت برای جلوگیری از پرش */
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
.form-content {
|
| 141 |
+
position: absolute;
|
| 142 |
+
top: 0;
|
| 143 |
+
left: 0;
|
| 144 |
+
width: 100%;
|
| 145 |
+
transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
|
| 146 |
+
opacity: 0;
|
| 147 |
+
visibility: hidden;
|
| 148 |
+
transform: translateX(50px);
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
.form-content.active {
|
| 152 |
+
opacity: 1;
|
| 153 |
+
visibility: visible;
|
| 154 |
+
transform: translateX(0);
|
| 155 |
+
position: relative;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
/* استایل ورودیها */
|
| 159 |
+
.input-group {
|
| 160 |
+
position: relative;
|
| 161 |
+
margin-bottom: 20px;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
.input-group i {
|
| 165 |
+
position: absolute;
|
| 166 |
+
top: 50%;
|
| 167 |
+
right: 15px;
|
| 168 |
+
transform: translateY(-50%);
|
| 169 |
+
color: var(--text-muted);
|
| 170 |
+
transition: color 0.3s;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
.form-input {
|
| 174 |
+
width: 100%;
|
| 175 |
+
background: rgba(15, 23, 42, 0.6);
|
| 176 |
+
border: 1px solid var(--border-color);
|
| 177 |
+
border-radius: 12px;
|
| 178 |
+
padding: 12px 45px 12px 15px;
|
| 179 |
+
color: var(--text-main);
|
| 180 |
+
font-size: 0.95rem;
|
| 181 |
+
transition: all 0.3s ease;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
.form-input:focus {
|
| 185 |
+
border-color: var(--primary);
|
| 186 |
+
box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
.form-input:focus + i {
|
| 190 |
+
color: var(--primary);
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
/* دکمه نمایش رمز عبور */
|
| 194 |
+
.toggle-password {
|
| 195 |
+
position: absolute;
|
| 196 |
+
left: 15px;
|
| 197 |
+
right: auto !important;
|
| 198 |
+
cursor: pointer;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
/* بخش کپچا */
|
| 202 |
+
.captcha-area {
|
| 203 |
+
display: flex;
|
| 204 |
+
align-items: center;
|
| 205 |
+
gap: 10px;
|
| 206 |
+
margin-bottom: 20px;
|
| 207 |
+
background: rgba(255, 255, 255, 0.05);
|
| 208 |
+
padding: 10px;
|
| 209 |
+
border-radius: 12px;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
#captchaCanvas {
|
| 213 |
+
background: #fff;
|
| 214 |
+
border-radius: 8px;
|
| 215 |
+
cursor: pointer;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
.captcha-input {
|
| 219 |
+
flex: 1;
|
| 220 |
+
background: transparent;
|
| 221 |
+
border: none;
|
| 222 |
+
border-bottom: 1px solid var(--border-color);
|
| 223 |
+
color: var(--text-main);
|
| 224 |
+
padding: 5px;
|
| 225 |
+
text-align: center;
|
| 226 |
+
font-family: monospace;
|
| 227 |
+
font-size: 1.1rem;
|
| 228 |
+
letter-spacing: 2px;
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
.captcha-input:focus {
|
| 232 |
+
border-bottom-color: var(--primary);
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
/* دکمه اصلی */
|
| 236 |
+
.submit-btn {
|
| 237 |
+
width: 100%;
|
| 238 |
+
padding: 14px;
|
| 239 |
+
background: linear-gradient(135deg, var(--primary), #818cf8);
|
| 240 |
+
color: white;
|
| 241 |
+
border: none;
|
| 242 |
+
border-radius: 12px;
|
| 243 |
+
font-size: 1rem;
|
| 244 |
+
font-weight: bold;
|
| 245 |
+
cursor: pointer;
|
| 246 |
+
transition: transform 0.2s, box-shadow 0.2s;
|
| 247 |
+
font-family: inherit;
|
| 248 |
+
display: flex;
|
| 249 |
+
justify-content: center;
|
| 250 |
+
align-items: center;
|
| 251 |
+
gap: 10px;
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
.submit-btn:hover {
|
| 255 |
+
transform: translateY(-2px);
|
| 256 |
+
box-shadow: 0 10px 20px -10px var(--primary);
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
.submit-btn:active {
|
| 260 |
+
transform: translateY(0);
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
/* سیستم Toast Notification */
|
| 264 |
+
.toast-container {
|
| 265 |
+
position: fixed;
|
| 266 |
+
top: 20px;
|
| 267 |
+
left: 50%;
|
| 268 |
+
transform: translateX(-50%);
|
| 269 |
+
z-index: 1000;
|
| 270 |
+
display: flex;
|
| 271 |
+
flex-direction: column;
|
| 272 |
+
gap: 10px;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
.toast {
|
| 276 |
+
min-width: 300px;
|
| 277 |
+
padding: 16px;
|
| 278 |
+
border-radius: 10px;
|
| 279 |
+
color: white;
|
| 280 |
+
font-size: 0.9rem;
|
| 281 |
+
display: flex;
|
| 282 |
+
align-items: center;
|
| 283 |
+
gap: 12px;
|
| 284 |
+
box-shadow: 0 10px 30px rgba(0,0,0,0.3);
|
| 285 |
+
animation: slideDown 0.4s ease forwards;
|
| 286 |
+
backdrop-filter: blur(5px);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
.toast.success { background: rgba(16, 185, 129, 0.9); border-right: 4px solid #059669; }
|
| 290 |
+
.toast.error { background: rgba(239, 68, 68, 0.9); border-right: 4px solid #dc2626; }
|
| 291 |
+
.toast.info { background: rgba(59, 130, 246, 0.9); border-right: 4px solid #2563eb; }
|
| 292 |
+
|
| 293 |
+
@keyframes slideDown {
|
| 294 |
+
from { opacity: 0; transform: translateY(-20px); }
|
| 295 |
+
to { opacity: 1; transform: translateY(0); }
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
@keyframes fadeOut {
|
| 299 |
+
to { opacity: 0; transform: translateY(-20px); }
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
/* ریسپانسیو */
|
| 303 |
+
@media (max-width: 480px) {
|
| 304 |
+
.card {
|
| 305 |
+
padding: 30px 20px;
|
| 306 |
+
width: 95%;
|
| 307 |
+
}
|
| 308 |
+
.container {
|
| 309 |
+
padding: 10px;
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
</head>
|
|
|
|
| 314 |
<body>
|
| 315 |
|
| 316 |
+
<!-- هدر شامل لینک مورد نظر -->
|
| 317 |
+
<header>
|
| 318 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
|
| 319 |
+
Built with anycoder <i class="fas fa-code"></i>
|
| 320 |
+
</a>
|
| 321 |
+
</header>
|
| 322 |
+
|
| 323 |
+
<!-- کانتینر اصلی -->
|
| 324 |
+
<div class="container">
|
| 325 |
+
<div class="card">
|
| 326 |
+
|
| 327 |
+
<!-- تبهای تغییر وضعیت -->
|
| 328 |
+
<div class="tabs">
|
| 329 |
+
<button class="tab-btn active" onclick="switchTab('login')">ورود</button>
|
| 330 |
+
<button class="tab-btn" onclick="switchTab('register')">ثبتنام</button>
|
| 331 |
+
</div>
|
| 332 |
+
|
| 333 |
+
<div class="form-wrapper">
|
| 334 |
+
<!-- فرم ورود -->
|
| 335 |
+
<form id="loginForm" class="form-content active" novalidate onsubmit="handleLogin(event)">
|
| 336 |
+
<div class="input-group">
|
| 337 |
+
<input type="text" class="form-input" placeholder="نام کاربری" required>
|
| 338 |
+
<i class="fas fa-user"></i>
|
| 339 |
+
</div>
|
| 340 |
+
<div class="input-group">
|
| 341 |
+
<input type="password" class="form-input" placeholder="رمز عبور" required>
|
| 342 |
+
<i class="fas fa-lock"></i>
|
| 343 |
+
<i class="fas fa-eye toggle-password" onclick="togglePassword(this)"></i>
|
| 344 |
+
</div>
|
| 345 |
+
|
| 346 |
+
<div class="captcha-area">
|
| 347 |
+
<canvas id="loginCaptcha" width="100" height="40" onclick="generateCaptcha('loginCaptcha')"></canvas>
|
| 348 |
+
<input type="text" class="captcha-input" placeholder="کد تصویر" maxlength="5">
|
| 349 |
+
<i class="fas fa-sync-alt" onclick="generateCaptcha('loginCaptcha')" style="cursor:pointer; color:var(--primary)"></i>
|
| 350 |
+
</div>
|
| 351 |
+
|
| 352 |
+
<button type="submit" class="submit-btn">
|
| 353 |
+
<span>ورود به حساب</span>
|
| 354 |
+
<i class="fas fa-arrow-left"></i>
|
| 355 |
+
</button>
|
| 356 |
+
</form>
|
| 357 |
+
|
| 358 |
+
<!-- فرم ثبتنام -->
|
| 359 |
+
<form id="registerForm" class="form-content" novalidate onsubmit="handleRegister(event)">
|
| 360 |
+
<div class="input-group">
|
| 361 |
+
<input type="text" class="form-input" placeholder="نام کاربری جدید" required>
|
| 362 |
+
<i class="fas fa-user-plus"></i>
|
| 363 |
+
</div>
|
| 364 |
+
<div class="input-group">
|
| 365 |
+
<input type="password" class="form-input" id="regPass" placeholder="رمز عبور" required>
|
| 366 |
+
<i class="fas fa-lock"></i>
|
| 367 |
+
<i class="fas fa-eye toggle-password" onclick="togglePassword(this)"></i>
|
| 368 |
+
</div>
|
| 369 |
+
<div class="input-group">
|
| 370 |
+
<input type="password" class="form-input" placeholder="تکرار رمز عبور" required>
|
| 371 |
+
<i class="fas fa-check-double"></i>
|
| 372 |
+
</div>
|
| 373 |
+
|
| 374 |
+
<div class="captcha-area">
|
| 375 |
+
<canvas id="regCaptcha" width="100" height="40" onclick="generateCaptcha('regCaptcha')"></canvas>
|
| 376 |
+
<input type="text" class="captcha-input" placeholder="کد تصویر" maxlength="5">
|
| 377 |
+
<i class="fas fa-sync-alt" onclick="generateCaptcha('regCaptcha')" style="cursor:pointer; color:var(--primary)"></i>
|
| 378 |
+
</div>
|
| 379 |
+
|
| 380 |
+
<button type="submit" class="submit-btn">
|
| 381 |
+
<span>ساخت حساب کاربری</span>
|
| 382 |
+
<i class="fas fa-user-check"></i>
|
| 383 |
+
</button>
|
| 384 |
+
</form>
|
| 385 |
+
</div>
|
| 386 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
</div>
|
| 388 |
|
| 389 |
+
<!-- کانتینر پیامها -->
|
| 390 |
+
<div class="toast-container" id="toastContainer"></div>
|
| 391 |
+
|
| 392 |
+
<script>
|
| 393 |
+
// --- مدیریت تبها ---
|
| 394 |
+
function switchTab(tab) {
|
| 395 |
+
const loginForm = document.getElementById('loginForm');
|
| 396 |
+
const registerForm = document.getElementById('registerForm');
|
| 397 |
+
const btns = document.querySelectorAll('.tab-btn');
|
| 398 |
+
|
| 399 |
+
if (tab === 'login') {
|
| 400 |
+
loginForm.classList.add('active');
|
| 401 |
+
registerForm.classList.remove('active');
|
| 402 |
+
btns[0].classList.add('active');
|
| 403 |
+
btns[1].classList.remove('active');
|
| 404 |
+
generateCaptcha('loginCaptcha'); // رفرش کپچا برای امنیت
|
| 405 |
+
} else {
|
| 406 |
+
loginForm.classList.remove('active');
|
| 407 |
+
registerForm.classList.add('active');
|
| 408 |
+
btns[0].classList.remove('active');
|
| 409 |
+
btns[1].classList.add('active');
|
| 410 |
+
generateCaptcha('regCaptcha'); // رفرش کپچا برای امنیت
|
| 411 |
+
}
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
// --- مدیریت نمایش/مخفی کردن رمز عبور ---
|
| 415 |
+
function togglePassword(icon) {
|
| 416 |
+
const input = icon.previousElementSibling.previousElementSibling;
|
| 417 |
+
if (input.type === 'password') {
|
| 418 |
+
input.type = 'text';
|
| 419 |
+
icon.classList.remove('fa-eye');
|
| 420 |
+
icon.classList.add('fa-eye-slash');
|
| 421 |
+
} else {
|
| 422 |
+
input.type = 'password';
|
| 423 |
+
icon.classList.remove('fa-eye-slash');
|
| 424 |
+
icon.classList.add('fa-eye');
|
| 425 |
+
}
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
// --- سیستم تولید کپچا (بدون نیاز به سرور) ---
|
| 429 |
+
const captchaCodes = {};
|
| 430 |
+
|
| 431 |
+
function generateCaptcha(canvasId) {
|
| 432 |
+
const canvas = document.getElementById(canvasId);
|
| 433 |
+
const ctx = canvas.getContext('2d');
|
| 434 |
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
| 435 |
+
|
| 436 |
+
// پسزمینه نویز
|
| 437 |
+
ctx.fillStyle = '#f1f5f9';
|
| 438 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
| 439 |
+
|
| 440 |
+
// تولید کد رندوم 5 کاراکتری
|
| 441 |
+
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
| 442 |
+
let code = '';
|
| 443 |
+
for (let i = 0; i < 5; i++) {
|
| 444 |
+
code += chars[Math.floor(Math.random() * chars.length)];
|
| 445 |
+
}
|
| 446 |
+
captchaCodes[canvasId] = code;
|
| 447 |
+
|
| 448 |
+
// رسم متن
|
| 449 |
+
ctx.font = 'bold 24px monospace';
|
| 450 |
+
ctx.textBaseline = 'middle';
|
| 451 |
+
for (let i = 0; i < code.length; i++) {
|
| 452 |
+
ctx.save();
|
| 453 |
+
// چرخش و موقعیت تصادفی برای هر حرف
|
| 454 |
+
const x = 15 + i * 18;
|
| 455 |
+
const y = 20 + (Math.random() - 0.5) * 10;
|
| 456 |
+
const angle = (Math.random() - 0.5) * 0.4;
|
| 457 |
+
|
| 458 |
+
ctx.translate(x, y);
|
| 459 |
+
ctx.rotate(angle);
|
| 460 |
+
ctx.fillStyle = `rgb(${Math.random()*100}, ${Math.random()*100}, ${Math.random()*150})`;
|
| 461 |
+
ctx.fillText(code[i], 0, 0);
|
| 462 |
+
ctx.restore();
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
// اضافه کردن خطوط نویز
|
| 466 |
+
for (let i = 0; i < 5; i++) {
|
| 467 |
+
ctx.strokeStyle = `rgba(0,0,0,0.2)`;
|
| 468 |
+
ctx.beginPath();
|
| 469 |
+
ctx.moveTo(Math.random() * canvas.width, Math.random() * canvas.height);
|
| 470 |
+
ctx.lineTo(Math.random() * canvas.width, Math.random() * canvas.height);
|
| 471 |
+
ctx.stroke();
|
| 472 |
+
}
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
// --- سیستم نمایش پیام (Toast) ---
|
| 476 |
+
function showToast(message, type = 'info') {
|
| 477 |
+
const container = document.getElementById('toastContainer');
|
| 478 |
+
const toast = document.createElement('div');
|
| 479 |
+
toast.className = `toast ${type}`;
|
| 480 |
+
|
| 481 |
+
let icon = 'fa-info-circle';
|
| 482 |
+
if (type === 'success') icon = 'fa-check-circle';
|
| 483 |
+
if (type === 'error') icon = 'fa-exclamation-circle';
|
| 484 |
+
|
| 485 |
+
toast.innerHTML = `<i class="fas ${icon}"></i> <span>${message}</span>`;
|
| 486 |
+
|
| 487 |
+
container.appendChild(toast);
|
| 488 |
+
|
| 489 |
+
// حذف خودکار بعد از 3 ثانیه
|
| 490 |
+
setTimeout(() => {
|
| 491 |
+
toast.style.animation = 'fadeOut 0.4s ease forwards';
|
| 492 |
+
toast.addEventListener('animationend', () => {
|
| 493 |
+
toast.remove();
|
| 494 |
+
});
|
| 495 |
+
}, 3000);
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
// --- منطق فرم ورود ---
|
| 499 |
+
function handleLogin(e) {
|
| 500 |
+
e.preventDefault();
|
| 501 |
+
const inputs = e.target.querySelectorAll('input');
|
| 502 |
+
const username = inputs[0].value.trim();
|
| 503 |
+
const password = inputs[1].value.trim();
|
| 504 |
+
const captchaInput = inputs[2].value.trim();
|
| 505 |
+
const canvasId = 'loginCaptcha';
|
| 506 |
+
|
| 507 |
+
// اعتبارسنجی
|
| 508 |
+
if (!username || !password) {
|
| 509 |
+
showToast('لطفا تمام فیلدها را پر کنید', 'error');
|
| 510 |
+
return;
|
| 511 |
+
}
|
| 512 |
+
if (captchaInput.toLowerCase() !== captchaCodes[canvasId].toLowerCase()) {
|
| 513 |
+
showToast('کد تصویر اشتباه است', 'error');
|
| 514 |
+
generateCaptcha(canvasId);
|
| 515 |
+
inputs[2].value = '';
|
| 516 |
+
return;
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
// شبیهسازی ارسال به سرور
|
| 520 |
+
const btn = e.target.querySelector('button');
|
| 521 |
+
const originalText = btn.innerHTML;
|
| 522 |
+
btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> بررسی...';
|
| 523 |
+
btn.disabled = true;
|
| 524 |
+
|
| 525 |
+
setTimeout(() => {
|
| 526 |
+
btn.innerHTML = originalText;
|
| 527 |
+
btn.disabled = false;
|
| 528 |
+
showToast('خوش آمدید! ورود موفقیت آمیز بود.', 'success');
|
| 529 |
+
// اینجا میتوان کاربر را به صفحه چت ردایرکت کرد
|
| 530 |
+
}, 1500);
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
// --- منطق فرم ثبتنام ---
|
| 534 |
+
function handleRegister(e) {
|
| 535 |
+
e.preventDefault();
|
| 536 |
+
const inputs = e.target.querySelectorAll('input');
|
| 537 |
+
const username = inputs[0].value.trim();
|
| 538 |
+
const pass = inputs[1].value.trim();
|
| 539 |
+
const confirmPass = inputs[2].value.trim();
|
| 540 |
+
const captchaInput = inputs[3].value.trim();
|
| 541 |
+
const canvasId = 'regCaptcha';
|
| 542 |
+
|
| 543 |
+
// اعتبارسنجی
|
| 544 |
+
if (!username || !pass || !confirmPass) {
|
| 545 |
+
showToast('لطفا تمام فیلدها را پر کنید', 'error');
|
| 546 |
+
return;
|
| 547 |
+
}
|
| 548 |
+
if (pass.length < 4) {
|
| 549 |
+
showToast('رمز عبور باید حداقل ۴ کاراکتر باشد', 'error');
|
| 550 |
+
return;
|
| 551 |
+
}
|
| 552 |
+
if (pass !== confirmPass) {
|
| 553 |
+
showToast('رمز عبور و تکرار آن مطابقت ندارند', 'error');
|
| 554 |
+
return;
|
| 555 |
+
}
|
| 556 |
+
if (captchaInput.toLowerCase() !== captchaCodes[canvasId].toLowerCase()) {
|
| 557 |
+
showToast('کد تصویر اشتباه است', 'error');
|
| 558 |
+
generateCaptcha(canvasId);
|
| 559 |
+
inputs[3].value = '';
|
| 560 |
+
return;
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
// شبیهسازی ثبتنام
|
| 564 |
+
const btn = e.target.querySelector('button');
|
| 565 |
+
const originalText = btn.innerHTML;
|
| 566 |
+
btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> در حال ثبت...';
|
| 567 |
+
btn.disabled = true;
|
| 568 |
+
|
| 569 |
+
setTimeout(() => {
|
| 570 |
+
btn.innerHTML = originalText;
|
| 571 |
+
btn.disabled = false;
|
| 572 |
+
showToast('حساب کاربری با موفقیت ساخته شد!', 'success');
|
| 573 |
+
// پاک کردن فرم و رفتن به تب ورود
|
| 574 |
+
e.target.reset();
|
| 575 |
+
switchTab('login');
|
| 576 |
+
}, 1500);
|
| 577 |
+
}
|
| 578 |
+
|
| 579 |
+
// مقداردهی اولیه کپچاها
|
| 580 |
+
window.onload = function() {
|
| 581 |
+
generateCaptcha('loginCaptcha');
|
| 582 |
+
generateCaptcha('regCaptcha');
|
| 583 |
+
};
|
| 584 |
+
|
| 585 |
+
</script>
|
| 586 |
+
</body>
|
| 587 |
+
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|