support English
This commit is contained in:
1 parent
138a3d15d8
commit
b8ed110459
36 files changed
+523
-118
No files matched your search
+26
-1
@@ -59,6 +59,7 @@ export function resolveFileUrl(path: string): string {
|
||||
|
||||
export const api = {
|
||||
provinces: () => request<{ items: Province[] }>("/provinces"),
|
||||
sponsors: () => request<{ items: Sponsor[] }>("/sponsors"),
|
||||
routeGroups: () => request<{ items: RouteGroup[] }>("/route-groups"),
|
||||
routes: (params: { group?: string; province?: number } = {}) => {
|
||||
const q = new URLSearchParams();
|
||||
@@ -110,11 +111,16 @@ export const api = {
|
||||
},
|
||||
};
|
||||
|
||||
export type Province = { id: number; name_th: string };
|
||||
export type Province = {
|
||||
id: number;
|
||||
name_th: string;
|
||||
name_en: string | null;
|
||||
};
|
||||
export type RouteGroup = {
|
||||
id: number;
|
||||
code: string;
|
||||
label_th: string;
|
||||
label_en: string | null;
|
||||
display_order: number;
|
||||
is_active: boolean;
|
||||
};
|
||||
@@ -128,10 +134,12 @@ export type ImageRef = {
|
||||
export type RouteListItem = {
|
||||
route_id: string;
|
||||
name_th: string;
|
||||
name_en: string | null;
|
||||
vehicle_type: string;
|
||||
route_group_id: number;
|
||||
route_group_code: string;
|
||||
route_group_label_th: string;
|
||||
route_group_label_en: string | null;
|
||||
contact: Record<string, unknown>;
|
||||
metadata: Record<string, unknown>;
|
||||
province_ids: number[];
|
||||
@@ -143,8 +151,11 @@ export type RouteStop = {
|
||||
station_id: number;
|
||||
code: string;
|
||||
name_th: string;
|
||||
name_en: string | null;
|
||||
city_th: string | null;
|
||||
city_en: string | null;
|
||||
province_th: string | null;
|
||||
province_en: string | null;
|
||||
station_type: string;
|
||||
attributes: Record<string, unknown>;
|
||||
};
|
||||
@@ -152,8 +163,11 @@ export type StopListItem = {
|
||||
id: number;
|
||||
code: string;
|
||||
name_th: string;
|
||||
name_en: string | null;
|
||||
city_th: string | null;
|
||||
city_en: string | null;
|
||||
province_th: string | null;
|
||||
province_en: string | null;
|
||||
station_type: string;
|
||||
attributes: Record<string, unknown>;
|
||||
images: ImageRef[];
|
||||
@@ -165,17 +179,28 @@ export type StopDetail = StopListItem & {
|
||||
routes: {
|
||||
route_id: string;
|
||||
name_th: string;
|
||||
name_en: string | null;
|
||||
vehicle_type: string;
|
||||
route_group_code: string;
|
||||
route_group_label_th: string;
|
||||
route_group_label_en: string | null;
|
||||
}[];
|
||||
};
|
||||
export type Sponsor = {
|
||||
slug: string;
|
||||
name_th: string;
|
||||
name_en: string | null;
|
||||
website_url: string | null;
|
||||
display_order: number;
|
||||
meta: Record<string, unknown>;
|
||||
};
|
||||
export type Schedule = {
|
||||
id: number;
|
||||
route_id: string;
|
||||
station_id: number;
|
||||
station_code: string;
|
||||
station_name_th: string;
|
||||
station_name_en: string | null;
|
||||
direction_note: string | null;
|
||||
departure_times: string[];
|
||||
variants: Record<string, unknown>;
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
/* เลือกชื่อเฉพาะตามภาษา: xxx_en → xxx_th (ผ่าน I18N.name ของ i18n.ts) */
|
||||
function nm(o: any, base: string): string {
|
||||
const I = (window as any).I18N;
|
||||
return I && I.name ? I.name(o, base) : ((o && o[base + '_th']) || '');
|
||||
}
|
||||
/* Ported from web-at-transit-mock/ui/partials/blog.init.js — logic unchanged; bootstrap converted to mount(). */
|
||||
/* ============================================================
|
||||
หน้าบทความ — loader + สลับมุมมอง ตาราง/รายการ + หน้าอ่านบทความ
|
||||
@@ -332,7 +338,7 @@
|
||||
if (!o.station_code) return Promise.resolve(null);
|
||||
return stationByCode(o.station_code).then(function (s) {
|
||||
if (!s || numOrNull(s.latitude) == null) return null;
|
||||
return { coords: [numOrNull(s.latitude), numOrNull(s.longitude)], label: o.label || s.station_name_th || '' };
|
||||
return { coords: [numOrNull(s.latitude), numOrNull(s.longitude)], label: o.label || nm(s, 'station_name') || '' };
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
/* เลือกชื่อเฉพาะตามภาษา: xxx_en → xxx_th (ผ่าน I18N.name ของ i18n.ts) */
|
||||
function nm(o: any, base: string): string {
|
||||
const I = (window as any).I18N;
|
||||
return I && I.name ? I.name(o, base) : ((o && o[base + '_th']) || '');
|
||||
}
|
||||
/* Ported from web-at-transit-mock/ui/partials/checkSchedule.init.js — logic unchanged; bootstrap converted to mount(). */
|
||||
/* ============================================================
|
||||
checkSchedule.init.js — หน้า #/check/<รหัสสาย>
|
||||
@@ -289,7 +295,7 @@
|
||||
var det = document.createElement('details');
|
||||
det.className = 'mu-stop-card';
|
||||
det.open = true;
|
||||
var where = [x.city_th, x.province_th].filter(Boolean).join(' · ');
|
||||
var where = [nm(x, 'city'), nm(x, 'province')].filter(Boolean).join(' · ');
|
||||
var sum = document.createElement('summary');
|
||||
sum.innerHTML =
|
||||
'<span class="mu-stop-head ' + TONES.transfer + '">' +
|
||||
@@ -427,7 +433,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 = 'สาย ' + r.route_id + (nm(r, 'route_name') ? ' - ' + nm(r, 'route_name') : '');
|
||||
sel.appendChild(o);
|
||||
});
|
||||
sel.value = rid;
|
||||
@@ -438,7 +444,7 @@
|
||||
|
||||
/* Hero + คำอธิบายโซน */
|
||||
var hero = $('check-hero-route');
|
||||
if (hero) hero.textContent = 'สาย ' + rid + (route.route_name_th ? ' · ' + route.route_name_th : '');
|
||||
if (hero) hero.textContent = 'สาย ' + rid + (nm(route, 'route_name') ? ' · ' + nm(route, 'route_name') : '');
|
||||
|
||||
/* "อัปเดตล่าสุด N วันที่แล้ว" — วันที่จากฟิลด์ updated ของไฟล์ตารางสายนี้ (Schedules.updatedOf)
|
||||
แยกบรรทัดของตัวเอง (#check-updated-line) เพราะ #check-now-line แสดงเวลาปัจจุบันอยู่แล้ว */
|
||||
@@ -472,8 +478,8 @@
|
||||
return {
|
||||
sid: sid,
|
||||
st: st,
|
||||
name: isOtherHub && firstSubName ? firstSubName : (st ? st.station_name_th : 'จุดจอด ' + sid),
|
||||
city: st ? st.city_th : '',
|
||||
name: isOtherHub && firstSubName ? firstSubName : (st ? nm(st, 'station_name') : 'จุดจอด ' + sid),
|
||||
city: st ? nm(st, 'city') : '',
|
||||
code: st ? st.station_code : '',
|
||||
recs: recs.filter(function (r) { return String(r.route_id) === rid && r.station_id === sid; })
|
||||
};
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
/* เลือกชื่อเฉพาะตามภาษา: xxx_en → xxx_th (ผ่าน I18N.name ของ i18n.ts) */
|
||||
function nm(o: any, base: string): string {
|
||||
const I = (window as any).I18N;
|
||||
return I && I.name ? I.name(o, base) : ((o && o[base + '_th']) || '');
|
||||
}
|
||||
/* Ported from web-at-transit-mock/ui/partials/home.init.js — logic unchanged; bootstrap converted to mount(). */
|
||||
/* ---- ported module body ---- */
|
||||
'use strict';
|
||||
@@ -67,14 +73,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) {
|
||||
@@ -92,7 +98,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);
|
||||
});
|
||||
|
||||
@@ -368,7 +374,7 @@
|
||||
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>' +
|
||||
'<p class="mu-route-name">' + esc(nm(r, 'route_name')) + '</p>' +
|
||||
'<div class="mu-route-chip-wrap"></div>' +
|
||||
'</div>';
|
||||
var wrap = a.querySelector('.mu-route-chip-wrap');
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
/* เลือกชื่อเฉพาะตามภาษา: xxx_en → xxx_th (ผ่าน I18N.name ของ i18n.ts) */
|
||||
function nm(o: any, base: string): string {
|
||||
const I = (window as any).I18N;
|
||||
return I && I.name ? I.name(o, base) : ((o && o[base + '_th']) || '');
|
||||
}
|
||||
/* Ported from web-at-transit-mock/ui/map.js — logic unchanged. */
|
||||
/* ============================================================
|
||||
Atroute — แผนที่เส้นทาง (Leaflet, vanilla)
|
||||
@@ -147,7 +153,7 @@ window.ATMap = (function () {
|
||||
hit.forEach(function (o) {
|
||||
/* แตกเป็น "จุดจริง" ทีละจุด — ชื่อ ↔ พิกัด จับคู่ตามลำดับ (จุดที่ไม่มีพิกัด = ไม่ปักหมุด) */
|
||||
var subs = (window.OtherStop && OtherStop.stopsOf) ? OtherStop.stopsOf(o) : [];
|
||||
if (!subs.length) subs = [{ name: o.station_name_th, hasCoord: false, lat: null, lng: null }];
|
||||
if (!subs.length) subs = [{ name: nm(o, 'station_name'), hasCoord: false, lat: null, lng: null }];
|
||||
subs.forEach(function (sub, si) {
|
||||
stops.push({
|
||||
name: sub.name,
|
||||
@@ -164,7 +170,7 @@ window.ATMap = (function () {
|
||||
}
|
||||
}
|
||||
var st = byId[sid];
|
||||
if (st) stops.push({ name: st.station_name_th, pt: pointOf(st), code: st.station_code });
|
||||
if (st) stops.push({ name: nm(st, 'station_name'), pt: pointOf(st), code: st.station_code });
|
||||
});
|
||||
|
||||
var total = lineLengthKm([main]);
|
||||
@@ -333,12 +339,12 @@ window.ATMap = (function () {
|
||||
hits.forEach(function (h) {
|
||||
var s = h.station, pt = pointOf(s);
|
||||
if (!pt) return;
|
||||
var html = '<div class="at-pop"><b>' + esc(s.station_name_th) + '</b>';
|
||||
html += '<span>' + esc([s.city_th, s.province_th].filter(Boolean).join(' · ')) + '</span>';
|
||||
var html = '<div class="at-pop"><b>' + esc(nm(s, 'station_name')) + '</b>';
|
||||
html += '<span>' + esc([nm(s, 'city'), nm(s, 'province')].filter(Boolean).join(' · ')) + '</span>';
|
||||
if (s.station_code) html += '<a href="' + esc(href(opts, s.station_code)) + '">' + esc(t('map.viewStopPage')) + '</a>';
|
||||
html += '</div>';
|
||||
L.marker([pt[1], pt[0]], { icon: pinIcon('term') })
|
||||
.bindTooltip('<b>' + esc(s.station_name_th) + '</b><br>' + esc(s.province_th || ''), { direction: 'top', offset: [0, -9] })
|
||||
.bindTooltip('<b>' + esc(nm(s, 'station_name')) + '</b><br>' + esc(nm(s, 'province')), { direction: 'top', offset: [0, -9] })
|
||||
.bindPopup(html, { closeButton: false, offset: [0, -6] })
|
||||
.addTo(group);
|
||||
});
|
||||
@@ -468,7 +474,7 @@ window.ATMap = (function () {
|
||||
} else {
|
||||
rows = sts.map(function (h) {
|
||||
var k = kmFromStart(main, pointOf(h.station));
|
||||
return { name: h.station.station_name_th, km: k.km.toFixed(1), off: false, href: href(opts, h.station.station_code) };
|
||||
return { name: nm(h.station, 'station_name'), km: k.km.toFixed(1), off: false, href: href(opts, h.station.station_code) };
|
||||
}).sort(function (a, b) { return parseFloat(a.km) - parseFloat(b.km); });
|
||||
}
|
||||
renderKmList('route-map-list', rows);
|
||||
@@ -541,7 +547,7 @@ window.ATMap = (function () {
|
||||
/* opts.focus = จุดจริงของสายที่เลือก (เช่น จุดขึ้นรถประจำทางอื่นๆ → วัดสีบัวทอง) */
|
||||
var stPt = opts.focus ? pointOf(opts.focus) : pointOf(st);
|
||||
var focusFirst = (opts.focus && window.OtherStop && OtherStop.firstName) ? OtherStop.firstName(opts.focus) : null;
|
||||
var pinName = focusFirst || (opts.focus && opts.focus.station_name_th) || st.station_name_th;
|
||||
var pinName = focusFirst || (opts.focus && nm(opts.focus, 'station_name')) || nm(st, 'station_name');
|
||||
if (stPt) {
|
||||
L.marker([stPt[1], stPt[0]], { icon: pinIcon('here'), zIndexOffset: 1000 })
|
||||
.bindTooltip('<b>' + esc(pinName) + '</b><br>' + esc(t('map.thisStop')), { direction: 'top', offset: [0, -11] })
|
||||
@@ -621,7 +627,7 @@ window.ATMap = (function () {
|
||||
ul.className = 'at-near-list';
|
||||
near.forEach(function (x) {
|
||||
var li = document.createElement('li');
|
||||
var name = x.kind === 'station' ? x.o.station_name_th : (x.o.place || x.o.type);
|
||||
var name = x.kind === 'station' ? nm(x.o, 'station_name') : (x.o.place || x.o.type);
|
||||
var meta = [];
|
||||
if (x.kind === 'station') meta.push(t('map.legendTerminal'));
|
||||
else {
|
||||
@@ -661,7 +667,7 @@ window.ATMap = (function () {
|
||||
near.forEach(function (x) {
|
||||
var kind = x.kind === 'station' ? 'term' : 'stop';
|
||||
L.marker([x.pt[1], x.pt[0]], { icon: pinIcon(kind) })
|
||||
.bindTooltip(esc(x.kind === 'station' ? x.o.station_name_th : (x.o.place || x.o.type)), { direction: 'top', offset: [0, -8] })
|
||||
.bindTooltip(esc(x.kind === 'station' ? nm(x.o, 'station_name') : (x.o.place || x.o.type)), { direction: 'top', offset: [0, -8] })
|
||||
.addTo(map);
|
||||
pts.push([x.pt[1], x.pt[0]]);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
/* เลือกชื่อเฉพาะตามภาษา: xxx_en → xxx_th (ผ่าน I18N.name ของ i18n.ts) */
|
||||
function nm(o: any, base: string): string {
|
||||
const I = (window as any).I18N;
|
||||
return I && I.name ? I.name(o, base) : ((o && o[base + '_th']) || '');
|
||||
}
|
||||
/* Ported from web-at-transit-mock/ui/popular.js — logic unchanged. */
|
||||
/* popular.js — อัลกอริทึมนับ "สายที่เปิดดูบ่อย" สำหรับ footer (ฝั่งเบราว์เซอร์ ไม่มี backend)
|
||||
|
||||
@@ -111,7 +117,7 @@
|
||||
var li = document.createElement('li');
|
||||
var a = document.createElement('a');
|
||||
a.href = '/routes/' + id;
|
||||
a.textContent = 'สาย ' + id + (r.route_name_th ? ' · ' + r.route_name_th : '');
|
||||
a.textContent = 'สาย ' + id + (nm(r, 'route_name') ? ' · ' + nm(r, 'route_name') : '');
|
||||
li.appendChild(a);
|
||||
ul.appendChild(li);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
/* เลือกชื่อเฉพาะตามภาษา: xxx_en → xxx_th (ผ่าน I18N.name ของ i18n.ts) */
|
||||
function nm(o: any, base: string): string {
|
||||
const I = (window as any).I18N;
|
||||
return I && I.name ? I.name(o, base) : ((o && o[base + '_th']) || '');
|
||||
}
|
||||
/* Ported from web-at-transit-mock/ui/partials/busDetail.init.js — logic unchanged; bootstrap converted to mount(). */
|
||||
/* ============================================================
|
||||
busDetail.init.js — เติมข้อมูลหน้า #/routes/<รหัสสาย> จาก JSON
|
||||
@@ -335,8 +341,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 — สาย ' + rid + (nm(route, 'route_name') ? ' ' + nm(route, 'route_name') : '');
|
||||
|
||||
/* dropdown: เติมจาก routes.json (ลำดับตามไฟล์) + เปลี่ยนแล้วไปสายนั้น */
|
||||
var sel = $('route-select');
|
||||
@@ -345,7 +351,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 = 'สาย ' + r.route_id + (nm(r, 'route_name') ? ' - ' + nm(r, 'route_name') : '');
|
||||
sel.appendChild(o);
|
||||
});
|
||||
sel.value = rid;
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
/* เลือกชื่อเฉพาะตามภาษา: xxx_en → xxx_th (ผ่าน I18N.name ของ i18n.ts) */
|
||||
function nm(o: any, base: string): string {
|
||||
const I = (window as any).I18N;
|
||||
return I && I.name ? I.name(o, base) : ((o && o[base + '_th']) || '');
|
||||
}
|
||||
/* Ported from web-at-transit-mock/ui/partials/schedules.js — logic unchanged. */
|
||||
/* ============================================================
|
||||
schedules.js — ตัวอ่านข้อมูลตารางเวลา (ใช้ร่วมทุกหน้า)
|
||||
@@ -148,7 +154,7 @@
|
||||
fetch(DATA_URL + 'stations.json', { cache: 'no-store' })
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (d) {
|
||||
((d && d.stations) || []).forEach(function (st) { STATION_NAMES[String(st.station_id)] = st.station_name_th; });
|
||||
((d && d.stations) || []).forEach(function (st) { STATION_NAMES[String(st.station_id)] = nm(st, 'station_name'); });
|
||||
})
|
||||
.catch(function () {});
|
||||
}
|
||||
@@ -156,7 +162,7 @@
|
||||
/* หน้าเว็บที่โหลด stations.json อยู่แล้วส่งชื่อเข้ามาได้ → ข้อความหมายเหตุมีชื่อทันที (ไม่ต้องรอ fetch) */
|
||||
function setStationNames(list) {
|
||||
((list && list.stations) || list || []).forEach(function (st) {
|
||||
if (st && st.station_id != null) STATION_NAMES[String(st.station_id)] = st.station_name_th;
|
||||
if (st && st.station_id != null) STATION_NAMES[String(st.station_id)] = nm(st, 'station_name');
|
||||
});
|
||||
}
|
||||
/* เรียกทันทีตอนไฟล์ถูกโหลด — จะทันรอบเรนเดอร์แรก (ชื่อจุดอ้างอิงในข้อความ "คำนวณจาก ...") */
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
/* เลือกชื่อเฉพาะตามภาษา: xxx_en → xxx_th (ผ่าน I18N.name ของ i18n.ts) */
|
||||
function nm(o: any, base: string): string {
|
||||
const I = (window as any).I18N;
|
||||
return I && I.name ? I.name(o, base) : ((o && o[base + '_th']) || '');
|
||||
}
|
||||
/* Ported from web-at-transit-mock/ui/partials/stopDetail.init.js — logic unchanged; bootstrap converted to mount(). */
|
||||
/* ============================================================
|
||||
stopDetail.init.js — หน้ารายละเอียดป้าย (#/stops/<รหัส>)
|
||||
@@ -121,13 +127,13 @@
|
||||
|
||||
/* ---------- เรนเดอร์: หัวป้าย ---------- */
|
||||
function renderHero(st, sum, photo, place) {
|
||||
var baseName = st.station_name_th || ('ป้าย ' + st.station_code);
|
||||
var baseName = nm(st, 'station_name') || ('ป้าย ' + st.station_code);
|
||||
/* จุดขึ้นรถประจำทางอื่นๆ: ต่อท้ายด้วยชื่อสถานที่จริงของสายที่กำลังดูอยู่ */
|
||||
var placeName = (place && window.OtherStop && OtherStop.firstName) ? OtherStop.firstName(place)
|
||||
: (place && place.station_name_th) ? place.station_name_th : null;
|
||||
: (place && nm(place, 'station_name')) ? nm(place, 'station_name') : null;
|
||||
var name = baseName + (placeName ? ' \u00b7 ' + placeName : '');
|
||||
var city = (place && place.city_th) || st.city_th || '';
|
||||
var prov = (place && place.province_th) || st.province_th || '';
|
||||
var city = (place && nm(place, 'city')) || nm(st, 'city') || '';
|
||||
var prov = (place && nm(place, 'province')) || nm(st, 'province') || '';
|
||||
|
||||
var crumb = $('stop-breadcrumb');
|
||||
if (crumb) crumb.innerHTML = '<a href="/">' + esc(t('nav.home')) + '</a>/ <a href="/stops">' +
|
||||
@@ -237,10 +243,10 @@
|
||||
/* จุดขึ้นรถประจำทางอื่นๆ → แสดง "ชื่อจุดจริง · อำเภอ" แทนคำว่าจุดจอดที่ N */
|
||||
/* จุดขึ้นรถประจำทางอื่นๆ ที่มีหลายจุด → โชว์จุดแรก + "(+N จุด)" ไม่ยัดชื่อทั้งชุด */
|
||||
var subs = (place && window.OtherStop && OtherStop.stopsOf) ? OtherStop.stopsOf(place) : [];
|
||||
var pName = subs.length ? subs[0].name : (place && place.station_name_th) || '';
|
||||
var pName = subs.length ? subs[0].name : (place && nm(place, 'station_name')) || '';
|
||||
var pMore = subs.length > 1 ? ' ' + t('stop.otherMore', { n: subs.length - 1 }) : '';
|
||||
var metaText = place
|
||||
? pName + pMore + (place.city_th ? ' \u00b7 ' + place.city_th : '')
|
||||
? pName + pMore + (nm(place, 'city') ? ' \u00b7 ' + nm(place, 'city') : '')
|
||||
: posLabel + (x.total > 1 ? ' \u00b7 ' + (x.index + 1) + '/' + x.total : '');
|
||||
var sum = document.createElement('summary');
|
||||
sum.innerHTML =
|
||||
@@ -248,7 +254,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(nm(r, 'route_name') || ('สาย ' + r.route_id)) + '</strong>' +
|
||||
'<span class="mu-stop-summary-meta">' + esc(metaText) + '</span>' +
|
||||
'</span>' +
|
||||
'<span class="mu-stop-summary-rail">' +
|
||||
@@ -502,7 +508,7 @@
|
||||
: t('stop.otherStopsAll', { m: list.length })) + '</h2>' +
|
||||
'<ul class="mu-list mu-other-list">' + list.map(function (x) {
|
||||
var st = x.stop;
|
||||
var where = [st.city_th, st.province_th].filter(Boolean).join(' · ');
|
||||
var where = [nm(st, 'city'), nm(st, 'province')].filter(Boolean).join(' · ');
|
||||
var base = baseByRoute[String(x.route_id)] || null;
|
||||
var hasOff = (st.offsetMin != null);
|
||||
var times = (hasOff && base && canShift) ? Schedules.shiftTimes(base, st.offsetMin) : null;
|
||||
|
||||
Reference in new issue
Block a user