แผนที่จาก GPKG + บทความ 6 ชิ้น + ลดความหนา footer

== แผนที่ / GIS ==
- qgis-to-web.py: อ่าน GPKG ได้ (--from gpkg) + เพิ่ม dream-Watcharapol
- เพิ่ม dream-*.geojson 6 ไฟล์ (เส้นทางที่เสนอ: บ้านภาชี · ชานเมืองอยุธยา · HSR · เมืองทองธานี · ปากเกร็ด · วัชรพล)
- map.js: ATMap.proposal() วาดเส้นจริงจาก geojson (ไม่ใช่เส้นตรง) · smoothFactor 0.5
  · coordOf() รับ coords=[lat,lng] · fitAll รับได้ทั้งจุดเดี่ยวและเส้น · setStyle บน featureGroup

== บทความ (blog) ==
- text3: ถ้าผมได้ออกแบบสายเดินรถเอง (จาก mydream.html) TH+EN
- text4: วิธีเดินทางไปสถานีรถไฟ และสนามบิน (จาก train-airplane.html) TH+EN
- text5/text6: โครงเปล่ารอเติมเนื้อหา (แสวงหา-โพธิ์ทอง · อำเภอเข้าเมือง)
- แผนที่ความฝัน: map.groups 3 กลุ่ม · คลิกเส้น/หมุด/แถวได้ · ป้ายที่มา
- ย่อหน้า: ระยะห่าง 20px + ย่อหน้าหน้าบรรทัด 1.5em

== ตารางเดินรถ ==
- เปลี่ยนชื่อคีย์ dir_* -> direction_* ทุกไฟล์ (backward-compat ในโค้ด)
- 1011: จุดย่อย 2 ทิศ + offsets [0,25,55]
- 954/2194: จุดย่อย station 8 + offsets
- refreshHighlights: วนข้ามวันเมื่อเลยเที่ยวสุดท้าย + ไฮเทลต์ชิปทุกจุด
- 8 other_stop.md: อัปเดตตรงข้อมูลจริง 8 รายการ

== i18n ==
- แยกไฟล์ต่อภาษา ui/locales/{th,en}.json + i18n.js = loader (ลด 28KB -> 6.5KB)
- resource/tools/check-i18n.py ตรวจคีย์ขาด/ซ้ำ
- ข้อความผู้สนับสนุนหน้าแรก + คำแปล EN

== UI ==
- ฝังฟอนต์ K2D (ui/vendor/fonts/) ออฟไลน์ 100%
- cache busting ?v=<SW VERSION> ทุกรูป (ui/imageurl.js)
- footer: ลดความหนา 468 -> 349px + line-height 1.5 กันสระ/วรรณยุกต์ซ้อน
- QR modal + ปุ่มคัดลอกลิงก์ · หน้าอัปเดตล่าสุดใน #/check
- credits: ขอขอบคุณภาพรถ 3 สาย

== เครื่องมือ ==
- bump-version.py · stamp-schedules.py · derive-times.py (จุดอ้างอิง ± นาที)
This commit is contained in:
Bkk1234 committed 2026-10-05 03:55:09 +07:00
1 parent 1cfaeb1526
commit 656f65b41c
109 files changed
+3335 -1225

No files matched your search

