mock: three search tabs - stop code, place name, near me
- busStop.html: added the third tab (data-mode=near) and its own panel with the location button, hint and result area; removed the near button from the toolbar and deleted the old on-screen numpad markup - busStop.search.js: MODE_NEAR in setMode, disables the other panels, hides the stop list while ranked results are shown, skips filtering in that mode, and removed the dead initNumpad code - security gate: the tab is revealed only when isSecureContext and navigator.geolocation exist; otherwise it stays hidden and the mode is refused - map.js: re-enable the button after a successful lookup - i18n: stops.modeNear / nearCta / nearHint - bump SW version to 2026.09.27.98 Verified on localhost:8090 - three tabs, near mode shows a map with 8 ranked stops, button re-enables and works again, switching back restores the list; with isSecureContext forced false the tab is hidden and unselectable.
This commit is contained in:
1 parent
74d605f1c4
commit
750b4a2ea8
25 files changed
+426
-180
No files matched your search
@@ -235,7 +235,7 @@
|
||||
<div class="mu-container">
|
||||
<div class="mu-blog-bar" id="blog-bar" hidden>
|
||||
<p class="mu-blog-count" id="blog-count"></p>
|
||||
<div class="mu-view-switch" role="group" aria-label="มุมมอง">
|
||||
<div class="mu-view-switch" role="group" aria-label="มุมมอง" data-i18n-attr="aria-label:aria.mapsView">
|
||||
<button type="button" class="mu-view-btn" data-view="grid">
|
||||
<svg class="ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg>
|
||||
<span data-i18n="blog.viewGrid">ตาราง</span>
|
||||
|
||||
+10
-10
@@ -162,17 +162,17 @@
|
||||
|
||||
<main class="mu-page">
|
||||
<div class="mu-container">
|
||||
<p class="mu-breadcrumb"><a href="#/">หน้าแรก</a>/ <span data-i18n="nav.routes">รายละเอียดสายรถ</span></p>
|
||||
<p class="mu-breadcrumb"><a href="#/" data-i18n="nav.home">หน้าแรก</a>/ <span data-i18n="nav.routes">รายละเอียดสายรถ</span></p>
|
||||
<h1 class="mu-page-title"><span class="mu-route-chip" id="route-chip"></span> <span id="route-title"></span></h1>
|
||||
|
||||
<!-- ตัวเลือกสายรถ: เติมจาก resource/data/routes.json (busDetail.init.js) -->
|
||||
<form class="mu-toolbar" onsubmit="return false">
|
||||
<select aria-label="เลือกสายรถ" id="route-select"></select>
|
||||
<select aria-label="เลือกสายรถ" data-i18n-attr="aria-label:route.selectRoute" id="route-select"></select>
|
||||
</form>
|
||||
|
||||
<!-- ============ รถประจำสาย + ติดต่อผู้ประกอบการ (การ์ดเดียว) ============ -->
|
||||
<!-- รูปรถ/คำอธิบาย/QR/เบอร์โทร: เติมจาก resource/data/captions/caption<รหัสสาย>.json + routes.json -->
|
||||
<section class="mu-vehicle-card" aria-label="รถประจำสายและติดต่อผู้ประกอบการ" id="route-vehicle-card">
|
||||
<section class="mu-vehicle-card" aria-label="รถประจำสายและติดต่อผู้ประกอบการ" data-i18n-attr="aria-label:aria.vehicleSection" id="route-vehicle-card">
|
||||
<img id="route-vehicle-img" alt="" loading="lazy" decoding="async" hidden>
|
||||
<div class="meta">
|
||||
<p class="label" data-i18n="route.vehicle">รถประจำสาย</p>
|
||||
@@ -183,25 +183,25 @@
|
||||
</section>
|
||||
|
||||
<!-- ============ สรุปเส้นทาง ============ -->
|
||||
<section class="mu-summary" aria-label="สรุปเส้นทาง">
|
||||
<section class="mu-summary" aria-label="สรุปเส้นทาง" data-i18n-attr="aria-label:aria.routeSummary">
|
||||
<div class="mu-container">
|
||||
<div class="mu-summary-grid">
|
||||
<div class="mu-stat tag-purple"><h3 id="stat-stops">–</h3><p>จุดจอดหลัก</p></div>
|
||||
<div class="mu-stat tag-sky"><h3 id="stat-provinces">–</h3><p>จังหวัดที่ผ่าน</p></div>
|
||||
<div class="mu-stat tag-mint"><h3 id="stat-trips">–</h3><p>รอบต่อวัน</p></div>
|
||||
<div class="mu-stat tag-pink"><h3 id="stat-next">–</h3><p>รอบถัดไป</p></div>
|
||||
<div class="mu-stat tag-purple"><h3 id="stat-stops">–</h3><p data-i18n="route.kpiStops">จุดจอดหลัก</p></div>
|
||||
<div class="mu-stat tag-sky"><h3 id="stat-provinces">–</h3><p data-i18n="route.kpiProvince">จังหวัดที่ผ่าน</p></div>
|
||||
<div class="mu-stat tag-mint"><h3 id="stat-trips">–</h3><p data-i18n="route.kpiTrips">รอบต่อวัน</p></div>
|
||||
<div class="mu-stat tag-pink"><h3 id="stat-next">–</h3><p data-i18n="route.kpiNext">รอบถัดไป</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ============ แผนที่เส้นทาง (Leaflet + GeoJSON จาก QGIS) ============ -->
|
||||
<section class="mu-zone" aria-label="แผนที่เส้นทาง">
|
||||
<section class="mu-zone" aria-label="แผนที่เส้นทาง" data-i18n-attr="aria-label:aria.routeMap">
|
||||
<div class="mu-zone-head">
|
||||
<span class="mu-zone-tag tag-sky" data-i18n="route.mapTitle">เส้นทางเดินรถ</span>
|
||||
<p class="mu-zone-desc" data-i18n="route.mapDesc">เส้นทางจริงจากข้อมูล GIS · ป้ายหยุดรถตามเส้นทาง</p>
|
||||
</div>
|
||||
<div class="mu-map-card">
|
||||
<div class="at-map" id="route-map" role="region" aria-label="แผนที่เส้นทางเดินรถ"></div>
|
||||
<div class="at-map" id="route-map" role="region" aria-label="แผนที่เส้นทางเดินรถ" data-i18n-attr="aria-label:aria.routeGeom"></div>
|
||||
<p class="at-map-caption" id="route-map-caption"></p>
|
||||
<div class="at-km-wrap" hidden>
|
||||
<h3><span data-i18n="map.alongRoute">จุดจอดตามเส้นทาง (กม. จากต้นทาง)</span></h3>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
function $(id) { return document.getElementById(id); }
|
||||
function t(k, v) { return window.I18N ? I18N.t(k, v) : k; }
|
||||
function nm(o, base) { return (window.I18N && I18N.name) ? I18N.name(o, base) : ((o && o[base + '_th']) || ''); }
|
||||
function esc(s) {
|
||||
return String(s == null ? '' : s).replace(/&/g, '&').replace(/</g, '<')
|
||||
.replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
||||
@@ -164,7 +165,7 @@
|
||||
var note = (cap && cap.line_note) ? String(cap.line_note).trim() : '';
|
||||
setText('route-line-note', note);
|
||||
var phones = (route.phone || []).filter(Boolean);
|
||||
tryImage(qr, qrUrls(rid, cap), 'LINE QR สาย ' + rid, function (ok) {
|
||||
tryImage(qr, qrUrls(rid, cap), t('route.qrAlt', { n: rid }), function (ok) {
|
||||
qrBtn.hidden = !ok; /* ไม่มีรูป = ไม่มีปุ่มขยาย */
|
||||
if (ok) {
|
||||
var label = (kind ? t('route.link.' + kind.key) : 'LINE Official');
|
||||
@@ -307,7 +308,7 @@
|
||||
var img = $('route-vehicle-img');
|
||||
var card = $('route-vehicle-card');
|
||||
if (img) {
|
||||
tryImage(img, vehicleUrls(rid, cap), 'รถของสาย ' + rid, function (ok) {
|
||||
tryImage(img, vehicleUrls(rid, cap), t('route.vehicleAlt', { n: rid }), function (ok) {
|
||||
if (card) card.classList.toggle('no-photo', !ok);
|
||||
});
|
||||
}
|
||||
@@ -333,8 +334,8 @@
|
||||
if (chipEl) {
|
||||
chipEl.className = 'mu-route-chip' + (route.route_group ? ' grp-' + route.route_group : '');
|
||||
}
|
||||
setText('route-title', route.route_name_th);
|
||||
document.title = 'Atroute — สาย ' + rid + (route.route_name_th ? ' ' + route.route_name_th : '');
|
||||
setText('route-title', nm(route, 'route_name'));
|
||||
document.title = 'Atroute — ' + t('common.routePrefix', { n: rid }) + (nm(route, 'route_name') ? ' ' + nm(route, 'route_name') : '');
|
||||
|
||||
/* dropdown: เติมจาก routes.json (ลำดับตามไฟล์) + เปลี่ยนแล้วไปสายนั้น */
|
||||
var sel = $('route-select');
|
||||
@@ -343,7 +344,7 @@
|
||||
list.forEach(function (r) {
|
||||
var o = document.createElement('option');
|
||||
o.value = r.route_id;
|
||||
o.textContent = 'สาย ' + r.route_id + (r.route_name_th ? ' - ' + r.route_name_th : '');
|
||||
o.textContent = t('common.routePrefix', { n: r.route_id }) + (nm(r, 'route_name') ? ' - ' + nm(r, 'route_name') : '');
|
||||
sel.appendChild(o);
|
||||
});
|
||||
sel.value = rid;
|
||||
|
||||
+40
-26
@@ -379,14 +379,14 @@
|
||||
<div class="mu-hero-map">
|
||||
<p class="mu-hero-map-title"><span data-i18n="stops.mapTitle">แผนที่ย่อของเครือข่ายป้าย</span></p>
|
||||
<div class="mu-hero-map-box">
|
||||
<img class="mu-hero-map-photo" src="../.image/network/overview-map.png" alt="แผนที่เครือข่ายป้าย Atroute" loading="lazy" decoding="async">
|
||||
<img class="mu-hero-map-photo" src="../.image/network/overview-map.png" alt="แผนที่เครือข่ายป้าย Atroute" data-i18n-attr="alt:aria.networkMapAlt" loading="lazy" decoding="async">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<form class="mu-toolbar" id="stops-form" onsubmit="return false">
|
||||
<!-- โหมดค้นหา: เลือกอย่างใดอย่างหนึ่ง (ห้ามชนกัน) -->
|
||||
<div class="mu-search-tabs" role="tablist" aria-label="รูปแบบการค้นหา">
|
||||
<div class="mu-search-tabs" role="tablist" aria-label="รูปแบบการค้นหา" data-i18n-attr="aria-label:aria.searchMode">
|
||||
<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>
|
||||
@@ -395,6 +395,11 @@
|
||||
<svg class="ic" aria-hidden="true"><use href="#ic-landmark"/></svg>
|
||||
<span data-i18n="stops.modePlace">ค้นหาด้วยชื่อสถานที่</span>
|
||||
</button>
|
||||
<!-- หมวดที่ 3: ป้ายใกล้ฉัน — แสดงเฉพาะเมื่อเป็น secure context (ดูสคริปต์ท้ายไฟล์) -->
|
||||
<button type="button" class="mu-search-tab" data-mode="near" role="tab" aria-selected="false" id="stops-near-tab" hidden>
|
||||
<svg class="ic" aria-hidden="true"><use href="#ic-map-pin"/></svg>
|
||||
<span data-i18n="stops.modeNear">ป้ายใกล้ฉัน</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- โหมด 1: รหัสป้าย (5 ช่อง: 2 หน้า + 3 หลัง) -->
|
||||
@@ -402,32 +407,19 @@
|
||||
<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">
|
||||
autocomplete="off" aria-label="หลักที่ 1" data-i18n-attr="aria-label:aria.digitN" data-i18n-n="1" placeholder="0">
|
||||
<input class="mu-code-cell" type="text" inputmode="numeric" maxlength="1"
|
||||
autocomplete="off" aria-label="หลักที่ 2" placeholder="0">
|
||||
autocomplete="off" aria-label="หลักที่ 2" data-i18n-attr="aria-label:aria.digitN" data-i18n-n="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">
|
||||
autocomplete="off" aria-label="หลักที่ 3" data-i18n-attr="aria-label:aria.digitN" data-i18n-n="3" placeholder="0">
|
||||
<input class="mu-code-cell" type="text" inputmode="numeric" maxlength="1"
|
||||
autocomplete="off" aria-label="หลักที่ 4" placeholder="0">
|
||||
autocomplete="off" aria-label="หลักที่ 4" data-i18n-attr="aria-label:aria.digitN" data-i18n-n="4" placeholder="0">
|
||||
<input class="mu-code-cell" type="text" inputmode="numeric" maxlength="1"
|
||||
autocomplete="off" aria-label="หลักที่ 5" placeholder="0">
|
||||
autocomplete="off" aria-label="หลักที่ 5" data-i18n-attr="aria-label:aria.digitN" data-i18n-n="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: ชื่อสถานที่ -->
|
||||
@@ -441,21 +433,25 @@
|
||||
<p class="mu-search-hint" data-i18n="stops.placeHint">พิมพ์ชื่อสถานที่สำคัญ เช่น โรงพยาบาล สำนักงานที่ดิน แล้วเลือกรายการที่ตรงกัน</p>
|
||||
</div>
|
||||
|
||||
<!-- หมวดที่ 3: ป้ายใกล้ฉัน — ขอพิกัดจากเครื่อง แล้วเรียงป้ายตามระยะจริง -->
|
||||
<div class="mu-search-mode" id="stops-near-wrap" hidden>
|
||||
<button type="button" class="mu-btn primary" id="near-me-btn">
|
||||
<svg class="ic" aria-hidden="true"><use href="#ic-map-pin"/></svg>
|
||||
<span data-i18n="stops.nearCta">ขอพิกัดและหาป้ายใกล้ฉัน</span>
|
||||
</button>
|
||||
<p class="mu-search-hint" data-i18n="stops.nearHint">ระบบจะขอตำแหน่งจากเครื่อง แล้วคำนวณระยะจากพิกัดป้าย/ศาลารถ เรียงจากใกล้ไปไกล</p>
|
||||
<div id="near-me-result" class="mu-near-wrap" hidden></div>
|
||||
</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>
|
||||
<button type="button" class="mu-btn ghost" id="near-me-btn">
|
||||
<svg class="ic" aria-hidden="true"><use href="#ic-map-pin"/></svg>
|
||||
<span data-i18n="map.useMyLocation">ป้ายใกล้ฉัน</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>
|
||||
|
||||
<div id="near-me-result" class="mu-near-wrap" hidden></div>
|
||||
|
||||
<ul class="mu-stop-grid" id="stops-list"></ul>
|
||||
|
||||
<div class="mu-show-more">
|
||||
@@ -465,10 +461,28 @@
|
||||
</main>
|
||||
|
||||
<script>
|
||||
/* ป้ายใกล้ฉัน — หมวดที่ 3 ของการค้นหา
|
||||
ต้องมี secure context (HTTPS หรือ localhost) เบราว์เซอร์จึงยอมให้ geolocation
|
||||
ไม่ผ่านเงื่อนไข → ซ่อนแท็บทั้งแท็บ (กดไปก็ได้แต่ error) */
|
||||
(function () {
|
||||
var SECURE = (typeof window !== 'undefined') &&
|
||||
window.isSecureContext === true &&
|
||||
typeof navigator !== 'undefined' && !!navigator.geolocation;
|
||||
|
||||
var tab = document.getElementById('stops-near-tab');
|
||||
if (tab) tab.hidden = !SECURE;
|
||||
|
||||
if (!SECURE) {
|
||||
var wrap0 = document.getElementById('stops-near-wrap');
|
||||
if (wrap0) wrap0.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var btn = document.getElementById('near-me-btn');
|
||||
var out = document.getElementById('near-me-result');
|
||||
if (!btn || !out || !window.ATMap) return;
|
||||
if (btn.dataset.nearBound === '1') return;
|
||||
btn.dataset.nearBound = '1';
|
||||
ATMap.nearMe(btn, out, { limit: 8 });
|
||||
})();
|
||||
</script>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
{ 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) : '—' }
|
||||
{ label: t('stops.kpi.buses'), value: topBus ? t('common.routePrefix', { n: topBus }) : '—' }
|
||||
];
|
||||
|
||||
host.innerHTML = '';
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
var MODE_CODE = 'code';
|
||||
var MODE_PLACE = 'place';
|
||||
var MODE_NEAR = 'near'; /* หมวดที่ 3: ป้ายใกล้ฉัน (ต้องมี HTTPS) */
|
||||
|
||||
var state = {
|
||||
mode: MODE_CODE,
|
||||
@@ -90,6 +91,10 @@
|
||||
}
|
||||
|
||||
function currentFilter() {
|
||||
// โหมดใกล้ฉัน: ไม่กรองรายการ (ผลลัพธ์แสดงในโซนของตัวเอง)
|
||||
if (state.mode === MODE_NEAR) {
|
||||
return { fn: function () { return true; }, value: '' };
|
||||
}
|
||||
// โหมดรหัส: ถ้ายังไม่กรอกช่องไหนเลย → ไม่กรอง (แสดงทั้งหมด)
|
||||
if (state.mode === MODE_CODE && !state.codeTouched) {
|
||||
return { fn: function () { return true; }, value: '' };
|
||||
@@ -206,23 +211,33 @@
|
||||
|
||||
/* ---------- สลับโหมด (หัวใจของการกันชน) ---------- */
|
||||
function setMode(mode) {
|
||||
if (mode !== MODE_CODE && mode !== MODE_PLACE) return;
|
||||
if (mode !== MODE_CODE && mode !== MODE_PLACE && mode !== MODE_NEAR) return;
|
||||
/* โหมดใกล้ฉันใช้ได้เฉพาะ secure context */
|
||||
if (mode === MODE_NEAR && !(window.isSecureContext && navigator.geolocation)) return;
|
||||
state.mode = mode;
|
||||
|
||||
var codeWrap = document.getElementById('stops-code-wrap');
|
||||
var placeWrap = document.getElementById('stops-place-wrap');
|
||||
var nearWrap = document.getElementById('stops-near-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;
|
||||
var isPlace = mode === MODE_PLACE;
|
||||
var isNear = mode === MODE_NEAR;
|
||||
|
||||
// แสดง/ซ่อนช่องกรอก
|
||||
// แสดง/ซ่อนช่องกรอก — เลือกได้ทีละโหมดเท่านั้น
|
||||
if (codeWrap) codeWrap.hidden = !isCode;
|
||||
if (placeWrap) placeWrap.hidden = isCode;
|
||||
if (pad) pad.hidden = !isCode;
|
||||
if (suggest) suggest.hidden = isCode;
|
||||
if (placeWrap) placeWrap.hidden = !isPlace;
|
||||
if (nearWrap) nearWrap.hidden = !isNear;
|
||||
if (suggest) suggest.hidden = !isPlace;
|
||||
|
||||
// โหมดใกล้ฉัน: ซ่อนรายการป้ายทั้งหมด (ผลลัพธ์หลักคือการ์ดเรียงตามระยะ)
|
||||
var stopList = document.getElementById('stops-list');
|
||||
if (stopList) stopList.hidden = isNear;
|
||||
var showAllBtn = document.getElementById('stops-show-all');
|
||||
if (showAllBtn && isNear) showAllBtn.hidden = true;
|
||||
|
||||
// ปิดการใช้งานช่องของโหมดที่ไม่ได้เลือก + ล้างค่า → กันการค้น 2 ทางพร้อมกัน
|
||||
Array.prototype.forEach.call(cells, function (c) {
|
||||
@@ -236,8 +251,8 @@
|
||||
updateCodeDisplay();
|
||||
}
|
||||
if (placeInput) {
|
||||
placeInput.disabled = isCode;
|
||||
if (isCode) { placeInput.value = ''; state.placeQuery = ''; }
|
||||
placeInput.disabled = !isPlace;
|
||||
if (!isPlace) { placeInput.value = ''; state.placeQuery = ''; }
|
||||
}
|
||||
|
||||
// ไฮไลต์ปุ่ม toggle
|
||||
@@ -249,7 +264,11 @@
|
||||
|
||||
// โฟกัสช่องที่เพิ่งเปิด
|
||||
if (isCode) focusCell(0);
|
||||
if (!isCode && placeInput) placeInput.focus();
|
||||
if (isPlace && placeInput) placeInput.focus();
|
||||
if (isNear) {
|
||||
var nearBtn = document.getElementById('near-me-btn');
|
||||
if (nearBtn) nearBtn.focus();
|
||||
}
|
||||
|
||||
apply();
|
||||
}
|
||||
@@ -352,44 +371,6 @@
|
||||
}
|
||||
|
||||
/* ---------- 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) {
|
||||
@@ -481,7 +462,6 @@
|
||||
suggest.hidden = true;
|
||||
});
|
||||
|
||||
initNumpad();
|
||||
setMode(MODE_CODE); // เริ่มที่โหมดรหัส
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
</section>
|
||||
|
||||
<!-- ============ สรุปเส้นทาง (สถิติแบบ index) ============ -->
|
||||
<section class="mu-summary" aria-label="สรุปเส้นทาง">
|
||||
<section class="mu-summary" aria-label="สรุปเส้นทาง" data-i18n-attr="aria-label:aria.routeSummary">
|
||||
<div class="mu-container">
|
||||
<div class="mu-summary-grid">
|
||||
<div class="mu-stat tag-purple"><h3 id="check-stat-stops">–</h3><p data-i18n="check.kpiStops">จุดจอดหลัก</p></div>
|
||||
@@ -159,7 +159,7 @@
|
||||
</section>
|
||||
|
||||
<!-- ============ ตารางเวลาเดินรถ ============ -->
|
||||
<section class="mu-schedule" aria-label="ตารางเวลาเดินรถ">
|
||||
<section class="mu-schedule" aria-label="ตารางเวลาเดินรถ" data-i18n-attr="aria-label:check.title">
|
||||
<div class="mu-container">
|
||||
<div class="mu-zone">
|
||||
<div class="mu-zone-head">
|
||||
|
||||
@@ -318,7 +318,7 @@
|
||||
|
||||
var head = document.createElement('p');
|
||||
head.className = 'mu-stop-sub';
|
||||
head.textContent = (r.direction_label || r.dir_label) || r.direction_note || ('จาก ' + first);
|
||||
head.textContent = (r.direction_label || r.dir_label) || r.direction_note || t('check.fromName', { name: first });
|
||||
body.appendChild(head);
|
||||
|
||||
var grid = document.createElement('div');
|
||||
@@ -425,7 +425,7 @@
|
||||
routes.forEach(function (r) {
|
||||
var o = document.createElement('option');
|
||||
o.value = r.route_id;
|
||||
o.textContent = 'สาย ' + r.route_id + (r.route_name_th ? ' - ' + r.route_name_th : '');
|
||||
o.textContent = t('common.routePrefix', { n: r.route_id }) + (r.route_name_th ? ' - ' + r.route_name_th : '');
|
||||
sel.appendChild(o);
|
||||
});
|
||||
sel.value = rid;
|
||||
@@ -436,7 +436,7 @@
|
||||
|
||||
/* Hero + คำอธิบายโซน */
|
||||
var hero = $('check-hero-route');
|
||||
if (hero) hero.textContent = 'สาย ' + rid + (route.route_name_th ? ' · ' + route.route_name_th : '');
|
||||
if (hero) hero.textContent = t('common.routePrefix', { n: rid }) + (route.route_name_th ? ' · ' + route.route_name_th : '');
|
||||
|
||||
/* "อัปเดตล่าสุด N วันที่แล้ว" — วันที่จากฟิลด์ updated ของไฟล์ตารางสายนี้ (Schedules.updatedOf)
|
||||
แยกบรรทัดของตัวเอง (#check-updated-line) เพราะ #check-now-line แสดงเวลาปัจจุบันอยู่แล้ว */
|
||||
@@ -470,7 +470,7 @@
|
||||
return {
|
||||
sid: sid,
|
||||
st: st,
|
||||
name: isOtherHub && firstSubName ? firstSubName : (st ? st.station_name_th : 'จุดจอด ' + sid),
|
||||
name: isOtherHub && firstSubName ? firstSubName : (st ? st.station_name_th : t('check.stopNameN', { n: sid })),
|
||||
city: st ? st.city_th : '',
|
||||
code: st ? st.station_code : '',
|
||||
recs: recs.filter(function (r) { return String(r.route_id) === rid && r.station_id === sid; })
|
||||
@@ -506,11 +506,11 @@
|
||||
dayText = t('check.dayMixed');
|
||||
} else if (selectedByDay) {
|
||||
dayText = t(di.dayType === 'holiday' ? 'check.dayHoliday' : 'check.dayWeekday') +
|
||||
' (' + t('check.dayOfWeek') + ' ' + di.weekday_th + ')';
|
||||
' (' + t('check.dayOfWeek') + ' ' + (window.Schedules && Schedules.dayName ? Schedules.dayName(di.weekday) : di.weekday_th) + ')';
|
||||
}
|
||||
}
|
||||
/* แยกเป็นชิ้น ๆ เพื่อให้ตัดบรรทัดได้เป็นหน่วย (ไม่ตัดกลางชื่อสถานี/ชื่อวัน) */
|
||||
var segs = ['สาย ' + rid];
|
||||
var segs = [t('common.routePrefix', { n: rid })];
|
||||
if (names.length > 1) segs.push(names[0] + ' \u2192 ' + names[names.length - 1]);
|
||||
segs.push(groups.length + ' ' + t('check.stopsCount'));
|
||||
if (dayText) segs.push(dayText);
|
||||
|
||||
+18
-18
@@ -19,53 +19,53 @@
|
||||
<main class="mu-page">
|
||||
<div class="mu-credit-wrap">
|
||||
<div class="mu-credit-hero">
|
||||
<p class="mu-breadcrumb"><a href="#/">หน้าแรก</a>/ เครดิต</p>
|
||||
<p class="mu-breadcrumb"><a href="#/" data-i18n="credits.breadHome">หน้าแรก</a>/ <span data-i18n="credits.breadSelf">เครดิต</span></p>
|
||||
<h1><span data-i18n="credits.title">เครดิตและแหล่งที่มา</span></h1>
|
||||
<p>รายการทรัพยากรทั้งหมดที่ใช้ในเว็บนี้ พร้อมใบอนุญาต (license) ตามข้อกำหนดของเจ้าของแต่ละราย</p>
|
||||
<p data-i18n="credits.lead">รายการทรัพยากรทั้งหมดที่ใช้ในเว็บนี้ พร้อมใบอนุญาต (license) ตามข้อกำหนดของเจ้าของแต่ละราย</p>
|
||||
</div>
|
||||
|
||||
<section class="mu-credit-section">
|
||||
<h2><span data-i18n="credits.icons">ไอคอน — Lucide</span></h2>
|
||||
<p class="src">แหล่งที่มา: <a href="https://lucide.dev" rel="noopener">lucide.dev</a> · ใบอนุญาต: <a href="https://github.com/lucide-icons/lucide/blob/main/LICENSE" rel="noopener">MIT License</a> — ใช้ได้ฟรีทั้งส่วนบุคคลและเชิงพาณิชย์ โดยไม่ต้องระบุเครดิต แต่เราระบุไว้เพื่อความโปร่งใส</p>
|
||||
<p class="src"><span data-i18n="credits.src">แหล่งที่มา:</span> <a href="https://lucide.dev" rel="noopener">lucide.dev</a> · <span data-i18n="credits.lic">ใบอนุญาต:</span> <a href="https://github.com/lucide-icons/lucide/blob/main/LICENSE" rel="noopener">MIT License</a> — ใช้ได้ฟรีทั้งส่วนบุคคลและเชิงพาณิชย์ โดยไม่ต้องระบุเครดิต แต่เราระบุไว้เพื่อความโปร่งใส</p>
|
||||
<ul>
|
||||
<li>ไอคอนที่ใช้ทั้งหมด 15 รายการ เก็บที่ <code>.image/icons/lucide/</code></li>
|
||||
<li>alarm-clock, arrow-right, bus, bus-front, check, clock, globe, hourglass, map, map-pin, message-circle, phone, refresh-cw, search, triangle-alert</li>
|
||||
<li>วิธีใช้งาน: sprite <code>ui/partials/icons-sprite.svg</code> + <code><svg class="ic"><use href="#ic-ชื่อ"></code></li>
|
||||
<li><span data-i18n="credits.iconsCount">ไอคอนที่ใช้ทั้งหมด 15 รายการ เก็บที่</span> <code>.image/icons/lucide/</code></li>
|
||||
<li data-i18n="credits.iconNames">alarm-clock, arrow-right, bus, bus-front, check, clock, globe, hourglass, map, map-pin, message-circle, phone, refresh-cw, search, triangle-alert</li>
|
||||
<li><span data-i18n="credits.iconsUsage">วิธีใช้งาน: sprite</span> <code>ui/partials/icons-sprite.svg</code> + <code><svg class="ic"><use href="#ic-ชื่อ"></code></li>
|
||||
</ul>
|
||||
<div class="mu-license">
|
||||
<strong>MIT License (สรุป):</strong> อนุญาตให้ใช้ คัดลอก แก้ไข ผสาน เผยแพร่ แจกจ่าย ขาย และ/หรือให้สิทธิ์ใช้งานซอฟต์แวร์นี้ โดยมีเงื่อนไขให้ข้อความแสดงลิขสิทธิ์และข้อความอนุญาตข้างต้นปรากฏอยู่ในสำเนาทั้งหมดหรือส่วนสำคัญของซอฟต์แวร์ ซอฟต์แวร์นี้ให้บริการ "ตามสภาพ" โดยไม่มีการรับประกันใด ๆ
|
||||
<strong data-i18n="credits.mitStrong">MIT License (สรุป):</strong> <span data-i18n="credits.mitText">อนุญาตให้ใช้ คัดลอก แก้ไข ผสาน เผยแพร่ แจกจ่าย ขาย และ/หรือให้สิทธิ์ใช้งานซอฟต์แวร์นี้ โดยมีเงื่อนไขให้ข้อความแสดงลิขสิทธิ์และข้อความอนุญาตข้างต้นปรากฏอยู่ในสำเนาทั้งหมดหรือส่วนสำคัญของซอฟต์แวร์ ซอฟต์แวร์นี้ให้บริการ "ตามสภาพ" โดยไม่มีการรับประกันใด ๆ</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="mu-credit-section">
|
||||
<h2><span data-i18n="credits.fonts">ฟอนต์ — Google Fonts</span></h2>
|
||||
<p class="src">แหล่งที่มา: <a href="https://fonts.google.com" rel="noopener">fonts.google.com</a> · ใบอนุญาต: <a href="https://openfontlicense.org" rel="noopener">SIL Open Font License 1.1</a></p>
|
||||
<p class="src"><span data-i18n="credits.src">แหล่งที่มา:</span> <a href="https://fonts.google.com" rel="noopener">fonts.google.com</a> · <span data-i18n="credits.lic">ใบอนุญาต:</span> <a href="https://openfontlicense.org" rel="noopener">SIL Open Font License 1.1</a></p>
|
||||
<ul>
|
||||
<li><strong>K2D</strong> — ฟอนต์หลักของเว็บ (เนื้อหา + หัวเรื่อง) · มีหัวแบบไทย น้ำหนัก 300–800</li>
|
||||
<li><strong>Noto Sans Thai</strong> — ตัวสำรองเนื้อหา (โหลดผ่าน Google Fonts CDN)</li>
|
||||
<li><strong>Prompt</strong> — ตัวสำรองหัวเรื่อง/ตัวหนา</li>
|
||||
<li><strong>IBM Plex Mono</strong> — เวลา · เลขสาย · ตัวเลข (เรียงตรงกัน)</li>
|
||||
<li><strong>K2D</strong> — <span data-i18n="credits.fontK2D">ฟอนต์หลักของเว็บ (เนื้อหา + หัวเรื่อง) · มีหัวแบบไทย น้ำหนัก 300–800</span></li>
|
||||
<li><strong>Noto Sans Thai</strong> — <span data-i18n="credits.fontNoto">ตัวสำรองเนื้อหา (โหลดผ่าน Google Fonts CDN)</span></li>
|
||||
<li><strong>Prompt</strong> — <span data-i18n="credits.fontPrompt">ตัวสำรองหัวเรื่อง/ตัวหนา</span></li>
|
||||
<li><strong>IBM Plex Mono</strong> — <span data-i18n="credits.fontMono">เวลา · เลขสาย · ตัวเลข (เรียงตรงกัน)</span></li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="mu-credit-section">
|
||||
<h2><span data-i18n="credits.map">แผนที่</span></h2>
|
||||
<p class="src">ใบอนุญาต: Leaflet <a href="https://github.com/Leaflet/Leaflet/blob/main/LICENSE" rel="noopener">BSD-2-Clause</a> · ชุดแผนที่ (tiles): <a href="https://www.openstreetmap.org/copyright" rel="noopener">OpenStreetMap © ผู้มีส่วนร่วม (ODbL)</a></p>
|
||||
<p class="src"><span data-i18n="credits.lic">ใบอนุญาต:</span> Leaflet <a href="https://github.com/Leaflet/Leaflet/blob/main/LICENSE" rel="noopener">BSD-2-Clause</a> · ชุดแผนที่ (tiles): <a href="https://www.openstreetmap.org/copyright" rel="noopener">OpenStreetMap © ผู้มีส่วนร่วม (ODbL)</a></p>
|
||||
<ul>
|
||||
<li>Leaflet — ไลบรารีแผนที่แบบ open-source</li>
|
||||
<li>OpenStreetMap — ภาพ tiles และข้อมูลแผนที่ที่ใช้แสดงผล</li>
|
||||
<li>เส้นทางเดินรถ จุดจอด และหมุดสถานี วาดจากข้อมูล GIS ของทีม (<code>GeoJSON</code>) ทับบนแผนที่</li>
|
||||
<li data-i18n="credits.mapLeaflet">Leaflet — ไลบรารีแผนที่แบบ open-source</li>
|
||||
<li data-i18n="credits.mapOSM">OpenStreetMap — ภาพ tiles และข้อมูลแผนที่ที่ใช้แสดงผล</li>
|
||||
<li><span data-i18n="credits.mapGIS">เส้นทางเดินรถ จุดจอด และหมุดสถานี วาดจากข้อมูล GIS ของทีม</span> (<code>GeoJSON</code>)</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="mu-credit-section">
|
||||
<h2><span data-i18n="credits.photos">ขอขอบคุณภาพรถประจำทาง</span></h2>
|
||||
<p class="src">ภาพรถโดยสารประจำทางที่แสดงในหน้ารายละเอียดสาย มาจากแหล่งข้อมูลสาธารณะด้านล่างนี้ — ขอบคุณเจ้าของภาพและผู้รวบรวมทุกท่าน</p>
|
||||
<p class="src" data-i18n="credits.photosLead">ภาพรถโดยสารประจำทางที่แสดงในหน้ารายละเอียดสาย มาจากแหล่งข้อมูลสาธารณะด้านล่างนี้ — ขอบคุณเจ้าของภาพและผู้รวบรวมทุกท่าน</p>
|
||||
<ul>
|
||||
<li><strong>สาย 2194</strong> หัวเวียง-อยุธยา — จาก <a href="http://www.bangkokbusclub.com/cms/showthread.php?t=4968" rel="noopener">bangkokbusclub.com</a></li>
|
||||
<li><strong>สาย 8</strong> กรุงเทพ-สรรคบุรี-ชัยนาท — จาก <a href="https://web.facebook.com/groups/431811197419587/posts/2006978336569524/" rel="noopener">กลุ่ม Facebook (web.facebook.com)</a></li>
|
||||
<li><strong>สาย 954</strong> กรุงเทพ-ท่าช้าง — จาก <a href="https://gogo.town/route/bangkok-rangsit-angthong-thachang/" rel="noopener">gogo.town</a></li>
|
||||
<li><strong>รถไฟฟ้าสายสีแดง </strong> กรุงเทพ-ชุมทางบ้านภาชี — จาก <a href="https://thelist.group/realist/blog/%E0%B8%A3%E0%B8%96%E0%B9%84%E0%B8%9F%E0%B8%9F%E0%B9%89%E0%B8%B2%E0%B8%AA%E0%B8%B2%E0%B8%A2%E0%B8%AA%E0%B8%B5%E0%B9%81%E0%B8%94%E0%B8%87/" rel="noopener">thelist.group</a></li>
|
||||
<li><strong data-i18n="credits.lineRed">รถไฟฟ้าสายสีแดง</strong> กรุงเทพ-ชุมทางบ้านภาชี — จาก <a href="https://thelist.group/realist/blog/%E0%B8%A3%E0%B8%96%E0%B9%84%E0%B8%9F%E0%B8%9F%E0%B9%89%E0%B8%B2%E0%B8%AA%E0%B8%B2%E0%B8%A2%E0%B8%AA%E0%B8%B5%E0%B9%81%E0%B8%94%E0%B8%87/" rel="noopener">thelist.group</a></li>
|
||||
</ul>
|
||||
<p class="mu-license">
|
||||
<span data-i18n="credits.photosNote">และสายอื่น ๆ ที่ไม่ได้ระบุ ขอขอบคุณมา ณ ที่นี้</span>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="mu-sponsor-marquee" aria-label="ผู้สนับสนุนและพาร์ทเนอร์">
|
||||
<section class="mu-sponsor-marquee" aria-label="ผู้สนับสนุนและพาร์ทเนอร์" data-i18n-attr="aria-label:aria.sponsors">
|
||||
<div class="mu-sponsor-head">
|
||||
<h4 data-i18n="footer.sponsors">ผู้สนับสนุน & พาร์ทเนอร์</h4>
|
||||
<p class="lead" data-i18n="footer.sponsorsLead">ร่วมเป็นผู้สนับสนุนเราได้ เมื่อซื้อของออนไลน์ หรือซื้อตั๋วรถทัวร์ เครื่องบิน ออนไลน์กดเลือกสินค้า หรือบริการผ่านลิงค์นายหน้าของเราไม่มีค่าใช้จ่ายเพิ่ม</p>
|
||||
@@ -83,7 +83,7 @@
|
||||
<div class="mu-container">
|
||||
|
||||
<!-- คำอธิบายสีการ์ดตามหมวดเส้นทาง -->
|
||||
<section class="mu-legend" aria-label="คำอธิบายสีการ์ดตามหมวดเส้นทาง">
|
||||
<section class="mu-legend" aria-label="คำอธิบายสีการ์ดตามหมวดเส้นทาง" data-i18n-attr="aria-label:aria.legend">
|
||||
<h2 class="mu-legend-title" data-i18n="legend.title">คำอธิบายสีการ์ดตามหมวดเส้นทาง</h2>
|
||||
<ul class="mu-legend-list">
|
||||
<li><span class="sw sw-bangkok" aria-hidden="true"></span><span data-i18n="legend.bangkok">หมวดเส้นทางเข้ากรุงเทพฯ — การ์ดสีน้ำเงิน</span></li>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function nm(o, base) { return (window.I18N && I18N.name) ? I18N.name(o, base) : ((o && o[base + '_th']) || ''); }
|
||||
|
||||
// แหล่งข้อมูลเดียว (source of truth) — อย่า hardcode รายชื่อจังหวัด/สถานีไว้ในไฟล์นี้
|
||||
var DATA_URL = {
|
||||
provinces: '../resource/data/provinces.json',
|
||||
@@ -65,14 +67,14 @@
|
||||
PROVINCES.forEach(function (p) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = p.province_id;
|
||||
opt.textContent = p.province_name_th;
|
||||
opt.textContent = nm(p, 'province_name');
|
||||
if (p.province_id === startProvinceId) opt.selected = true;
|
||||
provinceSelect.appendChild(opt);
|
||||
});
|
||||
|
||||
function provinceName(id) {
|
||||
var p = PROVINCES.filter(function (x) { return x.province_id === id; })[0];
|
||||
return p ? p.province_name_th : '';
|
||||
return p ? nm(p, 'province_name') : '';
|
||||
}
|
||||
|
||||
function stationsFor(provinceId) {
|
||||
@@ -90,7 +92,7 @@
|
||||
list.forEach(function (st) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = st.station_code; /* ใช้รหัสสถานี = ลิงก์สั้น อ่านง่าย */
|
||||
opt.textContent = st.station_name_th;
|
||||
opt.textContent = nm(st, 'station_name');
|
||||
stationSelect.appendChild(opt);
|
||||
});
|
||||
|
||||
|
||||
@@ -189,6 +189,11 @@
|
||||
var DAYS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; /* ตรงกับ Date.getDay() */
|
||||
var DAY_TH = { sun: 'อาทิตย์', mon: 'จันทร์', tue: 'อังคาร', wed: 'พุธ', thu: 'พฤหัสบดี', fri: 'ศุกร์', sat: 'เสาร์' };
|
||||
var DAY_ABBR = { sun: 'อา', mon: 'จ', tue: 'อ', wed: 'พ', thu: 'พฤ', fri: 'ศ', sat: 'ส' };
|
||||
/* ชื่อวันแบบหลายภาษา — ใช้แสดงผลเท่านั้น (การตรวจคำยังใช้ค่าภาษาไทยข้างบน) */
|
||||
function dayName(key, short) {
|
||||
var k = 'day.' + key + (short ? 'S' : '');
|
||||
return (window.I18N && I18N.t) ? I18N.t(k) : (short ? DAY_ABBR[key] : DAY_TH[key]);
|
||||
}
|
||||
var DAY_ALIAS = { /* รับได้หลายชื่อ */
|
||||
weekday: 'weekday', workday: 'weekday', 'วันทำงาน': 'weekday', 'จ-ศ': 'weekday', 'จ–ศ': 'weekday',
|
||||
holiday: 'holiday', weekend: 'holiday', 'วันหยุด': 'holiday', 'ส-อา': 'holiday', 'ส–อา': 'holiday', 'เสาร์-อาทิตย์': 'holiday',
|
||||
@@ -214,7 +219,8 @@
|
||||
var d = date || new Date();
|
||||
var t = dayTypeOf(d);
|
||||
return { dayType: t, weekday: DAYS[d.getDay()], weekday_th: DAY_TH[DAYS[d.getDay()]], date: ymd(d),
|
||||
label_th: t === 'holiday' ? 'วันหยุด (ส–อา/นักขัตฤกษ์)' : 'วันทำงาน (จ–ศ)' };
|
||||
label_th: t === 'holiday' ? 'วันหยุด (ส–อา/นักขัตฤกษ์)' : 'วันทำงาน (จ–ศ)',
|
||||
labelKey: t === 'holiday' ? 'dayHoliday' : 'dayWeekday' };
|
||||
}
|
||||
/* ตรวจคำในข้อความ (direction_label / direction_note / note) ว่าหมายถึงวันไหน */
|
||||
function detectDay(text) {
|
||||
@@ -600,6 +606,7 @@
|
||||
todayType: todayType,
|
||||
dayTypeOf: dayTypeOf,
|
||||
dayInfo: dayInfo,
|
||||
dayName: dayName,
|
||||
dayKey: dayKey,
|
||||
DAYS: DAYS,
|
||||
DAY_TH: DAY_TH,
|
||||
|
||||
@@ -436,7 +436,7 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="mu-nearby" id="stop-nearby" aria-label="สถานที่ใกล้เคียง" hidden>
|
||||
<section class="mu-nearby" id="stop-nearby" aria-label="สถานที่ใกล้เคียง" data-i18n-attr="aria-label:stop.nearby" hidden>
|
||||
<h2><span data-i18n="stop.nearby">ใกล้เคียงป้าย</span></h2>
|
||||
<p class="sub" id="stop-nearby-sub"></p>
|
||||
<div class="mu-nearby-grid" id="stop-nearby-grid"></div>
|
||||
@@ -450,7 +450,7 @@
|
||||
<div class="mu-card-panel">
|
||||
<h2><span data-i18n="stop.routes">สายรถที่ผ่านจุดนี้</span></h2>
|
||||
<div class="mu-route-tools">
|
||||
<input id="mu-route-filter" class="mu-route-filter" type="text" placeholder="ค้นหาสายรถหรือปลายทาง" data-i18n-attr="placeholder:stop.searchRoute,aria-label:stop.searchRoute">
|
||||
<input id="mu-route-filter" class="mu-route-filter" type="text" placeholder="ค้นหาสายรถหรือปลายทาง" data-i18n-attr="placeholder:stop.searchRoute" data-i18n-attr="placeholder:stop.searchRoute,aria-label:stop.searchRoute">
|
||||
<span class="mu-route-count" id="mu-route-count"></span>
|
||||
</div>
|
||||
<ul class="mu-list mu-stop-list" id="stop-routes"></ul>
|
||||
@@ -458,7 +458,7 @@
|
||||
|
||||
<aside class="mu-card-panel">
|
||||
<h2><span data-i18n="stop.mapInfo">แผนที่และข้อมูลป้าย</span></h2>
|
||||
<div class="at-map" id="stop-map" role="region" aria-label="แผนที่เส้นทางที่ผ่านป้ายนี้"></div>
|
||||
<div class="at-map" id="stop-map" role="region" aria-label="แผนที่เส้นทางที่ผ่านป้ายนี้" data-i18n-attr="aria-label:aria.stopRoutesMap"></div>
|
||||
<p class="at-map-caption" id="stop-map-caption"></p>
|
||||
<div id="stop-chips" style="display:flex; flex-wrap:wrap; gap:8px; margin-top:14px;"></div>
|
||||
</aside>
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
|
||||
/* ---------- เรนเดอร์: หัวป้าย ---------- */
|
||||
function renderHero(st, sum, photo, place) {
|
||||
var baseName = st.station_name_th || ('ป้าย ' + st.station_code);
|
||||
var baseName = st.station_name_th || ('' + t('common.stopPrefix', { n: st.station_code }));
|
||||
/* จุดขึ้นรถประจำทางอื่นๆ: ต่อท้ายด้วยชื่อสถานที่จริงของสายที่กำลังดูอยู่ */
|
||||
var placeName = (place && window.OtherStop && OtherStop.firstName) ? OtherStop.firstName(place)
|
||||
: (place && place.station_name_th) ? place.station_name_th : null;
|
||||
@@ -246,7 +246,7 @@
|
||||
'<span class="mu-route-type-badge"><svg class="ic" aria-hidden="true"><use href="#ic-bus-front"/></svg> ' +
|
||||
esc(r.vehicle_type_th || t('type.terminal')) + '</span>' +
|
||||
'<span class="mu-stop-summary-main">' +
|
||||
'<strong>' + esc(r.route_name_th || ('สาย ' + r.route_id)) + '</strong>' +
|
||||
'<strong>' + esc(r.route_name_th || t('common.routePrefix', { n: r.route_id })) + '</strong>' +
|
||||
'<span class="mu-stop-summary-meta">' + esc(metaText) + '</span>' +
|
||||
'</span>' +
|
||||
'<span class="mu-stop-summary-rail">' +
|
||||
|
||||
Reference in new issue
Block a user