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

+13 -7
View File
@@ -26,6 +26,12 @@
var TAPS = 5; /* จำนวนครั้งที่ต้องกดตัวเลข */
var TAP_WINDOW = 2000; /* ต้องกดรัวภายใน 2 วิต่อครั้ง */
/* แปลข้อความ (ถ้าโหลดคำแปลไม่ทัน/ไม่มีคีย์ → ใช้ข้อความไทยที่ฝังไว้) */
function vt(key, fallback) {
var v = (window.I18N && I18N.t) ? I18N.t(key) : key;
return (!v || v === key) ? fallback : v;
}
/* SHA-256 ของรหัสรีเซ็ต — เก็บเฉพาะ hash (ไม่เก็บรหัสจริงในไฟล์นี้) */
var PASS_HASH = '4f23cd6ac8e7da56b92974cd0cf146eee9d995208a6645ed17eba91813c1d323';
@@ -169,13 +175,13 @@
wrap.className = 'mu-vreset';
wrap.innerHTML =
'<div class="mu-vreset-card" role="dialog" aria-modal="true" aria-labelledby="vreset-title">' +
'<h4 id="vreset-title">รีเซ็ตจำนวนผู้เข้าชม</h4>' +
'<label for="vreset-pass">รหัสรีเซ็ต</label>' +
'<h4 id="vreset-title">' + vt('visitors.resetTitle', 'รีเซ็ตจำนวนผู้เข้าชม') + '</h4>' +
'<label for="vreset-pass">' + vt('visitors.resetPass', 'รหัสรีเซ็ต') + '</label>' +
'<input id="vreset-pass" type="password" autocomplete="off" inputmode="text">' +
'<p class="mu-vreset-msg" role="status"></p>' +
'<div class="mu-vreset-row">' +
'<button type="button" class="mu-vreset-cancel">ยกเลิก</button>' +
'<button type="button" class="mu-vreset-ok">รีเซ็ต</button>' +
'<button type="button" class="mu-vreset-cancel">' + vt('visitors.cancel', 'ยกเลิก') + '</button>' +
'<button type="button" class="mu-vreset-ok">' + vt('visitors.confirm', 'รีเซ็ต') + '</button>' +
'</div>' +
'</div>';
@@ -188,14 +194,14 @@
Visitors.resetWith(input.value, function (ok, why) {
if (ok) {
msg.className = 'mu-vreset-msg is-ok';
msg.textContent = 'รีเซ็ตแล้ว — เริ่มนับใหม่จาก 0';
msg.textContent = vt('visitors.done', 'รีเซ็ตแล้ว — เริ่มนับใหม่จาก 0');
input.value = '';
setTimeout(close, 1200);
} else if (why === 'unsupported') {
msg.textContent = 'เบราว์เซอร์ไม่รองรับ — ต้องเปิดผ่าน https หรือ localhost';
msg.textContent = vt('visitors.unsupported', 'เบราว์เซอร์ไม่รองรับ');
} else {
msg.className = 'mu-vreset-msg is-bad';
msg.textContent = 'รหัสไม่ถูกต้อง';
msg.textContent = vt('visitors.badPass', 'รหัสไม่ถูกต้อง');
input.value = '';
input.focus();
}