pwa: remove floating install-app button

- drop beforeinstallprompt handler + .mu-install-btn markup from ui/pwa.js
- remove .mu-install-btn styles from _shared.css
- drop unused pwa.install i18n key (th/en)
- SW registration/auto-update untouched; VERSION 2026.09.27.107
This commit is contained in:
Bkk1234 committed 2026-11-03 00:20:30 +07:00
1 parent 4acb43ff45
commit 449afb923a
6 files changed
+8 -73

No files matched your search

-25
View File
@@ -494,31 +494,6 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
outline-offset: 2px;
}
/* ---------- ปุ่มติดตั้งแอป (PWA — inject จาก pwa.js) ---------- */
.mu-install-btn {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 100;
display: none; /* โผล่เมื่อ beforeinstallprompt เท่านั้น */
align-items: center;
gap: 8px;
min-height: 48px;
padding: 12px 20px;
border: none;
border-radius: 999px;
cursor: pointer;
font-family: inherit;
font-size: .95rem;
font-weight: 700;
color: #fff;
background: linear-gradient(135deg, #a855f7, #7c3aed);
box-shadow: 0 10px 24px rgba(124, 58, 237, .35);
transition: transform .15s ease;
}
.mu-install-btn:active { transform: translateY(1px); }
.mu-install-btn svg { width: 20px; height: 20px; }
/* =========================================================
Motion — อนิเมชันร่วมทุกหน้า (ไฟล์ JS: ui/motion.js)
---------------------------------------------------------
+5 -5
View File
@@ -12,8 +12,8 @@
<link href="./_shared.css" rel="stylesheet">
<link href="./vendor/leaflet/leaflet.css" rel="stylesheet">
<link href="./map.css" rel="stylesheet">
<meta name="app-version" content="2026.09.27.106">
<link rel="icon" type="image/png" href="../.image/icons/minibus-512x512.png?v=2026.09.27.106">
<meta name="app-version" content="2026.09.27.107">
<link rel="icon" type="image/png" href="../.image/icons/minibus-512x512.png?v=2026.09.27.107">
<style>
.mu-card.empty { width: 100%; padding: 16px; text-align: center; color: #6f7b95; background: #fff7fb; border: 1px dashed #f4c7df; }
a.mu-card { text-decoration: none; color: inherit; display: block; }
@@ -305,7 +305,7 @@
</script>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="apple-touch-icon" href="../.image/icons/minibus-192x192.png?v=2026.09.27.106">
<link rel="apple-touch-icon" href="../.image/icons/minibus-192x192.png?v=2026.09.27.107">
<script src="./imageurl.js" defer></script>
<script src="./pwa.js" defer></script>
<script src="./i18n.js" defer></script>
@@ -411,7 +411,7 @@
<header class="mu-topbar">
<div class="mu-container mu-topbar-inner">
<a class="mu-brand" href="#/" aria-label="Atroute — หน้าแรก" data-i18n-attr="aria-label:aria.brandHome">
<img class="mu-logo-img" src="../.image/icons/minibus-512x512.png?v=2026.09.27.106" alt="Atroute logo" width="44" height="44" decoding="async">
<img class="mu-logo-img" src="../.image/icons/minibus-512x512.png?v=2026.09.27.107" alt="Atroute logo" width="44" height="44" decoding="async">
<span>
<span class="mu-brand-title">Atroute</span>
<span class="mu-brand-subtitle" data-i18n="brand.subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span>
@@ -454,7 +454,7 @@
<div class="mu-footer-grid">
<div class="mu-footer-brand">
<div class="mu-footer-brand-row">
<img src="../.image/icons/minibus-512x512.png?v=2026.09.27.106" alt="Atroute">
<img src="../.image/icons/minibus-512x512.png?v=2026.09.27.107" alt="Atroute">
<div>
<strong>Atroute</strong>
<span data-i18n="brand.subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span>
-1
View File
@@ -334,7 +334,6 @@
"credits.breadHome": "Home",
"credits.breadSelf": "Credits",
"credits.lineRed": "SRT Red Line",
"pwa.install": "Install app",
"aria.brandHome": "Atroute — home",
"aria.mainMenu": "Main menu",
"aria.langSwitch": "Language",
-1
View File
@@ -334,7 +334,6 @@
"credits.breadHome": "หน้าแรก",
"credits.breadSelf": "เครดิต",
"credits.lineRed": "รถไฟฟ้าสายสีแดง",
"pwa.install": "ติดตั้งแอป",
"aria.brandHome": "Atroute — หน้าแรก",
"aria.mainMenu": "เมนูหลัก",
"aria.langSwitch": "ภาษา / Language",
+2 -40
View File
@@ -12,46 +12,8 @@
var CHECK_INTERVAL_MS = 30 * 60 * 1000; // ตรวจอัปเดตทุก 30 นาที
/* ---- ปุ่มติดตั้งแอป (ก่อน install prompt) ---- */
var deferredPrompt = null;
var installBtn = null;
function makeInstallBtn() {
var btn = document.createElement("button");
btn.type = "button";
btn.className = "mu-install-btn";
btn.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/><path d="M12 15V3"/></svg> ' + ((window.I18N && I18N.t) ? I18N.t('pwa.install') : 'ติดตั้งแอป');
btn.addEventListener("click", function () {
if (!deferredPrompt) return;
deferredPrompt.prompt();
deferredPrompt.userChoice.then(function () {
deferredPrompt = null;
if (installBtn) installBtn.style.display = "none";
});
});
document.body.appendChild(btn);
/* เปลี่ยนภาษาแล้ว → อัปเดตข้อความบนปุ่ม */
window.addEventListener('langchange', function () {
if (!installBtn) return;
var svg = installBtn.querySelector('svg');
installBtn.textContent = '';
if (svg) installBtn.appendChild(svg);
installBtn.appendChild(document.createTextNode(
(window.I18N && I18N.t) ? I18N.t('pwa.install') : 'ติดตั้งแอป'));
});
return btn;
}
window.addEventListener("beforeinstallprompt", function (e) {
e.preventDefault();
deferredPrompt = e;
if (!installBtn) installBtn = makeInstallBtn();
installBtn.style.display = "inline-flex";
});
window.addEventListener("appinstalled", function () {
if (installBtn) installBtn.style.display = "none";
});
/* หมายเหตุ: ไม่มีปุ่ม "ติดตั้งแอป" ลอยมุมขวาล่างแล้ว
(ตั้งใจเอาออก — Chrome จะโชว์ไอคอนติดตั้งของเบราว์เซอร์เองตามปกติ) */
window.addEventListener("load", function () {
navigator.serviceWorker
+1 -1
View File
@@ -13,7 +13,7 @@
- ขั้นตอนอัปเดต: ดู AGENTS.md หัวข้อ PWA
============================================================ */
const VERSION = "2026.09.27.106"; // ← bump ทุกครั้งที่แก้ SW เอง
const VERSION = "2026.09.27.107"; // ← bump ทุกครั้งที่แก้ SW เอง
const CACHE = `at-transit-${VERSION}`;
const PRECACHE = [