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

+17 -2
View File
@@ -75,15 +75,18 @@
el.textContent = t(el.getAttribute('data-i18n'), vars);
});
scope.querySelectorAll('[data-i18n-attr]').forEach(function (el) {
var avars = null;
var an = el.getAttribute('data-i18n-n');
if (an !== null) avars = { n: an };
el.getAttribute('data-i18n-attr').split(',').forEach(function (pair) {
var parts = pair.split(':');
if (parts.length === 2) {
var attr = parts[0].trim();
var key = parts[1].trim();
if (attr === 'html') {
el.innerHTML = t(key);
el.innerHTML = t(key, avars);
} else {
el.setAttribute(attr, t(key));
el.setAttribute(attr, t(key, avars));
}
}
});
@@ -109,8 +112,20 @@
});
}
/* เลือกชื่อเฉพาะตามภาษา: ชื่อฟิลด์ฐาน เช่น 'province_name' → province_name_en / province_name_th
ไม่มีคำแปล = ถอยไปใช้ภาษาไทย (ชื่อเฉพาะไม่บังคับต้องแปล) */
function name(obj, base) {
if (!obj) return '';
var v = obj[base + '_' + current];
if (v != null && v !== '') return v;
var b = obj[base + '_' + BASE];
if (b != null && b !== '') return b;
return obj[base] != null ? obj[base] : '';
}
window.I18N = {
t: t,
name: name,
apply: apply,
setLang: setLang,
getLang: function () { return current; },