+241 -25
View File
@@ -27,7 +27,9 @@
var ONLY_STOPS_WITH_SCHEDULE = false;
var sections = []; /* [{ chips:[], times:[], station }] */
var netRoute = null; /* routes.json ของสายที่แสดงอยู่ */
var netRoute = null;
var OTHER_ENTRIES = [];
var ROUTE_IDS = []; /* routes.json ของสายที่แสดงอยู่ */
var timer = null;
function $(id) { return document.getElementById(id); }
@@ -56,10 +58,15 @@
}
/* ---------- จำแนกประเภทจุดจอดจากข้อมูล + ลำดับในเส้นทาง ---------- */
/* บทบาทของจุดในการ์ด:
index 0 = ต้นทาง · index สุดท้าย = ปลายทาง
ระหว่างนั้น: จุดที่เป็น "สถานีขนส่งหลัก" = กลางทาง (จุดพักรถที่คนขึ้น/ลงได้)
จุดป้ายริมทางทั่วไป = ผ่านทาง
⚠️ ใช้กับ "ลำดับที่แสดงในหน้านี้" เท่านั้น — ลำดับมาอยู่ที่ station_order ไม่ใช่บทบาทถาวร */
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 };
if (st && st.station_type === 'main_terminal') return { key: 'route.transfer', icon: 'ic-map-pin', tone: TONES.transfer };
return { key: 'route.pass', icon: 'ic-map-pin', tone: TONES.pass };
}
@@ -111,12 +118,12 @@
return;
}
/* หัวแถว = ชื่อทิศ (dir_label) → ไม่มีค่อยใช้ dir_note → ไม่มีอีกค่อยบอกว่าอยู่ที่จุดนี้
/* หัวแถว = ชื่อทิศ (direction_label) → ไม่มีค่อยใช้ direction_note → ไม่มีอีกค่อยบอกว่าอยู่ที่จุดนี้
ทิศที่ไปคนละทางจากจุดเดียวกัน (ป่าโมกไปอ่างทอง / ป่าโมกไปอยุธยา) จึงแยกให้เห็นชัด */
var sub = document.createElement('p');
sub.className = 'mu-stop-sub';
if (r.dir_label) {
sub.innerHTML = esc(r.dir_label) +
if ((r.direction_label || r.dir_label)) {
sub.innerHTML = esc((r.direction_label || r.dir_label)) +
(r.direction_note ? ' <span class="mu-direction-tag">' + esc(r.direction_note) + '</span>' : '');
} else if (r.direction_note) {
sub.innerHTML = esc(r.direction_note) + ' <span class="mu-direction-tag">' + esc(t('check.direction')) + '</span>';
@@ -175,32 +182,212 @@
});
}
/* ---------- แถวข้อมูลแบบ "ชิ้น" (segment) ----------
แต่ละชิ้นเป็น flex item → ตัดบรรทัดเป็นหน่วย ไม่ตัดกลางคำ
(สำคัญกับข้อความไทยที่ไม่มีเว้นวรรค เช่น "บขส.อ่างทอง → สถานีเดินรถโดยสารขนาดเล็ก (จตุจักร)"
จะไม่ถูกตัดกลางชื่อสถานี) · ตัวคั่น "·" วาดด้วย CSS (.mu-zone-seg + .mu-zone-seg::before) */
function icSvg(name) {
return '<svg class="ic" aria-hidden="true"><use href="#' + name + '"/></svg>';
}
/* seg = "ข้อความล้วน" หรือ { html: "...", icon: "ic-xxx" } (html ต้อง esc() มาก่อน) */
function setSegments(host, segs) {
if (!host) return;
host.innerHTML = '';
segs.forEach(function (s) {
var seg = document.createElement('span');
seg.className = 'mu-zone-seg';
if (s && typeof s === 'object') {
seg.innerHTML = (s.icon ? icSvg(s.icon) : '') + (s.html || '');
} else {
seg.textContent = String(s == null ? '' : s); /* ข้อความล้วน — ปลอดภัยจาก HTML */
}
host.appendChild(seg);
});
}
/* ---------- "อัปเดตล่าสุด N วันที่แล้ว" จากฟิลด์ updated (ISO) ----------
เทียบ "วันนี้" กับวันที่ในฟิลด์ updated (ไม่ใช้เวลา → ไม่มีปัญหา timezone)
วันเดียวกัน → "วันนี้" · เมื่อวาน → "เมื่อวาน"
< 7 วัน → N วันที่แล้ว · < 30 วัน → N สัปดาห์ที่แล้ว
< 365 วัน → N เดือนที่แล้ว · มากกว่า → N ปี M เดือนที่แล้ว
หมายเหตุ: ใช้ mtime/Last-Modified จากเบราว์เซอร์ไม่ได้ (fetch ข้ามโดเมนไม่ให้อ่าน)
→ ค่ามาจาก resource/tools/stamp-schedules.py ที่เติมจาก mtime จริง */
function daysAgo(iso) {
var m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '').trim());
if (!m) return null;
var then = new Date(Date.UTC(+m[1], +m[2] - 1, +m[3]));
if (isNaN(then.getTime())) return null;
var now = new Date();
var today = new Date(Date.UTC(now.getFullYear(), now.getMonth(), now.getDate()));
return Math.round((today - then) / 86400000);
}
function agoLabel(days) {
if (days == null) return '';
if (days <= 0) return t('check.agoToday');
if (days === 1) return t('check.agoYesterday');
if (days < 7) return t('check.agoDays', { n: days });
if (days < 30) return t('check.agoWeeks', { n: Math.floor(days / 7) });
if (days < 365) return t('check.agoMonths', { n: Math.floor(days / 30) });
var y = Math.floor(days / 365), mo = Math.floor((days % 365) / 30);
return mo ? t('check.agoYearsMonths', { y: y, m: mo }) : t('check.agoYears', { y: y });
}
function appendSubStopCards(listEl, rid, groups, schedDoc, recs) {
if (!window.OtherStop || !OtherStop.allStops || !window.Schedules) return;
/* allStops() คืน "รายการแบน": [{ index, name, city_th, province_th, lat, lng, offsetMin, hasCoord, entry }] */
var sub = OtherStop.allStops(OTHER_ENTRIES, rid, ROUTE_IDS);
if (!sub || sub.length < 2) return; /* มีจุดเดียว = การ์ดหลักแสดงอยู่แล้ว */
var first = sub[0].name;
/* จุดอ้างอิง = จุดแรกของจุดย่อย (index 0 · offset = 0) ซึ่งตรงกับการ์ดหลัก (station 8)
แต่ละทิศมี "จุดอ้างอิงของตัวเอง" — ทิศที่มีข้อมูล (station_id = จุดอ้างอิง) ให้ offset คงที่ (+0)
สายที่วิ่ง 2 ทาง (ไป-กลับ) จึงแสดงครบทั้ง 2 ทิศในทุกจุดย่อย
ทิศที่ยังไม่มีตาราง (แค่ชื่อทิศ) → ไม่แสดง (ห้ามเดาเวลาที่ไม่มีต้นทาง) */
/* จุดอ้างอิง = "จุดขึ้นรถประจำทางอื่นๆ" (station 8) — จุดแรกของ other_stop คือจุดที่มีตารางจริง
ไม่ใช้ "record แรก" เพราะ recs เรียงตาม station_order (บขส.อ่างทองมาก่อน) จะได้จุดอ้างอิงผิด */
var hubSid = null, hubDir = null; /* hubDir = ชื่อทิศ "ของจุดอ้างอิง" (ตัวตั้งเวลา) */
groups.forEach(function (g) {
if (String(g.sid) === '8') hubSid = '8';
});
if (hubSid === null) { /* ไม่มี station 8 → ใช้จุดแรกที่มีเวลาตามเดิม */
groups.forEach(function (g) {
g.recs.forEach(function (r) {
if ((r.departure_times || []).length && hubSid === null) hubSid = String(r.station_id);
});
});
}
/* ทิศตั้งต้น = ทิศที่ "เริ่มจากจุดอ้างอิง" (จุดแรกของ other_stop = วัดสีบัวทอง)
ตัวชี้ที่ใช้ได้: ชื่อทิศตรงกับ "จาก<ชื่อจุดแรก>" หรือ note ของจุดย่อย */
var hubName = sub[0].name;
recs.forEach(function (r) {
if (String(r.route_id) !== rid) return;
if (hubDir !== null || !(r.departure_times || []).length) return;
var lbl = String((r.direction_label || r.dir_label) || '');
var note = String((r.direction_note || r.dir_note) || '');
if (lbl.indexOf(hubName) !== -1 || note.indexOf(hubName) === 0) hubDir = (r.direction_label || r.dir_label);
});
if (hubSid === null) return; /* ไม่มีตารางจริงเลย → คำนวณไม่ได้ */
/* ทุกทิศของสายนี้: ทิศของจุดอ้างอิง = เวลาต้นทาง · ทิศอื่น = จุดอ้างอิง + offset ของจุดนี้ */
var legs = [];
recs.forEach(function (r) {
if (String(r.route_id) !== rid) return; /* เฉพาะสายนี้ — recs มีทุกสาย */
if (!(r.departure_times || []).length) return; /* ทิศนี้ยังไม่มีตาราง → ข้าม */
legs.push({ rec: r, fixed: ((r.direction_label || r.dir_label) === hubDir) ? 0 : null });
});
if (!legs.length) return; /* ไม่มีทิศที่คำนวณได้ → ไม่แสดงการ์ดย่อย */
/* จุดแรกของจุดย่อย = จุดอ้างอิงเอง (แสดงเป็นการ์ดหลักอยู่แล้ว) → เริ่มที่จุดที่ 2
และข้ามจุดที่พิกัด/ชื่อซ้ำกับจุดอ้างอิง */
sub.slice(1).forEach(function (x) {
if (x.name === hubName) return; /* ชื่อซ้ำกับการ์ดต้นทาง → ไม่แสดงซ้ำ */
var off = (x.offsetMin == null ? null : Number(x.offsetMin));
var li = document.createElement('li');
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 sum = document.createElement('summary');
sum.innerHTML =
'<span class="mu-stop-head ' + TONES.transfer + '">' +
'<span class="mu-stop-kind"><svg class="ic" aria-hidden="true"><use href="#ic-map-pin"/></svg> <span>' +
esc(t('stops.subStop')) + '</span></span>' +
'<span class="mu-stop-title"><strong>' + esc(x.name) + '</strong><small>' + esc(where) + '</small></span>' +
'<span class="mu-stop-chevron">\u2304</span>' +
'</span>';
det.appendChild(sum);
var body = document.createElement('div');
body.className = 'mu-stop-body';
if (off == null) { /* ยังไม่ระบุเวลาเดินทาง → คำนวณไม่ได้ */
var na = document.createElement('p');
na.className = 'mu-stop-sub';
na.textContent = t('stops.noOffset');
body.appendChild(na);
} else {
legs.forEach(function (leg) {
var r = leg.rec;
var raw = (r.departure_times || []).length ? r.departure_times : [];
if (!raw.length) return; /* ทิศนี้ยังไม่มีตารางจริง → ข้าม */
/* ทิศของจุดอ้างอิงเอง (fixed = 0) → เวลาเท่าต้นทาง · ทิศอื่น → บวก offset ของจุดนี้ */
var o = (leg.fixed === 0) ? 0 : off;
var times = (o === 0) ? raw.slice() : Schedules.shiftTimes(raw, o);
var head = document.createElement('p');
head.className = 'mu-stop-sub';
head.textContent = (r.direction_label || r.dir_label) || r.direction_note || ('จาก ' + first);
body.appendChild(head);
var grid = document.createElement('div');
grid.className = 'mu-time-grid' + (o === 0 ? '' : ' is-est');
var chips = [];
times.forEach(function (tm) {
var chip = document.createElement('div');
chip.className = 'mu-time-chip';
chip.textContent = tm;
grid.appendChild(chip);
chips.push(chip);
});
body.appendChild(grid);
/* ให้จุดย่อยอยู่ในระบบ "รอบถัดไป" ด้วย (refreshHighlights วน sections[])
ไม่งั้นชิปของจุดย่อยไม่ถูกไฮไลต์ และรอบถัดไปมองไม่เห็นเวลาของจุดนี้ */
sections.push({ chips: chips, times: times, station: x.name });
if (o !== 0) {
var note = document.createElement('p');
note.className = 'mu-est-note';
note.textContent = t('time.derived', { base: first, n: Schedules.offsetLabel(o) });
body.appendChild(note);
}
});
}
det.appendChild(body);
li.appendChild(det);
listEl.appendChild(li);
});
}
/* ---------- ไฮไลต์เที่ยวถัดไป + บรรทัดเวลาปัจจุบัน ---------- */
function refreshHighlights() {
var nowm = nowMin();
var next = null; /* เที่ยวถัดไปที่เร็วที่สุดในทุกจุดจอด */
/* เลือกเที่ยวถัดไปของจุดหนึ่ง ๆ
- ถ้ามีเที่ยวที่ยังไม่ผ่านวันนี้ → ใช้ตัวแรกนั้น
- ถ้าหมดทุกเที่ยวของวันแล้ว → วนไปเที่ยวแรกของ "วันถัดไป" (+1440 เพื่อเทียบลำดับข้ามวันได้)
หน้าจอแสดงแค่ HH:MM (ไม่ติดป้าย "พรุ่งนี้" — เจ้าของข้อมูลกำหนด) แต่ไฮไลต์ชิปแบบเดียวกัน */
function pick(sec, idx, m) {
if (idx < 0 || !sec.chips[idx]) return;
sec.chips[idx].classList.add('next');
if (next === null || m < next.m) next = { m: m, time: sec.times[idx], station: sec.station };
}
sections.forEach(function (sec) {
sec.chips.forEach(function (c) { c.classList.remove('next'); });
if (!sec.times.length) return;
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;
}
if (m >= nowm) { pick(sec, i, m); return; }
}
pick(sec, 0, toMin(sec.times[0]) + 1440); /* หมดวัน → เที่ยวแรกพรุ่งนี้ */
});
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;
var nowSegs = [{ icon: 'ic-clock', html: esc(t('check.now')) + ' <b>' + hhmm(nowm) + '</b>' }];
if (next) {
nowSegs.push({ html: esc(t('check.nextAt')) + ' <b>' + esc(next.time) + '</b> ' +
'<span class="mu-zone-at">(' + esc(next.station) + ')</span>' });
} else if (sections.length) {
nowSegs.push({ html: '<b>' + esc(t('check.noMoreToday')) + '</b>' });
}
setSegments(line, nowSegs);
}
/* ---------- โหลด + แสดงผล ---------- */
@@ -212,9 +399,12 @@
Promise.all([
fetchJSON(DATA + 'routes.json'),
fetchJSON(DATA + 'stations.json'),
Schedules.load().then(function (sd) { return Schedules.normSub(sd); })
Schedules.load().then(function (sd) { return Schedules.normSub(sd); }),
fetchJSON(DATA + '8 other_stop.json').catch(function () { return null; }) /* จุดย่อยของ "จุดขึ้นรถอื่นๆ" */
]).then(function (res) {
var routes = (res[0] || {}).routes || [];
OTHER_ENTRIES = (res[3] || {}).other_stop || [];
ROUTE_IDS = routes.map(function (r) { return String(r.route_id); });
var sts = (res[1] || {}).stations || [];
if (window.Schedules && Schedules.setStationNames) Schedules.setStationNames(sts); /* ให้ข้อความ "คำนวณจาก ..." มีชื่อจุด */
var recs = window.Schedules ? Schedules.records(res[2]) : ((res[2] || {}).schedules || res[2] || []);
@@ -248,6 +438,15 @@
var hero = $('check-hero-route');
if (hero) hero.textContent = 'สาย ' + rid + (route.route_name_th ? ' · ' + route.route_name_th : '');
/* "อัปเดตล่าสุด N วันที่แล้ว" — วันที่จากฟิลด์ updated ของไฟล์ตารางสายนี้ (Schedules.updatedOf)
แยกบรรทัดของตัวเอง (#check-updated-line) เพราะ #check-now-line แสดงเวลาปัจจุบันอยู่แล้ว */
var updLine = $('check-updated-line');
if (updLine) {
var upd = (window.Schedules && Schedules.updatedOf) ? Schedules.updatedOf(rid) : null;
var nDays = daysAgo(upd);
updLine.textContent = nDays == null ? '' : t('check.updatedAgo', { ago: agoLabel(nDays) });
}
/* จัดกลุ่มตามลำดับจุดจอดของสาย แล้วต่อด้วยจุดที่เหลือ (ถ้ามีข้อมูล) */
var order = (route.station_ids || []).slice();
/* schema 2: ใช้ station_order ที่ตรวจทิศทางมาแล้วจากไฟล์ (ถ้ามี) */
@@ -257,12 +456,21 @@
if (String(r.route_id) === rid && order.indexOf(r.station_id) === -1) order.push(r.station_id);
});
/* จุดที่เป็น "จุดขึ้นรถประจำทางอื่นๆ" (station 8) ให้ใช้ชื่อจริงของสายนั้น
จาก 8 other_stop.json (จุดแรก) เช่น 954 → "ตลาดท่าช้าง" แทนชื่อกลาง ๆ */
var firstSubName = null;
if (window.OtherStop && OtherStop.allStops) {
var allSub = OtherStop.allStops(OTHER_ENTRIES, rid, ROUTE_IDS);
if (allSub.length) firstSubName = allSub[0].name; /* จุดแรกของจุดย่อย = ชื่อจริงของสายนี้ */
}
var groups = order.map(function (sid) {
var st = byId[sid] || null;
var isOtherHub = String(sid) === '8'; /* จุดรวม "จุดขึ้นรถอื่นๆ" */
return {
sid: sid,
st: st,
name: st ? st.station_name_th : 'จุดจอด ' + sid,
name: isOtherHub && firstSubName ? firstSubName : (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; })
@@ -272,7 +480,12 @@
});
var listEl = $('check-schedule-list');
if (listEl) renderList(listEl, route, groups);
if (listEl) {
renderList(listEl, route, groups);
/* จุดย่อยของสายนั้น (จาก 8 other_stop.json) — จุดที่ 2 เป็นต้นไปของสาย 8
เช่น 2194: ① วัดหัวเวียง ② วัดถนน (เวลาจุดถัดไป = เวลาจุดแรก + offsets_min) */
appendSubStopCards(listEl, rid, groups, res[2], recs);
}
var desc = $('check-zone-desc');
if (desc) {
@@ -280,7 +493,7 @@
/* บอกว่า "ตารางวันนี้" เป็นของวันไหน — เฉพาะสายที่มีการแยกตารางตามวัน (service) เท่านั้น
สายอื่นข้อความเหมือนเดิมทุกตัวอักษร */
/* ป้ายบอกว่า "ตารางที่เห็นอยู่นี้เป็นของวันไหน" — ใช้ผลตรวจวันจากตัวอ่านกลาง (ไม่คำนวณเองในหน้านี้) */
var dayLine = '';
var dayText = '';
if (window.Schedules && Schedules.dayInfo && Schedules.directions) {
var di = Schedules.dayInfo();
var infos = (Schedules.directions(res[2], rid) || []).map(function (d) { return d.service || { from: 'ไม่ระบุ' }; });
@@ -288,17 +501,20 @@
var unknown = infos.some(function (x) { return x.unknown; }); /* ยังไม่ระบุวันเลย */
var selectedByDay = infos.some(function (x) { return x.from === 'service' || x.from === 'ระบุตรง' || x.from === 'คำในโน้ต'; });
if (unknown) {
dayLine = ' · ' + t('check.dayUnknown');
dayText = t('check.dayUnknown');
} else if (conflict) {
dayLine = ' · ' + t('check.dayMixed');
dayText = t('check.dayMixed');
} else if (selectedByDay) {
dayLine = ' · ' + t(di.dayType === 'holiday' ? 'check.dayHoliday' : 'check.dayWeekday') +
dayText = t(di.dayType === 'holiday' ? 'check.dayHoliday' : 'check.dayWeekday') +
' (' + t('check.dayOfWeek') + ' ' + di.weekday_th + ')';
}
}
desc.textContent = 'สาย ' + rid + ' · ' +
(names.length > 1 ? names[0] + ' \u2192 ' + names[names.length - 1] + ' · ' : '') +
groups.length + ' ' + t('check.stopsCount') + dayLine;
/* แยกเป็นชิ้น ๆ เพื่อให้ตัดบรรทัดได้เป็นหน่วย (ไม่ตัดกลางชื่อสถานี/ชื่อวัน) */
var segs = ['สาย ' + rid];
if (names.length > 1) segs.push(names[0] + ' \u2192 ' + names[names.length - 1]);
segs.push(groups.length + ' ' + t('check.stopsCount'));
if (dayText) segs.push(dayText);
setSegments(desc, segs);
}
/* KPI */