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 -5
View File
@@ -21,6 +21,7 @@
function $(id) { return document.getElementById(id); }
function t(k, v) { return window.I18N ? I18N.t(k, v) : k; }
function nm(o, base) { return (window.I18N && I18N.name) ? I18N.name(o, base) : ((o && o[base + '_th']) || ''); }
function esc(s) {
return String(s == null ? '' : s).replace(/&/g, '&amp;').replace(/</g, '&lt;')
.replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
@@ -164,7 +165,7 @@
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) {
tryImage(qr, qrUrls(rid, cap), t('route.qrAlt', { n: rid }), function (ok) {
qrBtn.hidden = !ok; /* ไม่มีรูป = ไม่มีปุ่มขยาย */
if (ok) {
var label = (kind ? t('route.link.' + kind.key) : 'LINE Official');
@@ -307,7 +308,7 @@
var img = $('route-vehicle-img');
var card = $('route-vehicle-card');
if (img) {
tryImage(img, vehicleUrls(rid, cap), 'รถของสาย ' + rid, function (ok) {
tryImage(img, vehicleUrls(rid, cap), t('route.vehicleAlt', { n: rid }), function (ok) {
if (card) card.classList.toggle('no-photo', !ok);
});
}
@@ -333,8 +334,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 — ' + t('common.routePrefix', { n: rid }) + (nm(route, 'route_name') ? ' ' + nm(route, 'route_name') : '');
/* dropdown: เติมจาก routes.json (ลำดับตามไฟล์) + เปลี่ยนแล้วไปสายนั้น */
var sel = $('route-select');
@@ -343,7 +344,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 = t('common.routePrefix', { n: r.route_id }) + (nm(r, 'route_name') ? ' - ' + nm(r, 'route_name') : '');
sel.appendChild(o);
});
sel.value = rid;