555
This commit is contained in:
1 parent
4ac51969e2
commit
d198430310
10 files changed
+2951
-308
No files matched your search
+339
-195
@@ -1,30 +1,13 @@
|
||||
<style>
|
||||
:root {
|
||||
--bus-purple: #7a4cc0;
|
||||
--bus-purple-soft: #f5eeff;
|
||||
--bus-sky: #3071b8;
|
||||
--bus-sky-soft: #ebf5ff;
|
||||
--bus-mint: #1f8765;
|
||||
--bus-mint-soft: #eafaf4;
|
||||
--bus-pink: #bb3a78;
|
||||
--bus-pink-soft: #fff0f6;
|
||||
--bus-amber: #c47b1d;
|
||||
--bus-amber-soft: #fff6e8;
|
||||
--panel-shadow: 0 10px 30px rgba(63, 43, 94, 0.08);
|
||||
}
|
||||
|
||||
.mu-page {
|
||||
background:
|
||||
radial-gradient(circle at 10% 10%, rgba(122, 76, 192, 0.10), transparent 30%),
|
||||
radial-gradient(circle at 90% 0%, rgba(48, 113, 184, 0.10), transparent 28%),
|
||||
linear-gradient(180deg, #fcfbff 0%, #f5f9ff 100%);
|
||||
linear-gradient(180deg, #ffffff 0%, #faf7ff 55%, #f4f0fd 100%);
|
||||
}
|
||||
|
||||
.mu-hero-panel {
|
||||
background: linear-gradient(135deg, #f8f4ff 0%, #eef6ff 55%, #f0fdf8 100%);
|
||||
background: linear-gradient(135deg, #ffffff 0%, #f7f2ff 60%, #efe6ff 100%);
|
||||
border: 1px solid #e7e0f6;
|
||||
border-radius: 20px;
|
||||
box-shadow: var(--panel-shadow);
|
||||
border-radius: 8px;
|
||||
padding: 18px;
|
||||
margin-bottom: 16px;
|
||||
display: grid;
|
||||
@@ -32,23 +15,20 @@
|
||||
gap: 16px;
|
||||
align-items: stretch;
|
||||
}
|
||||
.mu-hero-title { margin: 0; font-size: 1.8rem; line-height: 1.15; color: #1f2a44; }
|
||||
.mu-hero-title { margin: 0; font-size: 1.6rem; line-height: 1.2; color: #1f2a44; }
|
||||
.mu-hero-subtitle { margin: 8px 0 0; color: #66728f; font-size: .95rem; max-width: 48rem; }
|
||||
.mu-kpi-grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
|
||||
.mu-kpi {
|
||||
border: 1px solid rgba(122, 76, 192, 0.12);
|
||||
border-radius: 14px;
|
||||
border: 1px solid #d9c9f2;
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
background: rgba(255,255,255,.82);
|
||||
box-shadow: 0 8px 18px rgba(63, 43, 94, 0.06);
|
||||
background: linear-gradient(135deg, #f0e7fc, #e6d8f8);
|
||||
}
|
||||
.mu-kpi .label { margin: 0; color:#6f7b95; font-size:.76rem; font-weight:700; letter-spacing:.03em; text-transform: uppercase; }
|
||||
.mu-kpi .value { margin:4px 0 0; color:#1f2a44; font-size:1.03rem; font-weight:800; }
|
||||
.mu-kpi .label { margin: 0; color:#6b5b8a; font-size:.76rem; font-weight:700; letter-spacing:.03em; text-transform: uppercase; }
|
||||
.mu-kpi .value { margin:4px 0 0; color:#2b1f4d; font-size:1.03rem; font-weight:800; font-variant-numeric: tabular-nums; }
|
||||
.mu-hero-map {
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(145deg, #ffffff 0%, #f7fbff 100%);
|
||||
border: 1px solid #e6edf7;
|
||||
box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 10px 20px rgba(63,43,94,.06);
|
||||
border: 1px solid #e7e0f6;
|
||||
border-radius: 8px;
|
||||
padding: 14px;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
@@ -59,12 +39,9 @@
|
||||
.mu-hero-map-box {
|
||||
flex:1;
|
||||
min-height: 160px;
|
||||
border-radius: 14px;
|
||||
background:
|
||||
radial-gradient(circle at 20% 30%, rgba(122, 76, 192, 0.13), transparent 22%),
|
||||
radial-gradient(circle at 80% 20%, rgba(48, 113, 184, 0.13), transparent 24%),
|
||||
linear-gradient(135deg, #f7fbff, #eefaf5);
|
||||
border: 1px dashed #d7e3f4;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(135deg, #faf7ff, #f2ecfd);
|
||||
border: 1px dashed #d9cdf2;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
@@ -74,28 +51,199 @@
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
/* ===== Search toolbar: 2 โหมด ===== */
|
||||
.mu-toolbar {
|
||||
background: rgba(255,255,255,.82);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(231, 224, 246, 0.9);
|
||||
border-radius: 16px;
|
||||
padding: 12px;
|
||||
box-shadow: var(--panel-shadow);
|
||||
background: linear-gradient(135deg, #f0e7fc, #e6d8f8);
|
||||
border: 1px solid #d9c9f2;
|
||||
border-radius: 8px;
|
||||
padding: 14px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.mu-toolbar input,
|
||||
.mu-toolbar select {
|
||||
border-radius: 12px;
|
||||
border: 1px solid #dfe6f1;
|
||||
background: linear-gradient(180deg, #fff, #f8fbff);
|
||||
min-height: 44px;
|
||||
.mu-search-tabs {
|
||||
display: flex;
|
||||
gap: 0;
|
||||
border: 1px solid #d5c3f0;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 12px;
|
||||
width: fit-content;
|
||||
max-width: 100%;
|
||||
}
|
||||
.mu-toolbar input:focus,
|
||||
.mu-toolbar select:focus {
|
||||
box-shadow: 0 0 0 3px rgba(122, 76, 192, 0.14);
|
||||
border-color: #c8b4ec;
|
||||
.mu-search-tab {
|
||||
font-family: inherit;
|
||||
font-size: .88rem;
|
||||
font-weight: 700;
|
||||
padding: 10px 18px;
|
||||
border: none;
|
||||
border-right: 1px solid #d5c3f0;
|
||||
background: #fff;
|
||||
color: #5b3b71;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
transition: background .15s ease, color .15s ease;
|
||||
}
|
||||
.mu-search-tab:last-child { border-right: none; }
|
||||
.mu-search-tab:hover { background: #f3ecff; }
|
||||
.mu-search-tab.active { background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff; }
|
||||
.mu-search-tab .ic { width: 16px; height: 16px; }
|
||||
|
||||
.mu-search-mode { display: block; }
|
||||
/* กัน .display:block ทับ attribute [hidden] — โหมดที่ไม่ได้ใช้ต้องซ่อนจริง */
|
||||
.mu-search-mode[hidden],
|
||||
.mu-numpad[hidden] { display: none; }
|
||||
|
||||
.mu-search-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
border: 1px solid #d5c3f0;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
padding: 0 12px;
|
||||
min-height: 48px;
|
||||
transition: border-color .15s ease;
|
||||
}
|
||||
.mu-search-field:focus-within { border-color: #a855f7; }
|
||||
.mu-search-field .ic { position: static; width: 18px; height: 18px; color: #8b5cf6; flex: none; }
|
||||
.mu-search-field input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
border: none;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: #1f2a44;
|
||||
padding: 12px 0;
|
||||
}
|
||||
.mu-search-field input::placeholder { color: #6f7b95; font-weight: 500; opacity: .8; }
|
||||
|
||||
/* ===== ช่องรหัสป้าย 6 ช่อง: [x] + [x][x][x][x] ===== */
|
||||
.mu-code-boxes {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.mu-code-cell {
|
||||
width: 46px;
|
||||
height: 54px;
|
||||
text-align: center;
|
||||
font-family: "IBM Plex Mono", ui-monospace, monospace;
|
||||
font-size: 1.35rem;
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #1f2a44;
|
||||
background: #fff;
|
||||
border: 2px solid #e0d6f5;
|
||||
border-radius: 8px;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
transition: border-color .15s ease, background .15s ease;
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
.mu-code-cell::-webkit-outer-spin-button,
|
||||
.mu-code-cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
|
||||
.mu-code-cell::placeholder { color: #7a6a9e; font-weight: 600; opacity: 1; }
|
||||
.mu-code-cell:focus {
|
||||
border-color: #a855f7;
|
||||
background: #faf7ff;
|
||||
}
|
||||
.mu-code-cell:disabled { opacity: .45; }
|
||||
/* 2 หลักหน้า (ก่อน +) — เน้นให้เห็นว่าเป็นหัวของรหัส */
|
||||
.mu-code-cell:nth-of-type(1),
|
||||
.mu-code-cell:nth-of-type(2) {
|
||||
border-color: #b07ce0;
|
||||
background: linear-gradient(135deg, #7a4cc0, #b07ce0);
|
||||
color: #fff;
|
||||
}
|
||||
.mu-code-cell:nth-of-type(1)::placeholder,
|
||||
.mu-code-cell:nth-of-type(2)::placeholder { color: #fff; opacity: .8; font-weight: 600; }
|
||||
.mu-code-cell:nth-of-type(1):focus,
|
||||
.mu-code-cell:nth-of-type(2):focus { border-color: #6d28d9; }
|
||||
.mu-code-plus {
|
||||
font-family: "IBM Plex Mono", ui-monospace, monospace;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: #7a4cc0;
|
||||
line-height: 1;
|
||||
padding: 0 2px;
|
||||
}
|
||||
.mu-code-display {
|
||||
margin: 10px 0 0;
|
||||
font-family: "IBM Plex Mono", ui-monospace, monospace;
|
||||
font-size: .9rem;
|
||||
font-weight: 700;
|
||||
color: #6d28d9;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.mu-search-hint { margin: 8px 0 0; font-size: .82rem; color: #6f7b95; }
|
||||
|
||||
/* numpad — โชว์เฉพาะจอเล็ก */
|
||||
.mu-numpad { display: none; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; max-width: 320px; }
|
||||
.mu-numpad button {
|
||||
font-family: "IBM Plex Mono", ui-monospace, monospace;
|
||||
font-size: 1.2rem;
|
||||
font-weight: 700;
|
||||
padding: 14px 0;
|
||||
border: 1px solid #e0d6f5;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
color: #1f2a44;
|
||||
cursor: pointer;
|
||||
font-variant-numeric: tabular-nums;
|
||||
transition: background .12s ease, border-color .12s ease;
|
||||
}
|
||||
.mu-numpad button:active { background: #f3ecff; border-color: #b07ce0; }
|
||||
.mu-numpad button[data-key="back"] { grid-column: span 2; font-size: 1rem; }
|
||||
|
||||
/* suggest */
|
||||
.mu-suggest {
|
||||
border: 1px solid #e0d6f5;
|
||||
border-radius: 8px;
|
||||
margin-top: 8px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
max-height: 260px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.mu-suggest-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
padding: 11px 14px;
|
||||
border: none;
|
||||
border-bottom: 1px solid #f1edfa;
|
||||
background: #fff;
|
||||
font-family: inherit;
|
||||
font-size: .9rem;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
color: #1f2a44;
|
||||
}
|
||||
.mu-suggest-item:last-child { border-bottom: none; }
|
||||
.mu-suggest-item:hover { background: #faf7ff; }
|
||||
.mu-suggest-code {
|
||||
font-family: "IBM Plex Mono", ui-monospace, monospace;
|
||||
font-size: .85rem;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #7a4cc0, #b07ce0);
|
||||
padding: 3px 9px;
|
||||
border-radius: 4px;
|
||||
flex: none;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.mu-toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
|
||||
.mu-toolbar-count { margin: 10px 0 0; font-size: .84rem; color: #6f7b95; }
|
||||
.mu-toolbar-count b { color: #7a4cc0; font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* ===== การ์ดป้าย ===== */
|
||||
.mu-stop-grid {
|
||||
display:grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
@@ -105,78 +253,90 @@
|
||||
}
|
||||
.mu-stop-grid li {
|
||||
margin: 0;
|
||||
border-radius: 18px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: var(--panel-shadow);
|
||||
border: 1px solid rgba(231, 224, 246, 0.95);
|
||||
border: 1px solid #e7e0f6;
|
||||
background: #fff;
|
||||
transition: border-color .15s ease, transform .15s ease;
|
||||
}
|
||||
.mu-stop-grid li:hover { border-color: #a855f7; transform: translateY(-1px); }
|
||||
.mu-stop-card {
|
||||
height: 100%;
|
||||
padding: 16px;
|
||||
background: linear-gradient(135deg, #fff 0%, #fffafc 100%);
|
||||
background: #fff;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
gap: 12px;
|
||||
}
|
||||
.mu-stop-card.main { background: linear-gradient(135deg, #f7f1ff 0%, #fbf8ff 100%); }
|
||||
.mu-stop-card.local { background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%); }
|
||||
.mu-stop-card.market { background: linear-gradient(135deg, #fff2f7 0%, #fff9fc 100%); }
|
||||
.mu-stop-card.van { background: linear-gradient(135deg, #fff6eb 0%, #fffdf8 100%); }
|
||||
.mu-stop-card.private { background: linear-gradient(135deg, #eefaf4 0%, #fbfefc 100%); }
|
||||
|
||||
.mu-stop-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
|
||||
.mu-type-pill {
|
||||
display:inline-flex;
|
||||
align-items:center;
|
||||
gap:6px;
|
||||
border-radius:999px;
|
||||
padding: 5px 10px;
|
||||
display:inline-block;
|
||||
border-radius: 4px;
|
||||
padding: 4px 9px;
|
||||
font-size:.74rem;
|
||||
font-weight:800;
|
||||
letter-spacing:.01em;
|
||||
white-space:nowrap;
|
||||
}
|
||||
.mu-type-pill.market { background: var(--bus-pink-soft); color: var(--bus-pink); }
|
||||
.mu-type-pill.local { background: var(--bus-sky-soft); color: var(--bus-sky); }
|
||||
.mu-type-pill.private{ background: var(--bus-mint-soft); color: var(--bus-mint); }
|
||||
.mu-type-pill.van { background: var(--bus-amber-soft); color: var(--bus-amber); }
|
||||
.mu-type-pill.main { background: var(--bus-purple-soft); color: var(--bus-purple); }
|
||||
.mu-stop-title { margin:0; font-size:1.05rem; line-height:1.25; color:#1f2a44; }
|
||||
.mu-type-pill.local { background: #f3ecff; color: #6d28d9; }
|
||||
.mu-stop-title { margin:6px 0 0; font-size:1.05rem; line-height:1.3; color:#1f2a44; }
|
||||
.mu-loc { color:#6f7b95; font-size:.85rem; margin-top:4px; }
|
||||
.mu-chip-row { display:flex; flex-wrap:wrap; gap:8px; }
|
||||
.mu-chip {
|
||||
display:inline-flex;
|
||||
align-items:center;
|
||||
gap:6px;
|
||||
padding:6px 10px;
|
||||
border-radius:999px;
|
||||
background: rgba(255,255,255,.9);
|
||||
border: 1px solid rgba(231, 224, 246, 0.95);
|
||||
padding:5px 10px;
|
||||
border-radius: 4px;
|
||||
background: #faf7ff;
|
||||
border: 1px solid #e7e0f6;
|
||||
color:#5b3b71;
|
||||
font-size:.8rem;
|
||||
font-weight:700;
|
||||
}
|
||||
.mu-chip.count { background: rgba(122, 76, 192, 0.08); color:#7a4cc0; border-color: rgba(122,76,192,.15); }
|
||||
.mu-chip.route { background: rgba(48, 113, 184, 0.08); color:#3071b8; border-color: rgba(48,113,184,.15); }
|
||||
.mu-chip.new { background: rgba(31, 135, 101, 0.08); color:#1f8765; border-color: rgba(31,135,101,.15); }
|
||||
.mu-stop-action { margin-top:auto; display:flex; justify-content:space-between; align-items:center; gap:12px; }
|
||||
.mu-row-link {
|
||||
display:inline-flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
padding:10px 14px;
|
||||
border-radius:12px;
|
||||
background: linear-gradient(135deg, #7a4cc0, #3071b8);
|
||||
color:#fff;
|
||||
text-decoration:none;
|
||||
font-weight:700;
|
||||
box-shadow: 0 8px 18px rgba(122,76,192,.18);
|
||||
white-space:nowrap;
|
||||
.mu-chip.route { background: #f3ecff; color:#6d28d9; border-color: #e0d6f5; }
|
||||
/* รหัสป้าย = ม่วง-ขาว แบบเดียวกับป้ายสายรถ */
|
||||
.mu-chip.count.stop-code {
|
||||
background: linear-gradient(135deg, #7a4cc0, #b07ce0);
|
||||
color: #fff;
|
||||
border-color: transparent;
|
||||
font-family: "IBM Plex Mono", ui-monospace, monospace;
|
||||
font-size: .92rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: .05em;
|
||||
font-variant-numeric: tabular-nums;
|
||||
flex: none;
|
||||
padding: 7px 11px;
|
||||
}
|
||||
.mu-row-link:hover { filter: brightness(1.02); }
|
||||
.mu-stop-action { margin-top:auto; display:flex; justify-content:space-between; align-items:center; gap:12px; }
|
||||
.mu-stop-note { color:#6f7b95; font-size:.8rem; margin:0; }
|
||||
|
||||
.mu-stop-thumb {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 180px;
|
||||
object-fit: cover;
|
||||
background: #f7f9fd;
|
||||
border-bottom: 1px solid #e7e0f6;
|
||||
}
|
||||
/* รูป placeholder — ย่อและจัดกลาง ไม่ให้ครอปโลโก้ */
|
||||
.mu-stop-thumb.is-placeholder {
|
||||
object-fit: contain;
|
||||
padding: 34px;
|
||||
background: linear-gradient(135deg, #faf7ff, #f2ecfd);
|
||||
}
|
||||
|
||||
.mu-stop-empty {
|
||||
grid-column: 1 / -1;
|
||||
list-style: none;
|
||||
padding: 40px 16px;
|
||||
text-align: center;
|
||||
color: #6f7b95;
|
||||
border: 1px dashed #e0d6f5;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.mu-hero-panel { grid-template-columns: 1fr; }
|
||||
.mu-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
@@ -185,122 +345,106 @@
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.mu-kpi-grid { grid-template-columns: 1fr; }
|
||||
.mu-stop-action { flex-direction: column; align-items:flex-start; }
|
||||
.mu-row-link { width: 100%; }
|
||||
.mu-numpad { display: grid; }
|
||||
.mu-search-tabs { width: 100%; }
|
||||
.mu-search-tab { flex: 1; justify-content: center; padding: 10px 12px; font-size: .84rem; }
|
||||
.mu-stop-action { flex-direction: column; align-items: flex-start; }
|
||||
/* กล่องรหัส: ย่อให้พอดีจอ 375px (5×40 + เครื่องหมาย + gap = ~244px) */
|
||||
.mu-code-boxes { gap: 5px; }
|
||||
.mu-code-cell { width: 40px; height: 48px; font-size: 1.15rem; }
|
||||
.mu-code-plus { font-size: 1.25rem; }
|
||||
}
|
||||
|
||||
/* === Modern image polish (page-specific) === */
|
||||
.mu-hero-map-photo { width: 100%; height: 100%; min-height: 160px; object-fit: cover; border-radius: 14px; display: block; box-shadow: 0 8px 18px rgba(63,43,94,.08); }
|
||||
|
||||
/* Integrated stop thumbnail: tall hero with bottom gradient fade
|
||||
so the photo flows into the card body instead of looking pasted on. */
|
||||
.mu-stop-grid li { position: relative; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
|
||||
.mu-stop-grid li:hover { transform: translateY(-3px); box-shadow: 0 18px 36px rgba(63,43,94,.16); }
|
||||
.mu-stop-thumb {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 180px;
|
||||
object-fit: cover;
|
||||
background: #eef2f9;
|
||||
transition: transform .45s ease;
|
||||
}
|
||||
.mu-stop-grid li:hover .mu-stop-thumb { transform: scale(1.05); }
|
||||
.mu-stop-grid li:has(.mu-stop-thumb)::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: 130px; height: 70px;
|
||||
background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #fff 95%);
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
.mu-stop-grid li:has(.mu-stop-thumb) .mu-stop-card { padding-top: 8px; position: relative; z-index: 2; }
|
||||
.mu-stop-grid li:has(.mu-stop-thumb) .mu-type-pill {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
margin-top: -18px;
|
||||
box-shadow: 0 4px 10px rgba(15,23,42,.12);
|
||||
}
|
||||
/* Cards without a photo get a colored gradient hero banner
|
||||
so they look intentional, not empty. */
|
||||
.mu-stop-grid li:not(:has(.mu-stop-thumb))::before {
|
||||
content: "";
|
||||
display: block;
|
||||
height: 110px;
|
||||
background:
|
||||
radial-gradient(circle at 20% 20%, rgba(255,255,255,.4), transparent 55%),
|
||||
linear-gradient(135deg, #7a4cc0, #3071b8);
|
||||
}
|
||||
.mu-stop-grid li:not(:has(.mu-stop-thumb)) .mu-stop-card.main::before { background: linear-gradient(135deg, #7a4cc0, #c084fc); }
|
||||
.mu-stop-grid li:not(:has(.mu-stop-thumb)) .mu-stop-card { margin-top: -28px; position: relative; z-index: 2; border-radius: 18px 18px 0 0; background: #fff !important; box-shadow: 0 -8px 18px rgba(0,0,0,.08); }
|
||||
.mu-hero-map-photo { width: 100%; height: 100%; min-height: 160px; object-fit: cover; border-radius: 8px; display: block; }
|
||||
</style>
|
||||
|
||||
<main class="mu-page">
|
||||
<main class="mu-page">
|
||||
<div class="mu-container">
|
||||
<p class="mu-breadcrumb"><a href="#/">หน้าแรก</a>/ ป้ายหยุดรถ</p>
|
||||
<p class="mu-breadcrumb"><a href="#/" data-i18n="nav.home">หน้าแรก</a>/ <span data-i18n="nav.stops">ป้ายหยุดรถ</span></p>
|
||||
|
||||
<section class="mu-hero-panel">
|
||||
<div>
|
||||
<h1 class="mu-hero-title"><span data-i18n="stops.title">ค้นหาป้ายหยุดรถแบบรวดเร็ว</span></h1>
|
||||
<p class="mu-hero-subtitle"><span data-i18n="stops.subtitle">รวมสถานีขนส่งหลัก จุดจอดท้องถิ่น สถานีรถตู้ และจุดเอกชนในโทน soft gradient ที่ดูสะอาดตา ใช้งานได้ทั้งบนมือถือและเดสก์ท็อป</span></p>
|
||||
<div class="mu-kpi-grid" aria-label="summary metrics">
|
||||
<div class="mu-kpi">
|
||||
<p class="label"><span data-i18n="stops.kpi.total">จำนวนจุดทั้งหมด</span></p>
|
||||
<p class="value">19 จุด</p>
|
||||
</div>
|
||||
<div class="mu-kpi">
|
||||
<p class="label"><span data-i18n="stops.kpi.coverage">ครอบคลุม</span></p>
|
||||
<p class="value">9 จังหวัด</p>
|
||||
</div>
|
||||
<div class="mu-kpi">
|
||||
<p class="label"><span data-i18n="stops.kpi.types">ประเภทหลัก</span></p>
|
||||
<p class="value">4 กลุ่มป้าย</p>
|
||||
</div>
|
||||
<div class="mu-kpi">
|
||||
<p class="label"><span data-i18n="stops.kpi.routes">เที่ยวใช้งานบ่อย</span></p>
|
||||
<p class="value">สาย 101</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="mu-hero-subtitle"><span data-i18n="stops.subtitle">ค้นหาด้วยรหัสหลักกิโลเมตรของป้าย หรือค้นหาด้วยชื่อสถานที่สำคัญ</span></p>
|
||||
<div class="mu-kpi-grid" id="stops-kpi" aria-label="summary metrics"></div>
|
||||
</div>
|
||||
<div class="mu-hero-map">
|
||||
<p class="mu-hero-map-title"><span data-i18n="stops.mapTitle">แผนที่ย่อของเครือข่ายป้าย</span></p>
|
||||
<img class="mu-hero-map-photo" src="../.image/network/overview-map.png" alt="แผนที่เครือข่ายป้าย Atroute" loading="lazy" decoding="async">
|
||||
<div class="mu-hero-map-box">
|
||||
<img class="mu-hero-map-photo" src="../.image/network/overview-map.png" alt="แผนที่เครือข่ายป้าย Atroute" loading="lazy" decoding="async">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<form class="mu-toolbar" onsubmit="return false">
|
||||
<div class="mu-search-field">
|
||||
<svg class="ic" aria-hidden="true"><use href="#ic-search"/></svg>
|
||||
<input type="search" placeholder="ค้นหาชื่อสถานที่ เช่น บขส.อ่างทอง" data-i18n-attr="placeholder:stops.searchPh,aria-label:stops.searchPh">
|
||||
<form class="mu-toolbar" id="stops-form" onsubmit="return false">
|
||||
<!-- โหมดค้นหา: เลือกอย่างใดอย่างหนึ่ง (ห้ามชนกัน) -->
|
||||
<div class="mu-search-tabs" role="tablist" aria-label="รูปแบบการค้นหา">
|
||||
<button type="button" class="mu-search-tab" data-mode="code" role="tab" aria-selected="true">
|
||||
<svg class="ic" aria-hidden="true"><use href="#ic-map-pin"/></svg>
|
||||
<span data-i18n="stops.modeCode">ค้นหาด้วยรหัสป้าย</span>
|
||||
</button>
|
||||
<button type="button" class="mu-search-tab" data-mode="place" role="tab" aria-selected="false">
|
||||
<svg class="ic" aria-hidden="true"><use href="#ic-landmark"/></svg>
|
||||
<span data-i18n="stops.modePlace">ค้นหาด้วยชื่อสถานที่</span>
|
||||
</button>
|
||||
</div>
|
||||
<select aria-label="ประเภทป้ายหยุดรถ">
|
||||
<option><span data-i18n="stops.allTypes">ทุกประเภท</span></option>
|
||||
<option><span data-i18n="type.terminal">สถานีขนส่งผู้โดยสาร</span></option>
|
||||
<option><span data-i18n="type.busstop">ศาลารอรถ หรือป้ายหยุดรถ</span></option>
|
||||
<option><span data-i18n="type.startlocalpoint">ต้นทางรถสายท้องถิ่น</span></option>
|
||||
</select>
|
||||
<button type="button" class="mu-btn primary"><span data-i18n="common.search">ค้นหา</span></button>
|
||||
<a class="mu-btn ghost" href="#/"><span data-i18n="common.back">ย้อนกลับ</span></a>
|
||||
|
||||
<!-- โหมด 1: รหัสป้าย (5 ช่อง: 2 หน้า + 3 หลัง) -->
|
||||
<div class="mu-search-mode" id="stops-code-wrap">
|
||||
<div class="mu-code-boxes" id="stops-code-boxes" role="group"
|
||||
data-i18n-attr="aria-label:stops.codePh" aria-label="รหัสป้าย">
|
||||
<input class="mu-code-cell" type="text" inputmode="numeric" maxlength="1"
|
||||
autocomplete="off" aria-label="หลักที่ 1" placeholder="0">
|
||||
<input class="mu-code-cell" type="text" inputmode="numeric" maxlength="1"
|
||||
autocomplete="off" aria-label="หลักที่ 2" placeholder="0">
|
||||
<span class="mu-code-plus" aria-hidden="true">+</span>
|
||||
<input class="mu-code-cell" type="text" inputmode="numeric" maxlength="1"
|
||||
autocomplete="off" aria-label="หลักที่ 3" placeholder="0">
|
||||
<input class="mu-code-cell" type="text" inputmode="numeric" maxlength="1"
|
||||
autocomplete="off" aria-label="หลักที่ 4" placeholder="0">
|
||||
<input class="mu-code-cell" type="text" inputmode="numeric" maxlength="1"
|
||||
autocomplete="off" aria-label="หลักที่ 5" placeholder="0">
|
||||
</div>
|
||||
<p class="mu-code-display" id="stops-code-display" hidden></p>
|
||||
<p class="mu-search-hint" data-i18n="stops.codeHintBox">พิมพ์ตัวเลขในช่อง ระบบจะเติม 0 ให้อัตโนมัติเมื่อเว้นว่าง</p>
|
||||
<div class="mu-numpad" id="stops-numpad">
|
||||
<button type="button" data-key="1">1</button>
|
||||
<button type="button" data-key="2">2</button>
|
||||
<button type="button" data-key="3">3</button>
|
||||
<button type="button" data-key="4">4</button>
|
||||
<button type="button" data-key="5">5</button>
|
||||
<button type="button" data-key="6">6</button>
|
||||
<button type="button" data-key="7">7</button>
|
||||
<button type="button" data-key="8">8</button>
|
||||
<button type="button" data-key="9">9</button>
|
||||
<button type="button" data-key="0">0</button>
|
||||
<button type="button" data-key="back"><span data-i18n="stops.padDelete">ลบ</span></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- โหมด 2: ชื่อสถานที่ -->
|
||||
<div class="mu-search-mode" id="stops-place-wrap" hidden>
|
||||
<div class="mu-search-field">
|
||||
<svg class="ic" aria-hidden="true"><use href="#ic-search"/></svg>
|
||||
<input type="search" id="stops-place-input" autocomplete="off"
|
||||
placeholder="โรงพยาบาลอ่างทอง" data-i18n-attr="placeholder:stops.placePh,aria-label:stops.placePh">
|
||||
</div>
|
||||
<div class="mu-suggest" id="stops-suggest" hidden></div>
|
||||
<p class="mu-search-hint" data-i18n="stops.placeHint">พิมพ์ชื่อสถานที่สำคัญ เช่น โรงพยาบาล สำนักงานที่ดิน แล้วเลือกรายการที่ตรงกัน</p>
|
||||
</div>
|
||||
|
||||
<div class="mu-toolbar-actions">
|
||||
<button type="button" class="mu-btn primary" id="stops-search-btn"><span data-i18n="common.search">ค้นหา</span></button>
|
||||
<button type="button" class="mu-btn ghost" id="stops-reset-btn"><span data-i18n="stops.reset">ล้างค่า</span></button>
|
||||
<a class="mu-btn ghost" href="#/"><span data-i18n="common.back">ย้อนกลับ</span></a>
|
||||
</div>
|
||||
|
||||
<p class="mu-toolbar-count" id="stops-count" hidden></p>
|
||||
</form>
|
||||
|
||||
<ul class="mu-stop-grid">
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/54950.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">บขส.อ่างทอง</h2><p class="mu-loc">เมืองอ่างทอง · อ่างทอง</p></div><span class="mu-chip count">8 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">สายหลัก</span><span class="mu-chip">เปิดบริการ</span></div><div class="mu-stop-action"><p class="mu-stop-note">ศูนย์กลางเส้นทางหลักของจังหวัด</p><a class="mu-row-link" href="#/stops/at_main_terminal?route=101"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/36020.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">สถานีขนส่งป่าโมก</h2><p class="mu-loc">ป่าโมก · อ่างทอง</p></div><span class="mu-chip count">2 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">จุดต่อรถ</span><span class="mu-chip">Hub ย่อย</span></div><div class="mu-stop-action"><p class="mu-stop-note">เหมาะสำหรับต่อรถไปอยุธยา</p><a class="mu-row-link" href="#/stops/pa_mok_terminal?route=101"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/39321.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card local"><div class="mu-stop-top"><div><span class="mu-type-pill local"><span data-i18n="type.local">จุดจอดท้องถิ่น</span></span><h2 class="mu-stop-title">จุดขึ้นลงรถสองแถว 101 อยุธยา-ป่าโมก-อ่างทอง</h2><p class="mu-loc">พระนครศรีอยุธยา · อยุธยา</p></div><span class="mu-chip count">1 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">สาย 101</span><span class="mu-chip new">ผ่านทาง</span></div><div class="mu-stop-action"><p class="mu-stop-note">จุดขึ้นลงในเส้นทางที่ใช้งานบ่อย</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/42110.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card market"><div class="mu-stop-top"><div><span class="mu-type-pill market"><span data-i18n="type.market">ตลาด</span></span><h2 class="mu-stop-title">ตลาดเจ้าพรหม</h2><p class="mu-loc">พระนครศรีอยุธยา · อยุธยา</p></div><span class="mu-chip count">3 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">คึกคัก</span><span class="mu-chip">ชุมชน</span></div><div class="mu-stop-action"><p class="mu-stop-note">มีรถผ่านหลายช่วงเวลา</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/42250.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card van"><div class="mu-stop-top"><div><span class="mu-type-pill van"><span data-i18n="type.van">สถานีรถตู้</span></span><h2 class="mu-stop-title">ท่ารถตู้ต่างจังหวัด รังสิต</h2><p class="mu-loc">รังสิต · ปทุมธานี</p></div><span class="mu-chip count">5 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">รถตู้</span><span class="mu-chip">ศูนย์ต่อรถ</span></div><div class="mu-stop-action"><p class="mu-stop-note">เชื่อมกรุงเทพกับจังหวัดรอบนอก</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/36020.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card van"><div class="mu-stop-top"><div><span class="mu-type-pill van"><span data-i18n="type.van">สถานีรถตู้</span></span><h2 class="mu-stop-title">สถานีเดินรถโดยสารขนาดเล็ก (จตุจักร) รถตู้/มินิบัส</h2><p class="mu-loc">จตุจักร · กรุงเทพมหานคร</p></div><span class="mu-chip count">5 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">มินิบัส</span><span class="mu-chip">เมืองใหญ่</span></div><div class="mu-stop-action"><p class="mu-stop-note">ศูนย์รวมรถตู้ในโซนกรุงเทพฯ</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/39321.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">บขส.ลพบุรี</h2><p class="mu-loc">เมืองลพบุรี · ลพบุรี</p></div><span class="mu-chip count">1 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">ทางผ่าน</span><span class="mu-chip">ภูมิภาค</span></div><div class="mu-stop-action"><p class="mu-stop-note">จุดเชื่อมเส้นทางภาคกลางตอนบน</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/42110.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card local"><div class="mu-stop-top"><div><span class="mu-type-pill local"><span data-i18n="type.local">จุดจอดท้องถิ่น</span></span><h2 class="mu-stop-title"><span data-i18n="type.other">จุดขึ้นรถประจำทางอื่นๆ</span></h2><p class="mu-loc">— · —</p></div><span class="mu-chip count">7 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">พื้นที่ยืดหยุ่น</span><span class="mu-chip">กระจายตัว</span></div><div class="mu-stop-action"><p class="mu-stop-note">จุดรองรับการเดินทางภายในท้องถิ่น</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/42250.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">บขส.สุพรรณบุรี</h2><p class="mu-loc">เมืองสุพรรณบุรี · สุพรรณบุรี</p></div><span class="mu-chip count">2 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">สายเชื่อม</span><span class="mu-chip">เมืองรอง</span></div><div class="mu-stop-action"><p class="mu-stop-note">โทนแสงนุ่ม เหมาะกับการต่อรถ</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/54950.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">บขส.สระบุรี</h2><p class="mu-loc">เมืองสระบุรี · สระบุรี</p></div><span class="mu-chip count">1 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">จุดหลัก</span><span class="mu-chip">ทางผ่าน</span></div><div class="mu-stop-action"><p class="mu-stop-note">เหมาะสำหรับเส้นทางเชื่อมจังหวัดถัดไป</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/36020.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card private"><div class="mu-stop-top"><div><span class="mu-type-pill private">จุดเอกชน</span><h2 class="mu-stop-title">นะโมซุปเปอร์มาร์ท</h2><p class="mu-loc">วิเศษชัยชาญ · อ่างทอง</p></div><span class="mu-chip count">1 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">เอกชน</span><span class="mu-chip">จุดขาย</span></div><div class="mu-stop-action"><p class="mu-stop-note">เป็นจุดจอดย่อยของพื้นที่ชุมชน</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/39321.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card van"><div class="mu-stop-top"><div><span class="mu-type-pill van"><span data-i18n="type.van">สถานีรถตู้</span></span><h2 class="mu-stop-title">สายใต้เก่า ปิ่นเกล้า จุดจอดรถตู้</h2><p class="mu-loc">บางกอกน้อย · กรุงเทพมหานคร</p></div><span class="mu-chip count">1 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">รถตู้</span><span class="mu-chip">กทม.</span></div><div class="mu-stop-action"><p class="mu-stop-note">โทนสีอุ่นสำหรับรถตู้และมินิบัส</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/42110.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">บขส.ชัยนาท</h2><p class="mu-loc">เมืองชัยนาท · ชัยนาท</p></div><span class="mu-chip count">1 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">ภาคกลาง</span><span class="mu-chip">ต้นทาง-ปลายทาง</span></div><div class="mu-stop-action"><p class="mu-stop-note">เชื่อมเส้นทางหลักของจังหวัด</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><img class="mu-stop-thumb" src="../.image/stops/42250.jpg" alt="" loading="lazy" decoding="async"><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">บขส.999 อ่างทอง สายเอเชีย-เหนือ (ไม่เข้าเมือง)</h2><p class="mu-loc">เมืองอ่างทอง · อ่างทอง</p></div><span class="mu-chip count">1 สาย</span></div><div class="mu-chip-row"><span class="mu-chip route">ทางด่วน</span><span class="mu-chip">นอกเมือง</span></div><div class="mu-stop-action"><p class="mu-stop-note">จุดสำหรับสายวิ่งนอกตัวเมือง</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">สถานีขนส่งไชโย</h2><p class="mu-loc">ไชโย · อ่างทอง</p></div><span class="mu-chip count">เร็วๆ นี้</span></div><div class="mu-chip-row"><span class="mu-chip route">coming soon</span><span class="mu-chip">placeholder</span></div><div class="mu-stop-action"><p class="mu-stop-note">กำลังเตรียมข้อมูลสำหรับแสดงผล</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">สถานีขนส่งโพธิ์ทอง</h2><p class="mu-loc">โพธิ์ทอง · อ่างทอง</p></div><span class="mu-chip count">เร็วๆ นี้</span></div><div class="mu-chip-row"><span class="mu-chip route">coming soon</span><span class="mu-chip">placeholder</span></div><div class="mu-stop-action"><p class="mu-stop-note">ข้อมูลพร้อมต่อยอดในรอบถัดไป</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">สถานีขนส่งแสวงหา</h2><p class="mu-loc">แสวงหา · อ่างทอง</p></div><span class="mu-chip count">เร็วๆ นี้</span></div><div class="mu-chip-row"><span class="mu-chip route">coming soon</span><span class="mu-chip">placeholder</span></div><div class="mu-stop-action"><p class="mu-stop-note">เตรียมโครงสำหรับรองรับจังหวัดย่อย</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">สถานีขนส่งวิเศษชัยชาญ</h2><p class="mu-loc">วิเศษชัยชาญ · อ่างทอง</p></div><span class="mu-chip count">เร็วๆ นี้</span></div><div class="mu-chip-row"><span class="mu-chip route">coming soon</span><span class="mu-chip">placeholder</span></div><div class="mu-stop-action"><p class="mu-stop-note">คิวแผนที่และเวลารถกำลังรอข้อมูล</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
<li><div class="mu-stop-card main"><div class="mu-stop-top"><div><span class="mu-type-pill main"><span data-i18n="type.terminal">สถานีขนส่งหลัก</span></span><h2 class="mu-stop-title">สถานีขนส่งสามโก้</h2><p class="mu-loc">สามโก้ · อ่างทอง</p></div><span class="mu-chip count">เร็วๆ นี้</span></div><div class="mu-chip-row"><span class="mu-chip route">coming soon</span><span class="mu-chip">placeholder</span></div><div class="mu-stop-action"><p class="mu-stop-note">โครงหน้าเตรียมรองรับข้อมูลในอนาคต</p><a class="mu-row-link" href="#/stops"><span data-i18n="common.details">ดูรายละเอียด</span></a></div></div></li>
|
||||
</ul>
|
||||
<ul class="mu-stop-grid" id="stops-list"></ul>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="./partials/busStop.search.js"></script>
|
||||
<script src="./partials/busStop.init.js"></script>
|
||||
@@ -0,0 +1,246 @@
|
||||
/* ============================================================
|
||||
หน้าป้ายหยุดรถ — render จาก resource/data/busstop_list.json
|
||||
------------------------------------------------------------
|
||||
ข้อมูล: busstop_list.json (shape = array ตรง ๆ ไม่มี wrapper)
|
||||
{
|
||||
"route_code": "3064", // Highway No.
|
||||
"section_code": "0100", // Control Section
|
||||
"route_name": "อ่างทอง - ปากดง", // Highway Name
|
||||
"kilometer": "3+000", // ★ รหัสป้าย (Survey point — แสดงผลคงรูปนี้)
|
||||
"position": "ขวาทาง", // Location of the pavilion
|
||||
"type": "ที่รอรถประจำทาง", // Picture / Size of the pavilion
|
||||
"latitude": 14.6016517229,
|
||||
"longitude": 100.4323316104,
|
||||
"buses-line": [15, 101] // ★ สายรถประจำทางที่ผ่านป้ายนี้ (ว่าง = [])
|
||||
}
|
||||
|
||||
กติกา:
|
||||
- รหัสป้ายบนจอ = kilometer คงรูปเดิมเสมอ ("3+000") ตาม AGENTS.md ข้อ 9
|
||||
- ชื่อไฟล์รูป = pad5(kilometer) → "3+000" = "03000" → .image/stops/03000.jpg
|
||||
(ตัด "+" ออก + เติม 0 หน้าให้ครบ 5 หลัก)
|
||||
- รูปหาย → ใช้ placeholder minibus-512x512.png
|
||||
- KPI คำนวณจากข้อมูลจริง ไม่ hardcode
|
||||
============================================================ */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var DATA_URL = '../resource/data/busstop_list.json';
|
||||
var IMG_DIR = '../.image/stops/';
|
||||
var IMG_EXT = '.jpg';
|
||||
var PLACEHOLDER = '../.image/icons/minibus-512x512.png';
|
||||
|
||||
function t(key, vars) {
|
||||
return window.I18N ? window.I18N.t(key, vars) : key;
|
||||
}
|
||||
|
||||
/* "3+000" → "03000" (ตัดเครื่องหมาย + ออก แล้วเติม 0 หน้าให้ครบ 5 หลัก) */
|
||||
function pad5(km) {
|
||||
if (!km) return '';
|
||||
return String(km)
|
||||
.split('+')
|
||||
.map(function (s) { return s.replace(/\D/g, ''); })
|
||||
.join('')
|
||||
.padStart(5, '0');
|
||||
}
|
||||
|
||||
function fetchJSON(url) {
|
||||
return fetch(url, { cache: 'no-store' })
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.catch(function () { return null; });
|
||||
}
|
||||
|
||||
/* ---------- รูป: ลองรูปจริงก่อน ถ้าไม่มีค่อยใช้ placeholder ---------- */
|
||||
function resolveImage(km) {
|
||||
var code = pad5(km);
|
||||
if (!code) return Promise.resolve(PLACEHOLDER);
|
||||
var url = IMG_DIR + code + IMG_EXT;
|
||||
return fetch(url, { method: 'HEAD', cache: 'no-store' })
|
||||
.then(function (r) { return r.ok ? url : PLACEHOLDER; })
|
||||
.catch(function () { return PLACEHOLDER; });
|
||||
}
|
||||
|
||||
/* ---------- KPI (คำนวณจากข้อมูลจริง) ---------- */
|
||||
function renderKpi(stops) {
|
||||
var host = document.getElementById('stops-kpi');
|
||||
if (!host) return;
|
||||
|
||||
var routes = {};
|
||||
var types = {};
|
||||
var busLines = {};
|
||||
stops.forEach(function (s) {
|
||||
if (s.route_code) routes[s.route_code] = true;
|
||||
if (s.type) types[s.type] = true;
|
||||
(s['buses-line'] || []).forEach(function (n) { busLines[n] = true; });
|
||||
});
|
||||
|
||||
// สายที่ผ่านป้ายเยอะที่สุด (นับจาก buses-line)
|
||||
var countByBus = {};
|
||||
stops.forEach(function (s) {
|
||||
(s['buses-line'] || []).forEach(function (n) {
|
||||
countByBus[n] = (countByBus[n] || 0) + 1;
|
||||
});
|
||||
});
|
||||
var busKeys = Object.keys(countByBus);
|
||||
var topBus = busKeys.sort(function (a, b) { return countByBus[b] - countByBus[a]; })[0];
|
||||
|
||||
var kpis = [
|
||||
{ label: t('stops.kpi.total'), value: stops.length + ' ' + t('stops.unitPoints') },
|
||||
{ label: t('stops.kpi.routes'), value: Object.keys(routes).length + ' ' + t('stops.unitRoutes') },
|
||||
{ label: t('stops.kpi.types'), value: Object.keys(types).length + ' ' + t('stops.unitTypes') },
|
||||
{ label: t('stops.kpi.buses'), value: topBus ? ('สาย ' + topBus) : '—' }
|
||||
];
|
||||
|
||||
host.innerHTML = '';
|
||||
kpis.forEach(function (k) {
|
||||
var box = document.createElement('div');
|
||||
box.className = 'mu-kpi';
|
||||
var label = document.createElement('p');
|
||||
label.className = 'label';
|
||||
label.textContent = k.label;
|
||||
var value = document.createElement('p');
|
||||
value.className = 'value';
|
||||
value.textContent = k.value;
|
||||
box.appendChild(label);
|
||||
box.appendChild(value);
|
||||
host.appendChild(box);
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- การ์ดป้าย ---------- */
|
||||
function buildCard(stop, imgUrl, idx) {
|
||||
var li = document.createElement('li');
|
||||
li.setAttribute('data-idx', String(idx));
|
||||
|
||||
var img = document.createElement('img');
|
||||
img.className = 'mu-stop-thumb';
|
||||
img.src = imgUrl;
|
||||
img.alt = stop.route_name || '';
|
||||
img.loading = 'lazy';
|
||||
img.decoding = 'async';
|
||||
if (imgUrl === PLACEHOLDER) img.classList.add('is-placeholder');
|
||||
li.appendChild(img);
|
||||
|
||||
var card = document.createElement('div');
|
||||
card.className = 'mu-stop-card local';
|
||||
|
||||
var top = document.createElement('div');
|
||||
top.className = 'mu-stop-top';
|
||||
|
||||
var left = document.createElement('div');
|
||||
|
||||
var pill = document.createElement('span');
|
||||
pill.className = 'mu-type-pill local';
|
||||
pill.textContent = stop.type || '';
|
||||
left.appendChild(pill);
|
||||
|
||||
var title = document.createElement('h2');
|
||||
title.className = 'mu-stop-title';
|
||||
title.textContent = stop.place || stop.route_name || '—';
|
||||
left.appendChild(title);
|
||||
|
||||
var loc = document.createElement('p');
|
||||
loc.className = 'mu-loc';
|
||||
loc.textContent = t('stops.highway') + ' ' + (stop.route_code || '—') +
|
||||
' · ' + t('stops.section') + ' ' + (stop.section_code || '—');
|
||||
left.appendChild(loc);
|
||||
|
||||
top.appendChild(left);
|
||||
|
||||
var codeChip = document.createElement('span');
|
||||
codeChip.className = 'mu-chip count stop-code';
|
||||
codeChip.textContent = stop.kilometer || '—';
|
||||
top.appendChild(codeChip);
|
||||
|
||||
card.appendChild(top);
|
||||
|
||||
var row = document.createElement('div');
|
||||
row.className = 'mu-chip-row';
|
||||
|
||||
// ★ สายรถประจำทางที่ผ่านป้ายนี้ (buses-line)
|
||||
var buses = stop['buses-line'] || [];
|
||||
if (buses.length) {
|
||||
buses.forEach(function (n) {
|
||||
var b = document.createElement('span');
|
||||
b.className = 'mu-chip route';
|
||||
b.textContent = t('stops.busPrefix') + ' ' + n;
|
||||
row.appendChild(b);
|
||||
});
|
||||
} else {
|
||||
var nb = document.createElement('span');
|
||||
nb.className = 'mu-chip';
|
||||
nb.textContent = t('stops.noBusLine');
|
||||
row.appendChild(nb);
|
||||
}
|
||||
card.appendChild(row);
|
||||
|
||||
var action = document.createElement('div');
|
||||
action.className = 'mu-stop-action';
|
||||
|
||||
var note = document.createElement('p');
|
||||
note.className = 'mu-stop-note';
|
||||
note.textContent = stop.position || '';
|
||||
action.appendChild(note);
|
||||
|
||||
var coords = document.createElement('span');
|
||||
coords.className = 'mu-chip';
|
||||
coords.textContent = (stop.latitude && stop.longitude)
|
||||
? stop.latitude.toFixed(4) + ', ' + stop.longitude.toFixed(4)
|
||||
: '—';
|
||||
action.appendChild(coords);
|
||||
|
||||
card.appendChild(action);
|
||||
li.appendChild(card);
|
||||
return li;
|
||||
}
|
||||
|
||||
function renderStops(stops, host) {
|
||||
host.innerHTML = '';
|
||||
if (!stops.length) {
|
||||
var empty = document.createElement('li');
|
||||
empty.className = 'mu-stop-empty';
|
||||
empty.textContent = t('stops.noResult');
|
||||
host.appendChild(empty);
|
||||
return;
|
||||
}
|
||||
// โหลดรูปทีละใบ แล้วค่อยต่อการ์ด (รักษาลำดับ)
|
||||
var chain = Promise.resolve();
|
||||
stops.forEach(function (stop, idx) {
|
||||
chain = chain.then(function () {
|
||||
return resolveImage(stop.kilometer).then(function (url) {
|
||||
host.appendChild(buildCard(stop, url, idx));
|
||||
});
|
||||
});
|
||||
});
|
||||
return chain;
|
||||
}
|
||||
|
||||
/* ---------- init ---------- */
|
||||
function init() {
|
||||
var host = document.getElementById('stops-list');
|
||||
if (!host) return;
|
||||
|
||||
fetchJSON(DATA_URL).then(function (data) {
|
||||
var stops = Array.isArray(data) ? data : (data && data.stops) || [];
|
||||
if (!stops.length) {
|
||||
host.innerHTML = '<li class="mu-stop-empty">' + t('stops.noResult') + '</li>';
|
||||
return;
|
||||
}
|
||||
renderKpi(stops);
|
||||
// ผูก event ก่อน render การ์ด — กันเคสที่ render ค้างแล้วปุ่มไม่ตอบสนอง
|
||||
if (window.StopsSearch) window.StopsSearch.init(stops);
|
||||
renderStops(stops, host).then(function () {
|
||||
// การ์ดพร้อมแล้ว → ให้ search module กรองซ้ำครั้งแรก
|
||||
if (window.StopsSearch) window.StopsSearch.init(stops);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
|
||||
// เปิดให้ search module ใช้ helper ร่วมกัน
|
||||
window.StopsRender = { pad5: pad5, PLACEHOLDER: PLACEHOLDER };
|
||||
})();
|
||||
@@ -0,0 +1,459 @@
|
||||
/* ============================================================
|
||||
ระบบค้นหาป้ายหยุดรถ — 2 โหมด (เลือกอย่างใดอย่างหนึ่ง)
|
||||
------------------------------------------------------------
|
||||
โหมด 1 "รหัสป้าย" : พิมพ์/กด numpad → auto-insert "+" → 00+000
|
||||
โหมด 2 "ชื่อสถานที่" : พิมพ์หา → จับคู่ place/route_name ใน JSON + suggest
|
||||
|
||||
กติกากันการชนกัน:
|
||||
- เปิดโหมดไหน ช่องของอีกโหมดถูก disable + เคลียร์ค่า + ซ่อน
|
||||
- มี activeMode ตัวเดียวเสมอ (state เดียว) → เป็นไปไม่ได้ที่จะค้น 2 ทางพร้อมกัน
|
||||
============================================================ */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var MODE_CODE = 'code';
|
||||
var MODE_PLACE = 'place';
|
||||
|
||||
var state = {
|
||||
mode: MODE_CODE,
|
||||
stops: [],
|
||||
codeValue: '',
|
||||
placeQuery: '',
|
||||
bound: false
|
||||
};
|
||||
|
||||
function t(key, vars) {
|
||||
return window.I18N ? window.I18N.t(key, vars) : key;
|
||||
}
|
||||
|
||||
/* ---------- normalize สำหรับเทียบแบบหลวม (ตัด +, -, ช่องว่าง) ---------- */
|
||||
function norm(s) {
|
||||
return String(s || '').toLowerCase().replace(/[\s+\-]/g, '');
|
||||
}
|
||||
|
||||
/* ---------- รหัสป้ายแบบ 5 ช่อง: [x][x] + [x][x][x] ----------
|
||||
ช่อง 0-1 = หลักหน้า (ก่อน +) · ช่อง 2-4 = หลักหลัง (หลัง +)
|
||||
ช่องที่ยังไม่กรอก → ถือเป็น 0 (เช่น "3" + "_" → "03+000")
|
||||
เก็บเป็น digits[] ความยาว 5 เสมอ */
|
||||
|
||||
var CODE_CELLS = 5; // 2 หน้า + 3 หลัง
|
||||
|
||||
/* digits[] (5 หลัก) → "03+000" */
|
||||
function digitsToCode(digits) {
|
||||
var d = digits.slice();
|
||||
for (var i = 0; i < CODE_CELLS; i++) d[i] = d[i] || '0';
|
||||
return d.slice(0, 2).join('') + '+' + d.slice(2).join('');
|
||||
}
|
||||
|
||||
/* "3+000" → digits ['0','3','0','0','0'] */
|
||||
function codeToDigits(code) {
|
||||
var parts = String(code || '').split('+');
|
||||
var head = (parts[0] || '').replace(/\D/g, '');
|
||||
var tail = (parts[1] || '').replace(/\D/g, '');
|
||||
head = head.padStart(2, '0').slice(-2);
|
||||
tail = tail.padStart(3, '0').slice(-3);
|
||||
return (head + tail).split('');
|
||||
}
|
||||
|
||||
/* เก็บของเดิมไว้ใช้กับ numpad/plantext เดิม (ถ้ามีคนเรียก) */
|
||||
/* พิมพ์ "3000" → "3+000" · "5005" → "5+005" */
|
||||
function formatCode(raw) {
|
||||
var digits = String(raw || '').replace(/\D/g, '').slice(0, 4);
|
||||
if (digits.length <= 1) return digits;
|
||||
return digits.slice(0, 1) + '+' + digits.slice(1);
|
||||
}
|
||||
|
||||
/* ---------- เทียบรหัส: "03+000" ตรงกับข้อมูล "3+000" ----------
|
||||
ข้อมูลจริงเก็บแบบไม่เติม 0 หน้า (3+000) แต่ UI เติมให้ครบ 2+3 (03+000)
|
||||
→ เทียบด้วยค่าที่ normalize แล้วเป็นตัวเลข 5 หลัก (เทียบ loosely) */
|
||||
function codeMatches(stop, query) {
|
||||
if (!query) return true;
|
||||
var q = norm(query); // "03+000" → "03000"
|
||||
var km = norm(stop.kilometer); // "3+000" → "3000"
|
||||
// เติม 0 หน้าให้เท่ากัน 5 หลักก่อนเทียบ (ตรงตัว)
|
||||
var qPad = q.padStart(5, '0');
|
||||
var kmPad = km.padStart(5, '0');
|
||||
if (qPad === kmPad) return true;
|
||||
// ผู้ใช้กรอกไม่ครบ → เทียบแบบ prefix จากซ้าย
|
||||
return qPad.indexOf(kmPad) === 0 || kmPad.indexOf(qPad) === 0;
|
||||
}
|
||||
|
||||
/* ---------- เทียบชื่อ: place (ชื่อสถานที่สำคัญ) + route_name + type ---------- */
|
||||
function placeMatches(stop, query) {
|
||||
if (!query) return true;
|
||||
var q = norm(query);
|
||||
var hay = norm([stop.place, stop.route_name, stop.route_code, stop.type, stop.position,
|
||||
(stop['buses-line'] || []).join(' ')].join(' '));
|
||||
return hay.indexOf(q) !== -1;
|
||||
}
|
||||
|
||||
function currentFilter() {
|
||||
// โหมดรหัส: ถ้ายังไม่กรอกช่องไหนเลย → ไม่กรอง (แสดงทั้งหมด)
|
||||
if (state.mode === MODE_CODE && !state.codeTouched) {
|
||||
return { fn: function () { return true; }, value: '' };
|
||||
}
|
||||
return state.mode === MODE_CODE
|
||||
? { fn: codeMatches, value: state.codeValue }
|
||||
: { fn: placeMatches, value: state.placeQuery };
|
||||
}
|
||||
|
||||
/* ---------- วาด suggestion (โหมดชื่อ) ---------- */
|
||||
function renderSuggest() {
|
||||
var box = document.getElementById('stops-suggest');
|
||||
if (!box) return;
|
||||
box.innerHTML = '';
|
||||
|
||||
if (state.mode !== MODE_PLACE) { box.hidden = true; return; }
|
||||
|
||||
var q = state.placeQuery;
|
||||
if (!q || norm(q).length < 1) { box.hidden = true; return; }
|
||||
|
||||
var hits = state.stops.filter(function (s) { return placeMatches(s, q); }).slice(0, 6);
|
||||
if (!hits.length) { box.hidden = true; return; }
|
||||
|
||||
hits.forEach(function (s) {
|
||||
var btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.className = 'mu-suggest-item';
|
||||
|
||||
var name = document.createElement('span');
|
||||
name.className = 'mu-suggest-name';
|
||||
name.textContent = s.place || s.route_name || '—';
|
||||
btn.appendChild(name);
|
||||
|
||||
var code = document.createElement('span');
|
||||
code.className = 'mu-suggest-code';
|
||||
code.textContent = s.kilometer || '';
|
||||
btn.appendChild(code);
|
||||
|
||||
btn.addEventListener('click', function () {
|
||||
state.placeQuery = s.place || s.route_name || '';
|
||||
var input = document.getElementById('stops-place-input');
|
||||
if (input) input.value = state.placeQuery;
|
||||
apply();
|
||||
box.hidden = true;
|
||||
input.focus();
|
||||
});
|
||||
|
||||
box.appendChild(btn);
|
||||
});
|
||||
box.hidden = false;
|
||||
}
|
||||
|
||||
/* ---------- กรอง + แสดงผล ---------- */
|
||||
function apply() {
|
||||
var host = document.getElementById('stops-list');
|
||||
if (!host) return;
|
||||
|
||||
var f = currentFilter();
|
||||
var filtered = state.stops.filter(function (s) { return f.fn(s, f.value); });
|
||||
|
||||
// อัปเดตการ์ดที่มีอยู่แล้วใน DOM (ไม่ยิง network ซ้ำ)
|
||||
var cards = host.querySelectorAll('li');
|
||||
var shown = 0;
|
||||
Array.prototype.forEach.call(cards, function (li) {
|
||||
var idx = parseInt(li.getAttribute('data-idx'), 10);
|
||||
if (isNaN(idx)) return;
|
||||
var visible = filtered.indexOf(state.stops[idx]) !== -1;
|
||||
li.hidden = !visible;
|
||||
if (visible) shown++;
|
||||
});
|
||||
|
||||
// empty state
|
||||
var empty = host.querySelector('.mu-stop-empty');
|
||||
if (shown === 0) {
|
||||
if (!empty) {
|
||||
empty = document.createElement('li');
|
||||
empty.className = 'mu-stop-empty';
|
||||
host.appendChild(empty);
|
||||
}
|
||||
empty.hidden = false;
|
||||
empty.textContent = t('stops.noResult') + (f.value ? ' — ' + f.value : '');
|
||||
} else if (empty) {
|
||||
empty.hidden = true;
|
||||
}
|
||||
|
||||
// จำนวนผลลัพธ์
|
||||
var count = document.getElementById('stops-count');
|
||||
if (count) {
|
||||
count.textContent = t('stops.showing', { a: shown, b: state.stops.length });
|
||||
count.hidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- สลับโหมด (หัวใจของการกันชน) ---------- */
|
||||
function setMode(mode) {
|
||||
if (mode !== MODE_CODE && mode !== MODE_PLACE) return;
|
||||
state.mode = mode;
|
||||
|
||||
var codeWrap = document.getElementById('stops-code-wrap');
|
||||
var placeWrap = document.getElementById('stops-place-wrap');
|
||||
var placeInput = document.getElementById('stops-place-input');
|
||||
var suggest = document.getElementById('stops-suggest');
|
||||
var pad = document.getElementById('stops-numpad');
|
||||
var cells = codeCells();
|
||||
|
||||
var isCode = mode === MODE_CODE;
|
||||
|
||||
// แสดง/ซ่อนช่องกรอก
|
||||
if (codeWrap) codeWrap.hidden = !isCode;
|
||||
if (placeWrap) placeWrap.hidden = isCode;
|
||||
if (pad) pad.hidden = !isCode;
|
||||
if (suggest) suggest.hidden = isCode;
|
||||
|
||||
// ปิดการใช้งานช่องของโหมดที่ไม่ได้เลือก + ล้างค่า → กันการค้น 2 ทางพร้อมกัน
|
||||
Array.prototype.forEach.call(cells, function (c) {
|
||||
c.disabled = !isCode;
|
||||
if (!isCode) c.value = '';
|
||||
});
|
||||
if (!isCode) {
|
||||
state.codeValue = '';
|
||||
state.codeDigits = [];
|
||||
state.codeTouched = false;
|
||||
updateCodeDisplay();
|
||||
}
|
||||
if (placeInput) {
|
||||
placeInput.disabled = isCode;
|
||||
if (isCode) { placeInput.value = ''; state.placeQuery = ''; }
|
||||
}
|
||||
|
||||
// ไฮไลต์ปุ่ม toggle
|
||||
document.querySelectorAll('.mu-search-tab').forEach(function (btn) {
|
||||
var on = btn.getAttribute('data-mode') === mode;
|
||||
btn.classList.toggle('active', on);
|
||||
btn.setAttribute('aria-selected', String(on));
|
||||
});
|
||||
|
||||
// โฟกัสช่องที่เพิ่งเปิด
|
||||
if (isCode) focusCell(0);
|
||||
if (!isCode && placeInput) placeInput.focus();
|
||||
|
||||
apply();
|
||||
}
|
||||
|
||||
/* ---------- 6-box code input ----------
|
||||
[x] + [x][x][x][x] ← 5 ช่อง + เครื่องหมาย + คั่นกลาง
|
||||
- พิมพ์เลข → เด้งไปช่องถัดไปอัตโนมัติ
|
||||
- Backspace บนช่องว่าง → ถอยกลับช่องก่อน
|
||||
- ช่องว่างถือเป็น 0 แต่ตัวที่โชว์คือ placeholder จาง ๆ
|
||||
- วาง (paste) "3+000" หรือ "3000" ได้ทั้งคู่ */
|
||||
|
||||
function codeCells() {
|
||||
return document.querySelectorAll('.mu-code-cell');
|
||||
}
|
||||
|
||||
/* อัปเดต state.codeValue จากช่องทั้ง 5 */
|
||||
function syncCodeFromCells() {
|
||||
var cells = codeCells();
|
||||
var digits = [];
|
||||
for (var i = 0; i < CODE_CELLS; i++) {
|
||||
var v = cells[i] ? cells[i].value.replace(/\D/g, '') : '';
|
||||
digits.push(v.charAt(0) || '');
|
||||
}
|
||||
state.codeDigits = digits;
|
||||
state.codeValue = digitsToCode(digits);
|
||||
state.codeTouched = digits.some(function (d) { return d !== ''; });
|
||||
return state.codeValue;
|
||||
}
|
||||
|
||||
/* เขียน digits[] กลับลงช่อง (ใช้ตอน paste / ล้างค่า / numpad) */
|
||||
function paintCells(digits) {
|
||||
var cells = codeCells();
|
||||
for (var i = 0; i < CODE_CELLS; i++) {
|
||||
if (cells[i]) cells[i].value = digits[i] || '';
|
||||
}
|
||||
syncCodeFromCells();
|
||||
updateCodeDisplay();
|
||||
}
|
||||
|
||||
/* โชว์รหัสเต็ม (เติม 0) ใต้ช่อง */
|
||||
function updateCodeDisplay() {
|
||||
var out = document.getElementById('stops-code-display');
|
||||
if (!out) return;
|
||||
if (!state.codeTouched) { out.textContent = ''; out.hidden = true; return; }
|
||||
out.hidden = false;
|
||||
out.textContent = t('stops.codeFull') + ' ' + state.codeValue;
|
||||
}
|
||||
|
||||
function focusCell(idx) {
|
||||
var cells = codeCells();
|
||||
if (idx < 0 || idx >= CODE_CELLS) return;
|
||||
var el = cells[idx];
|
||||
if (el) { el.focus(); el.select(); }
|
||||
}
|
||||
|
||||
function initCodeCells() {
|
||||
var cells = codeCells();
|
||||
if (!cells.length) return;
|
||||
|
||||
Array.prototype.forEach.call(cells, function (cell, idx) {
|
||||
// พิมพ์เลข → เก็บ 1 หลัก + เด้งไปช่องถัดไป
|
||||
cell.addEventListener('input', function () {
|
||||
var v = this.value.replace(/\D/g, '');
|
||||
this.value = v.charAt(v.length - 1) || ''; // เอาเฉพาะหลักสุดท้ายที่พิมพ์
|
||||
syncCodeFromCells();
|
||||
updateCodeDisplay();
|
||||
apply();
|
||||
if (this.value && idx < CODE_CELLS - 1) focusCell(idx + 1);
|
||||
});
|
||||
|
||||
// Backspace บนช่องว่าง → ถอยกลับ
|
||||
cell.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Backspace' && !this.value) {
|
||||
e.preventDefault();
|
||||
focusCell(idx - 1);
|
||||
return;
|
||||
}
|
||||
if (e.key === 'ArrowLeft') { e.preventDefault(); focusCell(idx - 1); }
|
||||
if (e.key === 'ArrowRight') { e.preventDefault(); focusCell(idx + 1); }
|
||||
});
|
||||
|
||||
// วางรหัสทั้งชุด
|
||||
cell.addEventListener('paste', function (e) {
|
||||
var txt = (e.clipboardData || window.clipboardData).getData('text') || '';
|
||||
if (!/[\d+]/.test(txt)) return;
|
||||
e.preventDefault();
|
||||
var clean = txt.replace(/[^\d+]/g, '');
|
||||
if (clean.indexOf('+') !== -1) {
|
||||
paintCells(codeToDigits(clean));
|
||||
} else {
|
||||
var d = clean.replace(/\D/g, '').slice(0, CODE_CELLS).split('');
|
||||
while (d.length < CODE_CELLS) d.push('');
|
||||
paintCells(d);
|
||||
}
|
||||
updateCodeDisplay();
|
||||
apply();
|
||||
focusCell(CODE_CELLS - 1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- numpad (ใช้กับ 5 ช่อง) ---------- */
|
||||
function initNumpad() {
|
||||
var pad = document.getElementById('stops-numpad');
|
||||
if (!pad) return;
|
||||
|
||||
pad.addEventListener('click', function (e) {
|
||||
var key = e.target.closest('[data-key]');
|
||||
if (!key) return;
|
||||
e.preventDefault();
|
||||
var k = key.getAttribute('data-key');
|
||||
var cells = codeCells();
|
||||
if (!cells.length) return;
|
||||
|
||||
/* ตำแหน่งเป้าหมาย = ช่องแรกที่ว่าง (ช่องท้ายสุดถ้าเต็มหมด) */
|
||||
var idx = CODE_CELLS - 1;
|
||||
for (var i = 0; i < CODE_CELLS; i++) {
|
||||
if (!cells[i].value) { idx = i; break; }
|
||||
}
|
||||
|
||||
if (k === 'back') {
|
||||
// ถอยจากท้าย: ล้างช่องขวาสุดที่มีค่า แล้วเลื่อนเป้าไปช่องนั้น
|
||||
var last = -1;
|
||||
for (var j = CODE_CELLS - 1; j >= 0; j--) {
|
||||
if (cells[j].value) { last = j; break; }
|
||||
}
|
||||
idx = last === -1 ? 0 : last;
|
||||
cells[idx].value = '';
|
||||
} else {
|
||||
cells[idx].value = k;
|
||||
}
|
||||
|
||||
syncCodeFromCells();
|
||||
updateCodeDisplay();
|
||||
apply();
|
||||
// โฟกัสช่องถัดไป (ไม่ select — กันกด numpad แล้วทับค่าเดิม)
|
||||
var next = Math.min(idx + (k === 'back' ? 0 : 1), CODE_CELLS - 1);
|
||||
if (cells[next]) cells[next].focus();
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- init ---------- */
|
||||
function init(stops) {
|
||||
if (stops) state.stops = stops;
|
||||
|
||||
// idempotent — เรียกซ้ำได้ (ผูก event แค่ครั้งแรก)
|
||||
if (state.bound) { apply(); return; }
|
||||
state.bound = true;
|
||||
|
||||
var placeInput = document.getElementById('stops-place-input');
|
||||
var tabs = document.querySelectorAll('.mu-search-tab');
|
||||
|
||||
// toggle
|
||||
tabs.forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
setMode(btn.getAttribute('data-mode'));
|
||||
});
|
||||
});
|
||||
|
||||
// ช่องรหัส: 6-box → เด้งช่อง + เติม 0
|
||||
initCodeCells();
|
||||
|
||||
// ช่องชื่อ: debounce + suggest
|
||||
if (placeInput) {
|
||||
var timer = null;
|
||||
placeInput.addEventListener('input', function () {
|
||||
var v = this.value;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function () {
|
||||
state.placeQuery = v;
|
||||
renderSuggest();
|
||||
apply();
|
||||
}, 180);
|
||||
});
|
||||
placeInput.addEventListener('focus', renderSuggest);
|
||||
}
|
||||
|
||||
// ปุ่มค้นหา (โหมดรหัส: กดแล้วกรองเลย / โหมดชื่อ: ยืนยัน suggest แรก)
|
||||
var searchBtn = document.getElementById('stops-search-btn');
|
||||
if (searchBtn) {
|
||||
searchBtn.addEventListener('click', function () {
|
||||
if (state.mode === MODE_CODE) {
|
||||
syncCodeFromCells();
|
||||
updateCodeDisplay();
|
||||
} else {
|
||||
state.placeQuery = placeInput ? placeInput.value : '';
|
||||
renderSuggest();
|
||||
}
|
||||
apply();
|
||||
});
|
||||
}
|
||||
|
||||
// ปุ่มล้างค่า
|
||||
var resetBtn = document.getElementById('stops-reset-btn');
|
||||
if (resetBtn) {
|
||||
resetBtn.addEventListener('click', function () {
|
||||
var cells = codeCells();
|
||||
Array.prototype.forEach.call(cells, function (c) { c.value = ''; });
|
||||
if (placeInput) placeInput.value = '';
|
||||
state.codeValue = '';
|
||||
state.codeDigits = [];
|
||||
state.codeTouched = false;
|
||||
state.placeQuery = '';
|
||||
updateCodeDisplay();
|
||||
var suggest = document.getElementById('stops-suggest');
|
||||
if (suggest) suggest.hidden = true;
|
||||
apply();
|
||||
focusCell(0);
|
||||
});
|
||||
}
|
||||
|
||||
// ปิด suggest เมื่อคลิกนอก
|
||||
document.addEventListener('click', function (e) {
|
||||
var suggest = document.getElementById('stops-suggest');
|
||||
if (!suggest || suggest.hidden) return;
|
||||
if (e.target.closest('#stops-place-wrap') || e.target.closest('#stops-suggest')) return;
|
||||
suggest.hidden = true;
|
||||
});
|
||||
|
||||
initNumpad();
|
||||
setMode(MODE_CODE); // เริ่มที่โหมดรหัส
|
||||
}
|
||||
|
||||
window.StopsSearch = { init: init, setMode: setMode, formatCode: formatCode };
|
||||
|
||||
// ให้ i18n เรียก render ใหม่ได้ (ไม่บังคับ)
|
||||
window.addEventListener('langchange', function () {
|
||||
if (state.stops.length) { renderSuggest(); apply(); }
|
||||
});
|
||||
})();
|
||||
@@ -86,7 +86,11 @@
|
||||
if (stationHint) stationHint.innerHTML = tr('home.stationCount', { n: list.length }) + ' ' + province;
|
||||
}
|
||||
var prefix = tr('home.provincePrefix');
|
||||
if (heroProvince) heroProvince.textContent = (prefix ? prefix + ' ' : '') + province;
|
||||
// กรุงเทพมหานครเป็นเขตปกครองพิเศษ ไม่ใช่ "จังหวัด" → ไม่เติมคำนำหน้า
|
||||
var label = (prefix && province !== 'กรุงเทพมหานคร')
|
||||
? prefix + ' ' + province
|
||||
: province;
|
||||
if (heroProvince) heroProvince.textContent = label;
|
||||
}
|
||||
|
||||
provinceSelect.addEventListener('change', function () {
|
||||
|
||||
@@ -106,9 +106,14 @@
|
||||
font-weight: 800;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.mu-stop-summary-main { order: 2; }
|
||||
.mu-route-type-badge { display: inline-block; order: 3; background: linear-gradient(135deg, #f5eeff, #fce7f3); color: #7a4cc0; padding: 4px 8px; border-radius: 8px; font-size: .8rem; font-weight: 700; margin-left: auto; margin-right: 0; border: 1px solid #e8d9f0; }
|
||||
.mu-stop-summary-rail { order: 4; margin-left: 10px; }
|
||||
.mu-stop-summary-main { order: 2; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
|
||||
.mu-stop-summary-main strong { font-size: .95rem; line-height: 1.3; }
|
||||
.mu-stop-summary-main .mu-stop-summary-meta { color: #6f7b95; font-size: .78rem; }
|
||||
.mu-route-type-badge { display: inline-flex; align-items: center; gap: 5px; order: 3; flex: none; background: linear-gradient(135deg, #f5eeff, #fce7f3); color: #7a4cc0; padding: 4px 8px; border-radius: 8px; font-size: .8rem; font-weight: 700; border: 1px solid #e8d9f0; white-space: nowrap; }
|
||||
.mu-stop-summary-rail { order: 4; flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
|
||||
.mu-route-chip { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 38px; padding: 5px 9px; border-radius: 8px; background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff; font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
|
||||
.mu-stop-chevron { display: inline-block; color: #7a4cc0; font-size: .9rem; line-height: 1; transition: transform .2s ease; }
|
||||
.mu-stop-expander[open] .mu-stop-chevron { transform: rotate(180deg); }
|
||||
.mu-live-clock-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -297,7 +302,15 @@
|
||||
.mu-stop-expander > summary {
|
||||
background: linear-gradient(180deg, #fff, #fff6fb);
|
||||
padding: 14px;
|
||||
/* flex + wrap: จอกว้างเรียงบรรทัดเดียว / จอแคบพับลงมา ไม่ทับกัน */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
}
|
||||
.mu-stop-expander > summary::-webkit-details-marker { display: none; }
|
||||
.mu-stop-list > li:nth-child(4n + 1) .mu-stop-expander > summary { border-left: 4px solid #8b5cf6; }
|
||||
.mu-stop-list > li:nth-child(4n + 2) .mu-stop-expander > summary { border-left: 4px solid #38bdf8; }
|
||||
.mu-stop-list > li:nth-child(4n + 3) .mu-stop-expander > summary { border-left: 4px solid #f472b6; }
|
||||
@@ -328,6 +341,18 @@
|
||||
.mu-stop-summary-rail {
|
||||
gap: 6px;
|
||||
}
|
||||
/* จอแคบ: จัด summary เป็น 3 แถวอ่านง่าย — chip+badge / ชื่อสาย / รอบ+ลูกศร */
|
||||
.mu-stop-expander > summary {
|
||||
row-gap: 9px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.mu-stop-summary-main { flex: 1 1 100%; order: 5; }
|
||||
.mu-stop-summary-rail {
|
||||
flex: 1 1 100%;
|
||||
order: 6;
|
||||
margin-left: 0;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.mu-next-arrival {
|
||||
font-size: .72rem;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user