GSMEthesis commited on
Commit
8db3c89
·
verified ·
1 Parent(s): 1881626

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -115
app.py CHANGED
@@ -461,121 +461,6 @@ div[data-testid="stVerticalBlock"] > div[data-testid="stHorizontalBlock"] > div
461
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important; /* سایه بیشتر */
462
  }
463
 
464
- /* ======== استایل‌های سفارشی اسلایدر ======== */
465
-
466
- /* استایل اسلایدر */
467
- .stSlider > div > div > div > div {
468
- background: linear-gradient(90deg, #E6E6FA, #6A0DAD) !important;
469
- height: 10px !important;
470
- }
471
-
472
- /* نقاط اسلایدر */
473
- .stSlider > div > div > div > div > div > div {
474
- width: 18px !important;
475
- height: 18px !important;
476
- border-radius: 50% !important;
477
- background-color: #6A0DAD !important;
478
- border: 3px solid white !important;
479
- box-shadow: 0 0 5px rgba(0,0,0,0.3) !important;
480
- }
481
-
482
- /* متن دو طرف */
483
- .slider-labels {
484
- display: flex;
485
- justify-content: space-between;
486
- margin: 5px 0 15px 0;
487
- font-family: 'B Nazanin' !important;
488
- font-size: 14px !important;
489
- color: #6A0DAD;
490
- }
491
-
492
- /* نقاط روی اسلایدر */
493
- div[data-testid="stVerticalBlock"] div[data-testid="stSlider"] div[data-testid="stThumbValue"] {
494
- visibility: visible !important;
495
- }
496
-
497
- /* دسته اسلایدر */
498
- div[data-testid="stVerticalBlock"] div[data-testid="stSlider"] div[role="slider"] {
499
- background-color: #6a0dad !important;
500
- z-index: 1;
501
- }
502
-
503
- /* خط زمینه اسلایدر */
504
- div[data-testid="stVerticalBlock"] div[data-testid="stSlider"] div[role="slider"]::before {
505
- content: "";
506
- display: block;
507
- position: absolute;
508
- background-color: #e6e6fa;
509
- height: 6px;
510
- width: 100%;
511
- top: 50%;
512
- transform: translateY(-50%);
513
- border-radius: 3px;
514
- z-index: 0;
515
- }
516
-
517
- /* نقاط گسسته برای اسلایدر 5 نقطه‌ای */
518
- div[data-testid="stVerticalBlock"] div[data-testid="stSlider"][data-discrete="five-point"] div[role="slider"]::after {
519
- content: "";
520
- position: absolute;
521
- width: 100%;
522
- height: 15px;
523
- top: 50%;
524
- transform: translateY(-50%);
525
- background: repeating-linear-gradient(
526
- to right,
527
- transparent,
528
- transparent calc(25% - 1px),
529
- #6a0dad calc(25%),
530
- #6a0dad calc(25% + 1px),
531
- transparent calc(25% + 1px),
532
- transparent calc(50% - 1px),
533
- #6a0dad calc(50%),
534
- #6a0dad calc(50% + 1px),
535
- transparent calc(50% + 1px),
536
- transparent calc(75% - 1px),
537
- #6a0dad calc(75%),
538
- #6a0dad calc(75% + 1px)
539
- );
540
- pointer-events: none;
541
- z-index: 0;
542
- }
543
-
544
- /* نقاط گسسته برای اسلایدر 7 نقطه‌ای */
545
- div[data-testid="stVerticalBlock"] div[data-testid="stSlider"][data-discrete="seven-point"] div[role="slider"]::after {
546
- content: "";
547
- position: absolute;
548
- width: 100%;
549
- height: 15px;
550
- top: 50%;
551
- transform: translateY(-50%);
552
- background: repeating-linear-gradient(
553
- to right,
554
- transparent,
555
- transparent calc(16.66% - 1px),
556
- #6a0dad calc(16.66%),
557
- #6a0dad calc(16.66% + 1px),
558
- transparent calc(16.66% + 1px),
559
- transparent calc(33.33% - 1px),
560
- #6a0dad calc(33.33%),
561
- #6a0dad calc(33.33% + 1px),
562
- transparent calc(33.33% + 1px),
563
- transparent calc(50% - 1px),
564
- #6a0dad calc(50%),
565
- #6a0dad calc(50% + 1px),
566
- transparent calc(50% + 1px),
567
- transparent calc(66.66% - 1px),
568
- #6a0dad calc(66.66%),
569
- #6a0dad calc(66.66% + 1px),
570
- transparent calc(66.66% + 1px),
571
- transparent calc(83.33% - 1px),
572
- #6a0dad calc(83.33%),
573
- #6a0dad calc(83.33% + 1px)
574
- );
575
- pointer-events: none;
576
- z-index: 0;
577
- }
578
-
579
  /* استایل تضمینی برای رادیو باتن‌ها - نسخه نهایی */
580
  .stRadio > div > div > div > div > div > label,
581
  .stRadio > div > div > div > div > label,
@@ -787,6 +672,35 @@ h3 {
787
  </style>
788
  """, unsafe_allow_html=True)
789
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  # ========== توابع اصلی ==========
791
  def create_ride_map():
792
  """ایجاد نقشه سفر با Folium - نسخه اصلاح شده با مناطق عمومی"""
 
461
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important; /* سایه بیشتر */
462
  }
463
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
  /* استایل تضمینی برای رادیو باتن‌ها - نسخه نهایی */
465
  .stRadio > div > div > div > div > div > label,
466
  .stRadio > div > div > div > div > label,
 
672
  </style>
673
  """, unsafe_allow_html=True)
674
 
675
+ components.html("""
676
+ <script>
677
+ function styleSliders() {
678
+ // اضافه کردن نقاط به اسلایدرها
679
+ const sliders = document.querySelectorAll('[data-testid="stSlider"] > div:first-child');
680
+ sliders.forEach(slider => {
681
+ const max = parseInt(slider.getAttribute('aria-valuemax'));
682
+ const min = parseInt(slider.getAttribute('aria-valuemin'));
683
+ const steps = max - min;
684
+
685
+ // ایجاد نقاط
686
+ slider.style.background = `repeating-linear-gradient(
687
+ to right,
688
+ #6a0dad,
689
+ #6a0dad 2px,
690
+ transparent 2px,
691
+ transparent calc(100%/${steps} - 1px),
692
+ #6a0dad calc(100%/${steps}),
693
+ #6a0dad calc(100%/${steps} + 1px)
694
+ )`;
695
+ });
696
+ }
697
+
698
+ // اجرای تابع پس از بارگذاری صفحه
699
+ document.addEventListener('DOMContentLoaded', styleSliders);
700
+ window.addEventListener('load', styleSliders);
701
+ </script>
702
+ """)
703
+
704
  # ========== توابع اصلی ==========
705
  def create_ride_map():
706
  """ایجاد نقشه سفر با Folium - نسخه اصلاح شده با مناطق عمومی"""