add schudual function
This commit is contained in:
1 parent
d198430310
commit
88311326e6
252 files changed
+4803
-579
No files matched your search
+26
-85
@@ -43,6 +43,9 @@
|
||||
grid-template-columns: 1.3fr 1fr;
|
||||
margin-bottom: 26px;
|
||||
}
|
||||
/* ไม่มีรูปรถใน .image/routes/<รหัส>/ → การ์ดไม่เว้นช่องว่าง */
|
||||
#route-vehicle-card.no-photo { grid-template-columns: 1fr; }
|
||||
#route-vehicle-card.no-photo > .meta { grid-column: 1 / -1; }
|
||||
.mu-vehicle-card > img {
|
||||
grid-column: 1; width: 100%; height: 100%; min-height: 240px;
|
||||
object-fit: cover; display: block;
|
||||
@@ -119,115 +122,53 @@
|
||||
<main class="mu-page">
|
||||
<div class="mu-container">
|
||||
<p class="mu-breadcrumb"><a href="#/">หน้าแรก</a>/ <span data-i18n="nav.routes">รายละเอียดสายรถ</span></p>
|
||||
<h1 class="mu-page-title"><span class="mu-route-chip">101</span> อ่างทอง - ป่าโมก - อยุธยา</h1>
|
||||
<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="เลือกสายรถ">
|
||||
<option>สาย 101 - อ่างทอง-ป่าโมก-อยุธยา</option>
|
||||
<option>สาย 902 - กรุงเทพ-อ่างทอง สายเอเซีย</option>
|
||||
<option>สาย 15 - กรุงเทพ-อ่างทอง สายใน</option>
|
||||
<option>สาย 951 - กรุงเทพ-วิเศษ-สุพรรณ</option>
|
||||
<option>สาย 952 - กรุงเทพ-วิเศษชัยชาญ</option>
|
||||
<option>สาย 954 - กรุงเทพ-ท่าช้าง</option>
|
||||
<option>สาย 8 - กรุงเทพ-สรรคบุรี-ชัยนาท</option>
|
||||
<option>สาย 464 - สุพรรณ-อ่างทอง-สระบุรี</option>
|
||||
<option>สาย 641 - อ่างทอง-บ้านแพรก-ลพบุรี</option>
|
||||
<option>สาย 2194 - หัวเวียง-อยุธยา</option>
|
||||
<option>สาย 324 - อ่างทอง-วัดพิกุลทอง</option>
|
||||
<option>สาย 1011 - อ่างทอง-สีบัวทอง</option>
|
||||
<option>สาย 2231 - อ่างทอง-มหานาม</option>
|
||||
<option>สาย 999 - บขส.อ่างทอง สายเอเชีย-เหนือ</option>
|
||||
</select>
|
||||
<select aria-label="เลือกสถานี">
|
||||
<option>บขส.อ่างทอง</option>
|
||||
<option>สถานีขนส่งป่าโมก</option>
|
||||
<option>จุดขึ้นลงรถสองแถว 101 อยุธยา</option>
|
||||
<option>ตลาดเจ้าพรหม</option>
|
||||
</select>
|
||||
<select aria-label="เลือกสายรถ" id="route-select"></select>
|
||||
</form>
|
||||
|
||||
<!-- ============ รถประจำสาย + ติดต่อผู้ประกอบการ (การ์ดเดียว) ============ -->
|
||||
<section class="mu-vehicle-card" aria-label="รถประจำสายและติดต่อผู้ประกอบการ">
|
||||
<img src="../.image/routes/101/car.jpeg" alt="รถของสาย 101" loading="lazy" decoding="async">
|
||||
<!-- รูปรถ/คำอธิบาย/QR/เบอร์โทร: เติมจาก resource/data/captions/caption<รหัสสาย>.json + routes.json -->
|
||||
<section class="mu-vehicle-card" aria-label="รถประจำสายและติดต่อผู้ประกอบการ" 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>
|
||||
<h2>รถปรับอากาศ · ไม่สูบบุหรี่</h2>
|
||||
<p>40 ที่นั่ง · ให้บริการตลอดเส้นทางอ่างทอง–ป่าโมก–อยุธยา พร้อมที่วางสัมภาระและแอร์เย็นฉ่ำ</p>
|
||||
</div>
|
||||
<div class="mu-vehicle-contact">
|
||||
<div class="mu-contact-item">
|
||||
<span class="ic-wrap tone-green"><svg class="ic" aria-hidden="true"><use href="#ic-message-circle"/></svg></span>
|
||||
<div class="txt">
|
||||
<strong>LINE Official</strong>
|
||||
<span>ติดตามข่าวสาย 101 · เลื่อนเวลา · ไม่มีรถ</span>
|
||||
</div>
|
||||
<img class="mu-qr-img" src="../.image/qrcode/101.png" alt="LINE QR สาย 101" loading="lazy" decoding="async">
|
||||
</div>
|
||||
<a class="mu-contact-item" href="tel:+66649639025">
|
||||
<span class="ic-wrap"><svg class="ic" aria-hidden="true"><use href="#ic-phone"/></svg></span>
|
||||
<div class="txt">
|
||||
<strong>โทรสอบถาม</strong>
|
||||
<span>+66 64 963 9025</span>
|
||||
</div>
|
||||
</a>
|
||||
<h2 id="route-vehicle-title" hidden></h2>
|
||||
<p id="route-vehicle-desc" hidden></p>
|
||||
</div>
|
||||
<div class="mu-vehicle-contact" id="route-contact"></div>
|
||||
</section>
|
||||
|
||||
<!-- ============ สรุปเส้นทาง ============ -->
|
||||
<section class="mu-summary" aria-label="สรุปเส้นทาง">
|
||||
<div class="mu-container">
|
||||
<div class="mu-summary-grid">
|
||||
<div class="mu-stat tag-purple"><h3>4</h3><p>จุดจอดหลัก</p></div>
|
||||
<div class="mu-stat tag-sky"><h3>2</h3><p>จังหวัดที่ผ่าน</p></div>
|
||||
<div class="mu-stat tag-mint"><h3>15</h3><p>รอบต่อวัน</p></div>
|
||||
<div class="mu-stat tag-pink"><h3>09:10</h3><p>รอบถัดไป</p></div>
|
||||
<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>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ============ แผนที่เส้นทาง ============ -->
|
||||
<!-- ============ แผนที่เส้นทาง (Leaflet + GeoJSON จาก QGIS) ============ -->
|
||||
<section class="mu-zone" aria-label="แผนที่เส้นทาง">
|
||||
<div class="mu-zone-head">
|
||||
<span class="mu-zone-tag tag-sky" data-i18n="route.mapTitle">เส้นทางเดินรถ</span>
|
||||
<p class="mu-zone-desc">สาย 101 · บขส.อ่างทอง → ตลาดเจ้าพรหม</p>
|
||||
<p class="mu-zone-desc" data-i18n="route.mapDesc">เส้นทางจริงจากข้อมูล GIS · ป้ายหยุดรถตามเส้นทาง</p>
|
||||
</div>
|
||||
<div class="mu-map-card">
|
||||
<svg viewBox="0 0 400 190" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="แผนที่เส้นทางสาย 101">
|
||||
<defs>
|
||||
<linearGradient id="mapBg" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" stop-color="#f0ebff"/>
|
||||
<stop offset="100%" stop-color="#eef6ff"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="400" height="190" fill="url(#mapBg)" rx="12"/>
|
||||
<path d="M 60 110 C 130 40 200 160 340 80" stroke="#d8c7f8" stroke-width="9" fill="none" stroke-linecap="round" opacity=".35"/>
|
||||
<path d="M 60 110 C 130 40 200 160 340 80" stroke="#7a4cc0" stroke-width="4" fill="none" stroke-linecap="round"/>
|
||||
<g>
|
||||
<circle cx="60" cy="110" r="16" fill="#7a4cc0"/>
|
||||
<circle cx="60" cy="110" r="10" fill="#fff"/>
|
||||
<text x="60" y="145" text-anchor="middle" font-size="12" fill="#1f2a44" font-weight="700">บขส.อ่างทอง</text>
|
||||
<text x="60" y="160" text-anchor="middle" font-size="10" fill="#6f7b95">ต้นทาง</text>
|
||||
</g>
|
||||
<g>
|
||||
<circle cx="170" cy="70" r="16" fill="#3071b8"/>
|
||||
<circle cx="170" cy="70" r="10" fill="#fff"/>
|
||||
<text x="170" y="45" text-anchor="middle" font-size="12" fill="#1f2a44" font-weight="700">สถานีป่าโมก</text>
|
||||
<text x="170" y="30" text-anchor="middle" font-size="10" fill="#6f7b95">จุดเปลี่ยน</text>
|
||||
</g>
|
||||
<g>
|
||||
<circle cx="270" cy="130" r="16" fill="#1f8765"/>
|
||||
<circle cx="270" cy="130" r="10" fill="#fff"/>
|
||||
<text x="270" y="165" text-anchor="middle" font-size="12" fill="#1f2a44" font-weight="700">จุดขึ้นลงรถสองแถว</text>
|
||||
<text x="270" y="180" text-anchor="middle" font-size="10" fill="#6f7b95">ผ่านทาง</text>
|
||||
</g>
|
||||
<g>
|
||||
<circle cx="340" cy="80" r="16" fill="#bb3a78"/>
|
||||
<circle cx="340" cy="80" r="10" fill="#fff"/>
|
||||
<text x="340" y="55" text-anchor="middle" font-size="12" fill="#1f2a44" font-weight="700">ตลาดเจ้าพรหม</text>
|
||||
<text x="340" y="40" text-anchor="middle" font-size="10" fill="#6f7b95">ปลายทาง</text>
|
||||
</g>
|
||||
</svg>
|
||||
<div class="at-map" id="route-map" role="region" aria-label="แผนที่เส้นทางเดินรถ"></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>
|
||||
<ul id="route-map-list"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="./partials/busDetail.init.js"></script>
|
||||
@@ -0,0 +1,216 @@
|
||||
/* ============================================================
|
||||
busDetail.init.js — เติมข้อมูลหน้า #/routes/<รหัสสาย> จาก JSON
|
||||
------------------------------------------------------------
|
||||
ชื่อสาย/ตัวเลือก/เบอร์โทร resource/data/routes.json
|
||||
รูปรถ/คำอธิบาย/QR resource/data/captions/caption<รหัส>.json
|
||||
รอบต่อวัน/รอบถัดไป resource/data/schedules.json
|
||||
แผนที่ resource/data/geojson-web/<รหัส>.geojson (ATMap)
|
||||
รูปรถ: .image/routes/<รหัส>/ ตั้งชื่อไฟล์ขึ้นต้นด้วย car หรือ boat
|
||||
QR: .image/qrcode/<รหัส>.png
|
||||
============================================================ */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var DATA = '../resource/data/';
|
||||
var IMG_ROUTES = '../.image/routes/';
|
||||
var IMG_QR = '../.image/qrcode/';
|
||||
var CAR_NAMES = ['car', 'boat']; /* ลำดับชื่อไฟล์รูปรถที่ยอมรับ */
|
||||
var CAR_EXTS = ['jpeg', 'jpg', 'webp', 'png'];
|
||||
var QR_EXTS = ['png', 'PNG', 'jpg', 'JPG', 'jpeg', 'JPEG', 'webp'];
|
||||
var FALLBACK_ID = '101'; /* เข้า #/routes ตรง ๆ ไม่มีรหัสสาย */
|
||||
|
||||
function $(id) { return document.getElementById(id); }
|
||||
function t(k, v) { return window.I18N ? I18N.t(k, v) : k; }
|
||||
function esc(s) {
|
||||
return String(s == null ? '' : s).replace(/&/g, '&').replace(/</g, '<')
|
||||
.replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
||||
}
|
||||
function fetchJSON(u) {
|
||||
return fetch(u, { cache: 'no-store' }).then(function (r) { return r.ok ? r.json() : null; }).catch(function () { return null; });
|
||||
}
|
||||
function setText(id, s) {
|
||||
var el = $(id);
|
||||
if (!el) return;
|
||||
var v = (s == null ? '' : String(s)).trim();
|
||||
el.textContent = v;
|
||||
el.hidden = !v;
|
||||
}
|
||||
/* ตัวเลขสรุป: ไม่มีข้อมูลให้แสดง – เพื่อให้การ์ดทั้ง 4 ช่องเท่ากัน */
|
||||
function setStat(id, s) {
|
||||
var el = $(id);
|
||||
if (!el) return;
|
||||
var v = (s == null ? '' : String(s)).trim();
|
||||
el.textContent = v || '–';
|
||||
el.hidden = false;
|
||||
}
|
||||
function uniq(a) { return a.filter(function (u, i) { return u && a.indexOf(u) === i; }); }
|
||||
|
||||
/* ลองโหลดรูปตามลำดับ — พลาดก็ลองตัวถัดไป ไม่มีเลยก็ซ่อน (ไม่ทิ้งไอคอนรูปแตก) */
|
||||
function tryImage(img, urls, alt, onDone) {
|
||||
var i = 0;
|
||||
img.alt = alt || '';
|
||||
img.loading = 'eager'; /* ห้าม lazy: รูปที่ซ่อนอยู่จะไม่ถูกโหลด แล้ว onload ไม่ยิง */
|
||||
img.onload = function () { img.hidden = false; if (onDone) onDone(true); };
|
||||
img.onerror = function () {
|
||||
if (i >= urls.length) { img.hidden = true; if (onDone) onDone(false); return; }
|
||||
img.src = urls[i++];
|
||||
};
|
||||
img.onerror();
|
||||
}
|
||||
function vehicleUrls(rid, cap) {
|
||||
var base = IMG_ROUTES + encodeURIComponent(rid) + '/', out = [];
|
||||
if (cap && cap.vehicle_image) out.push(base + cap.vehicle_image);
|
||||
CAR_NAMES.forEach(function (n) { CAR_EXTS.forEach(function (e) { out.push(base + n + '.' + e); }); });
|
||||
return uniq(out);
|
||||
}
|
||||
function qrUrls(rid, cap) {
|
||||
var out = [];
|
||||
if (cap && cap.qr_image) out.push(IMG_QR + cap.qr_image);
|
||||
QR_EXTS.forEach(function (e) { out.push(IMG_QR + encodeURIComponent(rid) + '.' + e); });
|
||||
return uniq(out);
|
||||
}
|
||||
|
||||
/* จัดรูปแบบเบอร์ให้อ่านง่าย — รองรับทั้งมือถือ (+66xx xxx xxxx) และเบอร์บ้าน (0-xxxx-xxxx) */
|
||||
function fmtPhone(p) {
|
||||
var raw = String(p == null ? '' : p).trim();
|
||||
var digits = raw.replace(/[^\d+]/g, '');
|
||||
if (!digits) return '';
|
||||
var intl = /^\+?66/.test(digits);
|
||||
var nat = intl ? digits.replace(/^\+?66/, '') : digits;
|
||||
if (nat.charAt(0) === '0') return nat.slice(0, 1) + ' ' + nat.slice(1, 5) + ' ' + nat.slice(5);
|
||||
if (nat.length === 9) return '+66 ' + nat.slice(0, 2) + ' ' + nat.slice(2, 5) + ' ' + nat.slice(5);
|
||||
if (nat.length === 8) return '+66 ' + nat.slice(0, 2) + ' ' + nat.slice(2);
|
||||
return raw;
|
||||
}
|
||||
function telHref(p) { return 'tel:' + String(p == null ? '' : p).replace(/[^\d+]/g, ''); }
|
||||
|
||||
/* ---------- การ์ดติดต่อ (LINE + QR + เบอร์โทรทุกเบอร์จาก routes.json) ---------- */
|
||||
function buildContact(rid, route, cap) {
|
||||
var host = $('route-contact');
|
||||
if (!host) return;
|
||||
host.innerHTML = '';
|
||||
|
||||
var line = document.createElement('div');
|
||||
line.className = 'mu-contact-item';
|
||||
line.innerHTML =
|
||||
'<span class="ic-wrap tone-green"><svg class="ic" aria-hidden="true"><use href="#ic-message-circle"/></svg></span>' +
|
||||
'<div class="txt"><strong>LINE Official</strong><span id="route-line-note"></span></div>';
|
||||
var qr = document.createElement('img');
|
||||
qr.className = 'mu-qr-img';
|
||||
qr.loading = 'lazy';
|
||||
qr.decoding = 'async';
|
||||
qr.hidden = true;
|
||||
line.appendChild(qr);
|
||||
host.appendChild(line);
|
||||
|
||||
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) {
|
||||
line.hidden = !ok && !note; /* ไม่มีทั้ง QR และข้อความ = ไม่ต้องแสดงแถวนี้ */
|
||||
host.hidden = line.hidden && !phones.length; /* ไม่มีอะไรจะแสดงเลย */
|
||||
});
|
||||
|
||||
phones.forEach(function (p) {
|
||||
var a = document.createElement('a');
|
||||
a.className = 'mu-contact-item';
|
||||
a.href = telHref(p);
|
||||
a.innerHTML =
|
||||
'<span class="ic-wrap"><svg class="ic" aria-hidden="true"><use href="#ic-phone"/></svg></span>' +
|
||||
'<div class="txt"><strong>' + esc(t('route.call')) + '</strong><span>' + esc(fmtPhone(p)) + '</span></div>';
|
||||
host.appendChild(a);
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- รอบต่อวัน / รอบถัดไป จาก schedules.json ---------- */
|
||||
function toMin(hhmm) {
|
||||
var a = String(hhmm).split(':');
|
||||
return (parseInt(a[0], 10) || 0) * 60 + (parseInt(a[1], 10) || 0);
|
||||
}
|
||||
function nextTrip(times) {
|
||||
if (!times.length) return null;
|
||||
var uniqTimes = times.slice().sort();
|
||||
var now = new Date(), mins = now.getHours() * 60 + now.getMinutes();
|
||||
for (var i = 0; i < uniqTimes.length; i++) {
|
||||
if (toMin(uniqTimes[i]) >= mins) return uniqTimes[i];
|
||||
}
|
||||
return uniqTimes[0]; /* หมดรอบของวันนี้ → รอบแรกของวันถัดไป */
|
||||
}
|
||||
function loadTrips(rid) {
|
||||
return fetchJSON(DATA + 'schedules.json').then(function (d) {
|
||||
var recs = (d && (d.schedules || d)) || [];
|
||||
var out = [];
|
||||
recs.forEach(function (r) {
|
||||
if (String(r.route_id) === String(rid)) out = out.concat(r.departure_times || []);
|
||||
});
|
||||
return out;
|
||||
});
|
||||
}
|
||||
|
||||
function fillVehicle(rid, route, cap) {
|
||||
cap = cap || {};
|
||||
var img = $('route-vehicle-img');
|
||||
var card = $('route-vehicle-card');
|
||||
if (img) {
|
||||
tryImage(img, vehicleUrls(rid, cap), 'รถของสาย ' + rid, function (ok) {
|
||||
if (card) card.classList.toggle('no-photo', !ok);
|
||||
});
|
||||
}
|
||||
setText('route-vehicle-title', cap.vehicle_title);
|
||||
setText('route-vehicle-desc', cap.vehicle_desc);
|
||||
buildContact(rid, route, cap);
|
||||
}
|
||||
|
||||
function init() {
|
||||
var params = (window.__route && window.__route.params) || {};
|
||||
fetchJSON(DATA + 'routes.json').then(function (d) {
|
||||
var list = (d && d.routes) || [];
|
||||
if (!list.length) return;
|
||||
|
||||
var want = String(params.routeId || '');
|
||||
var route = list.filter(function (r) { return String(r.route_id) === want; })[0] ||
|
||||
list.filter(function (r) { return String(r.route_id) === FALLBACK_ID; })[0] || list[0];
|
||||
var rid = String(route.route_id);
|
||||
|
||||
/* หัวเรื่อง (chip + ชื่อสาย) */
|
||||
setText('route-chip', rid);
|
||||
setText('route-title', route.route_name_th);
|
||||
document.title = 'Atroute — สาย ' + rid + (route.route_name_th ? ' ' + route.route_name_th : '');
|
||||
|
||||
/* dropdown: เติมจาก routes.json (ลำดับตามไฟล์) + เปลี่ยนแล้วไปสายนั้น */
|
||||
var sel = $('route-select');
|
||||
if (sel) {
|
||||
sel.innerHTML = '';
|
||||
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 : '');
|
||||
sel.appendChild(o);
|
||||
});
|
||||
sel.value = rid;
|
||||
sel.addEventListener('change', function () {
|
||||
window.location.hash = '#/routes/' + encodeURIComponent(sel.value);
|
||||
});
|
||||
}
|
||||
|
||||
/* สรุปเส้นทาง */
|
||||
setStat('stat-stops', route.station_ids ? route.station_ids.length : '');
|
||||
setStat('stat-provinces', route.province_ids ? route.province_ids.length : '');
|
||||
loadTrips(rid).then(function (times) {
|
||||
setStat('stat-trips', times.length ? String(times.length) : '');
|
||||
setStat('stat-next', nextTrip(times) || '');
|
||||
});
|
||||
|
||||
/* รูปรถ/คำอธิบาย/QR/เบอร์โทร */
|
||||
fetchJSON(DATA + 'captions/caption' + encodeURIComponent(rid) + '.json').then(function (cap) {
|
||||
fillVehicle(rid, route, cap);
|
||||
});
|
||||
|
||||
/* แผนที่เส้นทาง */
|
||||
var mapEl = $('route-map');
|
||||
if (mapEl && window.ATMap) ATMap.route(mapEl, rid);
|
||||
});
|
||||
}
|
||||
|
||||
init();
|
||||
})();
|
||||
@@ -78,12 +78,6 @@
|
||||
<option>สาย 2231 - อ่างทอง-มหานาม</option>
|
||||
<option>สาย 999 - บขส.อ่างทอง สายเอเชีย-เหนือ</option>
|
||||
</select>
|
||||
<select aria-label="เลือกสถานี">
|
||||
<option>บขส.อ่างทอง</option>
|
||||
<option>สถานีขนส่งป่าโมก</option>
|
||||
<option>จุดขึ้นลงรถสองแถว 101 อยุธยา</option>
|
||||
<option>ตลาดเจ้าพรหม</option>
|
||||
</select>
|
||||
<a class="mu-back-btn" href="#/"><span data-i18n="common.backHome">← กลับหน้าแรก</span></a>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -436,15 +436,29 @@
|
||||
<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>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var btn = document.getElementById('near-me-btn');
|
||||
var out = document.getElementById('near-me-result');
|
||||
if (!btn || !out || !window.ATMap) return;
|
||||
ATMap.nearMe(btn, out, { limit: 8 });
|
||||
})();
|
||||
</script>
|
||||
<script src="./partials/busStop.search.js"></script>
|
||||
<script src="./partials/busStop.init.js"></script>
|
||||
+14
-163
@@ -127,10 +127,10 @@
|
||||
<div class="mu-blob three"></div>
|
||||
<div class="mu-container mu-hero-content">
|
||||
<span class="mu-badge"><svg class="ic" aria-hidden="true"><use href="#ic-clock"/></svg> <span data-i18n="cta.check">เช็กเวลาเดินรถ</span></span>
|
||||
<h1><span data-i18n="check.title">ตารางเวลาเดินรถ</span><br><span class="mu-gradient-text">สาย 101 · อ่างทอง–อยุธยา</span></h1>
|
||||
<p class="mu-hero-lead" data-i18n="check.lead">เลือกสายรถและสถานี แล้วดูรอบรถทุกจุดจอดในหน้าเดียว</p>
|
||||
<h1><span data-i18n="check.title">ตารางเวลาเดินรถ</span><br><span class="mu-gradient-text" id="check-hero-route"></span></h1>
|
||||
<p class="mu-hero-lead" data-i18n="check.lead">เลือกสายรถ แล้วดูรอบรถทุกจุดจอดในหน้าเดียว</p>
|
||||
|
||||
<div class="mu-route-selector">
|
||||
<div class="mu-route-selector single">
|
||||
<div class="mu-select-field">
|
||||
<label for="check-route-select">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 6v6"/><path d="M15 6v6"/><path d="M2 12h19.6"/><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3"/><circle cx="7" cy="18" r="2"/><path d="M9 18h5"/><circle cx="16" cy="18" r="2"/></svg>
|
||||
@@ -138,46 +138,11 @@
|
||||
</label>
|
||||
<div class="mu-select-box">
|
||||
<svg class="mu-select-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 6v6"/><path d="M15 6v6"/><path d="M2 12h19.6"/><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3"/><circle cx="7" cy="18" r="2"/><path d="M9 18h5"/><circle cx="16" cy="18" r="2"/></svg>
|
||||
<select id="check-route-select" data-i18n-attr="aria-label:route.selectRoute">
|
||||
<option>สาย 101 - อ่างทอง-ป่าโมก-อยุธยา</option>
|
||||
<option>สาย 902 - กรุงเทพ-อ่างทอง สายเอเซีย</option>
|
||||
<option>สาย 15 - กรุงเทพ-อ่างทอง สายใน</option>
|
||||
<option>สาย 951 - กรุงเทพ-วิเศษ-สุพรรณ</option>
|
||||
<option>สาย 952 - กรุงเทพ-วิเศษชัยชาญ</option>
|
||||
<option>สาย 954 - กรุงเทพ-ท่าช้าง</option>
|
||||
<option>สาย 8 - กรุงเทพ-สรรคบุรี-ชัยนาท</option>
|
||||
<option>สาย 464 - สุพรรณ-อ่างทอง-สระบุรี</option>
|
||||
<option>สาย 641 - อ่างทอง-บ้านแพรก-ลพบุรี</option>
|
||||
<option>สาย 2194 - หัวเวียง-อยุธยา</option>
|
||||
<option>สาย 324 - อ่างทอง-วัดพิกุลทอง</option>
|
||||
<option>สาย 1011 - อ่างทอง-สีบัวทอง</option>
|
||||
<option>สาย 2231 - อ่างทอง-มหานาม</option>
|
||||
<option>สาย 999 - บขส.อ่างทอง สายเอเชีย-เหนือ</option>
|
||||
</select>
|
||||
<svg class="mu-select-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span class="mu-select-arrow" aria-hidden="true"><svg class="ic"><use href="#ic-arrow-right"/></svg></span>
|
||||
|
||||
<div class="mu-select-field">
|
||||
<label for="check-station-select">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/></svg>
|
||||
<span data-i18n="route.selectStation">เลือกสถานี</span>
|
||||
</label>
|
||||
<div class="mu-select-box">
|
||||
<svg class="mu-select-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/></svg>
|
||||
<select id="check-station-select" data-i18n-attr="aria-label:route.selectStation">
|
||||
<option>บขส.อ่างทอง</option>
|
||||
<option>สถานีขนส่งป่าโมก</option>
|
||||
<option>จุดขึ้นลงรถสองแถว 101 อยุธยา</option>
|
||||
<option>ตลาดเจ้าพรหม</option>
|
||||
</select>
|
||||
<select id="check-route-select" data-i18n-attr="aria-label:route.selectRoute"></select>
|
||||
<svg class="mu-select-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="mu-select-hint" id="check-hint" aria-live="polite"></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -185,10 +150,10 @@
|
||||
<section class="mu-summary" aria-label="สรุปเส้นทาง">
|
||||
<div class="mu-container">
|
||||
<div class="mu-summary-grid">
|
||||
<div class="mu-stat tag-purple"><h3>4</h3><p data-i18n="check.kpiStops">จุดจอดหลัก</p></div>
|
||||
<div class="mu-stat tag-sky"><h3>2</h3><p data-i18n="check.kpiProvince">จังหวัดที่ผ่าน</p></div>
|
||||
<div class="mu-stat tag-mint"><h3>15</h3><p data-i18n="check.kpiTrips">รอบต่อวัน</p></div>
|
||||
<div class="mu-stat tag-pink"><h3>09:10</h3><p data-i18n="check.kpiNext">รอบถัดไป</p></div>
|
||||
<div class="mu-stat tag-purple"><h3 id="check-stat-stops">–</h3><p data-i18n="check.kpiStops">จุดจอดหลัก</p></div>
|
||||
<div class="mu-stat tag-sky"><h3 id="check-stat-provinces">–</h3><p data-i18n="check.kpiProvince">จังหวัดที่ผ่าน</p></div>
|
||||
<div class="mu-stat tag-mint"><h3 id="check-stat-trips">–</h3><p data-i18n="check.kpiTrips">รอบต่อวัน</p></div>
|
||||
<div class="mu-stat tag-pink"><h3 id="check-stat-next">–</h3><p data-i18n="check.kpiNext">รอบถัดไป</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -199,128 +164,14 @@
|
||||
<div class="mu-zone">
|
||||
<div class="mu-zone-head">
|
||||
<span class="mu-zone-tag tag-purple" data-i18n="check.scheduleAll">ตารางเวลาเดินรถทุกจุดจอด</span>
|
||||
<p class="mu-zone-desc">สาย 101 · บขส.อ่างทอง → ตลาดเจ้าพรหม · 4 จุดจอด</p>
|
||||
<p class="mu-zone-desc" id="check-zone-desc"></p>
|
||||
<p class="mu-zone-desc" id="check-now-line"></p>
|
||||
</div>
|
||||
|
||||
<ul class="mu-schedule-list">
|
||||
<li>
|
||||
<details class="mu-stop-card" open>
|
||||
<summary>
|
||||
<span class="mu-stop-head tone-purple">
|
||||
<span class="mu-stop-kind"><svg class="ic" aria-hidden="true"><use href="#ic-map-pin"/></svg> <span data-i18n="route.origin">ต้นทาง</span></span>
|
||||
<span class="mu-stop-title">
|
||||
<strong>บขส.อ่างทอง</strong>
|
||||
<small>อ่างทอง</small>
|
||||
</span>
|
||||
<span class="mu-stop-chevron">⌄</span>
|
||||
</span>
|
||||
</summary>
|
||||
<div class="mu-stop-body">
|
||||
<p class="mu-stop-sub">ตารางเดินรถ ณ บขส.อ่างทอง</p>
|
||||
<div class="mu-time-grid">
|
||||
<div class="mu-time-chip">07:30</div><div class="mu-time-chip">08:20</div>
|
||||
<div class="mu-time-chip next">09:10</div><div class="mu-time-chip">10:00</div>
|
||||
<div class="mu-time-chip">10:50</div><div class="mu-time-chip">11:50</div>
|
||||
<div class="mu-time-chip">13:00</div><div class="mu-time-chip">14:00</div>
|
||||
<div class="mu-time-chip">15:00</div>
|
||||
</div>
|
||||
<div class="mu-inline-actions">
|
||||
<a class="mu-btn ghost" href="#/stops/at_main_terminal?route=101" data-i18n="check.toStopDetail">ไปหน้ารายละเอียดจุดจอด</a>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<details class="mu-stop-card" open>
|
||||
<summary>
|
||||
<span class="mu-stop-head tone-sky">
|
||||
<span class="mu-stop-kind"><svg class="ic" aria-hidden="true"><use href="#ic-refresh-cw"/></svg> <span data-i18n="route.transfer">จุดเปลี่ยน</span></span>
|
||||
<span class="mu-stop-title">
|
||||
<strong>สถานีขนส่งป่าโมก</strong>
|
||||
<small>อ่างทอง</small>
|
||||
</span>
|
||||
<span class="mu-stop-chevron">⌄</span>
|
||||
</span>
|
||||
</summary>
|
||||
<div class="mu-stop-body">
|
||||
<p class="mu-stop-sub">ไปอ่างทอง <span class="mu-direction-tag" data-i18n="check.direction">ทิศทาง</span></p>
|
||||
<div class="mu-time-grid">
|
||||
<div class="mu-time-chip">07:30</div><div class="mu-time-chip">08:20</div>
|
||||
<div class="mu-time-chip">09:10</div><div class="mu-time-chip">10:00</div>
|
||||
<div class="mu-time-chip">10:50</div><div class="mu-time-chip">11:40</div>
|
||||
<div class="mu-time-chip">12:30</div><div class="mu-time-chip">13:20</div>
|
||||
<div class="mu-time-chip">14:10</div><div class="mu-time-chip">15:00</div>
|
||||
<div class="mu-time-chip">15:50</div><div class="mu-time-chip">16:40</div>
|
||||
<div class="mu-time-chip">17:30</div><div class="mu-time-chip">18:30</div>
|
||||
</div>
|
||||
<p class="mu-stop-sub" style="margin-top:14px;">ไปอยุธยา <span class="mu-direction-tag" data-i18n="check.direction">ทิศทาง</span></p>
|
||||
<div class="mu-time-grid">
|
||||
<div class="mu-time-chip">08:00</div><div class="mu-time-chip">08:50</div>
|
||||
<div class="mu-time-chip">09:40</div><div class="mu-time-chip">10:30</div>
|
||||
<div class="mu-time-chip">11:20</div><div class="mu-time-chip">12:20</div>
|
||||
<div class="mu-time-chip">13:30</div><div class="mu-time-chip">14:30</div>
|
||||
<div class="mu-time-chip">15:30</div>
|
||||
</div>
|
||||
<p class="mu-schedule-note"><svg class="ic" aria-hidden="true"><use href="#ic-triangle-alert"/></svg> เวลารถเปลี่ยนทุกวัน โดยเฉพาะวันหยุด</p>
|
||||
<div class="mu-inline-actions">
|
||||
<a class="mu-btn ghost" href="#/stops/pa_mok_terminal?route=101" data-i18n="check.toStopDetail">ไปหน้ารายละเอียดจุดจอด</a>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<details class="mu-stop-card" open>
|
||||
<summary>
|
||||
<span class="mu-stop-head tone-mint">
|
||||
<span class="mu-stop-kind"><svg class="ic" aria-hidden="true"><use href="#ic-map-pin"/></svg> <span data-i18n="route.pass">ผ่านทาง</span></span>
|
||||
<span class="mu-stop-title">
|
||||
<strong>จุดขึ้นลงรถสองแถว 101 อยุธยา-ป่าโมก-อ่างทอง</strong>
|
||||
<small>อยุธยา</small>
|
||||
</span>
|
||||
<span class="mu-stop-chevron">⌄</span>
|
||||
</span>
|
||||
</summary>
|
||||
<div class="mu-stop-body">
|
||||
<p class="mu-stop-sub" data-i18n="route.empty">ยังไม่มีข้อมูลตารางเวลา</p>
|
||||
<div class="mu-inline-actions">
|
||||
<a class="mu-btn ghost" href="#/stops/route_101_stop_ayutthaya?route=101" data-i18n="check.toStopDetail">ไปหน้ารายละเอียดจุดจอด</a>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<details class="mu-stop-card" open>
|
||||
<summary>
|
||||
<span class="mu-stop-head tone-pink">
|
||||
<span class="mu-stop-kind"><svg class="ic" aria-hidden="true"><use href="#ic-map-pin"/></svg> <span data-i18n="route.destination">ปลายทาง</span></span>
|
||||
<span class="mu-stop-title">
|
||||
<strong>ตลาดเจ้าพรหม</strong>
|
||||
<small>อยุธยา</small>
|
||||
</span>
|
||||
<span class="mu-stop-chevron">⌄</span>
|
||||
</span>
|
||||
</summary>
|
||||
<div class="mu-stop-body">
|
||||
<p class="mu-stop-sub">ตารางเดินรถ ณ ตลาดเจ้าพรหม (อยุธยา)</p>
|
||||
<div class="mu-time-grid">
|
||||
<div class="mu-time-chip">06:30</div><div class="mu-time-chip">07:20</div>
|
||||
<div class="mu-time-chip">08:10</div><div class="mu-time-chip next">09:00</div>
|
||||
<div class="mu-time-chip">09:50</div><div class="mu-time-chip">10:40</div>
|
||||
<div class="mu-time-chip">11:30</div><div class="mu-time-chip">12:20</div>
|
||||
<div class="mu-time-chip">13:10</div><div class="mu-time-chip">14:00</div>
|
||||
<div class="mu-time-chip">14:50</div><div class="mu-time-chip">15:40</div>
|
||||
<div class="mu-time-chip">16:30</div><div class="mu-time-chip">17:30</div>
|
||||
</div>
|
||||
<div class="mu-inline-actions">
|
||||
<a class="mu-btn ghost" href="#/stops/jaoprom_market?route=101" data-i18n="check.toStopDetail">ไปหน้ารายละเอียดจุดจอด</a>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- การ์ดจุดจอด + ชิปเวลา: สร้างจาก resource/data/schedules.json (checkSchedule.init.js) -->
|
||||
<ul class="mu-schedule-list" id="check-schedule-list"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script src="./partials/checkSchedule.init.js"></script>
|
||||
@@ -0,0 +1,277 @@
|
||||
/* ============================================================
|
||||
checkSchedule.init.js — หน้า #/check/<รหัสสาย>
|
||||
------------------------------------------------------------
|
||||
ดึงข้อมูลจริง:
|
||||
resource/data/routes.json ชื่อสาย / ตัวเลือก / station_ids / province_ids
|
||||
resource/data/stations.json ชื่อจุดจอด + จังหวัด + รหัสป้าย
|
||||
resource/data/schedules.json เวลาออกรถ (แยกตามจุดจอด/ทิศทาง) + หมายเหตุ
|
||||
|
||||
การไฮไลต์ (ตามเวลาบนเครื่องผู้ใช้):
|
||||
- ไฮไลต์ "เที่ยวถัดไป" = เที่ยวแรกที่เวลายังไม่ผ่าน (>= เวลาปัจจุบัน)
|
||||
- เลยเที่ยวสุดท้ายของวันแล้ว → ไม่ไฮไลต์เลย
|
||||
- หลังเที่ยงคืน เวลาปัจจุบันน้อยกว่าเที่ยวแรก → เที่ยวแรกของวันถูกไฮไลต์เอง
|
||||
- ตรวจซ้ำทุก 30 วินาที (และตอนสลับสาย/กลับเข้าแท็บ)
|
||||
============================================================ */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var DATA = '../resource/data/';
|
||||
var FALLBACK_ID = '101';
|
||||
var REFRESH_MS = 30000;
|
||||
var TONES = { origin: 'tone-purple', transfer: 'tone-sky', pass: 'tone-mint', destination: 'tone-pink' };
|
||||
|
||||
/* นโยบายการแสดงจุดจอดบนหน้าเช็กเวลา
|
||||
false = แสดงทุกจุดใน routes.json → station_ids (จุดที่ยังไม่มีตารางจะขึ้นการ์ด "ยังไม่มีข้อมูลตารางเวลา")
|
||||
← ค่าเริ่มต้น: ตรงกับดีไซน์เดิม (หน้าเดิมโชว์จุดที่ยังไม่มีตารางพร้อมข้อความนี้)
|
||||
true = แสดงเฉพาะจุดที่มี record ใน schedules.json (กระดานเวลาล้วน ๆ) */
|
||||
var ONLY_STOPS_WITH_SCHEDULE = false;
|
||||
|
||||
var sections = []; /* [{ chips:[], times:[], station }] */
|
||||
var netRoute = null; /* routes.json ของสายที่แสดงอยู่ */
|
||||
var timer = null;
|
||||
|
||||
function $(id) { return document.getElementById(id); }
|
||||
function t(k, v) { return window.I18N ? I18N.t(k, v) : k; }
|
||||
function esc(s) {
|
||||
return String(s == null ? '' : s).replace(/&/g, '&').replace(/</g, '<')
|
||||
.replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
||||
}
|
||||
function fetchJSON(u) {
|
||||
return fetch(u, { cache: 'no-store' }).then(function (r) { return r.ok ? r.json() : null; }).catch(function () { return null; });
|
||||
}
|
||||
function toMin(hhmm) {
|
||||
var a = String(hhmm).split(':');
|
||||
return (parseInt(a[0], 10) || 0) * 60 + (parseInt(a[1], 10) || 0);
|
||||
}
|
||||
function nowMin() { var d = new Date(); return d.getHours() * 60 + d.getMinutes(); }
|
||||
function hhmm(min) {
|
||||
var h = Math.floor(min / 60), m = min % 60;
|
||||
return (h < 10 ? '0' : '') + h + ':' + (m < 10 ? '0' : '') + m;
|
||||
}
|
||||
function setStat(id, s) {
|
||||
var el = $(id);
|
||||
if (!el) return;
|
||||
var v = (s == null ? '' : String(s)).trim();
|
||||
el.textContent = v || '–';
|
||||
}
|
||||
|
||||
/* ---------- จำแนกประเภทจุดจอดจากข้อมูล + ลำดับในเส้นทาง ---------- */
|
||||
function kindOf(st, i, n) {
|
||||
if (i === 0) return { key: 'route.origin', icon: 'ic-map-pin', tone: TONES.origin };
|
||||
if (i === n - 1) return { key: 'route.destination', icon: 'ic-map-pin', tone: TONES.destination };
|
||||
if (st && st.station_type === 'main_terminal') return { key: 'route.transfer', icon: 'ic-refresh-cw', tone: TONES.transfer };
|
||||
return { key: 'route.pass', icon: 'ic-map-pin', tone: TONES.pass };
|
||||
}
|
||||
|
||||
/* ---------- สร้างการ์ดจุดจอด ---------- */
|
||||
function renderList(listEl, route, groups) {
|
||||
listEl.innerHTML = '';
|
||||
sections = [];
|
||||
|
||||
groups.forEach(function (g, i) {
|
||||
var kind = kindOf(g.st, i, groups.length);
|
||||
var li = document.createElement('li');
|
||||
var det = document.createElement('details');
|
||||
det.className = 'mu-stop-card';
|
||||
det.open = true;
|
||||
|
||||
var sum = document.createElement('summary');
|
||||
sum.innerHTML =
|
||||
'<span class="mu-stop-head ' + kind.tone + '">' +
|
||||
'<span class="mu-stop-kind"><svg class="ic" aria-hidden="true"><use href="#' + kind.icon + '"/></svg> <span>' + esc(t(kind.key)) + '</span></span>' +
|
||||
'<span class="mu-stop-title"><strong>' + esc(g.name) + '</strong><small>' + esc(g.city) + '</small></span>' +
|
||||
'<span class="mu-stop-chevron">\u2304</span>' +
|
||||
'</span>';
|
||||
det.appendChild(sum);
|
||||
|
||||
var body = document.createElement('div');
|
||||
body.className = 'mu-stop-body';
|
||||
|
||||
if (!g.recs.length) {
|
||||
var none = document.createElement('p');
|
||||
none.className = 'mu-stop-sub';
|
||||
none.textContent = t('route.empty');
|
||||
body.appendChild(none);
|
||||
}
|
||||
|
||||
g.recs.forEach(function (r) {
|
||||
var times = (r.departure_times || []).slice();
|
||||
|
||||
/* ไม่มีเวลาเลย (เช่น สาย 999: departure_times = []) → บอกว่าไม่มีข้อมูล ไม่ต้องมีบรรทัดลอย */
|
||||
if (!times.length) {
|
||||
var empty = document.createElement('p');
|
||||
empty.className = 'mu-stop-sub';
|
||||
empty.textContent = t('route.empty');
|
||||
body.appendChild(empty);
|
||||
return;
|
||||
}
|
||||
|
||||
var sub = document.createElement('p');
|
||||
sub.className = 'mu-stop-sub';
|
||||
sub.innerHTML = r.direction_note
|
||||
? esc(r.direction_note) + ' <span class="mu-direction-tag">' + esc(t('check.direction')) + '</span>'
|
||||
: esc(t('check.atStop')) + ' ' + esc(g.name);
|
||||
body.appendChild(sub);
|
||||
|
||||
var grid = document.createElement('div');
|
||||
grid.className = 'mu-time-grid';
|
||||
var chips = [];
|
||||
times.forEach(function (tm) {
|
||||
var c = document.createElement('div');
|
||||
c.className = 'mu-time-chip';
|
||||
c.textContent = tm;
|
||||
grid.appendChild(c);
|
||||
chips.push(c);
|
||||
});
|
||||
body.appendChild(grid);
|
||||
sections.push({ chips: chips, times: times, station: g.name });
|
||||
|
||||
if (r.schedule_note) {
|
||||
var note = document.createElement('p');
|
||||
note.className = 'mu-schedule-note';
|
||||
note.innerHTML = '<svg class="ic" aria-hidden="true"><use href="#ic-triangle-alert"/></svg> ' + esc(r.schedule_note);
|
||||
body.appendChild(note);
|
||||
}
|
||||
});
|
||||
|
||||
if (g.code) {
|
||||
var act = document.createElement('div');
|
||||
act.className = 'mu-inline-actions';
|
||||
var a = document.createElement('a');
|
||||
a.className = 'mu-btn ghost';
|
||||
a.href = '#/stops/' + encodeURIComponent(g.code) + '?route=' + encodeURIComponent(route.route_id);
|
||||
a.textContent = t('check.toStopDetail');
|
||||
act.appendChild(a);
|
||||
body.appendChild(act);
|
||||
}
|
||||
|
||||
det.appendChild(body);
|
||||
li.appendChild(det);
|
||||
listEl.appendChild(li);
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- ไฮไลต์เที่ยวถัดไป + บรรทัดเวลาปัจจุบัน ---------- */
|
||||
function refreshHighlights() {
|
||||
var nowm = nowMin();
|
||||
var next = null; /* เที่ยวถัดไปที่เร็วที่สุดในทุกจุดจอด */
|
||||
|
||||
sections.forEach(function (sec) {
|
||||
sec.chips.forEach(function (c) { c.classList.remove('next'); });
|
||||
for (var i = 0; i < sec.times.length; i++) {
|
||||
var m = toMin(sec.times[i]);
|
||||
if (m >= nowm) { /* เที่ยวแรกที่ยังไม่ผ่าน */
|
||||
sec.chips[i].classList.add('next');
|
||||
if (next === null || m < next.m) next = { m: m, time: sec.times[i], station: sec.station };
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setStat('check-stat-next', next ? next.time : '');
|
||||
|
||||
var line = $('check-now-line');
|
||||
if (!line) return;
|
||||
var clock = '<svg class="ic" aria-hidden="true"><use href="#ic-clock"/></svg> ';
|
||||
var body = esc(t('check.now')) + ' <b>' + hhmm(nowm) + '</b>';
|
||||
if (next) body += ' · ' + esc(t('check.nextAt')) + ' <b>' + esc(next.time) + '</b> (' + esc(next.station) + ')';
|
||||
else if (sections.length) body += ' · <b>' + esc(t('check.noMoreToday')) + '</b>';
|
||||
line.innerHTML = clock + body;
|
||||
}
|
||||
|
||||
/* ---------- โหลด + แสดงผล ---------- */
|
||||
function init() {
|
||||
var params = (window.__route && window.__route.params) || {};
|
||||
var query = (window.__route && window.__route.query) || {};
|
||||
var want = String(params.routeId || query.route || '');
|
||||
|
||||
Promise.all([
|
||||
fetchJSON(DATA + 'routes.json'),
|
||||
fetchJSON(DATA + 'stations.json'),
|
||||
fetchJSON(DATA + 'schedules.json')
|
||||
]).then(function (res) {
|
||||
var routes = (res[0] || {}).routes || [];
|
||||
var sts = (res[1] || {}).stations || [];
|
||||
var recs = (res[2] || {}).schedules || res[2] || [];
|
||||
if (!routes.length) return;
|
||||
|
||||
var route = routes.filter(function (r) { return String(r.route_id) === want; })[0] ||
|
||||
routes.filter(function (r) { return String(r.route_id) === FALLBACK_ID; })[0] || routes[0];
|
||||
var rid = String(route.route_id);
|
||||
netRoute = route;
|
||||
|
||||
var byId = {};
|
||||
sts.forEach(function (s) { byId[s.station_id] = s; });
|
||||
|
||||
/* ตัวเลือกสายรถ (จาก routes.json) */
|
||||
var sel = $('check-route-select');
|
||||
if (sel) {
|
||||
sel.innerHTML = '';
|
||||
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 : '');
|
||||
sel.appendChild(o);
|
||||
});
|
||||
sel.value = rid;
|
||||
sel.addEventListener('change', function () {
|
||||
window.location.hash = '#/check/' + encodeURIComponent(sel.value);
|
||||
});
|
||||
}
|
||||
|
||||
/* Hero + คำอธิบายโซน */
|
||||
var hero = $('check-hero-route');
|
||||
if (hero) hero.textContent = 'สาย ' + rid + (route.route_name_th ? ' · ' + route.route_name_th : '');
|
||||
|
||||
/* จัดกลุ่มตามลำดับจุดจอดของสาย แล้วต่อด้วยจุดที่เหลือ (ถ้ามีข้อมูล) */
|
||||
var order = (route.station_ids || []).slice();
|
||||
recs.forEach(function (r) {
|
||||
if (String(r.route_id) === rid && order.indexOf(r.station_id) === -1) order.push(r.station_id);
|
||||
});
|
||||
|
||||
var groups = order.map(function (sid) {
|
||||
var st = byId[sid] || null;
|
||||
return {
|
||||
sid: sid,
|
||||
st: st,
|
||||
name: st ? st.station_name_th : 'จุดจอด ' + 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; })
|
||||
};
|
||||
}).filter(function (g) {
|
||||
return !ONLY_STOPS_WITH_SCHEDULE || g.recs.length;
|
||||
});
|
||||
|
||||
var listEl = $('check-schedule-list');
|
||||
if (listEl) renderList(listEl, route, groups);
|
||||
|
||||
var desc = $('check-zone-desc');
|
||||
if (desc) {
|
||||
var names = groups.map(function (g) { return g.name; });
|
||||
desc.textContent = 'สาย ' + rid + ' · ' +
|
||||
(names.length > 1 ? names[0] + ' \u2192 ' + names[names.length - 1] + ' · ' : '') +
|
||||
groups.length + ' ' + t('check.stopsCount');
|
||||
}
|
||||
|
||||
/* KPI */
|
||||
setStat('check-stat-stops', groups.length); /* นับจุดจอดที่แสดงจริง (ให้ตรงกับรายการด้านล่าง) */
|
||||
setStat('check-stat-provinces', route.province_ids ? route.province_ids.length : '');
|
||||
var trips = 0;
|
||||
recs.forEach(function (r) {
|
||||
if (String(r.route_id) === rid) trips += (r.departure_times || []).length;
|
||||
});
|
||||
setStat('check-stat-trips', trips ? String(trips) : '');
|
||||
|
||||
refreshHighlights();
|
||||
if (timer) clearInterval(timer);
|
||||
timer = setInterval(refreshHighlights, REFRESH_MS);
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('visibilitychange', function () {
|
||||
if (!document.hidden) refreshHighlights();
|
||||
});
|
||||
|
||||
init();
|
||||
})();
|
||||
+45
-125
@@ -1,3 +1,26 @@
|
||||
<style>
|
||||
/* ปุ่มแชร์ลิงก์สั้น — มุมล่างขวา ต่อจากการ์ดหมวดเส้นทาง */
|
||||
.mu-share-row { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin: 22px 0 44px; }
|
||||
.mu-share-btn {
|
||||
display: inline-flex; align-items: center; gap: 8px;
|
||||
padding: 10px 16px; border: 1px solid #7a4cc0; border-radius: 8px;
|
||||
background: #7a4cc0; color: #fff; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer;
|
||||
}
|
||||
.mu-share-btn:hover { background: #6a3cae; }
|
||||
.mu-share-btn:focus-visible { outline: 2px solid #2b2f42; outline-offset: 2px; }
|
||||
.mu-share-btn .ic { width: 18px; height: 18px; }
|
||||
.mu-share-status { margin: 0; font-size: .82rem; line-height: 1.7; color: #4b5570; text-align: right; }
|
||||
.mu-share-status:empty { display: none; }
|
||||
.mu-share-url { display: inline-block; padding: 2px 6px; border: 1px solid #e7e2f6; border-radius: 8px; background: #faf9ff; font-size: .8rem; }
|
||||
.mu-share-line { display: inline-block; margin-left: 6px; font-weight: 700; color: #06c755; text-decoration: none; }
|
||||
.mu-share-line:hover { text-decoration: underline; }
|
||||
@media (max-width: 560px) {
|
||||
.mu-share-row { align-items: stretch; }
|
||||
.mu-share-btn { justify-content: center; }
|
||||
.mu-share-status { text-align: left; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<section class="mu-hero">
|
||||
<img class="mu-hero-map" src="../.image/network/overview-map.png" alt="" aria-hidden="true" fetchpriority="high" decoding="async">
|
||||
<div class="mu-blob one"></div>
|
||||
@@ -59,134 +82,31 @@
|
||||
<main class="mu-main">
|
||||
<div class="mu-container">
|
||||
|
||||
<!-- หมวด 1: เข้ากรุงเทพฯ -->
|
||||
<section class="mu-zone">
|
||||
<div class="mu-zone-head">
|
||||
<span class="mu-zone-tag tag-sky" data-i18n="zone.bangkok">หมวดเส้นทางเข้ากรุงเทพฯ</span>
|
||||
<p class="mu-zone-desc"><span data-i18n="zone.bangkokDesc">เส้นทางเชื่อมต่อกรุงเทพมหานคร</span> · 6 <span data-i18n="common.routes">เส้นทาง</span></p>
|
||||
</div>
|
||||
<div class="mu-grid">
|
||||
<a class="mu-card" data-route="902" href="#/routes/902">
|
||||
<div class="mu-card-head"><p class="mu-route-number">902</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">กรุงเทพ-อ่างทอง สายเอเซีย</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-purple"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="15" href="#/routes/15">
|
||||
<div class="mu-card-head"><p class="mu-route-number">15</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">กรุงเทพ-อ่างทอง สายใน</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-sky"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="951" href="#/routes/951">
|
||||
<div class="mu-card-head"><p class="mu-route-number">951</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">กรุงเทพ-วิเศษ-สุพรรณ</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-pink"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="952" href="#/routes/952">
|
||||
<div class="mu-card-head"><p class="mu-route-number">952</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">กรุงเทพ-วิเศษชัยชาญ</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-mint"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="954" href="#/routes/954">
|
||||
<div class="mu-card-head"><p class="mu-route-number">954</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">กรุงเทพ-ท่าช้าง</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-purple"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="8" href="#/routes/8">
|
||||
<div class="mu-card-head"><p class="mu-route-number">8</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">กรุงเทพ-สรรคบุรี-ชัยนาท</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-sky"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- คำอธิบายสีการ์ดตามหมวดเส้นทาง -->
|
||||
<section class="mu-legend" aria-label="คำอธิบายสีการ์ดตามหมวดเส้นทาง">
|
||||
<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>
|
||||
<li><span class="sw sw-interprov" aria-hidden="true"></span><span data-i18n="legend.interprov">หมวดเส้นทางระหว่างจังหวัด — การ์ดสีม่วง</span></li>
|
||||
<li><span class="sw sw-inprov" aria-hidden="true"></span><span data-i18n="legend.inprov">หมวดเส้นทางภายในจังหวัด — การ์ดสีชมพู</span></li>
|
||||
<li><span class="sw sw-municipal" aria-hidden="true"></span><span data-i18n="legend.municipal">หมวดเส้นทางภายในเทศบาล — การ์ดสีเหลืองอ่อน</span></li>
|
||||
<li><span class="sw sw-empty" aria-hidden="true"></span><span data-i18n="legend.empty">ยังไม่มีข้อมูล — การ์ดสีเทา แสดง N/A แทนเลขสาย</span></li>
|
||||
</ul>
|
||||
<p class="mu-legend-note" data-i18n="legend.note">อ่างทองยังไม่มีรถหมวด 1 (เส้นทางภายในเทศบาล) จึงแสดงการ์ดสีเทาและใช้ N/A แทนตัวเลขสายเส้นทาง</p>
|
||||
</section>
|
||||
|
||||
<!-- หมวด 3: ระหว่างจังหวัด -->
|
||||
<section class="mu-zone">
|
||||
<div class="mu-zone-head">
|
||||
<span class="mu-zone-tag tag-purple" data-i18n="zone.interprov">หมวดเส้นทางระหว่างจังหวัด</span>
|
||||
<p class="mu-zone-desc"><span data-i18n="zone.interprovDesc">เส้นทางเชื่อมต่อจังหวัดใกล้เคียง</span> · 4 <span data-i18n="common.routes">เส้นทาง</span></p>
|
||||
</div>
|
||||
<div class="mu-grid">
|
||||
<a class="mu-card" data-route="101" href="#/routes/101">
|
||||
<div class="mu-card-head"><p class="mu-route-number">101</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">อ่างทอง-ป่าโมก-อยุธยา</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-purple"><svg class="ic" aria-hidden="true"><use href="#ic-alarm-clock"/></svg> <span data-i18n="card.nextTrip">เที่ยวถัดไป</span> 09:30</span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="464" href="#/routes/464">
|
||||
<div class="mu-card-head"><p class="mu-route-number">464</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">สุพรรณ-อ่างทอง-สระบุรี</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-sky"><svg class="ic" aria-hidden="true"><use href="#ic-alarm-clock"/></svg> <span data-i18n="card.nextTrip">เที่ยวถัดไป</span> 18:00</span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="641" href="#/routes/641">
|
||||
<div class="mu-card-head"><p class="mu-route-number">641</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">อ่างทอง-บ้านแพรก-ลพบุรี</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-pink"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="2194" href="#/routes/2194">
|
||||
<div class="mu-card-head"><p class="mu-route-number">2194</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">หัวเวียง-อยุธยา</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-mint"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- หมวด 4: ภายในจังหวัด -->
|
||||
<section class="mu-zone">
|
||||
<div class="mu-zone-head">
|
||||
<span class="mu-zone-tag tag-pink" data-i18n="zone.inprov">หมวดเส้นทางภายในจังหวัด</span>
|
||||
<p class="mu-zone-desc"><span data-i18n="zone.inprovDesc">เส้นทางภายในจังหวัดอ่างทอง</span> · 4 <span data-i18n="common.routes">เส้นทาง</span></p>
|
||||
</div>
|
||||
<div class="mu-grid">
|
||||
<a class="mu-card" data-route="324" href="#/routes/324">
|
||||
<div class="mu-card-head"><p class="mu-route-number">324</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">อ่างทอง-วัดพิกุลทอง</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-pink"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="1011" href="#/routes/1011">
|
||||
<div class="mu-card-head"><p class="mu-route-number">1011</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">อ่างทอง-สีบัวทอง</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-mint"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="2231" href="#/routes/2231">
|
||||
<div class="mu-card-head"><p class="mu-route-number">2231</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">อ่างทอง-มหานาม</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-purple"><svg class="ic" aria-hidden="true"><use href="#ic-check"/></svg> <span data-i18n="card.schedule">ดูตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="mu-card" data-route="999" href="#/routes/999">
|
||||
<div class="mu-card-head"><p class="mu-route-number">999</p></div>
|
||||
<div class="mu-route-info">
|
||||
<p class="mu-route-name">บขส.อ่างทอง สายเอเชีย-เหนือ</p>
|
||||
<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-sky"><svg class="ic" aria-hidden="true"><use href="#ic-hourglass"/></svg> <span data-i18n="card.noSchedule">ยังไม่มีตาราง</span></span></div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
<!-- หมวดเส้นทางทั้งหมด: สร้างจาก resource/data/route_groups.json + routes.json (+ routes_municipal.json)
|
||||
ที่มา: ui/partials/home.init.js → initRouteZones() — ห้าม hardcode การ์ดในไฟล์นี้ -->
|
||||
<div id="route-zones"></div>
|
||||
|
||||
<!-- ปุ่มแชร์ลิงก์สั้น (มุมล่างขวา ต่อจากการ์ดหมวดเส้นทางภายในจังหวัด) -->
|
||||
<div class="mu-share-row">
|
||||
<button type="button" class="mu-share-btn" id="share-btn">
|
||||
<svg class="ic" aria-hidden="true"><use href="#ic-share-2"/></svg>
|
||||
<span data-i18n="share.label">แชร์ลิงก์สั้น</span>
|
||||
</button>
|
||||
<p class="mu-share-status" id="share-status" aria-live="polite"></p>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
||||
+341
-50
@@ -4,7 +4,11 @@
|
||||
// แหล่งข้อมูลเดียว (source of truth) — อย่า hardcode รายชื่อจังหวัด/สถานีไว้ในไฟล์นี้
|
||||
var DATA_URL = {
|
||||
provinces: '../resource/data/provinces.json',
|
||||
stations: '../resource/data/stations.json'
|
||||
stations: '../resource/data/stations.json',
|
||||
routeGroups: '../resource/data/route_groups.json',
|
||||
routes: '../resource/data/routes.json',
|
||||
routesMunicipal: '../resource/data/routes_municipal.json',
|
||||
schedules: '../resource/data/schedules.json'
|
||||
};
|
||||
|
||||
// จังหวัดเริ่มต้น (home province ของเว็บนี้) — ใช้เป็นค่า default ของ hero + ตัวเลือก
|
||||
@@ -16,6 +20,11 @@
|
||||
.catch(function () { return null; });
|
||||
}
|
||||
|
||||
/* สถานะที่ผู้ใช้เลือก (ใช้กรองการ์ด + สร้างลิงก์แชร์) */
|
||||
var state = { provinceId: null, provinceName: DEFAULT_PROVINCE, stationCode: '', stationId: null };
|
||||
var PROVINCES = []; /* [{ province_id, province_name_th }] */
|
||||
var STATIONS = []; /* [{ station_id, station_code, station_name_th, province_th }] */
|
||||
|
||||
function initHomeSelectors() {
|
||||
var provinceSelect = document.getElementById('province-select');
|
||||
var stationSelect = document.getElementById('station-select');
|
||||
@@ -24,80 +33,117 @@
|
||||
if (!provinceSelect || !stationSelect) return;
|
||||
|
||||
var tr = window.I18N ? window.I18N.t : function (k) { return k; };
|
||||
var q = (window.__route && window.__route.query) || {}; /* ลิงก์สั้น: #/?s=<รหัสสถานี> หรือ #/?p=<province_id> */
|
||||
|
||||
// โหลดจังหวัด + สถานี จาก resource/data/*.json (โหลดพร้อมกันรอบเดียว)
|
||||
Promise.all([
|
||||
fetchJSON(DATA_URL.provinces),
|
||||
fetchJSON(DATA_URL.stations)
|
||||
]).then(function (results) {
|
||||
var provincesData = results[0];
|
||||
var stationsData = results[1];
|
||||
PROVINCES = ((results[0] || {}).provinces) || [];
|
||||
STATIONS = ((results[1] || {}).stations) || [];
|
||||
if (!PROVINCES.length) return; // โหลดข้อมูลไม่สำเร็จ → ปล่อย select ว่างไว้
|
||||
|
||||
var provinces = ((provincesData && provincesData.provinces) || [])
|
||||
.map(function (p) { return p.province_name_th; })
|
||||
.filter(Boolean);
|
||||
|
||||
var stations = (stationsData && stationsData.stations) || [];
|
||||
|
||||
if (!provinces.length) return; // โหลดข้อมูลไม่สำเร็จ → ปล่อย select ว่างไว้
|
||||
|
||||
var selectedProvince = provinces.indexOf(DEFAULT_PROVINCE) !== -1
|
||||
? DEFAULT_PROVINCE
|
||||
: provinces[0];
|
||||
/* เลือกจังหวัดเริ่มต้น: จากลิงก์ (?p= / ?s=) → ไม่งั้นใช้จังหวัดหลักของเว็บ */
|
||||
var startProvinceId = null;
|
||||
var startStationCode = q.s ? String(q.s) : '';
|
||||
if (startStationCode) {
|
||||
var st0 = STATIONS.filter(function (s) { return s.station_code === startStationCode; })[0];
|
||||
if (st0) {
|
||||
var pr0 = PROVINCES.filter(function (p) { return p.province_name_th === (st0.province_th || DEFAULT_PROVINCE); })[0];
|
||||
if (pr0) startProvinceId = pr0.province_id;
|
||||
}
|
||||
}
|
||||
if (startProvinceId === null && q.p) startProvinceId = parseInt(q.p, 10);
|
||||
if (startProvinceId === null) {
|
||||
var def = PROVINCES.filter(function (p) { return p.province_name_th === DEFAULT_PROVINCE; })[0];
|
||||
startProvinceId = def ? def.province_id : PROVINCES[0].province_id;
|
||||
}
|
||||
|
||||
provinceSelect.innerHTML = '';
|
||||
provinces.forEach(function (name) {
|
||||
PROVINCES.forEach(function (p) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = name;
|
||||
opt.textContent = name;
|
||||
if (name === selectedProvince) opt.selected = true;
|
||||
opt.value = p.province_id;
|
||||
opt.textContent = p.province_name_th;
|
||||
if (p.province_id === startProvinceId) opt.selected = true;
|
||||
provinceSelect.appendChild(opt);
|
||||
});
|
||||
|
||||
function stationsFor(province) {
|
||||
return stations
|
||||
.filter(function (s) {
|
||||
// สถานีที่ไม่มี province (เช่น "จุดขึ้นรถประจำทางอื่นๆ") ให้ถือว่าอยู่ในจังหวัดหลัก
|
||||
var p = s.province_th || DEFAULT_PROVINCE;
|
||||
return p === province;
|
||||
})
|
||||
.map(function (s) { return s.station_name_th; })
|
||||
.filter(Boolean);
|
||||
function provinceName(id) {
|
||||
var p = PROVINCES.filter(function (x) { return x.province_id === id; })[0];
|
||||
return p ? p.province_name_th : '';
|
||||
}
|
||||
|
||||
function populateStations(province) {
|
||||
function stationsFor(provinceId) {
|
||||
var name = provinceName(provinceId);
|
||||
return STATIONS.filter(function (s) {
|
||||
// สถานีที่ไม่มี province (เช่น "จุดขึ้นรถประจำทางอื่นๆ") ให้ถือว่าอยู่ในจังหวัดหลัก
|
||||
return (s.province_th || DEFAULT_PROVINCE) === name;
|
||||
});
|
||||
}
|
||||
|
||||
function populateStations(provinceId, preferredCode) {
|
||||
stationSelect.innerHTML = '';
|
||||
var list = stationsFor(province);
|
||||
if (list.length === 0) {
|
||||
var empty = document.createElement('option');
|
||||
empty.value = '';
|
||||
empty.textContent = tr('home.stationEmpty');
|
||||
empty.disabled = true;
|
||||
empty.selected = true;
|
||||
stationSelect.appendChild(empty);
|
||||
if (stationHint) stationHint.textContent = tr('home.stationEmptyHint') + ' ' + province;
|
||||
} else {
|
||||
list.forEach(function (name) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = name;
|
||||
opt.textContent = name;
|
||||
stationSelect.appendChild(opt);
|
||||
});
|
||||
if (stationHint) stationHint.innerHTML = tr('home.stationCount', { n: list.length }) + ' ' + province;
|
||||
var list = stationsFor(provinceId);
|
||||
|
||||
/* ตัวเลือกแรก = ทุกสถานีในจังหวัด (ค่าเริ่มต้น → แสดงทุกสาย) */
|
||||
var all = document.createElement('option');
|
||||
all.value = '';
|
||||
all.textContent = tr('home.allStations');
|
||||
stationSelect.appendChild(all);
|
||||
|
||||
list.forEach(function (st) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = st.station_code; /* ใช้รหัสสถานี = ลิงก์สั้น อ่านง่าย */
|
||||
opt.textContent = st.station_name_th;
|
||||
stationSelect.appendChild(opt);
|
||||
});
|
||||
|
||||
if (!list.length) {
|
||||
all.textContent = tr('home.stationEmpty');
|
||||
all.disabled = true;
|
||||
if (stationHint) stationHint.textContent = tr('home.stationEmptyHint') + ' ' + provinceName(provinceId);
|
||||
} else if (stationHint) {
|
||||
stationHint.innerHTML = tr('home.stationCount', { n: list.length }) + ' ' + provinceName(provinceId);
|
||||
}
|
||||
|
||||
/* คืนค่าที่เลือกไว้ (จากลิงก์) ถ้ามีในจังหวัดนี้ */
|
||||
if (preferredCode && list.some(function (s) { return s.station_code === preferredCode; })) {
|
||||
stationSelect.value = preferredCode;
|
||||
} else {
|
||||
stationSelect.value = '';
|
||||
}
|
||||
|
||||
var prefix = tr('home.provincePrefix');
|
||||
var pname = provinceName(provinceId);
|
||||
// กรุงเทพมหานครเป็นเขตปกครองพิเศษ ไม่ใช่ "จังหวัด" → ไม่เติมคำนำหน้า
|
||||
var label = (prefix && province !== 'กรุงเทพมหานคร')
|
||||
? prefix + ' ' + province
|
||||
: province;
|
||||
var label = (prefix && pname !== 'กรุงเทพมหานคร') ? prefix + ' ' + pname : pname;
|
||||
if (heroProvince) heroProvince.textContent = label;
|
||||
}
|
||||
|
||||
/* อ่านสถานะจาก select แล้ววาดการ์ดใหม่ */
|
||||
function syncState() {
|
||||
state.provinceId = parseInt(provinceSelect.value, 10);
|
||||
state.provinceName = provinceName(state.provinceId);
|
||||
state.stationCode = stationSelect.value || '';
|
||||
var st = STATIONS.filter(function (s) { return s.station_code === state.stationCode; })[0];
|
||||
state.stationId = st ? st.station_id : null;
|
||||
}
|
||||
|
||||
provinceSelect.addEventListener('change', function () {
|
||||
populateStations(provinceSelect.value);
|
||||
populateStations(parseInt(provinceSelect.value, 10));
|
||||
syncState();
|
||||
renderZones();
|
||||
});
|
||||
|
||||
populateStations(selectedProvince);
|
||||
stationSelect.addEventListener('change', function () {
|
||||
syncState();
|
||||
renderZones();
|
||||
});
|
||||
|
||||
populateStations(startProvinceId, startStationCode);
|
||||
syncState();
|
||||
renderZones();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -111,6 +157,251 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
การ์ดหมวดเส้นทาง — สร้างจาก route_groups.json + routes.json
|
||||
(หมวดเทศบาลอ่านเพิ่มจาก routes_municipal.json ซึ่งเป็นไฟล์เปล่า
|
||||
พร้อมคีย์ครบ — เติมเมื่อไหร่การ์ดก็ขึ้นเอง)
|
||||
============================================================ */
|
||||
var GROUP_META = {
|
||||
municipal: { tag: 'tag-yellow', i18n: 'zone.municipal', desc: 'zone.municipalDesc', empty: 'zone.municipalNA' },
|
||||
bangkok: { tag: 'tag-sky', i18n: 'zone.bangkok', desc: 'zone.bangkokDesc' },
|
||||
interprovincial: { tag: 'tag-purple', i18n: 'zone.interprov', desc: 'zone.interprovDesc' },
|
||||
in_province: { tag: 'tag-pink', i18n: 'zone.inprov', desc: 'zone.inprovDesc' }
|
||||
};
|
||||
/* สีชิปหมุนวนตามลำดับการ์ด; ค่าที่เคยกำหนดเฉพาะสายไว้เดิมอยู่ใน FIXED_BADGE
|
||||
(ถ้าต้องการย้ายมาคุมจาก JSON ให้ใส่คีย์ "badge" ใน routes.json) */
|
||||
var BADGE_CYCLE = ['badge-purple', 'badge-sky', 'badge-pink', 'badge-mint'];
|
||||
var FIXED_BADGE = { '324': 'badge-pink', '1011': 'badge-mint', '2231': 'badge-purple', '999': 'badge-sky' };
|
||||
var ICON = { next: 'ic-alarm-clock', schedule: 'ic-check', none: 'ic-hourglass' };
|
||||
var chipSlots = []; /* { wrap, routeId } ไว้รีเฟรชทุกนาที */
|
||||
|
||||
function toMin(hhmm) {
|
||||
var a = String(hhmm).split(':');
|
||||
return (parseInt(a[0], 10) || 0) * 60 + (parseInt(a[1], 10) || 0);
|
||||
}
|
||||
function nowMin() { var d = new Date(); return d.getHours() * 60 + d.getMinutes(); }
|
||||
|
||||
/* เที่ยวถัดไปของสาย = เที่ยวแรกที่ยังไม่ผ่าน (ไม่วนไปพรุ่งนี้ — ตรงกับหน้าเช็กเวลา) */
|
||||
function nextTripOf(times) {
|
||||
var now = nowMin();
|
||||
var sorted = times.slice().sort();
|
||||
for (var i = 0; i < sorted.length; i++) {
|
||||
if (toMin(sorted[i]) >= now) return sorted[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* โหลดข้อมูลหมวด/เส้นทาง/เวลา ครั้งเดียว แล้วเก็บไว้ใช้ซ้ำ */
|
||||
var ZDATA = { loaded: false, groups: [], routes: [], timesByRoute: {} };
|
||||
|
||||
function loadZoneData() {
|
||||
if (ZDATA.loaded) return Promise.resolve();
|
||||
return Promise.all([
|
||||
fetchJSON(DATA_URL.routeGroups),
|
||||
fetchJSON(DATA_URL.routes),
|
||||
fetchJSON(DATA_URL.routesMunicipal),
|
||||
fetchJSON(DATA_URL.schedules)
|
||||
]).then(function (res) {
|
||||
var groups = ((res[0] || {}).route_groups) || [];
|
||||
var routes = ((res[1] || {}).routes) || [];
|
||||
var municipal = ((res[2] || {}).routes) || [];
|
||||
var recs = (res[3] || {}).schedules || res[3] || [];
|
||||
if (!groups.length || !routes.length) return;
|
||||
|
||||
/* รวมเส้นทางหมวดเทศบาลจากไฟล์แยก (ข้ามแถวที่ยังไม่ได้กรอก) */
|
||||
ZDATA.groups = groups.filter(function (g) { return g.is_active !== false; })
|
||||
.slice()
|
||||
.sort(function (a, b) { return (a.display_order || 0) - (b.display_order || 0); });
|
||||
ZDATA.routes = routes.concat(municipal.filter(function (r) { return r && r.route_id; }));
|
||||
|
||||
var t = {};
|
||||
recs.forEach(function (r) {
|
||||
var k = String(r.route_id);
|
||||
t[k] = (t[k] || []).concat(r.departure_times || []);
|
||||
});
|
||||
ZDATA.timesByRoute = t;
|
||||
ZDATA.loaded = true;
|
||||
});
|
||||
}
|
||||
|
||||
/* กรองเส้นทางตามที่เลือก: สถานี → จังหวัด → ทั้งหมด */
|
||||
function routesForSelection() {
|
||||
if (state.stationId) {
|
||||
return ZDATA.routes.filter(function (r) {
|
||||
return (r.station_ids || []).indexOf(state.stationId) !== -1;
|
||||
});
|
||||
}
|
||||
if (state.provinceId) {
|
||||
return ZDATA.routes.filter(function (r) {
|
||||
return (r.province_ids || []).indexOf(state.provinceId) !== -1;
|
||||
});
|
||||
}
|
||||
return ZDATA.routes;
|
||||
}
|
||||
|
||||
function renderZones() {
|
||||
var host = document.getElementById('route-zones');
|
||||
if (!host) return;
|
||||
var tr = window.I18N ? window.I18N.t : function (k) { return k; };
|
||||
|
||||
loadZoneData().then(function () {
|
||||
if (!ZDATA.loaded) return;
|
||||
var mine = routesForSelection();
|
||||
|
||||
host.innerHTML = '';
|
||||
chipSlots = []; /* กันชิปซ้ำหลังวาดใหม่ */
|
||||
ZDATA.groups.forEach(function (g) {
|
||||
host.appendChild(zoneSection(g, mine, ZDATA.timesByRoute, tr));
|
||||
});
|
||||
|
||||
if (shareRefresh) shareRefresh(); /* อัปเดตลิงก์สั้นตามที่เลือก */
|
||||
if (!zoneTimer && chipSlots.length) {
|
||||
zoneTimer = setInterval(refreshChips, 60000);
|
||||
document.addEventListener('visibilitychange', function () {
|
||||
if (!document.hidden) refreshChips();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var zoneTimer = null;
|
||||
var shareRefresh = null;
|
||||
|
||||
function zoneSection(group, allRoutes, timesByRoute, tr) {
|
||||
var meta = GROUP_META[group.route_group] || {};
|
||||
var mine = allRoutes.filter(function (r) { return r.route_group === group.route_group; });
|
||||
|
||||
var sec = document.createElement('section');
|
||||
sec.className = 'mu-zone';
|
||||
sec.setAttribute('data-group', group.route_group);
|
||||
|
||||
/* หมวดใหม่ที่ยังไม่มีคีย์แปล → ใช้ชื่อจาก route_groups.json ตรง ๆ */
|
||||
var label = meta.i18n ? tr(meta.i18n) : (group.route_group_label || group.route_group);
|
||||
var labelAttr = meta.i18n ? ' data-i18n="' + meta.i18n + '"' : '';
|
||||
var desc = meta.desc ? tr(meta.desc) : '';
|
||||
var descAttr = meta.desc ? ' data-i18n="' + meta.desc + '"' : '';
|
||||
|
||||
var head = document.createElement('div');
|
||||
head.className = 'mu-zone-head';
|
||||
head.innerHTML =
|
||||
'<span class="mu-zone-tag ' + (meta.tag || 'tag-sky') + '"' + labelAttr + '>' + esc(label) + '</span>' +
|
||||
'<p class="mu-zone-desc">' + (desc ? '<span' + descAttr + '>' + esc(desc) + '</span> · ' : '') +
|
||||
mine.length + ' <span data-i18n="common.routes">' + esc(tr('common.routes')) + '</span></p>';
|
||||
sec.appendChild(head);
|
||||
|
||||
var grid = document.createElement('div');
|
||||
grid.className = 'mu-grid';
|
||||
|
||||
if (!mine.length) {
|
||||
grid.innerHTML =
|
||||
'<div class="mu-card is-empty">' +
|
||||
'<div class="mu-card-head"><p class="mu-route-number">N/A</p></div>' +
|
||||
'<div class="mu-route-info">' +
|
||||
'<p class="mu-route-name" data-i18n="' + (meta.empty || 'card.noData') + '">' + esc(tr(meta.empty || 'card.noData')) + '</p>' +
|
||||
'<div class="mu-route-chip-wrap"><span class="mu-next-trip badge-gray" data-i18n="card.noData">' + esc(tr('card.noData')) + '</span></div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
} else {
|
||||
mine.forEach(function (r, i) {
|
||||
var badge = r.badge ? 'badge-' + r.badge : (FIXED_BADGE[r.route_id] || BADGE_CYCLE[i % BADGE_CYCLE.length]);
|
||||
var a = document.createElement('a');
|
||||
a.className = 'mu-card';
|
||||
a.setAttribute('data-route', r.route_id);
|
||||
a.href = '#/routes/' + encodeURIComponent(r.route_id);
|
||||
a.innerHTML =
|
||||
'<div class="mu-card-head"><p class="mu-route-number">' + esc(r.route_id) + '</p></div>' +
|
||||
'<div class="mu-route-info">' +
|
||||
'<p class="mu-route-name">' + esc(r.route_name_th || '') + '</p>' +
|
||||
'<div class="mu-route-chip-wrap"></div>' +
|
||||
'</div>';
|
||||
var wrap = a.querySelector('.mu-route-chip-wrap');
|
||||
var times = timesByRoute[String(r.route_id)] || [];
|
||||
wrap.appendChild(chipNode(chipState(times), badge, tr));
|
||||
chipSlots.push({ wrap: wrap, badge: badge, times: times });
|
||||
grid.appendChild(a);
|
||||
});
|
||||
}
|
||||
|
||||
sec.appendChild(grid);
|
||||
return sec;
|
||||
}
|
||||
|
||||
/* 3 สถานะของชิป (ตรงกับที่ออกแบบไว้เดิม): มีเที่ยวถัดไป → ดูตาราง → ยังไม่มีตาราง */
|
||||
function chipState(times) {
|
||||
var next = nextTripOf(times);
|
||||
if (next) return { icon: ICON.next, key: 'card.nextTrip', next: next };
|
||||
if (times.length) return { icon: ICON.schedule, key: 'card.schedule', next: null };
|
||||
return { icon: ICON.none, key: 'card.noSchedule', next: null };
|
||||
}
|
||||
|
||||
function chipNode(state, badge, tr) {
|
||||
var span = document.createElement('span');
|
||||
span.className = 'mu-next-trip ' + badge;
|
||||
span.innerHTML = '<svg class="ic" aria-hidden="true"><use href="#' + state.icon + '"/></svg> ' +
|
||||
'<span data-i18n="' + state.key + '">' + esc(tr(state.key)) + '</span>' + (state.next ? ' ' + esc(state.next) : '');
|
||||
return span;
|
||||
}
|
||||
|
||||
/* รีเฟรชชิปทุกนาที ให้เวลา "เที่ยวถัดไป" ตรงกับเวลาจริง */
|
||||
function refreshChips() {
|
||||
var tr = window.I18N ? window.I18N.t : function (k) { return k; };
|
||||
chipSlots.forEach(function (slot) {
|
||||
if (!slot.wrap.isConnected || !slot.times.length) return;
|
||||
slot.wrap.innerHTML = '';
|
||||
slot.wrap.appendChild(chipNode(chipState(slot.times), slot.badge, tr));
|
||||
});
|
||||
}
|
||||
|
||||
function esc(v) {
|
||||
return String(v == null ? '' : v).replace(/&/g, '&').replace(/</g, '<')
|
||||
.replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
ลิงก์สั้นสำหรับแชร์ (ส่งไลน์หากัน)
|
||||
#/?s=<รหัสสถานี> = เปิดหน้าแรกพร้อมเลือกสถานีนั้น
|
||||
#/?p=<province_id> = เปิดพร้อมเลือกจังหวัด
|
||||
============================================================ */
|
||||
function shortUrl() {
|
||||
var base = location.origin + location.pathname.replace(/index\.html$/, '');
|
||||
var q = state.stationCode ? 's=' + encodeURIComponent(state.stationCode)
|
||||
: (state.provinceId ? 'p=' + state.provinceId : '');
|
||||
return base + (q ? '#/?' + q : '#/');
|
||||
}
|
||||
|
||||
function initShare() {
|
||||
var btn = document.getElementById('share-btn');
|
||||
var status = document.getElementById('share-status');
|
||||
if (!btn) return;
|
||||
var tr = window.I18N ? window.I18N.t : function (k) { return k; };
|
||||
|
||||
function paint(msg) {
|
||||
if (!status) return;
|
||||
status.innerHTML = esc(msg) + ' <code class="mu-share-url">' + esc(shortUrl()) + '</code> ' +
|
||||
'<a class="mu-share-line" href="https://social-plugins.line.me/lineit/share?url=' +
|
||||
encodeURIComponent(shortUrl()) + '" target="_blank" rel="noopener">' + esc(tr('share.line')) + '</a>';
|
||||
}
|
||||
|
||||
shareRefresh = function () { if (status && status.dataset.shown) paint(status.dataset.msg || ''); };
|
||||
|
||||
btn.addEventListener('click', function () {
|
||||
var url = shortUrl();
|
||||
if (navigator.share) {
|
||||
navigator.share({ title: document.title, url: url }).catch(function () { /* ผู้ใช้ยกเลิก */ });
|
||||
}
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(url).then(function () {
|
||||
status.dataset.shown = '1'; status.dataset.msg = tr('share.copied'); paint(tr('share.copied'));
|
||||
}, function () {
|
||||
status.dataset.shown = '1'; status.dataset.msg = tr('share.short'); paint(tr('share.short'));
|
||||
});
|
||||
} else {
|
||||
status.dataset.shown = '1'; status.dataset.msg = tr('share.short'); paint(tr('share.short'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
initHomeSelectors();
|
||||
initMarquee();
|
||||
initShare();
|
||||
})();
|
||||
@@ -682,7 +682,8 @@
|
||||
|
||||
<aside class="mu-card-panel">
|
||||
<h2><span data-i18n="stop.mapInfo">แผนที่และข้อมูลป้าย</span></h2>
|
||||
<div class="mu-map-mock" style="border-radius: 12px; background: linear-gradient(145deg, #f4f8ff 0%, #effaf5 100%); border: 1px solid #d7e5f2; padding: 20px; min-height: 200px; display:flex; align-items:center; justify-content:center; color:#66728f; font-weight:700; text-align:center;"><svg class="ic" aria-hidden="true"><use href="#ic-map"/></svg> แผนที่ตำแหน่งป้ายและช่องจอด</div>
|
||||
<div class="at-map" id="stop-map" role="region" aria-label="แผนที่เส้นทางที่ผ่านป้ายนี้"></div>
|
||||
<p class="at-map-caption" id="stop-map-caption"></p>
|
||||
<div style="display:flex; flex-wrap:wrap; gap:8px; margin-top:14px;">
|
||||
<span class="mu-chip" style="background: rgba(255,255,255,.9); border:1px solid rgba(231, 224, 246, 0.95); color:#5b3b71;">เปิด 04:30</span>
|
||||
<span class="mu-chip" style="background: rgba(255,255,255,.9); border:1px solid rgba(231, 224, 246, 0.95); color:#5b3b71;">ปิด 21:00</span>
|
||||
@@ -816,3 +817,11 @@
|
||||
setInterval(tick, 30000);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var r = window.__route || { params: {} };
|
||||
var el = document.getElementById('stop-map');
|
||||
if (el && window.ATMap && r.params.code) ATMap.forStop(el, r.params.code);
|
||||
})();
|
||||
</script>
|
||||
Reference in new issue
Block a user