Schedules — กติกา "จุดนี้ = เวลาจุดอ้างอิง ± n นาที"
- ฟิลด์ derive { from_station_id, offset_min } คำนวณที่ ui/partials/schedules.js (ท่อเดียว) รองรับอ้างจุดข้ามทิศ
- จุดย่อยของ "8 other_stop" ใช้ offsets_min จับคู่ตามลำดับ (เช่น ตลาดสามโก้ = ตลาดท่าช้าง +45 นาที)
- เครื่องมือ resource/tools/derive-times.py + ตาราง resource/data/derive-times.csv (--check / --audit ชี้จุดที่ควรตั้งกฎ)
- แยกตารางเป็นรายสาย: scheduleslist/schedules<route_id>.json และ schedules.json เป็นสารบัญ (โหลดแบบ lazy + cache)
- ตรวจจับวันทำงาน/วันหยุด + schema 3 (weekday/holiday → directions) · ไฟล์ข้อมูลเป็น CRLF ทั้งชุด
- ล้างค่าที่ไม่ใช่ HH:MM ที่ฝังใน times (ทำให้ KPI เพี้ยน) + กันค่าหลอกในตัวสรุปเวลา
UI
- หน้ารายละเอียดป้าย/ตารางเวลา ขับเคลื่อนด้วย JSON (stopDetail.init.js) · จุดขึ้นรถประจำทางอื่นๆ รองรับหลายจุดต่อสาย
- #/stops: แสดง 6 ป้ายแรก + ปุ่ม "แสดงป้ายทั้งหมด" (โหลดรูปเฉพาะที่แสดง) · ชิปสาย → #/routes/<route_id>
- หน้าแรก: ตัดตัวเลือก "ทุกสถานีในจังหวัดนี้" · ตัวกรองจังหวัด/สถานี + ปุ่มแชร์ (share URL)
- การ์ดติดต่อ: ไอคอน/ชื่อ/สีเปลี่ยนตามชนิด URL (Facebook / LINE / เว็บไซต์) + ปุ่มเปิดลิงก์จาก web_url
- รูปรองรับหลายนามสกุล (.jpg → .jpeg → .webp → .png) · ป้าย "ประมาณ" + หมายเหตุสำหรับตารางที่คำนวณ
- หน้าเครดิตเหลือ 3 หมวด · แก้ข้อความหมวดแผนที่ให้ตรงกับข้อมูลจริง
- แผนที่ Leaflet (vendor ในโปรเจกต์ ไม่ใช้ CDN): เส้นทาง + หมุด + ป๊อปอัป · แก้ CSS ที่ทำให้ SVG ยุบ 0x0
เครื่องมือและเอกสาร
- qgis-to-web.py อ่าน .shp ตรง → geojson-web (สร้างใหม่ 10 ไฟล์) + audit-geojson.py ตรวจ 3 ส่วน
- stop-km.py วัดระยะ กม. ตามเส้นจริง → stop-km.json · schedules-editor.html (แก้ทีละไฟล์ · มุมมองตารางแบบ Excel)
- AGENTS.md: กติกา derive · offsets_min · นามสกุลรูป · ชิปสาย · หน้ารายละเอียดป้ายมาจากไหน
270 lines
13 KiB
CSS
270 lines
13 KiB
CSS
/* ============================================================
|
||
Atroute — Mobile-first responsive layer
|
||
------------------------------------------------------------
|
||
base = มือถือ (จอเล็กสุด iPhone 8 = 375px, รองรับ SE 320px)
|
||
ขยายขึ้นด้วย min-width:
|
||
≥480px มือถือใหญ่
|
||
≥640px มือถือใหญ่ / แท็บเล็ตเล็ก
|
||
≥768px iPad แนวตั้ง / แท็บเล็ต
|
||
≥1024px iPad แนวนอน / แล็ปท็อป
|
||
≥1280px คอม 19.5"–24"
|
||
≥1600px คอม 27" / 1440p+
|
||
|
||
หมายเหตุ: component ที่ router inject จาก partial (อยู่ใน #view)
|
||
ต้องใช้ prefix `#view` — เพราะ <style> ของ partial ถูก inject
|
||
ทีหลัง จึงต้องชนะด้วย specificity (ID > class)
|
||
============================================================ */
|
||
|
||
/* ---------- base: มือถือ ---------- */
|
||
html { -webkit-text-size-adjust: 100%; }
|
||
body { font-size: 16px; }
|
||
|
||
/* --- ขยายขนาด component บนมือถือ (desktop-oriented เดิมเล็กเกิน) --- */
|
||
/* topbar อยู่ใน section ด้านล่าง — content ใน #view ใช้ prefix ชนะ partial style */
|
||
#view .mu-btn { font-size: .95rem; min-height: 48px; }
|
||
#view .mu-badge { font-size: 1.05rem; }
|
||
#view .mu-zone-tag { font-size: 1rem; }
|
||
#view .mu-zone-desc, #view .mu-zone-sub { font-size: 1.05rem; }
|
||
#view .mu-route-name { font-size: 1.2rem; }
|
||
#view .mu-next-trip { font-size: .95rem; }
|
||
#view .mu-meta-pill { font-size: .95rem; }
|
||
#view .mu-route-type-badge { font-size: .85rem; }
|
||
#view .mu-stop-summary-meta { font-size: .85rem; }
|
||
#view .mu-time-chip { font-size: .95rem; min-height: 40px; }
|
||
#view .mu-info-card .label { font-size: .85rem; }
|
||
#view .mu-info-card .value { font-size: 1.1rem; }
|
||
#view .mu-stat p { font-size: .9rem; }
|
||
#view .mu-hero-lead { font-size: 1rem; }
|
||
#view .mu-select-box select { font-size: 1rem; }
|
||
|
||
/* --- กัน overflow พื้นฐาน (padding/รูป/grid/ข้อความยาว ไม่ให้ล้นจอมือถือ) --- */
|
||
*, *::before, *::after { box-sizing: border-box; }
|
||
img, svg, video { max-width: 100%; height: auto; }
|
||
/* grid/flex child ต้อง shrink ได้ (กัน min-width:auto ล้น container) */
|
||
#view .mu-hero-panel > *,
|
||
#view .mu-layout-grid > *,
|
||
#view .mu-hero-metric-grid > *,
|
||
#view .mu-stop-summary-main { min-width: 0; }
|
||
/* ข้อความยาวไม่ break (เช่น mock state query string / ชื่อยาว) */
|
||
#view .mu-inline-context strong,
|
||
#view .mu-stop-hero-title,
|
||
#view .mu-stop-hero-sub { overflow-wrap: anywhere; }
|
||
|
||
.mu-container { padding: 0 16px; }
|
||
main.mu-container { padding-top: 24px; padding-bottom: 24px; }
|
||
|
||
/* --- topbar: hamburger menu บนมือถือ (brand + lang + ☰ บรรทัดเดียว) --- */
|
||
.mu-topbar-inner { gap: 8px; padding: 10px 14px; flex-wrap: wrap; }
|
||
.mu-logo-img { width: 36px; height: 36px; }
|
||
.mu-brand { gap: 8px; flex-shrink: 0; }
|
||
.mu-brand-title { font-size: 1.05rem; white-space: nowrap; }
|
||
.mu-brand-subtitle { display: none; } /* กันล้น — โผล่กลับ ≥768px */
|
||
.mu-nav { display: none; } /* ซ่อน nav — ใช้ hamburger แทน */
|
||
.mu-lang-switch { order: 3; margin-left: auto; padding: 2px; }
|
||
.mu-lang-btn { font-size: .8rem; padding: 8px 12px; min-height: 40px; min-width: 40px; } /* tap target */
|
||
.mu-action-btn { display: none; } /* กันล้นบนจอเล็ก — โผล่กลับ ≥1024px */
|
||
|
||
/* hamburger menu (ขวาสุด) */
|
||
.mu-menu { display: block; position: relative; order: 4; margin-left: 2px; }
|
||
.mu-menu-btn {
|
||
display: flex; align-items: center; justify-content: center;
|
||
width: 44px; height: 44px;
|
||
border: none; background: transparent; cursor: pointer;
|
||
color: #1f2a44; list-style: none;
|
||
border-radius: 10px;
|
||
}
|
||
.mu-menu-btn::-webkit-details-marker { display: none; }
|
||
.mu-menu-btn svg { width: 26px; height: 26px; }
|
||
.mu-menu-panel {
|
||
position: absolute; top: calc(100% + 8px); right: 0;
|
||
min-width: 220px;
|
||
background: #fff; border: 1px solid #e7e2f6; border-radius: 14px;
|
||
box-shadow: 0 12px 28px rgba(20, 40, 90, .16);
|
||
padding: 8px;
|
||
z-index: 60;
|
||
display: flex; flex-direction: column; gap: 2px;
|
||
}
|
||
.mu-menu-panel a {
|
||
display: flex; align-items: center;
|
||
min-height: 48px; padding: 10px 14px;
|
||
border-radius: 10px;
|
||
color: #1f2a44; text-decoration: none;
|
||
font-size: 1.05rem; font-weight: 600;
|
||
}
|
||
.mu-menu-panel a:hover, .mu-menu-panel a:active { background: #f5efff; }
|
||
|
||
/* --- hero (หน้าแรก) — ช่องว่าง + ตัวหนังสือใหญ่ขึ้น --- */
|
||
.mu-hero { padding: 30px 0 34px; }
|
||
.mu-hero h1 { font-size: clamp(1.9rem, 8vw, 2.9rem); margin-bottom: 14px; line-height: 1.28; }
|
||
.mu-badge { margin-bottom: 10px; padding: 5px 14px; }
|
||
.mu-hero-lead { margin: 0 0 8px; }
|
||
.mu-hero-actions { flex-direction: column; align-items: stretch; padding: 0 6px; margin-top: 10px; gap: 8px; }
|
||
.mu-pill-link { justify-content: center; padding: 11px 18px; font-size: .9rem; }
|
||
|
||
/* --- ตัวเลือกจังหวัด/สถานี (หน้าแรก) --- */
|
||
#view .mu-route-selector { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 12px; }
|
||
#view .mu-route-selector select,
|
||
#view .mu-route-selector .mu-select-arrow { width: 100%; }
|
||
/* flex-basis 250px (จาก index.html) กลายเป็นความสูงตอน column — reset เป็น content height */
|
||
#view .mu-route-selector .mu-select-field { width: 100%; flex: 0 0 auto; }
|
||
#view .mu-select-arrow { transform: rotate(90deg); justify-content: center; }
|
||
|
||
/* --- marquee (สปอนเซอร์) — การ์ดเล็กลงบนมือถือ --- */
|
||
.mu-marquee-track { padding: 2px 0 10px; }
|
||
.mu-marquee-tile { width: 132px; height: 68px; margin-right: 10px; border-radius: 10px; }
|
||
|
||
/* --- โซนเส้นทาง + การ์ด — ระยะห่างกระชับ --- */
|
||
main.mu-container { padding-top: 14px; padding-bottom: 14px; }
|
||
.mu-zone { margin-bottom: 20px; }
|
||
.mu-zone-head { margin-bottom: 10px; gap: 10px; }
|
||
.mu-grid { gap: 12px; }
|
||
.mu-route-info { padding: 16px 16px 18px; }
|
||
.mu-route-name { margin-bottom: 6px; }
|
||
.mu-route-chip-wrap { gap: 6px; }
|
||
.mu-next-trip { padding: 3px 10px; font-size: .74rem; }
|
||
|
||
/* --- busStop --- */
|
||
#view .mu-hero-panel { grid-template-columns: 1fr; padding: 14px; gap: 12px; }
|
||
#view .mu-hero-title { font-size: 1.35rem; }
|
||
#view .mu-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
|
||
#view .mu-toolbar { flex-direction: column; align-items: stretch; }
|
||
#view .mu-toolbar select,
|
||
#view .mu-toolbar .mu-btn { width: 100%; min-height: 44px; }
|
||
#view .mu-search-field { width: 100%; min-width: 0; }
|
||
#view .mu-search-field input { min-height: 44px; }
|
||
#view .mu-stop-grid { grid-template-columns: 1fr; gap: 12px; }
|
||
#view .mu-hero-map { min-height: 200px; }
|
||
|
||
/* --- busDetail / expanded --- */
|
||
#view .mu-layout-grid { grid-template-columns: 1fr; gap: 12px; }
|
||
#view .mu-page-title { font-size: 1.45rem; }
|
||
#view .mu-route-hero { padding: 16px; }
|
||
#view .mu-info-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
|
||
#view .mu-panel,
|
||
#view .mu-card-panel { padding: 14px; }
|
||
#view .mu-photo-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
|
||
#view .mu-quickpick { display: flex; flex-wrap: wrap; gap: 8px; }
|
||
#view .mu-inline-actions { flex-wrap: wrap; }
|
||
#view .mu-back-btn { width: 100%; justify-content: center; padding: 10px; min-height: 44px; }
|
||
#view .mu-schedule-note { font-size: .82rem; }
|
||
|
||
/* --- stopDetail --- */
|
||
#view .mu-hero-metric-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
|
||
#view .mu-live-clock-card { padding: 14px; }
|
||
#view .mu-stop-summary-rail { flex-wrap: wrap; }
|
||
#view .mu-time-chip { min-width: 0; }
|
||
#view .mu-contact-row { flex-wrap: wrap; }
|
||
|
||
/* --- credits --- */
|
||
#view .mu-credit-wrap { padding: 24px 16px 40px; }
|
||
#view .mu-credit-hero h1 { font-size: 1.5rem; }
|
||
#view .mu-credit-section { padding: 16px; }
|
||
|
||
/* --- footer --- */
|
||
.mu-site-footer { margin-top: 24px; padding: 28px 0 0; }
|
||
.mu-site-footer .mu-container { padding: 0 16px; }
|
||
.mu-footer-grid { grid-template-columns: 1fr; gap: 20px; }
|
||
.mu-footer-col ul a { padding: 10px 0; min-height: 44px; } /* tap target */
|
||
.mu-footer-contact a { min-height: 44px; } /* tap target */
|
||
.mu-sponsor-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
|
||
|
||
/* ============================================================
|
||
≥480px — มือถือใหญ่
|
||
============================================================ */
|
||
@media (min-width: 480px) {
|
||
.mu-topbar-inner { padding: 12px 18px; }
|
||
.mu-hero-actions { flex-direction: row; justify-content: center; }
|
||
.mu-pill-link { width: auto; }
|
||
#view .mu-stop-grid { grid-template-columns: repeat(2, 1fr); }
|
||
#view .mu-photo-strip { grid-template-columns: repeat(3, 1fr); }
|
||
.mu-sponsor-strip { grid-template-columns: repeat(3, 1fr); }
|
||
}
|
||
|
||
/* ============================================================
|
||
≥640px — มือถือใหญ่ / แท็บเล็ตเล็ก
|
||
============================================================ */
|
||
@media (min-width: 640px) {
|
||
body { font-size: 16px; }
|
||
.mu-container { padding: 0 28px; }
|
||
.mu-brand-title { font-size: 1.05rem; }
|
||
.mu-topbar-inner { gap: 18px; padding: 14px 28px; flex-wrap: nowrap; }
|
||
.mu-logo-img { width: 44px; height: 44px; }
|
||
.mu-nav { order: 0; width: auto; margin-left: auto; justify-content: flex-start; gap: 24px; display: flex; }
|
||
.mu-nav a { font-size: .92rem; }
|
||
.mu-menu { display: none; }
|
||
.mu-lang-btn { font-size: .72rem; padding: 6px 10px; }
|
||
.mu-hero { padding: 44px 0 52px; }
|
||
.mu-hero-actions { margin-top: 14px; }
|
||
.mu-marquee-tile { width: 170px; height: 96px; margin-right: 16px; }
|
||
#view .mu-route-selector { flex-direction: row; align-items: flex-end; justify-content: center; }
|
||
#view .mu-route-selector select,
|
||
#view .mu-route-selector .mu-select-field { width: auto; }
|
||
#view .mu-select-arrow { transform: none; }
|
||
#view .mu-toolbar { flex-direction: row; flex-wrap: wrap; align-items: center; }
|
||
#view .mu-toolbar select,
|
||
#view .mu-toolbar .mu-btn { width: auto; }
|
||
#view .mu-search-field { flex: 1; min-width: 200px; }
|
||
#view .mu-back-btn { width: auto; }
|
||
.mu-footer-grid { grid-template-columns: 1fr 1fr; }
|
||
}
|
||
|
||
/* ============================================================
|
||
≥768px — iPad แนวตั้ง / แท็บเล็ต
|
||
============================================================ */
|
||
@media (min-width: 768px) {
|
||
.mu-brand-subtitle { display: block; font-size: .72rem; }
|
||
#view .mu-kpi-grid { grid-template-columns: repeat(4, 1fr); }
|
||
#view .mu-info-grid { grid-template-columns: repeat(4, 1fr); }
|
||
#view .mu-hero-metric-grid { grid-template-columns: repeat(4, 1fr); }
|
||
#view .mu-photo-strip { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
|
||
#view .mu-hero-panel { grid-template-columns: 1.1fr .9fr; padding: 18px; }
|
||
.mu-footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.1fr; }
|
||
.mu-sponsor-strip { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
|
||
}
|
||
|
||
/* ============================================================
|
||
≥1024px — iPad แนวนอน / แล็ปท็อป
|
||
============================================================ */
|
||
@media (min-width: 1024px) {
|
||
.mu-hero { padding: 56px 0 64px; }
|
||
.mu-action-btn { display: inline-flex; }
|
||
.mu-hero h1 { font-size: clamp(2.2rem, 4vw, 3rem); }
|
||
.mu-hero-actions { padding: 0; }
|
||
#view .mu-layout-grid { grid-template-columns: 1.35fr .9fr; gap: 16px; }
|
||
#view .mu-hero-title { font-size: 1.8rem; }
|
||
#view .mu-hero-map { min-height: auto; }
|
||
#view .mu-photo-strip { gap: 10px; }
|
||
}
|
||
|
||
/* ============================================================
|
||
≥1280px — คอม 19.5"–24"
|
||
============================================================ */
|
||
@media (min-width: 1280px) {
|
||
.mu-container { max-width: 1200px; }
|
||
#view .mu-stop-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
|
||
#view .mu-credit-wrap { padding: 40px 28px 56px; }
|
||
}
|
||
|
||
/* ============================================================
|
||
≥1600px — คอม 27" / 1440p+
|
||
============================================================ */
|
||
@media (min-width: 1600px) {
|
||
body { font-size: 17px; }
|
||
.mu-container { max-width: 1280px; }
|
||
#view .mu-photo-strip { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
|
||
#view .mu-stop-grid { grid-template-columns: repeat(4, 1fr); }
|
||
}
|
||
|
||
/* เวลาที่ "คำนวณจากต้นทาง" (ไม่ใช่ตารางจริงของผู้ประกอบการ) — ทำเครื่องหมายให้ผู้ใช้รู้ ไม่ให้เข้าใจผิด */
|
||
.mu-time-grid.is-est .mu-time-chip {
|
||
border: 1px dashed #a892d4;
|
||
background: #faf7ff;
|
||
color: #6b5a8e;
|
||
font-style: italic;
|
||
}
|
||
.mu-est-note {
|
||
margin: 6px 0 0;
|
||
font-size: .78rem;
|
||
color: #6b5a8e;
|
||
}
|