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

+8 -1
View File
@@ -189,6 +189,11 @@
var DAYS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; /* ตรงกับ Date.getDay() */
var DAY_TH = { sun: 'อาทิตย์', mon: 'จันทร์', tue: 'อังคาร', wed: 'พุธ', thu: 'พฤหัสบดี', fri: 'ศุกร์', sat: 'เสาร์' };
var DAY_ABBR = { sun: 'อา', mon: 'จ', tue: 'อ', wed: 'พ', thu: 'พฤ', fri: 'ศ', sat: 'ส' };
/* ชื่อวันแบบหลายภาษา — ใช้แสดงผลเท่านั้น (การตรวจคำยังใช้ค่าภาษาไทยข้างบน) */
function dayName(key, short) {
var k = 'day.' + key + (short ? 'S' : '');
return (window.I18N && I18N.t) ? I18N.t(k) : (short ? DAY_ABBR[key] : DAY_TH[key]);
}
var DAY_ALIAS = { /* รับได้หลายชื่อ */
weekday: 'weekday', workday: 'weekday', 'วันทำงาน': 'weekday', 'จ-ศ': 'weekday', 'จ–ศ': 'weekday',
holiday: 'holiday', weekend: 'holiday', 'วันหยุด': 'holiday', 'ส-อา': 'holiday', 'ส–อา': 'holiday', 'เสาร์-อาทิตย์': 'holiday',
@@ -214,7 +219,8 @@
var d = date || new Date();
var t = dayTypeOf(d);
return { dayType: t, weekday: DAYS[d.getDay()], weekday_th: DAY_TH[DAYS[d.getDay()]], date: ymd(d),
label_th: t === 'holiday' ? 'วันหยุด (ส–อา/นักขัตฤกษ์)' : 'วันทำงาน (จ–ศ)' };
label_th: t === 'holiday' ? 'วันหยุด (ส–อา/นักขัตฤกษ์)' : 'วันทำงาน (จ–ศ)',
labelKey: t === 'holiday' ? 'dayHoliday' : 'dayWeekday' };
}
/* ตรวจคำในข้อความ (direction_label / direction_note / note) ว่าหมายถึงวันไหน */
function detectDay(text) {
@@ -600,6 +606,7 @@
todayType: todayType,
dayTypeOf: dayTypeOf,
dayInfo: dayInfo,
dayName: dayName,
dayKey: dayKey,
DAYS: DAYS,
DAY_TH: DAY_TH,