mock: three search tabs - stop code, place name, near me

- busStop.html: added the third tab (data-mode=near) and its own panel with
  the location button, hint and result area; removed the near button from the
  toolbar and deleted the old on-screen numpad markup
- busStop.search.js: MODE_NEAR in setMode, disables the other panels, hides
  the stop list while ranked results are shown, skips filtering in that mode,
  and removed the dead initNumpad code
- security gate: the tab is revealed only when isSecureContext and
  navigator.geolocation exist; otherwise it stays hidden and the mode is
  refused
- map.js: re-enable the button after a successful lookup
- i18n: stops.modeNear / nearCta / nearHint
- bump SW version to 2026.09.27.98

Verified on localhost:8090 - three tabs, near mode shows a map with 8 ranked
stops, button re-enables and works again, switching back restores the list;
with isSecureContext forced false the tab is hidden and unselectable.
This commit is contained in:
Bkk1234 committed 2026-10-24 00:11:56 +07:00
1 parent 74d605f1c4
commit 750b4a2ea8
25 files changed
+426 -180

No files matched your search

+6 -6
View File
@@ -318,7 +318,7 @@
var head = document.createElement('p');
head.className = 'mu-stop-sub';
head.textContent = (r.direction_label || r.dir_label) || r.direction_note || ('จาก ' + first);
head.textContent = (r.direction_label || r.dir_label) || r.direction_note || t('check.fromName', { name: first });
body.appendChild(head);
var grid = document.createElement('div');
@@ -425,7 +425,7 @@
routes.forEach(function (r) {
var o = document.createElement('option');
o.value = r.route_id;
o.textContent = 'สาย ' + r.route_id + (r.route_name_th ? ' - ' + r.route_name_th : '');
o.textContent = t('common.routePrefix', { n: r.route_id }) + (r.route_name_th ? ' - ' + r.route_name_th : '');
sel.appendChild(o);
});
sel.value = rid;
@@ -436,7 +436,7 @@
/* Hero + คำอธิบายโซน */
var hero = $('check-hero-route');
if (hero) hero.textContent = 'สาย ' + rid + (route.route_name_th ? ' · ' + route.route_name_th : '');
if (hero) hero.textContent = t('common.routePrefix', { n: rid }) + (route.route_name_th ? ' · ' + route.route_name_th : '');
/* "อัปเดตล่าสุด N วันที่แล้ว" — วันที่จากฟิลด์ updated ของไฟล์ตารางสายนี้ (Schedules.updatedOf)
แยกบรรทัดของตัวเอง (#check-updated-line) เพราะ #check-now-line แสดงเวลาปัจจุบันอยู่แล้ว */
@@ -470,7 +470,7 @@
return {
sid: sid,
st: st,
name: isOtherHub && firstSubName ? firstSubName : (st ? st.station_name_th : 'จุดจอด ' + sid),
name: isOtherHub && firstSubName ? firstSubName : (st ? st.station_name_th : t('check.stopNameN', { n: sid })),
city: st ? st.city_th : '',
code: st ? st.station_code : '',
recs: recs.filter(function (r) { return String(r.route_id) === rid && r.station_id === sid; })
@@ -506,11 +506,11 @@
dayText = t('check.dayMixed');
} else if (selectedByDay) {
dayText = t(di.dayType === 'holiday' ? 'check.dayHoliday' : 'check.dayWeekday') +
' (' + t('check.dayOfWeek') + ' ' + di.weekday_th + ')';
' (' + t('check.dayOfWeek') + ' ' + (window.Schedules && Schedules.dayName ? Schedules.dayName(di.weekday) : di.weekday_th) + ')';
}
}
/* แยกเป็นชิ้น ๆ เพื่อให้ตัดบรรทัดได้เป็นหน่วย (ไม่ตัดกลางชื่อสถานี/ชื่อวัน) */
var segs = ['สาย ' + rid];
var segs = [t('common.routePrefix', { n: rid })];
if (names.length > 1) segs.push(names[0] + ' \u2192 ' + names[names.length - 1]);
segs.push(groups.length + ' ' + t('check.stopsCount'));
if (dayText) segs.push(dayText);