Compare commits

...
18 Commits
Author SHA1 Message Date
Bkk1234 b89814a273 chore(gitignore): ignore .vscode และ dev.cmd (launcher เฉพาะเครื่อง) 2026-11-20 08:47:13 +07:00
Bkk1234 82d784963e footer: contact email [email protected]
Replaces the old [email protected] in the SPA shell footer and the static
stop page · VERSION 2026.09.27.129
2026-11-04 22:00:45 +07:00
Bkk1234 679a4e1753 affiliates: add THpostmart + pantip mall partners
Both flagged in_footer_marquee; tile images live in .image/partners (not
tracked). Served copy in web-at-transit is synced from this file.
2026-11-04 21:36:49 +07:00
Bkk1234 d155d479ad dark: make dropdowns readable (select options + pop menus)
- theme.css: form controls inherit color-scheme per theme, and explicit
  dark/light overrides so the native <option> popup is not white-on-white;
  option/optgroup use --c-surface/--c-ink, :checked uses the purple tint
- _shared.css: .mu-pop-panel/.mu-pop-item/.mu-pop-btn carry token fallbacks so
  the theme/lang menus stay readable even if tokens are missing (stale cache)
- VERSION 2026.09.27.128
2026-11-04 02:24:32 +07:00
Bkk1234 14e7ec524f navbar: finish pixel parity with the Next header
- .mu-brand-title 1rem (was 1.05rem in index.html + responsive.css)
- .mu-logo-img radius var(--radius) (8px) and brand gap 8px like Next
- .mu-nav a colour var(--c-info) (Next uses --c-info, mock had --c-ink-2)
- measured at 1600px: credits 1083-1132, CTA 1150-1279, tools 1297-1405 —
  identical to web-at-transit; nav/CTA/tools positions now match exactly
- VERSION 2026.09.27.126
2026-11-04 02:08:13 +07:00
Bkk1234 b6ccb66ce2 check page: add share button (parity with Next) + shared share row styles
- ui/share.js: one handler for all pages (id=share-btn / id=share-status),
  short link = origin+path+hash, navigator.share + clipboard, LINE link,
  re-binds after router swaps the view (MutationObserver), skips buttons that
  a page already bound itself
- checkSchedule.html: share row inside .mu-container (same position as Next)
- _shared.css: .mu-share-* moved here from home.html, values copied from Next
  (ghost button, radius 8, 44px, tokens) so light/dark match
- home.init.js marks its own binding so the shared handler does not double-bind
- index.html + sw PRECACHE: share.js · VERSION 2026.09.27.124
2026-11-04 02:05:47 +07:00
Bkk1234 1adc2a6cd0 navbar: theme icons + CTA order to match Next exactly
- theme.js: icon SVGs now carry width/height 18 (sun / moon / monitor) so the
  icon renders inside the 40px button and switches with the mode
- .mu-topbar-tools { order: 2 } — the CTA now sits right after the credits link
  and the theme/lang tools move to the far right, same visual order as
  web-at-transit (CTA 1144-1273 vs tools 1291-1405 at 1600px)
- icon sizing scoped (#theme-icon svg) so the language chevron stays 12px;
  lang button back to 59px, tools 107px == Next
- VERSION 2026.09.27.123
2026-11-04 01:43:18 +07:00
Bkk1234 eabcff197c navbar: rebuild mock header from the Next implementation (source of truth)
- markup: lang + theme moved into .mu-topbar-tools (theme first, then lang),
  same order as web-at-transit: brand, nav, menu, tools, CTA
- CSS: replaced mock's .mu-lang-*/.mu-theme-* buttons with the Next rules
  (.mu-pop / .mu-pop-btn / .mu-pop-btn-lang / .mu-pop-panel / .mu-pop-item,
  40px tall, radius 8px, surface bg, 44px on coarse pointers)
- lang button keeps short label + 12px chevron; menu items use
  .mu-pop-item-th/.mu-pop-item-en and data-active for the selected row
- nav 0.95rem (was .92rem), header border -> var(--c-border)
- theme.js was never included in the shell (regex missed the versioned src) —
  added after i18n.js + precached with theme.css; that was why the theme menu
  did not open in the previous build
- VERSION 2026.09.27.120
2026-11-04 01:37:50 +07:00
Bkk1234 5800a61da3 theme: align nav colours with the shared tokens (parity with Next)
- .mu-nav a -> var(--c-ink-2), .mu-nav a.active -> var(--c-danger)
  so light and dark render identically in both projects
- VERSION 2026.09.27.116
2026-11-04 01:30:32 +07:00
Bkk1234 cdfd77ffff theme: dark mode + theme tokens (parity with web-at-transit)
- ui/theme.css: token set copied value-for-value from the Next app
  (--c-surface/-ink/-border/-brand/-tint/-glass + radius), light and dark blocks
- ui/theme.js: 3-mode switch (light / dark / auto=prefers-color-scheme) with a
  header dropdown, aria-haspopup/menu, Esc/outside close, live matchMedia listener
- index.html: pre-paint theme script (no flash), theme.css link before _shared.css
- remapped ~290 literal colours in _shared.css/index.html/partials to var(--c-*)
  so both projects render from the same tokens; dark patch block covers the
  remaining decorative gradients
- DESIGN.md: new section 3.2 (theme tokens + where to add colours)
- VERSION 2026.09.27.114
2026-11-04 01:29:37 +07:00
Bkk1234 bea8f0773e header: language dropdown + Thai as default language
- replace the two inline TH/EN buttons with a single dropdown (icon + label +
  caret) mirroring the Next app's LangSwitch: aria-haspopup/expanded,
  menuitemradio + aria-checked, close on Esc/outside, focus management
- i18n.js: default language is Thai (no longer guesses from navigator.language);
  saved choice still wins via at_lang
- bump VERSION 2026.09.27.109
2026-11-04 01:17:32 +07:00
Bkk1234 246b864c06 docs: add ARCHITECTURE.md and refresh README/AGENTS indexes
- ARCHITECTURE.md: end-to-end system doc (no-backend model, file map, boot
  sequence, routing, JSON data layer, shared engines, cache/update pipeline,
  analytics privacy model, failure modes, extension recipes, test checklist)
- README: doc map + 6-line how-it-works + release/verification commands
- AGENTS: doc index, analytics rules, auto-update rule; drop the outdated
  'ask users to press Ctrl+Shift+R' instruction
2026-11-04 00:19:24 +07:00
Bkk1234 fcdab3ac80 pwa: automatic update UX - no more hard refresh
- ui/version.json: server-side version marker, polled by pwa.js (load, 5 min,
  tab focus, network online); mismatch -> toast + auto reload once per version
- pwa.js: silent reload when tab hidden, guarded reload (sessionStorage) so a
  partial deploy cannot loop, ATUpdate.check() exposed for testing
- _shared.css: .mu-update-toast pill (bottom center, reduced-motion aware)
- shell js/css get ?v=<version> automatically (bump-version.py) so HTTP cache
  cannot serve stale files before the service worker takes control
- sw: cache fallback now ignores query string (precache still matches ?v= URLs)
- bump-version.py: writes version.json + verifies it in --check
- VERSION 2026.09.27.108
2026-11-03 00:32:41 +07:00
Bkk1234 449afb923a 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
2026-11-03 00:20:30 +07:00
Bkk1234 4acb43ff45 footer: remove visitor counter (12,834) and its reset dialog
- drop .mu-visitor markup + styles from ui/index.html
- delete ui/visitors.js (unused), remove from shell + sw PRECACHE
- drop unused visitors.* i18n keys (th/en)
- VERSION 2026.09.27.106
2026-11-03 00:15:54 +07:00
Bkk1234 2504c39305 analytics: privacy-first search stats (Umami-style), #/stats page
- ui/analytics.js: cookie-less local-first tracker (localStorage), DNT/GPC
  honoured, opt-out switch, term sanitiser (email/@handle/long digits stripped),
  900ms debounce, caps 300 terms / 200 views / 120 days
- optional Umami-compatible beacon (window.AT_ANALYTICS endpoint+siteId),
  disabled by default: no third-party requests unless the owner configures it
- #/stats view: KPIs, 14-day CSS bar chart, top terms, top route/stop pages,
  no-result terms, privacy panel, JSON export, clear, opt-out
- hooks: busStop search apply(), stopDetail route filter, hashchange pageviews
- i18n th/en (395 keys each), credits section, sw.js precache + VERSION 2026.09.27.105
2026-11-03 00:07:57 +07:00
Bkk1234 5381e0690a ui: add shared motion layer (page enter, scroll reveal, loading bar)
- ui/motion.js: Motion.enter/scan/loading, IntersectionObserver reveal with
  sweep fallback for jump-scroll, hidden tab and late-rendered cards
- _shared.css: --mu-ease token, .mu-loadbar, #view.mu-view-in, .mu-reveal
- router.js: start/stop loading bar, replay enter animation per view
- reduced-motion disables everything; maps are never transformed
- sw.js: precache motion.js, VERSION 2026.09.27.104
2026-11-02 23:56:16 +07:00
Bkk1234 ba5f4fd887 about/blog: revised copy for text2/3/4 and text5/7 2026-10-24 13:51:10 +07:00
43 changed files with 2941 additions and 742 deletions

No files matched your search

+7
View File
@@ -3,3 +3,10 @@
# ไฟล์ขยะ macOS # ไฟล์ขยะ macOS
.DS_Store .DS_Store
# editor / os
.vscode/
.idea/
# launcher เฉพาะเครื่องนี้ (path D:\Git\bin\dev-server.ps1)
dev.cmd
+63 -1
View File
@@ -9,6 +9,19 @@
อ่านไฟล์นี้ก่อนทำงานเสมอ เพื่อประหยัด token อย่าเดาโครงสร้าง อ่านไฟล์นี้ก่อนทำงานเสมอ เพื่อประหยัด token อย่าเดาโครงสร้าง
## แผนที่เอกสาร (อ่านตามงาน)
| งาน | เอกสาร |
|---|---|
| เข้าใจระบบทั้งหมด (boot, routing, data layer, engines, cache, analytics, recipes) | **`ARCHITECTURE.md`** ← ละเอียดที่สุด |
| กฎการแก้โค้ด / ห้ามทำอะไร | ไฟล์นี้ (`AGENTS.md`) |
| สี ฟอนต์ ระยะ กฎดีไซน์ | `DESIGN.md` (รัฐธรรมนูญ — แก้ก่อนเขียนโค้ด) |
| ข้อมูลเส้นทางจาก QGIS | `resource/data/QGIS Project/GeoJSON-2/README.md` |
| schema บทความ / หน้าเกี่ยวกับ | `ui/partials/blog-data/README.md` · `about-data/README.md` |
| ภาพรวมโปรเจกต์ + วิธีรัน | `README.md` |
> ถ้าเอกสารขัดกัน: `DESIGN.md` ชนะเรื่องหน้าตา · `AGENTS.md` ชนะเรื่องวิธีแก้โค้ด · `ARCHITECTURE.md` ชนะเรื่อง "ระบบทำงานยังไง" (ต้องอัปเดตให้ตรงโค้ดเสมอ)
--- ---
## โครงสร้าง ## โครงสร้าง
@@ -130,6 +143,54 @@ python -m http.server 8090 # เปิด http://localhost:8090/ui/index.
- `.gitignore` ว่างเปล่า — ถ้าเพิ่มไฟล์ขยะ (เช่น .DS_Store) ให้เพิ่มใน .gitignore - `.gitignore` ว่างเปล่า — ถ้าเพิ่มไฟล์ขยะ (เช่น .DS_Store) ให้เพิ่มใน .gitignore
- งานถัดไปที่คาดว่าเกี่ยวข้อง: นำดีไซน์นี้ไป implement ใน `web-at-transit` (Next.js) - งานถัดไปที่คาดว่าเกี่ยวข้อง: นำดีไซน์นี้ไป implement ใน `web-at-transit` (Next.js)
## การเคลื่อนไหว (ui/motion.js) — อนิเมชันร่วมทุกหน้า
**ไฟล์:** `ui/motion.js` (โหลดใน `index.html` ก่อน `router.js`) + CSS ท้าย `_shared.css` (`.mu-loadbar`, `#view.mu-view-in`, `.mu-reveal`)
**สเปก/โทเคน:** `DESIGN.md §8` — อย่าคิดระยะเวลาใหม่เอง
| ทำอะไร | เรียกจากไหน |
|---|---|
| แถบโหลดบางบนสุดระหว่าง fetch partial | `router.js` → `Motion.loading(true/false)` |
| หน้าใหม่ค่อย ๆ โผล่ (fade + 10px) | `router.js` → `Motion.enter(viewEl)` หลัง inject |
| การ์ดโผล่ตอนเลื่อน | อัตโนมัติ: `scan()` ใน `#view` + `MutationObserver` (การ์ดจาก JSON ก็ได้) |
**กติกา**
- อนิเมตเฉพาะ `opacity` + `transform` · ห้าม width/height/top/left
- **ห้าม**ใส่ `.mu-reveal` ให้อิลิเมนต์ที่ครอบแผนที่ (`.at-map`, `.leaflet-container`, `.blog-mapx`) — ใส่ `data-no-reveal` ถ้าต้องการยกเว้นเอง
- ของที่เห็นบนจอตอนโหลดไม่ถูกอนิเมต · หลังจบจะลบ class ทิ้ง (hover lift เดิมไม่เพี้ยน)
- `prefers-reduced-motion: reduce` → ปิดทั้งหมด (ทั้ง JS และ CSS)
- เพิ่มหน้าใหม่: ไม่ต้องแก้อะไร (router + observer จัดการ) — เพียงใช้คลาสการ์ดเดิม (`mu-card`, `mu-stop-card`, `mu-zone`, `mu-summary`, `mu-stat`, …)
- อย่าลืม `./motion.js` ใน `PRECACHE` ของ `sw.js` (มีแล้ว) และ bump `VERSION` เมื่อแก้ SW
## สถิติ (ui/analytics.js + หน้า #/stats) — privacy-first แบบ Umami
**แนวคิด:** อิง Umami (MIT) — ไม่มีคุกกี้/ไม่มี fingerprint/ไม่เก็บ IP-UA แต่ repo นี้ไม่มี backend
จึงเก็บรวมในเครื่อง (localStorage) เป็นค่าเริ่มต้น และ **ไม่ส่งออกเน็ตเลย**
| เก็บ | ไม่เก็บ |
|---|---|
| จำนวนเปิดหน้า/วัน · คำค้น (ทำให้ปลอดภัยแล้ว) + จำนวน + เวลาล่าสุด · คำที่ค้นไม่พบ · views ของ route/stop | IP · UA · พิกัด · คุกกี้ · รหัสเครื่อง · ประวัติข้ามเว็บ · ไม่มีรหัสผู้ใช้ถาวร |
**กติกา**
1. คำค้นต้องผ่าน `cleanTerm()` เสมอ (ตัดอีเมล · @handle · เลขยาว ≥5 หลัก · cap 60 ตัวอักษร · คำ <2 ตัวไม่เก็บ)
2. `Analytics.search()` **debounce 900ms ในตัว** — เรียกได้ทุกครั้งที่ผลค้นเปลี่ยน ไม่ต้อง debounce เอง
3. เคารพ `Do Not Track` + `Global Privacy Control` + สวิตช์ในหน้า `#/stats` (`at_stats_optout`)
4. **ห้ามเพิ่มคุกกี้/สคริปต์ภายนอก** — ถ้าต้องการเซิร์ฟเวอร์ให้ตั้ง `window.AT_ANALYTICS = {endpoint, siteId}`
ชี้ Umami ของตัวเอง (payload ตรงสเปก `/api/send`) อย่าเขียน endpoint ใหม่
5. เพดานกัน localStorage บวม: 300 คำ · 200 หน้า · 120 วัน · หน้าใหม่เรียกแค่ `search()` / `view()` (pageview ผูก hashchange แล้ว)
## อัปเดตเวอร์ชัน — ผู้ใช้ไม่ต้องกด Ctrl+Shift+R (ทั้งคอมและมือถือ)
```
python resource/tools/bump-version.py # คำสั่งเดียวจบ
python resource/tools/bump-version.py --check # ต้อง ✓ ทุกบรรทัด
```
คำสั่งเดียวอัปเดตครบ: `sw.js VERSION` · `meta app-version` · โลโก้ `?v=` · **shell js/css `?v=`** · **`ui/version.json`**
`ui/pwa.js` ตรวจ `version.json` (เปิดหน้า · ทุก 5 นาที · กลับมาที่แท็บ · เน็ตกลับมา) แล้วขึ้น toast + รีโหลดเอง
(รีโหลดครั้งเดียวต่อเวอร์ชัน — กันลูป) · แท็บถูกซ่อน = รีโหลดเงียบ
**กติกา:** เพิ่ม/ลบไฟล์ใน `PRECACHE` หรือแก้ `sw.js` = ต้อง bump · แก้รูปทับชื่อเดิม = ต้อง bump
## หน้ารายละเอียดป้าย `#/stops/<รหัสป้าย>` — ข้อมูลมาจากไหน ## หน้ารายละเอียดป้าย `#/stops/<รหัสป้าย>` — ข้อมูลมาจากไหน
หน้า `ui/partials/stopDetail.html` เป็น "โครงเปล่า" ล้วน ๆ (มีแต่ `<style>` + element ที่มี id) หน้า `ui/partials/stopDetail.html` เป็น "โครงเปล่า" ล้วน ๆ (มีแต่ `<style>` + element ที่มี id)
@@ -430,6 +491,7 @@ WARN = ค่าว่างเปล่า (อาจตั้งใจ) · ค
``` ```
python resource/tools/bump-version.py ← +1 รอบ (อัปเดต sw.js + meta + โลโก้ ให้ตรงกัน) python resource/tools/bump-version.py ← +1 รอบ (อัปเดต sw.js + meta + โลโก้ ให้ตรงกัน)
python resource/tools/bump-version.py --check ← ตรวจว่าทุกที่ตรงกัน python resource/tools/bump-version.py --check ← ตรวจว่าทุกที่ตรงกัน
→ ให้ผู้ใช้กด Ctrl+Shift+R ครั้งเดียว = รูปทั้งหมดโหลดใหม่ → **ไม่ต้องให้ผู้ใช้กดอะไร**: `pwa.js` เทียบ `version.json` กับ `meta app-version` แล้วรีโหลดเอง
(ดู `ARCHITECTURE.md` §7) · ใช้ Ctrl+Shift+R เฉพาะตอนพัฒนาเครื่องตัวเอง
``` ```
⚠️ รูปที่เพิ่ม "ชื่อใหม่" (ไม่ทับของเดิม) เห็นผลทันที ไม่ต้อง bump ⚠️ รูปที่เพิ่ม "ชื่อใหม่" (ไม่ทับของเดิม) เห็นผลทันที ไม่ต้อง bump
+337
View File
@@ -0,0 +1,337 @@
# ARCHITECTURE.md — สถาปัตยกรรม Atroute (web-at-transit-mock)
> เอกสารนี้ตอบคำถาม "ระบบนี้ทำงานยังไง" ทั้งฝั่งที่รันในเบราว์เซอร์ (frontend)
> และฝั่งเซิร์ฟเวอร์/ข้อมูล (ที่ repo นี้เรียกว่า backend แต่จริง ๆ ไม่มีโค้ดเซิร์ฟเวอร์)
> อ่านคู่กับ `AGENTS.md` (กฎการแก้โค้ด) และ `DESIGN.md` (กฎการออกแบบ)
---
## 0. อ่านอะไรก่อน
| อยากทำอะไร | อ่าน |
|---|---|
| แก้หน้าเว็บ/เพิ่ม view | `AGENTS.md` → §โครงสร้าง, §การเคลื่อนไหว, เอกสารนี้ §4–§6 |
| เปลี่ยนสี/ฟอนต์/สไตล์ | `DESIGN.md` (เป็นรัฐธรรมนูญ — แก้ก่อนเขียนโค้ด) |
| เพิ่ม/แก้ข้อมูลเส้นทาง | เอกสารนี้ §5 + `resource/data/QGIS Project/GeoJSON-2/README.md` |
| ปล่อยเวอร์ชันใหม่ | เอกสารนี้ §7 (`bump-version.py`) |
| ตรวจว่างานไม่พัง | เอกสารนี้ §12 (checklist) |
---
## 1. ภาพรวม — "backend" ของโปรเจกต์นี้คืออะไร
repo นี้เป็น **static site**: ไม่มี Node/PHP/DB ไม่มี build step
สิ่งที่ทำหน้าที่แทน backend แบ่งเป็น 4 อย่าง:
```
┌──────────────────────────── เบราว์เซอร์ผู้ใช้ ────────────────────────────┐
│ index.html (shell) │
│ └─ router.js ─ fetch partials/*.html ─┐ │
│ └─ <script> ใน partial (init) │ │
│ └─ fetch ../resource/data/*.json │
│ localStorage: at_stats_v1 · at_route_hits · at_reload_for │
│ Service Worker (sw.js): cache precache + network-first │
└───────────────▲──────────────────────────────────────────▲──────────────┘
│ HTTP GET (static files) │ (ถ้าตั้ง Umami)
┌───────────────┴───────────────┐ ┌────────────┴─────────────┐
│ static host / `make serve` │ │ Umami (ไม่บังคับ) │
│ ui/** resource/data/** │ │ POST /api/send │
└───────────────▲───────────────┘ └──────────────────────────┘
│ git push (Gitea)
┌───────────────┴──────────────────────────────────────────────────────────┐
│ offline pipeline: resource/tools/*.py (QGIS → geojson, km, version, i18n)│
│ inputs: resource/data/QGIS Project/*.shp|gpkg, scheduleslist/*.json │
└──────────────────────────────────────────────────────────────────────────┘
```
| หน้าที่ของ backend ปกติ | อะไรทำแทนใน repo นี้ |
|---|---|
| routing / template | `ui/router.js` (hash router) + `ui/partials/*.html` |
| API / query | `fetch()` ไฟล์ JSON ตรง ๆ (`resource/data/`) |
| session / บัญชีผู้ใช้ | ไม่มีเลย — ไม่มีล็อกอิน ไม่มีคุกกี้ |
| ฐานข้อมูล | ไฟล์ JSON ใน git (เจ้าของแก้มือ + เครื่องมือ Python ช่วย) |
| cache/CDN | Service Worker (`ui/sw.js`) + `?v=` cache busting |
| analytics | `ui/analytics.js` (local-first, ไม่มีเซิร์ฟเวอร์ — §8) |
| cron / batch | รันมือ: `python resource/tools/*.py` |
| deploy | `git push` ขึ้น Gitea แล้ว serve โฟลเดอร์เดิม |
**ผลที่ตามมา (สำคัญต่อการออกแบบ):** ทุกอย่างที่ปกติเก็บใน DB ต้องอยู่ใน JSON หรือ localStorage
และทุกฟีเจอร์ต้องทำงานได้แม้ไม่มีเน็ต (SW cache) — นี่คือเหตุผลของ pattern หลายอย่างในเอกสารนี้
---
## 2. แผนที่ไฟล์และหน้าที่
```
ui/
├── index.html shell เดียวของทั้งเว็บ: topbar/footer + <div id="view">
├── router.js hash router: VIEWS + parseHash + inject partial + exec script
├── partials/ view ละไฟล์ (HTML + <style> + <script src> ของตัวเอง)
│ ├── home.html / home.init.js #/ หน้าแรก + marquee + route selector
│ ├── busStop.html / busStop.init.js #/stops รายการป้าย + รูป + ชิปสาย
│ │ busStop.search.js โหมดค้นหา (รหัส/ชื่อ/ใกล้ฉัน)
│ ├── busDetail.html / busDetail.init.js #/routes รายละเอียดสาย + แผนที่ + QR
│ ├── checkSchedule.html / checkSchedule.init.js #/check ตารางเวลาตามจุดจอด
│ ├── stopDetail.html / stopDetail.init.js #/stops/:code ป้ายเดียว + เวลารถ + แผนที่
│ ├── blog.html / blog.init.js #/blog, #/blog/:id
│ ├── about.html / about.init.js #/about
│ ├── credits.html #/credits
│ ├── stats.html / stats.init.js #/stats (สถิติในเครื่อง — §8)
│ ├── schedules.js ★ ท่อกลางอ่านตารางเดินรถ (ทุกหน้าเรียกตัวนี้)
│ ├── otherStop.js ท่อกลาง "จุดขึ้นรถประจำทางอื่นๆ" (station_id 8)
│ └── icons-sprite.svg Lucide sprite (<symbol id="ic-*">)
├── _shared.css สไตล์ร่วมทุกหน้า + motion + toast
├── responsive.css mobile-first layer (base 375px, ขยายที่ 480/640/768/1024/1280/1600)
├── map.css / map.js Leaflet wrapper (ATMap) — ห้ามให้ CSS ภายนอกคุมขนาด svg
├── i18n.js + locales/ ระบบภาษา (th = base, en) — §6
├── motion.js page enter + scroll reveal + loading bar
├── analytics.js สถิติการค้นหาแบบไม่ระบุตัวตน
├── popular.js อันดับ "สายที่เปิดดูบ่อย" (footer)
├── imageurl.js ImgURL.of(url) → เติม ?v=<app-version>
├── pwa.js SW register + auto-update (version.json)
├── sw.js Service Worker: precache + network-first/cache-first
├── version.json เวอร์ชันฝั่งเซิร์ฟเวอร์ (ให้ pwa.js เทียบ)
└── manifest.json PWA manifest
resource/data/ ← "ฐานข้อมูล" ของเว็บ (ดู §5)
resource/tools/ ← สคริปต์ดูแลข้อมูล/เวอร์ชัน (รันมือ ไม่ใช่ build step)
.image/ ← รูปทั้งหมด (ไม่อยู่ใน git; มาจาก resource/images.zip)
```
---
## 3. Boot sequence — เปิดหน้าแรกเกิดอะไรขึ้น
```
1. GET /ui/index.html
└─ <link> k2d.css, _shared.css, leaflet.css, map.css, responsive.css
└─ inline <script> window.AT_ANALYTICS = {...}
└─ <script defer> imageurl → pwa → i18n → analytics → popular → leaflet
→ map → schedules.js → otherStop → motion → router
2. router.js (defer) รอ I18N.ready → render()
3. render(): parseHash() → VIEWS[name]
├─ fetch('partials/<view>.html', {cache:'no-store'})
├─ view.innerHTML = html
├─ execScripts(view) ← <script> ที่ inject ต้องสร้าง element ใหม่
├─ I18N.apply() ← แปลทุก [data-i18n]
├─ setNavActive() · document.title · scrollTo(0,0)
└─ Motion.enter(#view) ← page enter + เริ่ม scan reveal
4. <script> ของ partial (init) รัน → fetch JSON → วาดการ์ด
└─ MutationObserver ใน motion.js เห็น node ใหม่ → scan reveal อีกครั้ง
```
จุดที่พลาดบ่อย: **สคริปต์ใน partial ทำงานก่อน `I18N.apply()`** ของรอบนั้นเสมอ — ถ้าจะสร้างข้อความ
ต้องใช้ `I18N.t()` ตั้งแต่ต้น (หรือฟัง event `langchange` — router จะ re-render ให้อยู่แล้ว)
---
## 4. Routing
| hash | view | params | ไฟล์ |
|---|---|---|---|
| `#/` | home | — | `partials/home.html` |
| `#/stops` | stops | — | `partials/busStop.html` |
| `#/stops/:code` | stop | `{code}`, query `?route=<id>` | `partials/stopDetail.html` |
| `#/routes` | routes | — | `partials/busDetail.html` |
| `#/routes/:id` | routes | `{routeId}` | `partials/busDetail.html` |
| `#/check`, `#/check/:id` | check | `{routeId}` | `partials/checkSchedule.html` |
| `#/blog`, `#/blog/:id` | blog | `{postId}` | `partials/blog.html` |
| `#/about` · `#/credits` · `#/stats` | — | — | ตามชื่อ |
กติกา:
1. ลิงก์ภายในทั้งหมดเป็น `href="#/..."` — ห้าม `./x.html` (จะโหลดหน้าใหม่)
2. พารามิเตอร์อ่านจาก `window.__route` (router ตั้งให้ก่อนสคริปต์รัน)
3. `lastKey` กัน render ซ้ำ hash เดิม — `langchange` จะล้าง `lastKey` แล้ว render ใหม่
4. เพิ่มหน้าใหม่ = สร้าง `partials/<view>.html` + เพิ่มใน `VIEWS` + `parseHash()`
---
## 5. Data layer — JSON คือฐานข้อมูล
| ไฟล์ | โครงสร้าง | ใช้ที่ |
|---|---|---|
| `routes.json` | `{routes:[{route_id, route_name_th, route_group, web_url, …}]}` | home, busDetail, check, popular |
| `stations.json` | `{stations:[{station_id, station_code, station_name_th, lat, lng, photo?, facilities?, landmarks?}]}` | stopDetail, check, map |
| `schedules.json` | **schema 2**: `{schema:2, index:true, routes:[{route_id, file}]}` → ไฟล์จริง `scheduleslist/schedules<id>.json` | `partials/schedules.js` (ท่อกลาง) |
| `scheduleslist/schedules<id>.json` | `{route_id, directions:[{direction_id, direction_label, service?, days?, stops:[{station_id, km, times[], derive?, groups?}]}]}` | 同上 |
| `busstop_list.json` | array 154 รายการ ป้ายริมทาง (`kilometer`, `latitude`, …) | busStop (รูป + ระยะ) |
| `stop-km.json` | `{route_id: {station_id: km}}` (generated) | autoTimes / check |
| `holidays.json` | `{holidays:[{date, name}]}` — เจ้าของกรอกเอง ห้ามเดา | engine วัน |
| `route_groups.json` | นิยามหมวดเส้นทาง (สี chip) | busDetail |
| `provinces.json` · `affiliates.json` · `captions/` | ตัวช่วยแสดงผล/สปอนเซอร์/แคปชัน | home, credits |
| `geojson-web/*.geojson` | เส้นทางจริง (WGS84) — **generated จาก QGIS** | `ui/map.js` |
**ท่อข้อมูล (แก้ที่ต้นทางเสมอ):**
```
QGIS Project/*.shp|gpkg ──(qgis-to-web.py)──▶ geojson-web/*.geojson
scheduleslist/*.json ──(merge-schedules.py / schedules-to-grouped.py)──▶ schedules.json (schema 2)
geojson-web/*.geojson ──(stop-km.py)──▶ stop-km.json
derive-times.csv ──(derive-times.py)──▶ เติม derive{} ในไฟล์สาย
```
กฎเหล็ก: **ห้ามแก้ไฟล์ที่ขึ้น "(generated)" ด้วยมือ** — แก้ input แล้วรันสคริปต์ซ้ำ
(สคริปต์ทุกตัวมี `--check` / `--list` ให้ดูก่อนเขียน)
### 5.1 เครื่องยนต์วัน (day engine) — อยู่ใน `schedules.js` ที่เดียว
ลำดับตัดสิน: `days[]` → `service: weekday|holiday` → ตรวจคำใน label/note → ไม่ระบุ = แสดงทุกวัน
ถ้ากรองแล้วไม่มีทิศเหลือ → ถอยไปแสดงทั้งหมด + ธง `fallback` (หน้าเว็บห้ามว่าง)
นักขัตฤกษ์อ่านจาก `holidays.json` เท่านั้น
### 5.2 autoTimes / derive — เวลาที่ไม่ได้กรอก
- `autoTimes: true` + `speedKmh` → คำนวณจากจุดที่มีเวลาจริง + ระยะทาง (`stop-km.json`)
- `derive: {from_station_id, offset_min}` → เวลาจุดนั้น = เวลาจุดอ้างอิง ± n นาที
- ทั้งคู่ **ไม่ถูกเขียนกลับลง JSON** — คำนวณสดทุกครั้ง และแสดงด้วยกรอบเส้นประ + ข้อความ "ประมาณ"
---
## 6. Shared engines (frontend modules)
| module | ไฟล์ | API หลัก | ใครเรียก |
|---|---|---|---|
| Router | `ui/router.js` | `render()`, `window.__route` | shell |
| i18n | `ui/i18n.js` | `t(key, vars)` · `apply()` · `setLang()` · `ready` | ทุกหน้า |
| Schedules | `partials/schedules.js` | `records/route/directions/times/countTrips/dayInfo/serviceOf/…` | check, busDetail, home, stopDetail |
| OtherStop | `partials/otherStop.js` | `load()` · `forRoute()` · `allStops()` · `forStation()` (รองรับรหัสเพี้ยนสลับหลัก) | schedules, checkSchedule, stopDetail |
| Map | `ui/map.js` (ATMap) | `route(id)` · `forStop(el, code)` · `proposal(el, spec, onPick)` · `nearMe` | busDetail, stopDetail, blog, busStop |
| Motion | `ui/motion.js` | `enter(el)` · `scan()` · `loading(bool)` | router, ทุกหน้า (auto) |
| Analytics | `ui/analytics.js` | `search({q,scope,results})` · `pageview()` · `view()` · `report()` · `optOut()` | busStop.search, stopDetail, pwa(hashchange) |
| Popular | `ui/popular.js` | `hit(id)` · `ranked(n)` · `mount(ul, routes)` | router (footer) |
| ImgURL | `ui/imageurl.js` | `of(url)` → เติม `?v=` | ทุกที่ที่แสดงรูป |
| PWA | `ui/pwa.js` | SW register + `ATUpdate.check()` | shell |
**หลักการ:** ตรรกะที่ใช้ร่วมกันต้องอยู่ในไฟล์กลางไฟล์เดียว (Schedules/OtherStop/ATMap)
ห้าม copy ไปไว้ในหน้า — จะทำให้หน้าต่าง ๆ แสดงผลไม่ตรงกัน
---
## 7. Cache & การปล่อยเวอร์ชันใหม่ (ไม่มีใครต้องกด Ctrl+Shift+R)
```
ผู้ใช้เปิดเว็บ
├─ 1. index.html โหลด shell ด้วย ?v=<version> → HTTP cache เห็นเป็นไฟล์ใหม่
│ (bump-version.py เติมให้ทุกครั้งที่ปล่อยเวอร์ชัน)
├─ 2. SW: HTML/CSS/JS/JSON = network-first (cache:"no-store")
│ รูป/ฟอนต์ = cache-first · ออฟไลน์ fallback = offline.html
├─ 3. pwa.js: reg.update() ทุกเปิดหน้า + ทุก 30 นาที
└─ 4. pwa.js: fetch version.json ทุก 5 นาที / กลับมาที่แท็บ / เน็ตกลับมา
└─ version ≠ meta app-version → toast "กำลังอัปเดต…" → reload ครั้งเดียว/เวอร์ชัน
```
**ขั้นตอนปล่อยเวอร์ชัน (คำสั่งเดียว):**
```bash
python resource/tools/bump-version.py # sw.js VERSION + meta + ?v= (รูป/shell) + version.json
python resource/tools/bump-version.py --check # ต้องขึ้น ✓ ทุกบรรทัด
```
กติกา: แก้ `sw.js` เอง → ต้อง bump · เพิ่ม/ลบไฟล์ใน `PRECACHE` → ต้อง bump
· แก้รูปทับชื่อเดิม → ต้อง bump (ไม่งั้น cache-first คืนของเก่า)
---
## 8. สถิติ (analytics) — privacy-first แบบ Umami
```
ผู้ใช้ค้นหา → Analytics.search({q, scope, results})
├─ cleanTerm(): ตัดอีเมล · @handle · เลข ≥5 หลัก · cap 60 ตัวอักษร · คำ <2 ตัวไม่เก็บ
├─ debounce 900ms → 1 คำต่อการพิมพ์หนึ่งครั้ง
├─ localStorage at_stats_v1: days{pv,q,nores} · terms{q:[n,ts]} · empty · views{kind:id:[n,ts]}
└─ ถ้าตั้ง window.AT_ANALYTICS = {endpoint, siteId} → POST <endpoint>/api/send (สเปก Umami)
เกตความเป็นส่วนตัว: DNT · Global Privacy Control · สวิตช์ opt-out (at_stats_optout)
```
- ค่าเริ่มต้น **ไม่ส่งออกเน็ตเลย** (endpoint ว่าง) — ตัวเลขเป็นของเครื่องผู้ใช้แต่ละคน
- หน้า `#/stats` อ่านผ่าน `Analytics.report()` — มี KPI, กราฟ 14 วัน, top คำค้น, top หน้า,
"ค้นแล้วไม่พบ", ดาวน์โหลด JSON, ล้างข้อมูล
- เพดานกัน localStorage บวม: 300 คำ · 200 หน้า · 120 วัน
---
## 9. Failure modes & fallbacks (ออกแบบไว้แล้ว — ห้ามทำให้พังกว่าเดิม)
| สถานการณ์ | ระบบทำอะไร |
|---|---|
| ออฟไลน์ | SW precache + offline.html · หน้าเดิมยังเปิดได้ |
| `fetch` partial/JSON ล้มเหลว | router แสดงข้อความ `router.loadFail` (ไม่จอขาว) |
| ไม่มีไฟล์รูป (jpg/jpeg/webp/png) | ไล่ลองนามสกุล → ไม่มีเลย = ไม่แสดง `<img>` (ไม่เหลือช่องว่าง) |
| กรองตามวันแล้วไม่มีทิศ | ถอยไปแสดงทุกวัน + ธง `fallback` |
| ไม่มี geojson ของสาย | คงพื้นที่แผนที่ + ป้าย `blog.noGeo` |
| คำแปลขาด | `t()` คืน key เดิม (เห็นชัดว่าลืม) · `apply()` ไม่แตะ DOM ถ้าโหลดไฟล์ภาษาไม่ได้ |
| เบราว์เซอร์เก่าไม่มี SW/IO | ฟีเจอร์นั้นข้ามไป · เนื้อหายังอ่านได้ (JS ไม่ซ่อนอะไรถาวร) |
---
## 10. สูตรขยายงาน (recipes)
**เพิ่มหน้าใหม่**
1. `ui/partials/<view>.html` (+ `<style>` และ `<script src="./partials/<view>.init.js">` ท้ายไฟล์)
2. `ui/router.js`: เพิ่มใน `VIEWS` + `parseHash()`
3. ข้อความทุกชิ้นใส่ `data-i18n="…"` + เติมคีย์ใน `locales/th.json` และ `en.json`
4. `ui/sw.js` `PRECACHE` + `python resource/tools/bump-version.py`
**เพิ่มคำแปล**
1. เติมคีย์เดียวกันใน `th.json` และ `en.json` (ไฟล์เดียวต่อภาษา)
2. `python resource/tools/check-i18n.py` → ต้องไม่ ERROR
**เพิ่มไอคอน**: ดาวน์โหลดจาก lucide.dev → `.image/icons/lucide/` → เพิ่ม `<symbol id="ic-...">`
ใน `partials/icons-sprite.svg` → อัปเดตรายการใน `#/credits`
**เพิ่ม/แก้เส้นทาง**
1. แก้ shapefile ใน QGIS แล้ว `python resource/tools/qgis-to-web.py` (ห้ามแก้ geojson มือ)
2. แก้ตารางเวลาใน `resource/data/scheduleslist/schedules<id>.json` (หรือ GUI `schedules-editor.html`)
3. `python resource/tools/stop-km.py` ถ้าพิกัด/เส้นเปลี่ยน → `audit-geojson.py` ตรวจสุขภาพข้อมูล
**เพิ่มบทความ** → `ui/partials/blog-data/textN.json` (schema ใน `blog-data/README.md`)
---
## 11. Performance notes
- รูป: `loading="lazy"` + `ImgURL.of()` · รูปป้าย/สถานี hydrate เฉพาะใบที่มองเห็น (`StopsRender.hydrate`)
- Reveal ใช้เฉพาะ `opacity`/`transform` (ไม่เกิด CLS) · เคลียร์ class หลังอนิเมชันจบ
- Leaflet โหลดเฉพาะหน้าที่มีแผนที่ และห้ามให้ CSS ภายนอกกำหนดขนาด `svg.leaflet-zoom-animated`
- ฟอนต์ K2D ฝังใน repo (`ui/vendor/fonts/`) + precache ครบ → ออฟไลน์ได้จริง
- ไม่มี bundler: จำนวน request มากกว่า แต่ทุกไฟล์ precache ไว้ → เปิดซ้ำเร็วและออฟไลน์ได้
---
## 12. Checklist ก่อน commit / ปล่อยเวอร์ชัน
```bash
python resource/tools/check-i18n.py # ERROR = ห้าม commit (คีย์ขาด/ซ้ำ)
python resource/tools/bump-version.py --check # ต้อง ✓ ทุกบรรทัด
python resource/tools/audit-geojson.py # ถ้าแตะข้อมูลเส้นทาง
node --check ui/<ไฟล์ที่แก้>.js # ไฟล์ JS ทุกไฟล์ที่แก้
```
ตรวจในเบราว์เซอร์ (เปิด `http://localhost:8090/ui/index.html`):
1. ไล่ทุก route: `#/ #/stops #/routes/101 #/check #/stops/at_main_terminal #/credits #/about #/blog #/stats`
2. `document.documentElement.scrollWidth - clientWidth === 0` (ไม่มีล้นแนวนอน) ที่ 375px และ 1280px
3. Console ไม่มี error · แผนที่แสดง (`getBoundingClientRect()` ของ `.at-map` > 0)
4. เปลี่ยนภาษา TH/EN แล้วข้อความครบ (ไม่มี key เปล่า ๆ)
5. ออฟไลน์ (DevTools → Network offline) แล้ว reload — ยังเปิดหน้าได้
---
## 13. Glossary
| คำ | ความหมายในโปรเจกต์นี้ |
|---|---|
| view / partial | หนึ่งหน้าจอ = `partials/<view>.html` ที่ router fetch มาฉีดใส่ `#view` |
| shell | `ui/index.html` — topbar/footer/`#view` เท่านั้นที่โหลดจริงครั้งเดียว |
| ท่อกลาง | ไฟล์ JS ที่รวมตรรกะไว้ที่เดียวให้ทุกหน้าเรียก (Schedules, OtherStop, ATMap) |
| schema 2 | รูปแบบ `schedules.json` ที่แยกไฟล์ต่อสายใน `scheduleslist/` |
| autoTimes / derive | เวลาที่คำนวณจากจุดอ้างอิง ไม่ได้กรอกตรง ๆ (แสดงเป็นค่าประมาณ) |
| fallback flag | ธงบอกว่า engine ถอยไปใช้ข้อมูลทั้งหมดเพราะกรองแล้วว่าง |
| generated | ไฟล์ที่สคริปต์สร้าง ห้ามแก้มือ (geojson-web, stop-km.json, version.json) |
| bump | การอัปเวอร์ชันเดียวทั้งระบบผ่าน `bump-version.py` |
---
*เอกสารนี้ต้องเป็นจริงตามโค้ด — ถ้าแก้สถาปัตยกรรมแล้วอย่าลืมแก้ที่นี่ด้วย
(เช่น เพิ่ม engine ใหม่, เปลี่ยนกลไก cache, เพิ่มที่เก็บข้อมูล)*
+33
View File
@@ -115,6 +115,17 @@
- **ชื่อเฉพาะไม่แปล** — ชื่อสถานี จังหวัด สายรถ (ภาษาไทยเสมอ) - **ชื่อเฉพาะไม่แปล** — ชื่อสถานี จังหวัด สายรถ (ภาษาไทยเสมอ)
- **ตรวจก่อน commit:** `python resource/tools/check-i18n.py` - **ตรวจก่อน commit:** `python resource/tools/check-i18n.py`
## 3.2 ธีม (light / dark / ตามอุปกรณ์) — `ui/theme.css`
- **โทเคนสีทุกตัวอยู่ใน `ui/theme.css`** (`--c-*`) — ค่าเดียวกับ `web-at-transit/frontend/src/styles/theme.css`
(GUI สองโปรเจกต์ต้องตรงกัน ห้ามแก้ค่าข้างเดียว)
- โหมด: `light` · `dark` · `auto` = **ตามธีมอุปกรณ์** (`prefers-color-scheme`) ← ค่าเริ่มต้น
- ตั้งค่า: `<html data-theme="light|dark">` + `data-theme-mode="light|dark|auto"` · เก็บที่ `localStorage.at_theme`
- ปุ่มใน header = dropdown (ไอคอนเปลี่ยนตามโหมด) · สคริปต์ก่อน paint อยู่ใน `index.html` (กันจอขาววูบ)
- **ห้ามใส่ hex ใหม่ในไฟล์ CSS/partial** — ถ้าจำเป็นให้เพิ่มเป็นโทเคนคู่ light/dark ที่นี่ก่อน
(ยกเว้นสีที่ต้องคงที่ทุกธีม เช่น `#fff` บนพื้นแบรนด์ และไล่เฉดภาพประดับ)
## 4. ตัวพิมพ์ (Typography) ## 4. ตัวพิมพ์ (Typography)
```css ```css
@@ -222,6 +233,28 @@ subset thai/latin/latin-ext · ~218 KB) + ไฟล์ `.woff2` 18 ไฟล์
--- ---
## 8. การเคลื่อนไหว (Motion) — `ui/motion.js` + ท้าย `_shared.css`
**หลักคิด:** อนิเมชันต้องบอก "ของใหม่เข้ามา" ไม่ใช่ของเล่น — ทุกอย่างจบใน ≤ 0.6 วิ และต้องปิดได้
| บทบาท | ค่า | ที่มา |
|---|---|---|
| เส้นโค้ง | `--mu-ease` = `cubic-bezier(.22,.61,.36,1)` (deceleration) | MD motion |
| เข้าหน้า | 420ms · จาง + ขึ้น 10px (`#view.mu-view-in`) | — |
| การ์ดโผล่ตอนเลื่อน | 520ms · จาง + ขึ้น 18px (`.mu-reveal` → `.is-in`) | — |
| เหลื่อมต่อชิ้น | 45ms/ชิ้น (สูงสุด 4 ชิ้น = 180ms) | MD stagger 30–50ms |
| แถบโหลด | 3px บนสุด · โผล่/จาง 180–260ms (ออกเร็วกว่าเข้า) | MD exit-faster |
**กฎ**
1. แตะเฉพาะ `opacity` + `transform` — **ห้ามอนิเมต width/height/top/left** (ทำให้เกิด layout shift)
2. **ห้ามใส่ `.mu-reveal` ให้ของที่ครอบแผนที่** (`SKIP_INSIDE` ใน motion.js — Leaflet คำนวณพิกัดจากกล่องแม่)
3. ของที่เห็นบนจออยู่แล้วตอนโหลด **ไม่ต้องอนิเมต** (กันกะพริบ) — JS เลือกให้เอง
4. เคลียร์ class/transform ทิ้งหลังจบ → hover lift เดิมของแต่ละหน้าไม่ถูกทับ
5. `prefers-reduced-motion: reduce` = ปิดทั้งชุด (ไม่แตะ DOM, ไม่มีแถบโหลด)
6. เพิ่มหน้าใหม่ไม่ต้องแก้อะไร — router เรียก `Motion.enter()` ให้ และ MutationObserver สแกนการ์ดที่ JS สร้างทีหลัง
---
## 9. รูปภาพ (Asset cache) ## 9. รูปภาพ (Asset cache)
รูปทุกตัวเติม `?v=<เวอร์ชันแอป>` อัตโนมัติผ่าน `ui/imageurl.js` — เปลี่ยนรูปทับชื่อเดิมแล้ว รูปทุกตัวเติม `?v=<เวอร์ชันแอป>` อัตโนมัติผ่าน `ui/imageurl.js` — เปลี่ยนรูปทับชื่อเดิมแล้ว
+30
View File
@@ -5,6 +5,27 @@ Static HTML mockup / ดีไซน์ต้นแบบเว็บข้อ
> repo นี้เป็น **static HTML + vanilla JS** (ไม่มี backend / framework / build step) > repo นี้เป็น **static HTML + vanilla JS** (ไม่มี backend / framework / build step)
> ส่วน implementation จริง (Next.js) อยู่ที่ `web-at-transit` > ส่วน implementation จริง (Next.js) อยู่ที่ `web-at-transit`
## เอกสาร (อ่านตามบทบาท)
| ไฟล์ | เนื้อหา | ใครอ่าน |
|---|---|---|
| **`ARCHITECTURE.md`** | สถาปัตยกรรมเต็ม: boot sequence, routing, data layer, shared engines, cache/อัปเดต, analytics, failure modes, recipes | คน/AI ที่ต้องเข้าใจ "ระบบทำงานยังไง" |
| `AGENTS.md` | กฎการแก้โค้ด (ห้ามทำอะไร, ความจริงแต่ละเรื่องอยู่ที่ไหน) | AI coding agent |
| `DESIGN.md` | ระบบดีไซน์: โทเคนสี/ฟอนต์/ระยะ + กฎ "ห้ามทำ" | งาน UI ทุกชิ้น |
| `resource/data/QGIS Project/GeoJSON-2/README.md` | วิธี export เส้นทางจาก QGIS → geojson | งานข้อมูลเส้นทาง |
| `ui/partials/blog-data/README.md` · `about-data/README.md` | schema เนื้อหาบทความ/หน้าเกี่ยวกับ | งานเนื้อหา |
## ระบบทำงานยังไง (ย่อ)
1. `ui/index.html` คือ shell เดียว — topbar/footer + `<div id="view">`
2. `ui/router.js` อ่าน `location.hash` → `fetch('partials/<view>.html')` → ฉีดเข้า `#view` → รัน `<script>` ในไฟล์นั้น
3. แต่ละ view ดึงข้อมูลจาก `resource/data/*.json` ตรง ๆ (ไม่มี API)
4. ตรรกะร่วมอยู่ใน "ท่อกลาง": `partials/schedules.js` (ตารางเดินรถ/วัน) · `partials/otherStop.js` · `ui/map.js` (ATMap)
5. `ui/sw.js` precache ทุกไฟล์ → เปิดซ้ำเร็ว/ออฟไลน์ได้ · `ui/pwa.js` + `version.json` อัปเดตเองโดยผู้ใช้ไม่ต้องกดอะไร
6. สถิติ (`ui/analytics.js`) เก็บในเครื่องแบบไม่ระบุตัวตน — ดูที่ `#/stats`
รายละเอียดทั้งหมด (diagram, API ของแต่ละ engine, checklist ทดสอบ) → `ARCHITECTURE.md`
## โครงสร้าง ## โครงสร้าง
``` ```
@@ -45,6 +66,15 @@ http://localhost:8090/ui/index.html
3. **ห้ามเปิด `file://`** — fetch JSON + relative path จะใช้ไม่ได้ ต้องผ่าน static server เสมอ 3. **ห้ามเปิด `file://`** — fetch JSON + relative path จะใช้ไม่ได้ ต้องผ่าน static server เสมอ
4. เปลี่ยน port ได้ด้วย `make serve PORT=8080` 4. เปลี่ยน port ได้ด้วย `make serve PORT=8080`
## งานที่ต้องรันก่อน commit / ปล่อยเวอร์ชัน
```bash
python resource/tools/check-i18n.py # ERROR = ห้าม commit (คีย์ขาด/ซ้ำ)
python resource/tools/bump-version.py --check # ต้อง ✓ ทุกบรรทัด
python resource/tools/bump-version.py # ปล่อยเวอร์ชันใหม่ (ผู้ใช้ไม่ต้องกด Ctrl+Shift+R)
node --check ui/<ไฟล์ที่แก้>.js
```
## การจัดการรูปภาพ (images) ## การจัดการรูปภาพ (images)
รูปทั้งหมด (~31MB) อยู่ใน folder hidden `.image/` (ถูก `.gitignore` → ไม่ push ขึ้น git) รูปทั้งหมด (~31MB) อยู่ใน folder hidden `.image/` (ถูก `.gitignore` → ไม่ push ขึ้น git)
+24
View File
@@ -111,6 +111,30 @@
"affiliate_link": "", "affiliate_link": "",
"status": "registered", "status": "registered",
"note": "มีบัญชีแล้ว — ยังไม่ใช้ใน footer" "note": "มีบัญชีแล้ว — ยังไม่ใช้ใน footer"
},
{
"id": "THpostmart",
"brand": "THpostmart",
"brand_th": "ไทยโพสต์มาร์ท",
"tile_image": ".image/partners/thpostmart.png",
"in_footer_marquee": true,
"affiliate_program": "",
"program_url": "",
"affiliate_link": "https://www.thailandpostmart.com/",
"status": "no registered",
"note": "ไม่มีบัญชี"
},
{
"id": "pantip mall",
"brand": "pantip mall",
"brand_th": "พันทิป มอลล์",
"tile_image": ".image/partners/pantip mall.png",
"in_footer_marquee": true,
"affiliate_program": "",
"program_url": "",
"affiliate_link": "https://www.pantipmall.com/",
"status": "no registered",
"note": "ไม่มีบัญชี"
} }
] ]
} }
+27 -3
View File
@@ -16,6 +16,7 @@
หลังอัปรูป: รันคำสั่งนี้ แล้วให้ผู้ใช้กด Ctrl+Shift+R ครั้งเดียว = เห็นรูปใหม่ทั้งหมด หลังอัปรูป: รันคำสั่งนี้ แล้วให้ผู้ใช้กด Ctrl+Shift+R ครั้งเดียว = เห็นรูปใหม่ทั้งหมด
""" """
import argparse import argparse
import json
import re import re
import sys import sys
from pathlib import Path from pathlib import Path
@@ -24,9 +25,13 @@ ROOT = Path(__file__).resolve().parents[2]
UI = ROOT / "ui" UI = ROOT / "ui"
SW = UI / "sw.js" SW = UI / "sw.js"
INDEX = UI / "index.html" INDEX = UI / "index.html"
VERSION_JSON = UI / "version.json"
VER_RE = re.compile(r'const VERSION = "([^"]+)";') VER_RE = re.compile(r'const VERSION = "([^"]+)";')
# src="./x.js" | href="./x.css" (ไม่แตะ URL ภายนอก/ไฟล์อื่น)
SHELL_ASSET_RE = re.compile(r'((?:src|href)=")(\./[^"?]+\.(?:js|css))(?:\?v=[^"]*)?(")')
def read_version(): def read_version():
m = VER_RE.search(SW.read_text(encoding="utf-8")) m = VER_RE.search(SW.read_text(encoding="utf-8"))
@@ -60,15 +65,25 @@ def apply(ver, dry=False):
SW.write_text(sw2, encoding="utf-8") SW.write_text(sw2, encoding="utf-8")
changed.append("ui/sw.js") changed.append("ui/sw.js")
# 2) index.html — meta + โลโก้ static (?v=) # 2) index.html — meta + โลโก้ static (?v=) + shell asset (?v=)
idx = INDEX.read_text(encoding="utf-8") idx = INDEX.read_text(encoding="utf-8")
idx2 = re.sub(r'(<meta name="app-version" content=")[^"]*(">)', rf"\g<1>{ver}\g<2>", idx) idx2 = re.sub(r'(<meta name="app-version" content=")[^"]*(">)', rf"\g<1>{ver}\g<2>", idx)
idx2 = re.sub(r'(\.image/icons/[^"?]+\.(?:png|jpg|jpeg|webp|svg))\?v=[^"&]*', rf"\g<1>?v={ver}", idx2) idx2 = re.sub(r'(\.image/icons/[^"?]+\.(?:png|jpg|jpeg|webp|svg))\?v=[^"&]*', rf"\g<1>?v={ver}", idx2)
# JS/CSS ของ shell (./xxx.js, ./xxx.css) → ?v= กัน HTTP cache คืนของเก่าก่อน SW ทำงาน
idx2 = SHELL_ASSET_RE.sub(rf"\g<1>\g<2>?v={ver}\g<3>", idx2)
if idx2 != idx: if idx2 != idx:
if not dry: if not dry:
INDEX.write_text(idx2, encoding="utf-8") INDEX.write_text(idx2, encoding="utf-8")
changed.append("ui/index.html") changed.append("ui/index.html")
# 3) version.json — ให้ pwa.js ตรวจเวอร์ชันใหม่ได้เอง (ทุกเครื่อง)
want = '{"version": "%s"}\n' % ver
old = VERSION_JSON.read_text(encoding="utf-8") if VERSION_JSON.exists() else ""
if old != want:
if not dry:
VERSION_JSON.write_text(want, encoding="utf-8")
changed.append("ui/version.json")
return changed return changed
@@ -99,16 +114,25 @@ def main():
m = re.search(r'<meta name="app-version" content="([^"]*)"', idx) m = re.search(r'<meta name="app-version" content="([^"]*)"', idx)
meta = m.group(1) if m else None meta = m.group(1) if m else None
logos = set(re.findall(r"\.image/icons/[^\"]+?\?v=([^\"&]+)", idx)) logos = set(re.findall(r"\.image/icons/[^\"]+?\?v=([^\"&]+)", idx))
ok = (meta == cur) and (logos == {cur} or not logos) shell = set(re.findall(r'"\./[^"?]+\.(?:js|css)\?v=([^"]*)"', idx))
vjson = None
if VERSION_JSON.exists():
try:
vjson = json.loads(VERSION_JSON.read_text(encoding="utf-8")).get("version")
except Exception:
vjson = "parse-error"
ok = (meta == cur) and (logos == {cur} or not logos) and (shell == {cur} or not shell) and vjson == cur
print(f"sw.js VERSION = {cur}") print(f"sw.js VERSION = {cur}")
print(f"meta app-version= {meta} {'✓' if meta == cur else '✗ ไม่ตรง'}") print(f"meta app-version= {meta} {'✓' if meta == cur else '✗ ไม่ตรง'}")
print(f"โลโก้ ?v= = {sorted(logos) or '-'} {'✓' if (logos == {cur} or not logos) else '✗ ไม่ตรง'}") print(f"โลโก้ ?v= = {sorted(logos) or '-'} {'✓' if (logos == {cur} or not logos) else '✗ ไม่ตรง'}")
print(f"shell js/css ?v== {sorted(shell) or '-'} {'✓' if (shell == {cur} or not shell) else '✗ ไม่ตรง'}")
print(f"version.json = {vjson} {'✓' if vjson == cur else '✗ ไม่ตรง'}")
return 0 if ok else 1 return 0 if ok else 1
ver = cur if args.sync else next_version(cur, args.base) ver = cur if args.sync else next_version(cur, args.base)
changed = apply(ver, dry=False) changed = apply(ver, dry=False)
report(ver, changed) report(ver, changed)
print("\nขั้นตอนถัดไป: ให้ผู้ใช้กด Ctrl+Shift+R ครั้งเดียว (รูปทั้งหมดจะโหลดใหม่)") print("\nผู้ใช้ไม่ต้องกด Ctrl+Shift+R — pwa.js ตรวจ version.json เองแล้วอัปเดตให้")
return 0 return 0
+291 -55
View File
@@ -56,8 +56,8 @@
font-size: .72rem; font-size: .72rem;
font-weight: 800; font-weight: 800;
letter-spacing: .02em; letter-spacing: .02em;
background: rgba(255, 255, 255, .92); background: var(--c-glass);
color: #1f2a44; color: var(--c-ink);
backdrop-filter: blur(8px); backdrop-filter: blur(8px);
box-shadow: 0 4px 10px rgba(15, 23, 42, .15); box-shadow: 0 4px 10px rgba(15, 23, 42, .15);
} }
@@ -146,8 +146,8 @@
border-radius: 999px; border-radius: 999px;
font-size: .7rem; font-size: .7rem;
font-weight: 700; font-weight: 700;
background: rgba(255, 255, 255, .92); background: var(--c-glass);
color: #1f2a44; color: var(--c-ink);
backdrop-filter: blur(6px); backdrop-filter: blur(6px);
box-shadow: 0 4px 10px rgba(15, 23, 42, .14); box-shadow: 0 4px 10px rgba(15, 23, 42, .14);
} }
@@ -169,7 +169,7 @@
overflow: hidden; overflow: hidden;
box-shadow: 0 10px 24px rgba(63, 43, 94, .08); box-shadow: 0 10px 24px rgba(63, 43, 94, .08);
border: 1px solid rgba(231, 224, 246, .95); border: 1px solid rgba(231, 224, 246, .95);
background: #fff; background: var(--c-surface);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
transition: transform .18s ease, box-shadow .18s ease; transition: transform .18s ease, box-shadow .18s ease;
@@ -221,7 +221,7 @@
width: 48px; width: 48px;
height: 48px; height: 48px;
border-radius: 12px; border-radius: 12px;
background: #fff; background: var(--c-surface);
padding: 4px; padding: 4px;
object-fit: contain; object-fit: contain;
} }
@@ -273,7 +273,7 @@
.mu-footer-col ul a:hover { color: #fff; } .mu-footer-col ul a:hover { color: #fff; }
.mu-footer-col ul a::before { .mu-footer-col ul a::before {
content: "›"; content: "›";
color: #7a4cc0; color: var(--c-brand-ink);
font-weight: 800; font-weight: 800;
} }
.mu-footer-contact a, .mu-footer-contact a,
@@ -311,7 +311,7 @@
gap: 12px; gap: 12px;
} }
.mu-sponsor-tile { .mu-sponsor-tile {
background: #fff; background: var(--c-surface);
border-radius: 12px; border-radius: 12px;
padding: 14px; padding: 14px;
display: flex; display: flex;
@@ -398,7 +398,7 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
.mu-search-field .ic { .mu-search-field .ic {
position: absolute; position: absolute;
left: 12px; left: 12px;
color: #6f7b95; color: var(--c-ink-2);
pointer-events: none; pointer-events: none;
} }
.mu-search-field input { .mu-search-field input {
@@ -406,35 +406,110 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
padding: 10px 12px 10px 38px; padding: 10px 12px 10px 38px;
} }
/* ---------- ปุ่มสลับภาษา (ไทย / EN) ---------- */ /* ============================================================
.mu-lang-switch { ปุ่มเครื่องมือในแถบนำทาง — พอร์ตจาก web-at-transit (ต้นทางความจริง)
ธีม 1 ปุ่ม · ภาษา 1 ปุ่ม · แต่ละปุ่มมีเมนูของตัวเอง
radius 8px · สูง 40px (44px บนจอสัมผัส)
============================================================ */
.mu-topbar-tools {
display: flex;
align-items: center;
gap: 8px; /* WCAG 2.5.8 — เว้นระหว่างเป้ากด ≥ 8px */
flex-shrink: 0;
order: 2; /* ปุ่มเครื่องมืออยู่หลัง CTA (CTA ติด "เครดิต" เหมือน next) */
}
.mu-pop { position: relative; display: inline-flex; }
.mu-pop-btn {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 2px; justify-content: center;
background: #f0edf7; gap: 4px;
border: 1px solid #e4dcf2; min-width: 40px;
border-radius: 999px; height: 40px;
padding: 3px; padding: 0 8px;
flex-shrink: 0; border: 1px solid var(--c-border);
} border-radius: var(--radius);
.mu-lang-btn { background: var(--c-surface);
border: 0; color: var(--c-brand-ink);
background: transparent;
color: #6d28d9;
font-family: inherit; font-family: inherit;
font-size: .78rem;
font-weight: 700; font-weight: 700;
font-size: .72rem;
line-height: 1; line-height: 1;
padding: 6px 10px;
border-radius: 999px;
cursor: pointer; cursor: pointer;
transition: background .15s ease, color .15s ease; transition: border-color .15s ease, background .15s ease;
} }
.mu-lang-btn:hover { color: #5b21b6; } .mu-pop-btn-lang { min-width: 56px; padding: 0 10px; }
.mu-lang-btn.active { .mu-pop-btn:hover { border-color: #d8c9f2; background: var(--c-surface-2); }
background: #fff; .mu-pop-btn:active { transform: translateY(1px); }
color: #7a4cc0; .mu-pop-btn:focus-visible {
box-shadow: 0 1px 4px rgba(63, 43, 94, .18); outline: 2px solid var(--c-focus);
outline-offset: 2px;
}
.mu-pop-btn[aria-expanded="true"] {
border-color: var(--c-brand-ink);
background: var(--c-surface-2);
}
.mu-pop-btn .ic,
#theme-icon svg { width: 18px; height: 18px; flex: none; }
.mu-pop-btn-lang svg { flex: none; }
/* เมนูที่กางออก */
.mu-pop-panel {
position: absolute;
top: calc(100% + 6px);
right: 0;
z-index: 1200;
min-width: 168px;
padding: 6px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-surface);
box-shadow: 0 10px 24px var(--c-shadow);
}
.mu-pop-panel[hidden] { display: none; }
.mu-pop-item {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
min-height: 40px;
padding: 8px 10px;
border: 0;
border-radius: var(--radius-sm);
background: transparent;
color: var(--c-ink);
font-family: inherit;
font-size: .85rem;
font-weight: 600;
text-align: start;
cursor: pointer;
}
.mu-pop-item:hover { background: var(--c-surface-2); }
.mu-pop-item:focus-visible {
outline: 2px solid var(--c-focus);
outline-offset: -2px;
}
.mu-pop-item[data-active="1"] {
background: var(--c-tint-purple);
color: var(--c-brand-ink);
font-weight: 700;
}
.mu-pop-item-th { flex: 1 1 auto; }
.mu-pop-item-en {
flex: 0 0 auto;
font-size: .72rem;
font-weight: 600;
color: var(--c-ink-2);
letter-spacing: .04em;
}
.mu-pop-item[data-active="1"] .mu-pop-item-en { color: var(--c-brand-ink); }
@media (pointer: coarse) {
.mu-pop-btn { min-width: 44px; height: 44px; }
.mu-pop-btn-lang { min-width: 60px; }
} }
/* ============================================================ /* ============================================================
@@ -466,18 +541,18 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
} }
.mu-btn.primary:hover { box-shadow: 0 10px 22px rgba(124, 58, 237, .35); } .mu-btn.primary:hover { box-shadow: 0 10px 22px rgba(124, 58, 237, .35); }
.mu-btn.ghost { .mu-btn.ghost {
background: #fff; background: var(--c-surface);
border-color: #e7e2f6; border-color: var(--c-border);
color: #7a4cc0; color: var(--c-brand-ink);
box-shadow: 0 2px 8px rgba(63, 43, 94, .05); box-shadow: 0 2px 8px rgba(63, 43, 94, .05);
} }
.mu-btn.ghost:hover { border-color: #d8c9f2; background: #faf7ff; } .mu-btn.ghost:hover { border-color: #d8c9f2; background: var(--c-surface-2); }
/* select แบบโมเดิร์น — custom chevron แทนลูกศร native (prefix #view ชนะ partial style) */ /* select แบบโมเดิร์น — custom chevron แทนลูกศร native (prefix #view ชนะ partial style) */
#view .mu-toolbar select { #view .mu-toolbar select {
appearance: none; appearance: none;
-webkit-appearance: none; -webkit-appearance: none;
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a4cc0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"), linear-gradient(180deg, #fff, #f8fbff); background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a4cc0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"), linear-gradient(180deg, var(--c-surface), #f8fbff);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: right 12px center; background-position: right 12px center;
padding-right: 38px; padding-right: 38px;
@@ -494,27 +569,188 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
outline-offset: 2px; outline-offset: 2px;
} }
/* ---------- ปุ่มติดตั้งแอป (PWA — inject จาก pwa.js) ---------- */ /* =========================================================
.mu-install-btn { Toast แจ้งอัปเดตเวอร์ชันใหม่ (inject จาก ui/pwa.js)
========================================================= */
.mu-update-toast {
position: fixed; position: fixed;
bottom: 20px; left: 50%;
right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
z-index: 100; z-index: 1300;
display: none; /* โผล่เมื่อ beforeinstallprompt เท่านั้น */ display: inline-flex;
align-items: center; align-items: center;
gap: 8px; gap: 10px;
min-height: 48px; max-width: calc(100vw - 32px);
padding: 12px 20px; padding: 10px 16px;
border: none;
border-radius: 999px; border-radius: 999px;
cursor: pointer; background: #1f2a44;
font-family: inherit;
font-size: .95rem;
font-weight: 700;
color: #fff; color: #fff;
background: linear-gradient(135deg, #a855f7, #7c3aed); font-size: .82rem;
box-shadow: 0 10px 24px rgba(124, 58, 237, .35); font-weight: 600;
transition: transform .15s ease; line-height: 1.35;
box-shadow: 0 10px 24px rgba(15, 23, 42, .22);
transform: translate(-50%, 12px);
opacity: 0;
pointer-events: none;
transition: opacity .25s ease, transform .25s ease;
} }
.mu-install-btn:active { transform: translateY(1px); } .mu-update-toast.is-in { opacity: 1; transform: translate(-50%, 0); }
.mu-install-btn svg { width: 20px; height: 20px; } .mu-update-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #b694f6;
flex: none;
animation: muUpdatePulse 1.1s ease-in-out infinite;
}
@keyframes muUpdatePulse {
0%, 100% { opacity: .35; transform: scale(.85); }
50% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
.mu-update-toast { transition: none; }
.mu-update-dot { animation: none; }
}
/* =========================================================
Motion — อนิเมชันร่วมทุกหน้า (ไฟล์ JS: ui/motion.js)
---------------------------------------------------------
โทเคนเดียวทั้งเว็บ: ระยะ/ความเร็ว/เส้นโค้ง อยู่ที่นี่ที่เดียว
· --mu-ease = deceleration (เข้าช้า ออกเร็ว ตาม MD motion)
· 420ms = เข้าหน้า · 520ms = reveal · 45ms = ระยะเหลื่อมต่อชิ้น
ปิดทั้งชุดเมื่อผู้ใช้ตั้ง prefers-reduced-motion: reduce
========================================================= */
:root {
--mu-ease: cubic-bezier(.22, .61, .36, 1);
}
/* ---------- แถบโหลดบาง ๆ บนสุด (ระหว่าง fetch partial) ---------- */
.mu-loadbar {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 3px;
z-index: 1200; /* เหนือ topbar (1100) แต่ใต้ vreset (3000) */
pointer-events: none;
opacity: 0;
transition: opacity .25s ease; /* ออกเร็วกว่าเข้า (60–70%) */
}
.mu-loadbar.is-on { opacity: 1; }
.mu-loadbar-fill {
height: 100%;
width: 100%;
transform: scaleX(0);
transform-origin: 0 50%;
border-radius: 0 2px 2px 0;
background: linear-gradient(90deg, #7a4cc0, #b694f6);
box-shadow: 0 0 8px rgba(122, 76, 192, .45);
}
@media (prefers-reduced-motion: no-preference) {
/* ---------- เข้าหน้าใหม่: จาง + เลื่อนขึ้นเล็กน้อย ---------- */
#view.mu-view-in {
animation: muViewIn .42s var(--mu-ease) both;
}
@keyframes muViewIn {
from { opacity: 0; transform: translate3d(0, 10px, 0); }
to { opacity: 1; transform: none; }
}
/* ---------- เลื่อนแล้วค่อยโผล่ ---------- */
/* JS ใส่ .mu-reveal เฉพาะของที่ยังไม่เห็นบนจอ → ไม่มีอะไรกะพริบตอนโหลด
ใช้เฉพาะ opacity + transform = ไม่ดันเลย์เอาต์ (CLS 0) */
.mu-reveal {
opacity: 0;
transform: translate3d(0, 18px, 0);
transition:
opacity .52s var(--mu-ease),
transform .52s var(--mu-ease);
transition-delay: var(--mu-d, 0ms);
}
.mu-reveal.is-in {
opacity: 1;
transform: none;
}
}
/* ลดการเคลื่อนไหว: ไม่มีอนิเมชัน แต่เนื้อหาต้องอ่านได้ทันที */
@media (prefers-reduced-motion: reduce) {
#view.mu-view-in { animation: none; }
.mu-reveal { opacity: 1; transform: none; transition: none; }
.mu-loadbar { display: none; }
}
/* ============================================================
ปุ่ม "แชร์หน้านี้" — พอร์ตจาก web-at-transit (variant ghost)
ใช้ได้ทุกหน้า: ปุ่ม id="share-btn" + ข้อความ id="share-status"
============================================================ */
.mu-share-row {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
margin: 22px 0 44px;
}
.mu-share-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 44px;
padding: 10px 18px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-surface);
color: var(--c-brand-ink);
font-family: inherit;
font-size: .85rem;
font-weight: 700;
line-height: 1;
cursor: pointer;
transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.mu-share-btn:hover { border-color: #d8c9f2; background: var(--c-surface-2); }
.mu-share-btn:active { transform: translateY(1px); }
.mu-share-btn:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.mu-share-btn .ic { width: 16px; height: 16px; }
.mu-share-status {
margin: 0;
font-size: .85rem;
line-height: 1.7;
color: var(--c-ink-2);
text-align: right;
}
.mu-share-status:empty { display: none; }
.mu-share-url {
display: inline-block;
padding: 2px 8px;
border: 1px solid var(--c-border);
border-radius: 8px;
background: var(--c-surface-2);
font-family: ui-monospace, "IBM Plex Mono", monospace;
font-size: .8rem;
}
.mu-share-line {
display: inline-block;
margin-left: 6px;
font-weight: 700;
color: #06c755;
text-decoration: none;
}
.mu-share-line:hover { text-decoration: underline; }
@media (max-width: 560px) {
.mu-share-row { align-items: stretch; }
.mu-share-btn { justify-content: center; }
.mu-share-status { text-align: left; }
}
/* กันกรณีโทเคนโหลดไม่ครบ (เช่น cache เก่า) — dropdown ต้องอ่านออกเสมอ */
.mu-pop-panel { background: var(--c-surface, #fff); border-color: var(--c-border, #e7e2f6); }
:root[data-theme="dark"] .mu-pop-panel { background: var(--c-surface, #171225); border-color: var(--c-border, #352b52); }
.mu-pop-item { color: var(--c-ink, #1f2a44); }
:root[data-theme="dark"] .mu-pop-item { color: var(--c-ink, #ece9f7); }
.mu-pop-item[data-active="1"] { background: var(--c-tint-purple, #f4f1fb); color: var(--c-brand-ink, #7a4cc0); }
:root[data-theme="dark"] .mu-pop-item[data-active="1"] { background: var(--c-tint-purple, #241c3b); color: var(--c-brand-ink, #b892f5); }
.mu-pop-btn { background: var(--c-surface, #fff); color: var(--c-brand-ink, #7a4cc0); }
:root[data-theme="dark"] .mu-pop-btn { background: var(--c-surface, #171225); color: var(--c-brand-ink, #b892f5); }
+324
View File
@@ -0,0 +1,324 @@
/* ============================================================
analytics.js — สถิติการค้นหา/การเปิดหน้า แบบไม่ระบุตัวตน
------------------------------------------------------------
แนวคิดเดียวกับ Umami (privacy-first analytics) แต่ทำฝั่งเบราว์เซอร์ล้วน
เพราะ repo นี้ไม่มี backend:
• ไม่มีคุกกี้ · ไม่มี fingerprint · ไม่เก็บ IP/UA
• ไม่มีรหัสผู้ใช้ถาวร — session id สุ่มใหม่ทุกแท็บ (sessionStorage, ตายกับแท็บ)
• เคารพ Do Not Track + Global Privacy Control + สวิตช์ปิดของผู้ใช้เอง
• ข้อมูลรวมอยู่ในเครื่องนี้ (localStorage) — ค่าเริ่มต้น "ไม่ส่งออกเน็ตเลย"
• ถ้าเจ้าของเว็บตั้ง endpoint Umami เอง (window.AT_ANALYTICS) จึงจะส่ง:
payload ตรงสเปก Umami /api/send (type=event) — ไม่มีอะไรเพิ่มนอกรอบนั้น
API
Analytics.search({ q, scope, results }) ← เรียกได้ทุกคีย์สโตว์ม (debounce 900ms ให้เอง)
Analytics.pageview() ← ผูก hashchange ให้อัตโนมัติแล้ว
Analytics.view(kind, id) ← เปิดรายละเอียดสาย/ป้าย
Analytics.report() ← ข้อมูลสำหรับหน้า #/stats
Analytics.exportJSON() / clear() / optOut(bool) / isOptedOut()
ความเป็นส่วนตัวของ "คำค้น" (สำคัญ):
- ตัดอีเมล · @handle · เลขยาว ≥5 หลัก (เบอร์โทร/เลขบัตร) ออกก่อนบันทึก
- จำกัด 60 ตัวอักษร · รวมช่องว่าง · ตัวอักษรละตินเป็นตัวเล็ก
- คำที่สั้นกว่า 2 ตัวอักษรไม่บันทึก
- เก็บแค่ "คำ + จำนวนครั้ง + เวลาล่าสุด" ไม่ผูกกับใคร
============================================================ */
(function () {
'use strict';
var KEY = 'at_stats_v1';
var OPTOUT_KEY = 'at_stats_optout';
var SESSION_KEY = 'at_stats_sid';
var MAX_TERMS = 300; /* จำนวนคำค้นที่เก็บ */
var MAX_VIEWS = 200; /* จำนวนหน้า/สาย/ป้ายที่เก็บ */
var MAX_DAYS = 120; /* เก็บรายวัน 120 วัน */
var TERM_MAX_LEN = 60;
var DEBOUNCE_MS = 900;
var DAY_MS = 86400000;
/* ---------- ความยินยอม ---------- */
function cfg() { return window.AT_ANALYTICS || {}; }
function dntOn() {
var d = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
if (d === '1' || d === 'yes' || d === 'on') return true;
if (navigator.globalPrivacyControl === true) return true; /* GPC */
return false;
}
function optedOut() {
try { return localStorage.getItem(OPTOUT_KEY) === '1'; }
catch (e) { return true; } /* storage ปิด = ไม่เก็บ */
}
function tracking() { return !dntOn() && !optedOut(); }
/* ---------- helpers ---------- */
function now() { return Date.now(); }
function dayKey(ts) {
var d = new Date(ts);
var m = ('0' + (d.getMonth() + 1)).slice(-2);
var day = ('0' + d.getDate()).slice(-2);
return d.getFullYear() + '-' + m + '-' + day;
}
/* ทำคำค้นให้ปลอดภัยก่อนบันทึก */
function cleanTerm(q) {
var s = String(q == null ? '' : q).replace(/\s+/g, ' ').trim();
if (!s) return '';
s = s
.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g, ' ') /* อีเมล */
.replace(/@[\w.]+/g, ' ') /* @handle */
.replace(/\d{5,}/g, ' ') /* เบอร์โทร/เลขยาว */
.replace(/\s+/g, ' ')
.trim()
.toLowerCase();
if (s.length > TERM_MAX_LEN) s = s.slice(0, TERM_MAX_LEN);
return s;
}
/* ---------- storage ---------- */
function blank() {
return { v: 1, since: now(), days: {}, terms: {}, empty: {}, views: {} };
}
function read() {
try {
var raw = localStorage.getItem(KEY);
if (!raw) return blank();
var d = JSON.parse(raw);
if (!d || typeof d !== 'object' || d.v !== 1) return blank();
d.days = d.days || {}; d.terms = d.terms || {}; d.empty = d.empty || {}; d.views = d.views || {};
return d;
} catch (e) { return blank(); }
}
function write(d) {
try { localStorage.setItem(KEY, JSON.stringify(d)); } catch (e) { /* เงียบ */ }
}
/* ตัดข้อมูลเกินเพดาน (เก่าสุดก่อน) — กัน localStorage บวม */
function cap(map, max) {
var keys = Object.keys(map);
if (keys.length <= max) return false;
keys.sort(function (a, b) { return ((map[a] && map[a][1]) || 0) - ((map[b] && map[b][1]) || 0); });
var cut = keys.length - max;
for (var i = 0; i < cut; i++) delete map[keys[i]];
return true;
}
function bump(map, key, ts, max) {
if (!key) return;
var e = map[key];
map[key] = [(e && Number(e[0])) || 0, ts];
map[key][0] += 1;
cap(map, max);
}
function pruneDays(d, ts) {
var cut = dayKey(ts - (MAX_DAYS - 1) * DAY_MS);
Object.keys(d.days).forEach(function (k) { if (k < cut) delete d.days[k]; });
}
function day(d, ts) {
var k = dayKey(ts);
if (!d.days[k]) d.days[k] = { pv: 0, q: 0, nores: 0 };
return d.days[k];
}
/* ---------- ส่งออก Umami (ถ้าเจ้าของเว็บตั้งค่า) ---------- */
var sid = null;
function sessionId() {
if (sid) return sid;
try {
sid = sessionStorage.getItem(SESSION_KEY);
if (!sid) {
sid = Math.random().toString(36).slice(2) + now().toString(36);
sessionStorage.setItem(SESSION_KEY, sid);
}
} catch (e) { sid = 'anon'; }
return sid;
}
function send(name, data) {
var c = cfg();
if (!c || !c.endpoint || !c.siteId) return; /* ค่าเริ่มต้น: ไม่ส่งที่ไหน */
var body = {
type: 'event',
payload: {
website: c.siteId,
hostname: location.hostname,
url: location.pathname + location.hash,
referrer: document.referrer || '',
title: document.title || '',
language: navigator.language || '',
screen: (screen.width || 0) + 'x' + (screen.height || 0),
event_name: name,
event_data: data || {}
}
};
var url = String(c.endpoint).replace(/\/+$/, '') + '/api/send';
try {
var blob = new Blob([JSON.stringify(body)], { type: 'application/json' });
if (navigator.sendBeacon && navigator.sendBeacon(url, blob)) return;
fetch(url, { method: 'POST', body: JSON.stringify(body), keepalive: true,
headers: { 'Content-Type': 'application/json' } }).catch(function () {});
} catch (e) { /* ไม่ให้ analytics ทำให้หน้าเว็บพัง */ }
}
/* ---------- บันทึก ---------- */
var pending = null; /* { q, scope, results, timer } */
var lastPV = { key: '', ts: 0 };
var lastView = { key: '', ts: 0 };
function recordSearch(q, scope, results) {
var term = cleanTerm(q);
if (!term || term.replace(/\s/g, '').length < 2) return;
var ts = now();
var d = read();
var bucket = day(d, ts);
bucket.q += 1;
if (results === 0) { bucket.nores += 1; bump(d.empty, term, ts, MAX_TERMS); }
else bump(d.terms, term, ts, MAX_TERMS);
pruneDays(d, ts);
write(d);
if (tracking()) send('search', { term: term, scope: scope || '', results: results });
}
function flush() {
if (!pending) return;
var p = pending;
pending = null;
clearTimeout(p.timer);
recordSearch(p.q, p.scope, p.results);
}
function parseHash() {
var raw = (location.hash || '').replace(/^#/, '');
var path = raw.split('?')[0];
return path.split('/').filter(Boolean);
}
function trackViewOnce(kind, id) {
if (!id) return;
var key = kind + ':' + id;
var ts = now();
if (lastView.key === key && ts - lastView.ts < 1200) return;
lastView = { key: key, ts: ts };
var d = read();
bump(d.views, key, ts, MAX_VIEWS);
write(d);
if (tracking()) send('view', { kind: kind, id: String(id) });
}
var Analytics = {
/* นับการเปิดหน้า (เก็บเฉพาะตัวเลขรายวัน — ไม่เก็บว่าใคร) */
pageview: function () {
if (!tracking()) { flush(); return; }
var seg = parseHash();
var key = seg.join('/') || 'home';
var ts = now();
if (lastPV.key === key && ts - lastPV.ts < 1200) return; /* ป้องกันนับซ้ำตอน langchange */
lastPV = { key: key, ts: ts };
var d = read();
day(d, ts).pv += 1;
pruneDays(d, ts);
write(d);
if (seg[0] === 'routes' && seg[1]) trackViewOnce('route', decodeURIComponent(seg[1]));
else if (seg[0] === 'stops' && seg[1]) trackViewOnce('stop', decodeURIComponent(seg[1]));
if (tracking()) send('pageview', { path: '/' + key });
},
/* เรียกได้ทุกครั้งที่ผลค้นเปลี่ยน — debounce 900ms ให้เหลือ 1 คำต่อการพิมพ์ */
search: function (opts) {
if (!tracking()) return;
var o = opts || {};
var q = String(o.q == null ? '' : o.q);
if (!cleanTerm(q) || cleanTerm(q).replace(/\s/g, '').length < 2) return;
if (pending) clearTimeout(pending.timer);
pending = {
q: q,
scope: o.scope || '',
results: (typeof o.results === 'number') ? o.results : null,
timer: setTimeout(flush, DEBOUNCE_MS)
};
},
view: function (kind, id) { if (tracking()) trackViewOnce(kind, id); },
/* ---------- รายงานสำหรับหน้า #/stats ---------- */
report: function () {
var d = read();
var ts = now();
function rows(map, n, fn) {
var arr = Object.keys(map).map(function (k) {
var e = map[k] || [];
return fn(k, Number(e[0]) || 0, Number(e[1]) || 0);
}).filter(function (r) { return r.count > 0; });
arr.sort(function (a, b) { return b.count - a.count || b.last - a.last; });
return arr.slice(0, n || 10);
}
var days = Object.keys(d.days).sort().slice(-14).map(function (k) {
var v = d.days[k];
return { date: k, pageviews: v.pv || 0, searches: v.q || 0, noResult: v.nores || 0 };
});
var pv = 0, q = 0, nores = 0;
Object.keys(d.days).forEach(function (k) {
pv += d.days[k].pv || 0; q += d.days[k].q || 0; nores += d.days[k].nores || 0;
});
return {
since: d.since || ts,
totals: { pageviews: pv, searches: q, noResult: nores,
terms: Object.keys(d.terms).length, views: Object.keys(d.views).length },
days: days,
topTerms: rows(d.terms, 12, function (k, c, l) { return { term: k, count: c, last: l }; }),
topEmpty: rows(d.empty, 8, function (k, c, l) { return { term: k, count: c, last: l }; }),
topViews: rows(d.views, 12, function (k, c, l) {
var at = k.indexOf(':');
return { kind: k.slice(0, at), id: k.slice(at + 1), count: c, last: l };
})
};
},
exportJSON: function () { return JSON.stringify(read(), null, 2); },
clear: function () {
try { localStorage.removeItem(KEY); } catch (e) {}
pending = null;
lastPV = { key: '', ts: 0 };
lastView = { key: '', ts: 0 };
},
optOut: function (on) {
if (pending) { clearTimeout(pending.timer); pending = null; }
try { localStorage.setItem(OPTOUT_KEY, on ? '1' : '0'); } catch (e) {}
},
isOptedOut: function () { return optedOut() || dntOn(); },
tracking: tracking,
cleanTerm: cleanTerm,
_key: KEY
};
window.Analytics = Analytics;
/* ---------- ต่อท่ออัตโนมัติ ---------- */
window.addEventListener('hashchange', function () { Analytics.pageview(); });
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function () { Analytics.pageview(); });
} else {
Analytics.pageview();
}
})();
+50 -4
View File
@@ -35,8 +35,9 @@
var saved = localStorage.getItem(LS_KEY); var saved = localStorage.getItem(LS_KEY);
if (saved && SUPPORTED.indexOf(saved) !== -1) return saved; if (saved && SUPPORTED.indexOf(saved) !== -1) return saved;
} catch (e) { /* localStorage ไม่พร้อมใช้งาน */ } } catch (e) { /* localStorage ไม่พร้อมใช้งาน */ }
var nav = (navigator.language || BASE).toLowerCase(); /* ภาษาเริ่มต้น = ไทยเสมอ (ไม่เดาจาก navigator.language)
return nav.indexOf('en') === 0 ? 'en' : BASE; ผู้ใช้เปลี่ยนเองได้ที่ปุ่ม dropdown แล้วเลือกจำไว้ใน at_lang */
return BASE;
} }
/* ---------- โหลดไฟล์ภาษา (cache ต่อภาษา · ล้มเหลว = {} ไม่ให้พัง) ---------- */ /* ---------- โหลดไฟล์ภาษา (cache ต่อภาษา · ล้มเหลว = {} ไม่ให้พัง) ---------- */
@@ -94,10 +95,15 @@
document.documentElement.lang = current; document.documentElement.lang = current;
/* ไฮไลต์ปุ่มภาษาที่ active */ /* ปุ่มภาษาแบบ dropdown — ไฮไลต์ตัวที่เลือก + อัปเดตข้อความบนปุ่ม */
document.querySelectorAll('[data-i18n-switch]').forEach(function (btn) { document.querySelectorAll('[data-i18n-switch]').forEach(function (btn) {
btn.classList.toggle('active', btn.getAttribute('data-i18n-switch') === current); var on = btn.getAttribute('data-i18n-switch') === current;
btn.classList.toggle('active', on);
btn.setAttribute('aria-checked', on ? 'true' : 'false');
if (on) btn.setAttribute('data-active', '1'); else btn.removeAttribute('data-active');
}); });
var label = document.getElementById('lang-label');
if (label) label.textContent = current === 'en' ? 'EN' : 'ไทย';
} }
/* ---------- สลับภาษา (โหลดไฟล์ภาษาก่อน แล้วค่อยบอกให้หน้าวาดใหม่) ---------- */ /* ---------- สลับภาษา (โหลดไฟล์ภาษาก่อน แล้วค่อยบอกให้หน้าวาดใหม่) ---------- */
@@ -140,6 +146,46 @@
if (btn) setLang(btn.getAttribute('data-i18n-switch')); if (btn) setLang(btn.getAttribute('data-i18n-switch'));
}); });
/* ---------- dropdown ภาษา (ปุ่มเดียว + เมนู) ----------
โครงเดียวกับ LangSwitch ของแอป Next: aria-expanded, ปิดด้วย Esc/คลิกนอก,
ตัวเลือกในเมนูยังใช้ [data-i18n-switch] → กลไกแปลภาษาเดิมไม่ต้องแก้ */
(function langMenu() {
var wrap = document.getElementById('lang-switch');
var btn = document.getElementById('lang-btn');
var menu = document.getElementById('lang-menu');
if (!wrap || !btn || !menu) return;
function setOpen(on) {
menu.hidden = !on;
btn.setAttribute('aria-expanded', on ? 'true' : 'false');
if (on) {
var first = menu.querySelector('button');
if (first) first.focus({ preventScroll: true });
}
}
btn.addEventListener('click', function (e) {
e.stopPropagation();
setOpen(menu.hidden);
});
document.addEventListener('click', function (e) {
if (!wrap.contains(e.target)) setOpen(false);
});
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && !menu.hidden) {
setOpen(false);
btn.focus();
}
});
/* เลือกภาษาแล้วปิดเมนู (ตัวสลับภาษาอยู่ใน listener กลางด้านบน) */
menu.addEventListener('click', function (e) {
if (e.target.closest('[data-i18n-switch]')) setOpen(false);
});
})();
/* โหลดภาษาปัจจุบัน (+ ภาษาตั้งต้นสำหรับ fallback) แล้วจึงพร้อมใช้งาน */ /* โหลดภาษาปัจจุบัน (+ ภาษาตั้งต้นสำหรับ fallback) แล้วจึงพร้อมใช้งาน */
Promise.all([dict(BASE), dict(current)]).then(function () { Promise.all([dict(BASE), dict(current)]).then(function () {
apply(); apply();
+151 -138
View File
@@ -3,19 +3,34 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<script>
/* ตั้งธีมก่อน paint — ต้องตรงกับ ui/theme.js (light | dark | auto=อุปกรณ์) */
(function () {
try {
var m = localStorage.getItem('at_theme') || 'auto';
var dark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
var r = m === 'auto' ? (dark ? 'dark' : 'light') : m;
var h = document.documentElement;
h.dataset.theme = r;
h.dataset.themeMode = m;
h.style.colorScheme = r;
} catch (e) {}
})();
</script>
<title>หน้าแรก | Atroute (mockup)</title> <title>หน้าแรก | Atroute (mockup)</title>
<!-- ฟอนต์หลัก K2D: ไฟล์ในโปรเจกต์ (ui/vendor/fonts/) — ทำงานออฟไลน์ได้ --> <!-- ฟอนต์หลัก K2D: ไฟล์ในโปรเจกต์ (ui/vendor/fonts/) — ทำงานออฟไลน์ได้ -->
<link href="./vendor/fonts/k2d.css" rel="stylesheet"> <link href="./vendor/fonts/k2d.css?v=2026.09.27.129" rel="stylesheet">
<!-- ตัวสำรอง (โหลดจาก CDN เมื่อออนไลน์เท่านั้น · ออฟไลน์ถอยไปใช้ system-ui) --> <!-- ตัวสำรอง (โหลดจาก CDN เมื่อออนไลน์เท่านั้น · ออฟไลน์ถอยไปใช้ system-ui) -->
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800&family=Prompt:wght@400;500;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800&family=Prompt:wght@400;500;600;700&display=swap" rel="stylesheet">
<link href="../../frontend-web-transit/web-transit/css/main-theme.css" rel="stylesheet"> <link href="../../frontend-web-transit/web-transit/css/main-theme.css" rel="stylesheet">
<link href="./_shared.css" rel="stylesheet"> <link href="./theme.css?v=2026.09.27.129" rel="stylesheet">
<link href="./vendor/leaflet/leaflet.css" rel="stylesheet"> <link href="./_shared.css?v=2026.09.27.129" rel="stylesheet">
<link href="./map.css" rel="stylesheet"> <link href="./vendor/leaflet/leaflet.css?v=2026.09.27.129" rel="stylesheet">
<meta name="app-version" content="2026.09.27.103"> <link href="./map.css?v=2026.09.27.129" rel="stylesheet">
<link rel="icon" type="image/png" href="../.image/icons/minibus-512x512.png?v=2026.09.27.103"> <meta name="app-version" content="2026.09.27.129">
<link rel="icon" type="image/png" href="../.image/icons/minibus-512x512.png?v=2026.09.27.129">
<style> <style>
.mu-card.empty { width: 100%; padding: 16px; text-align: center; color: #6f7b95; background: #fff7fb; border: 1px dashed #f4c7df; } .mu-card.empty { width: 100%; padding: 16px; text-align: center; color: var(--c-ink-2); background: #fff7fb; border: 1px dashed #f4c7df; }
a.mu-card { text-decoration: none; color: inherit; display: block; } a.mu-card { text-decoration: none; color: inherit; display: block; }
/* Page-specific: hero */ /* Page-specific: hero */
@@ -43,10 +58,10 @@
letter-spacing: .02em; letter-spacing: .02em;
} }
/* zone tint — พื้นหลังการ์ดตามหมวดเส้นทาง (ตัวการ์ด = เฉดอ่อน / หัวการ์ด = เฉดสด) */ /* zone tint — พื้นหลังการ์ดตามหมวดเส้นทาง (ตัวการ์ด = เฉดอ่อน / หัวการ์ด = เฉดสด) */
.mu-zone:has(.tag-sky) { --zone-tint: #eff6ff; } .mu-zone:has(.tag-sky) { --zone-tint: var(--c-tint-cyan); }
.mu-zone:has(.tag-purple) { --zone-tint: #f5f3ff; } .mu-zone:has(.tag-purple) { --zone-tint: var(--c-tint-purple); }
.mu-zone:has(.tag-pink) { --zone-tint: #fdf2f8; } .mu-zone:has(.tag-pink) { --zone-tint: var(--c-tint-pink); }
.mu-zone:has(.tag-yellow) { --zone-tint: #fffbeb; } .mu-zone:has(.tag-yellow) { --zone-tint: var(--c-tint-amber); }
.mu-zone .mu-card, .mu-zone .mu-card,
.mu-zone .mu-route-info { background: var(--zone-tint, #fff); } .mu-zone .mu-route-info { background: var(--zone-tint, #fff); }
@@ -56,46 +71,46 @@
.mu-zone:has(.tag-yellow) .mu-card-head { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); } .mu-zone:has(.tag-yellow) .mu-card-head { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); }
/* การ์ดที่ยังไม่มีข้อมูล (is-empty): พื้นเทา + N/A แทนเลขสาย ไม่มีเงาตัวอักษร */ /* การ์ดที่ยังไม่มีข้อมูล (is-empty): พื้นเทา + N/A แทนเลขสาย ไม่มีเงาตัวอักษร */
.mu-card.is-empty, .mu-card.is-empty,
.mu-card.is-empty .mu-route-info { background: #f0f2f5; } .mu-card.is-empty .mu-route-info { background: var(--c-surface-3); }
.mu-card.is-empty .mu-card-head { background: #e4e7eb; } .mu-card.is-empty .mu-card-head { background: var(--c-surface-3); }
.mu-card.is-empty .mu-route-number { color: #5b636e !important; text-shadow: none !important; font-size: 42px !important; } .mu-card.is-empty .mu-route-number { color: var(--c-ink-2) !important; text-shadow: none !important; font-size: 42px !important; }
.mu-card.is-empty { cursor: default; } .mu-card.is-empty { cursor: default; }
.mu-card.is-empty:hover { transform: none; box-shadow: 0 4px 14px rgba(20,40,90,.06); } .mu-card.is-empty:hover { transform: none; box-shadow: 0 4px 14px rgba(20,40,90,.06); }
.mu-route-info { padding: 14px 16px 16px; background: #fff; } .mu-route-info { padding: 14px 16px 16px; background: var(--c-surface); }
.mu-route-name { margin: 0 0 10px; font-size: .95rem; color: #1f2a44; font-weight: 700; } .mu-route-name { margin: 0 0 10px; font-size: .95rem; color: var(--c-ink); font-weight: 700; }
/* ===== maintheme.png look: topbar, hero, zones, grid, summary, footer ===== */ /* ===== maintheme.png look: topbar, hero, zones, grid, summary, footer ===== */
body.main-theme-page { margin: 0; font-family: 'K2D','Noto Sans Thai','Prompt',system-ui,sans-serif; color: #1f2a44; background: #f7f9fd; } body.main-theme-page { margin: 0; font-family: 'K2D','Noto Sans Thai','Prompt',system-ui,sans-serif; color: var(--c-ink); background: var(--c-bg); }
.mu-container { max-width: 1200px; margin: 0 auto; padding: 0 28px; } .mu-container { max-width: 1200px; margin: 0 auto; padding: 0 28px; }
/* Topbar */ /* Topbar */
/* z-index 1100 — ต้องสูงกว่า Leaflet (pane 400 · control 800 · .leaflet-top 1000) /* z-index 1100 — ต้องสูงกว่า Leaflet (pane 400 · control 800 · .leaflet-top 1000)
ไม่งั้นแผนที่จะบัง nav ตอนเลื่อน */ ไม่งั้นแผนที่จะบัง nav ตอนเลื่อน */
.mu-topbar { background: #ffffff; border-bottom: 1px solid #e9eef7; position: sticky; top: 0; z-index: 1100; box-shadow: 0 2px 8px rgba(20,40,90,.04); } .mu-topbar { background: var(--c-surface); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 1100; box-shadow: 0 2px 8px rgba(20,40,90,.04); }
.mu-topbar-inner { display: flex; align-items: center; gap: 18px; padding: 14px 28px; } .mu-topbar-inner { display: flex; align-items: center; gap: 18px; padding: 14px 28px; }
.mu-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; } .mu-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.mu-logo-img { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg,#8b5cf6,#ec4899); padding: 4px; transition: transform .15s ease; } .mu-logo-img { width: 44px; height: 44px; border-radius: var(--radius); background: linear-gradient(135deg,#8b5cf6,#ec4899); padding: 4px; transition: transform .15s ease; }
.mu-brand:hover .mu-logo-img { transform: scale(1.06); } .mu-brand:hover .mu-logo-img { transform: scale(1.06); }
.mu-brand-title { display: block; margin: 0; font-weight: 800; font-size: 1.05rem; color: #1f2a44; transition: color .15s ease; } .mu-brand-title { display: block; margin: 0; font-weight: 800; font-size: 1rem; color: var(--c-ink); transition: color .15s ease; }
.mu-brand:hover .mu-brand-title { color: #7a4cc0; } .mu-brand:hover .mu-brand-title { color: var(--c-brand-ink); }
.mu-brand-subtitle { display: block; margin: 0; font-size: .72rem; color: #6f7b95; } .mu-brand-subtitle { display: block; margin: 0; font-size: .72rem; color: var(--c-ink-2); }
.mu-nav { margin-left: auto; display: flex; gap: 28px; } .mu-nav { margin-left: auto; display: flex; gap: 28px; }
.mu-nav a { color: #4a5876; text-decoration: none; font-size: .92rem; font-weight: 600; padding: 6px 4px; border-bottom: 2px solid transparent; } .mu-nav a { color: var(--c-info); text-decoration: none; font-size: .95rem; font-weight: 600; padding: 6px 4px; border-bottom: 2px solid transparent; }
.mu-nav a.active { color: #d6336c; border-bottom-color: #ec4899; } .mu-nav a.active { color: var(--c-danger); border-bottom-color: var(--c-danger); }
.mu-nav a:hover { color: #1f2a44; } .mu-nav a:hover { color: var(--c-ink); }
.mu-action-btn { background: linear-gradient(135deg,#a855f7,#7c3aed); color:#fff; padding: 10px 22px; border-radius: 999px; text-decoration:none; font-weight: 700; font-size:.88rem; box-shadow: 0 6px 14px rgba(124,58,237,.3); } .mu-action-btn { background: linear-gradient(135deg,#a855f7,#7c3aed); color:#fff; padding: 10px 22px; border-radius: 999px; text-decoration:none; font-weight: 700; font-size:.85rem; box-shadow: 0 6px 14px rgba(124,58,237,.3); }
/* Hero */ /* Hero */
.mu-hero { position: relative; overflow: hidden; padding: 56px 0 64px; background: linear-gradient(180deg, #f0ebff 0%, #ffe8ee 50%, #fff4d6 100%); text-align: center; } .mu-hero { position: relative; overflow: hidden; padding: 56px 0 64px; background: linear-gradient(180deg, #f0ebff 0%, #ffe8ee 50%, #fff4d6 100%); text-align: center; }
.mu-hero-map { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .3; filter: saturate(1.1); z-index: 0; pointer-events: none; } .mu-hero-map { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .3; filter: saturate(1.1); z-index: 0; pointer-events: none; }
.mu-blob { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .55; z-index: 0; } .mu-blob { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .55; z-index: 0; }
.mu-blob.one { width: 220px; height: 220px; background: #b794f4; top: -50px; left: 8%; } .mu-blob.one { width: 220px; height: 220px; background: var(--c-tint-purple); top: -50px; left: 8%; }
.mu-blob.two { width: 260px; height: 260px; background: #f9a8d4; top: 40%; right: 8%; } .mu-blob.two { width: 260px; height: 260px; background: var(--c-tint-pink); top: 40%; right: 8%; }
.mu-blob.three{ width: 180px; height: 180px; background: #fde68a; bottom: -40px; left: 38%; } .mu-blob.three{ width: 180px; height: 180px; background: var(--c-tint-amber); bottom: -40px; left: 38%; }
.mu-hero-content { position: relative; z-index: 1; } .mu-hero-content { position: relative; z-index: 1; }
.mu-badge { display: inline-block; background: rgba(255,255,255,.7); backdrop-filter: blur(6px); color: #6d28d9; padding: 6px 16px; border-radius: 999px; font-size: .82rem; font-weight: 700; margin-bottom: 18px; box-shadow: 0 4px 10px rgba(124,58,237,.12); } .mu-badge { display: inline-block; background: var(--c-glass-24); backdrop-filter: blur(6px); color: var(--c-brand-ink); padding: 6px 16px; border-radius: 999px; font-size: .82rem; font-weight: 700; margin-bottom: 18px; box-shadow: 0 4px 10px rgba(124,58,237,.12); }
.mu-hero h1 { margin: 0 0 26px; font-size: 2.2rem; font-weight: 800; line-height: 1.35; color: #1f2a44; } .mu-hero h1 { margin: 0 0 26px; font-size: 2.2rem; font-weight: 800; line-height: 1.35; color: var(--c-ink); }
.mu-gradient-text { background: linear-gradient(120deg, #d946ef 10%, #a855f7 60%, #6366f1 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .mu-gradient-text { background: linear-gradient(120deg, #d946ef 10%, #a855f7 60%, #6366f1 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
/* ===== Route selector: จังหวัด → สถานีขนส่งผู้โดยสาร (cascade) ===== */ /* ===== Route selector: จังหวัด → สถานีขนส่งผู้โดยสาร (cascade) ===== */
.mu-route-selector { .mu-route-selector {
@@ -116,7 +131,7 @@
margin: 0 0 7px 8px; margin: 0 0 7px 8px;
font-size: .8rem; font-size: .8rem;
font-weight: 700; font-weight: 700;
color: #6f7b95; color: var(--c-ink-2);
letter-spacing: .01em; letter-spacing: .01em;
} }
.mu-select-field > label svg { width: 15px; height: 15px; color: #8b5cf6; flex: none; } .mu-select-field > label svg { width: 15px; height: 15px; color: #8b5cf6; flex: none; }
@@ -124,8 +139,8 @@
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
background: #fff; background: var(--c-surface);
border: 1px solid #e7e2f6; border: 1px solid var(--c-border);
border-radius: 14px; border-radius: 14px;
box-shadow: 0 8px 20px rgba(63, 43, 94, .08); box-shadow: 0 8px 20px rgba(63, 43, 94, .08);
transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
@@ -142,7 +157,7 @@
font-family: inherit; font-family: inherit;
font-size: .95rem; font-size: .95rem;
font-weight: 600; font-weight: 600;
color: #1f2a44; color: var(--c-ink);
padding: 14px 12px; padding: 14px 12px;
cursor: pointer; cursor: pointer;
appearance: none; appearance: none;
@@ -150,8 +165,8 @@
} }
.mu-select-box .mu-select-chevron { width: 18px; height: 18px; margin-right: 14px; color: #8b5cf6; flex: none; pointer-events: none; } .mu-select-box .mu-select-chevron { width: 18px; height: 18px; margin-right: 14px; color: #8b5cf6; flex: none; pointer-events: none; }
.mu-select-arrow { display: none; align-self: center; color: #c4b5e6; font-weight: 700; font-size: 1.15rem; padding-bottom: 18px; } .mu-select-arrow { display: none; align-self: center; color: #c4b5e6; font-weight: 700; font-size: 1.15rem; padding-bottom: 18px; }
.mu-select-hint { margin: 12px 0 0; font-size: .84rem; color: #6f7b95; min-height: 1.25em; } .mu-select-hint { margin: 12px 0 0; font-size: .84rem; color: var(--c-ink-2); min-height: 1.25em; }
.mu-select-hint b { color: #7a4cc0; font-weight: 700; } .mu-select-hint b { color: var(--c-brand-ink); font-weight: 700; }
/* ===== Hero actions ===== */ /* ===== Hero actions ===== */
.mu-hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 18px; } .mu-hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 18px; }
@@ -161,9 +176,9 @@
gap: 7px; gap: 7px;
padding: 11px 20px; padding: 11px 20px;
border-radius: 999px; border-radius: 999px;
background: #fff; background: var(--c-surface);
border: 1px solid #e7e2f6; border: 1px solid var(--c-border);
color: #5b3b71; color: var(--c-ink-2);
text-decoration: none; text-decoration: none;
font-size: .88rem; font-size: .88rem;
font-weight: 700; font-weight: 700;
@@ -182,24 +197,24 @@
.mu-zone { margin-bottom: 32px; } .mu-zone { margin-bottom: 32px; }
.mu-zone-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 14px; } .mu-zone-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 14px; }
.mu-zone-tag { padding: 5px 14px; border-radius: 999px; font-size: .82rem; font-weight: 700; } .mu-zone-tag { padding: 5px 14px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.mu-zone-tag.tag-sky { background: #dbeafe; color: #1d4ed8; } .mu-zone-tag.tag-sky { background: var(--c-tint-cyan); color: var(--c-info); }
.mu-zone-tag.tag-pink { background: #fce7f3; color: #be185d; } .mu-zone-tag.tag-pink { background: var(--c-tint-pink); color: var(--c-danger); }
.mu-zone-tag.tag-purple { background: #ede9fe; color: #6d28d9; } .mu-zone-tag.tag-purple { background: var(--c-tint-purple); color: var(--c-brand-ink); }
.mu-zone-tag.tag-yellow { background: #fdf1d3; color: #8a6100; } .mu-zone-tag.tag-yellow { background: var(--c-tint-amber); color: var(--c-warn); }
/* คำอธิบายสีการ์ดตามหมวดเส้นทาง */ /* คำอธิบายสีการ์ดตามหมวดเส้นทาง */
.mu-legend { background: #fff; border: 1px solid #e9eef7; border-radius: 14px; padding: 16px 18px; margin-bottom: 26px; box-shadow: 0 4px 14px rgba(20,40,90,.05); } .mu-legend { background: var(--c-surface); border: 1px solid #e9eef7; border-radius: 14px; padding: 16px 18px; margin-bottom: 26px; box-shadow: 0 4px 14px rgba(20,40,90,.05); }
.mu-legend-title { margin: 0 0 12px; font-size: .95rem; font-weight: 800; color: #1f2a44; } .mu-legend-title { margin: 0 0 12px; font-size: .95rem; font-weight: 800; color: var(--c-ink); }
.mu-legend-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 18px; } .mu-legend-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 18px; }
.mu-legend-list li { display: flex; align-items: center; gap: 9px; font-size: .86rem; color: #3d4a63; } .mu-legend-list li { display: flex; align-items: center; gap: 9px; font-size: .86rem; color: var(--c-ink-2); }
.mu-legend-list .sw { width: 26px; height: 16px; border-radius: 4px; flex: none; border: 1px solid rgba(20,40,90,.12); } .mu-legend-list .sw { width: 26px; height: 16px; border-radius: 4px; flex: none; border: 1px solid rgba(20,40,90,.12); }
.sw-bangkok { background: linear-gradient(135deg, #3b82f6, #60a5fa); } .sw-bangkok { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.sw-interprov { background: linear-gradient(135deg, #8b5cf6, #c084fc); } .sw-interprov { background: linear-gradient(135deg, #8b5cf6, #c084fc); }
.sw-inprov { background: linear-gradient(135deg, #ec4899, #f472b6); } .sw-inprov { background: linear-gradient(135deg, #ec4899, #f472b6); }
.sw-municipal { background: linear-gradient(135deg, #f59e0b, #fbbf24); } .sw-municipal { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.sw-empty { background: #e4e7eb; } .sw-empty { background: var(--c-surface-3); }
.mu-legend-note { margin: 12px 0 0; color: #6f7b95; font-size: .82rem; } .mu-legend-note { margin: 12px 0 0; color: var(--c-ink-2); font-size: .82rem; }
.mu-zone-sub, .mu-zone-desc { color: #6f7b95; font-size: .88rem; margin: 0; } .mu-zone-sub, .mu-zone-desc { color: var(--c-ink-2); font-size: .88rem; margin: 0; }
/* ทุกบรรทัดคำอธิบายกินเต็มความกว้างของตัวเอง — ไม่ถูกบีบไปรวมแถวเดียวกับป้ายหัวข้อ /* ทุกบรรทัดคำอธิบายกินเต็มความกว้างของตัวเอง — ไม่ถูกบีบไปรวมแถวเดียวกับป้ายหัวข้อ
(เดิม flex ไม่มี wrap → ทุกบรรทัดถูกย่อรวมกันหมด ข้อความไทยจึงตัดคำมั่ว) */ (เดิม flex ไม่มี wrap → ทุกบรรทัดถูกย่อรวมกันหมด ข้อความไทยจึงตัดคำมั่ว) */
.mu-zone-head .mu-zone-desc { flex-basis: 100%; min-width: 0; line-height: 1.65; } .mu-zone-head .mu-zone-desc { flex-basis: 100%; min-width: 0; line-height: 1.65; }
@@ -210,85 +225,41 @@
.mu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; } .mu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
/* Cards */ /* Cards */
.mu-card { display: block; text-decoration: none; color: inherit; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 14px rgba(20,40,90,.06); transition: transform .15s, box-shadow .15s; } .mu-card { display: block; text-decoration: none; color: inherit; background: var(--c-surface); border-radius: 16px; overflow: hidden; box-shadow: 0 4px 14px rgba(20,40,90,.06); transition: transform .15s, box-shadow .15s; }
.mu-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20,40,90,.1); } .mu-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20,40,90,.1); }
.mu-card-head { aspect-ratio: auto !important; height: 130px !important; display: flex !important; align-items: center; justify-content: center; position: relative; } .mu-card-head { aspect-ratio: auto !important; height: 130px !important; display: flex !important; align-items: center; justify-content: center; position: relative; }
.mu-card-head::after { display: none !important; } .mu-card-head::after { display: none !important; }
.mu-card-head .mu-route-number { position: static !important; color: #fff !important; font-size: 52px !important; font-weight: 900; text-shadow: 0 4px 12px rgba(0,0,0,.2) !important; letter-spacing: .02em; margin: 0; } .mu-card-head .mu-route-number { position: static !important; color: #fff !important; font-size: 52px !important; font-weight: 900; text-shadow: 0 4px 12px rgba(0,0,0,.2) !important; letter-spacing: .02em; margin: 0; }
.mu-route-info { padding: 14px 14px 14px; } .mu-route-info { padding: 14px 14px 14px; }
.mu-route-name { margin: 0 0 10px; font-size: .9rem; color: #1f2a44; font-weight: 700; } .mu-route-name { margin: 0 0 10px; font-size: .9rem; color: var(--c-ink); font-weight: 700; }
.mu-card .mu-badge { background: #dcfce7; color: #15803d; padding: 4px 10px; font-size: .78rem; font-weight: 700; box-shadow: none; backdrop-filter: none; } .mu-card .mu-badge { background: var(--c-tint-green); color: var(--c-ok); padding: 4px 10px; font-size: .78rem; font-weight: 700; box-shadow: none; backdrop-filter: none; }
.mu-next-trip { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #dcfce7; color: #15803d; } .mu-next-trip { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--c-tint-green); color: var(--c-ok); }
.badge-purple { background: #ede9fe; color: #6d28d9; } .badge-purple { background: var(--c-tint-purple); color: var(--c-brand-ink); }
.badge-sky { background: #dbeafe; color: #1d4ed8; } .badge-sky { background: var(--c-tint-cyan); color: var(--c-info); }
.badge-pink { background: #fce7f3; color: #be185d; } .badge-pink { background: var(--c-tint-pink); color: var(--c-danger); }
.badge-mint { background: #d1fae5; color: #047857; } .badge-mint { background: var(--c-tint-green); color: var(--c-ok); }
.badge-gray { background: #e8eaed; color: #5b636e; } .badge-gray { background: var(--c-surface-3); color: var(--c-ink-2); }
.mu-route-chip-wrap { display:flex; gap: 8px; } .mu-route-chip-wrap { display:flex; gap: 8px; }
/* Summary stats */ /* Summary stats */
.mu-summary { padding: 20px 0 40px; } .mu-summary { padding: 20px 0 40px; }
.mu-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; } .mu-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.mu-stat { padding: 28px 18px; text-align: center; border-radius: 18px; font-weight: 700; margin: 0; } .mu-stat { padding: 28px 18px; text-align: center; border-radius: 18px; font-weight: 700; margin: 0; }
.mu-stat h3 { margin: 0 0 4px; font-size: 2rem; color: #1f2a44; font-weight: 800; } .mu-stat h3 { margin: 0 0 4px; font-size: 2rem; color: var(--c-ink); font-weight: 800; }
.mu-stat p { margin: 0; font-size: .82rem; color: #4a5876; font-weight: 600; } .mu-stat p { margin: 0; font-size: .82rem; color: var(--c-ink-2); font-weight: 600; }
.mu-stat.tag-pink { background: #fce7f3; } .mu-stat.tag-pink { background: var(--c-tint-pink); }
.mu-stat.tag-sky { background: #dbeafe; } .mu-stat.tag-sky { background: var(--c-tint-cyan); }
.mu-stat.tag-purple { background: #ede9fe; } .mu-stat.tag-purple { background: var(--c-tint-purple); }
.mu-stat.tag-mint { background: #d1fae5; } .mu-stat.tag-mint { background: var(--c-tint-green); }
/* ===== Visitor counter (footer bottom bar) ===== */ /* ===== Footer bottom bar ===== */
.mu-footer-bottom { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; } .mu-footer-bottom { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.mu-visitor {
display: inline-flex;
align-items: center;
gap: 7px;
margin: 0;
padding: 5px 12px;
border-radius: 999px;
background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.1);
color: #b6bdda;
font-size: .78rem;
font-weight: 600;
letter-spacing: .01em;
line-height: 1;
}
.mu-visitor svg { width: 14px; height: 14px; color: #b694f6; flex: none; }
.mu-visitor strong { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
/* ปุ่ม/ช่องรีเซ็ตผู้เข้าชม (ซ่อน — กดตัวเลข 5 ครั้ง) */
#visitor-count { cursor: pointer; }
.mu-vreset {
position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center;
padding: 20px; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px);
}
.mu-vreset-card {
width: 100%; max-width: 340px; background: #fff; border-radius: 16px; padding: 20px;
box-shadow: 0 18px 50px rgba(15, 23, 42, .28);
}
.mu-vreset-card h4 { margin: 0 0 12px; font-size: 1rem; color: #1f2a44; }
.mu-vreset-card label { display: block; font-size: .8rem; color: #6b7a94; margin-bottom: 6px; }
.mu-vreset-card input {
width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: .95rem;
border: 1px solid #d9d3e8; border-radius: 10px; color: #1f2a44; background: #fbfaff;
}
.mu-vreset-card input:focus { outline: 2px solid #7a4cc0; outline-offset: 1px; border-color: #7a4cc0; }
.mu-vreset-msg { margin: 10px 0 0; min-height: 18px; font-size: .8rem; color: #b3261e; }
.mu-vreset-msg.is-ok { color: #1f7a3d; }
.mu-vreset-row { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.mu-vreset-row button {
padding: 9px 16px; font-size: .85rem; font-weight: 700; border-radius: 10px; cursor: pointer;
border: 1px solid #d9d3e8; background: #fff; color: #3d4a63;
}
.mu-vreset-row button:hover { background: #fbfaff; }
.mu-vreset-ok { border-color: #7a4cc0 !important; background: #7a4cc0 !important; color: #fff !important; }
.mu-vreset-ok:hover { background: #6a3fb0 !important; }
/* ===== Sponsor marquee (between hero and main) ===== */ /* ===== Sponsor marquee (between hero and main) ===== */
.mu-sponsor-marquee { padding: 26px 0 6px; background: #fff; border-bottom: 1px solid #f0f2f8; } .mu-sponsor-marquee { padding: 26px 0 6px; background: var(--c-surface); border-bottom: 1px solid #f0f2f8; }
.mu-sponsor-head { text-align: center; margin-bottom: 18px; } .mu-sponsor-head { text-align: center; margin-bottom: 18px; }
.mu-sponsor-head h4 { margin: 0 0 4px; font-size: 1rem; font-weight: 800; color: #1f2a44; letter-spacing: .01em; } .mu-sponsor-head h4 { margin: 0 0 4px; font-size: 1rem; font-weight: 800; color: var(--c-ink); letter-spacing: .01em; }
.mu-sponsor-head .lead { margin: 0; color: #6f7b95; font-size: .84rem; } .mu-sponsor-head .lead { margin: 0; color: var(--c-ink-2); font-size: .84rem; }
.mu-marquee { .mu-marquee {
overflow: hidden; overflow: hidden;
position: relative; position: relative;
@@ -316,7 +287,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: #fff; background: var(--c-surface);
border: 1px solid #eef0f6; border: 1px solid #eef0f6;
border-radius: 14px; border-radius: 14px;
box-shadow: 0 4px 12px rgba(63, 43, 94, .05); box-shadow: 0 4px 12px rgba(63, 43, 94, .05);
@@ -337,20 +308,33 @@
</style> </style>
<link rel="manifest" href="./manifest.json"> <link rel="manifest" href="./manifest.json">
<meta name="theme-color" content="#7a4cc0"> <meta name="theme-color" content="#7a4cc0">
<!-- ============================================================
สถิติ (Analytics) — ค่าเริ่มต้น: เก็บในเครื่องเท่านั้น (ไม่ส่งที่ไหน)
ต้องการส่งเข้า Umami ของตัวเอง/Umami Cloud → ใส่ค่า 2 ตัวนี้:
endpoint: "https://umami.example.com" (โดเมน Umami ไม่ต้องมี /api/send)
siteId: "xxxxxxxx-xxxx-... (Website ID ใน Umami)"
payload ตรงสเปก Umami /api/send (type=event) · ไม่มีคุกกี้/ไม่มี UA/IP
============================================================ -->
<script>
window.AT_ANALYTICS = { endpoint: '', siteId: '' };
</script>
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default"> <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.103"> <link rel="apple-touch-icon" href="../.image/icons/minibus-192x192.png?v=2026.09.27.129">
<script src="./imageurl.js" defer></script> <script src="./imageurl.js?v=2026.09.27.129" defer></script>
<script src="./pwa.js" defer></script> <script src="./pwa.js?v=2026.09.27.129" defer></script>
<script src="./i18n.js" defer></script> <script src="./i18n.js?v=2026.09.27.129" defer></script>
<script src="./popular.js" defer></script> <script src="./theme.js?v=2026.09.27.129" defer></script>
<script src="./visitors.js" defer></script> <script src="./share.js?v=2026.09.27.129" defer></script>
<script src="./vendor/leaflet/leaflet.js" defer></script> <script src="./analytics.js?v=2026.09.27.129" defer></script>
<script src="./map.js" defer></script> <script src="./popular.js?v=2026.09.27.129" defer></script>
<script src="./partials/schedules.js" defer></script> <script src="./vendor/leaflet/leaflet.js?v=2026.09.27.129" defer></script>
<script src="./partials/otherStop.js" defer></script> <script src="./map.js?v=2026.09.27.129" defer></script>
<script src="./router.js" defer></script> <script src="./partials/schedules.js?v=2026.09.27.129" defer></script>
<link rel="stylesheet" href="./responsive.css"> <script src="./partials/otherStop.js?v=2026.09.27.129" defer></script>
<script src="./motion.js?v=2026.09.27.129" defer></script>
<script src="./router.js?v=2026.09.27.129" defer></script>
<link rel="stylesheet" href="./responsive.css?v=2026.09.27.129">
</head> </head>
<body class="main-theme-page"> <body class="main-theme-page">
<svg xmlns="http://www.w3.org/2000/svg" style="display:none" aria-hidden="true"> <svg xmlns="http://www.w3.org/2000/svg" style="display:none" aria-hidden="true">
@@ -444,7 +428,7 @@
<header class="mu-topbar"> <header class="mu-topbar">
<div class="mu-container mu-topbar-inner"> <div class="mu-container mu-topbar-inner">
<a class="mu-brand" href="#/" aria-label="Atroute — หน้าแรก" data-i18n-attr="aria-label:aria.brandHome"> <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.103" alt="Atroute logo" width="44" height="44" decoding="async"> <img class="mu-logo-img" src="../.image/icons/minibus-512x512.png?v=2026.09.27.129" alt="Atroute logo" width="44" height="44" decoding="async">
<span> <span>
<span class="mu-brand-title">Atroute</span> <span class="mu-brand-title">Atroute</span>
<span class="mu-brand-subtitle" data-i18n="brand.subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span> <span class="mu-brand-subtitle" data-i18n="brand.subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span>
@@ -472,10 +456,43 @@
<a href="#/credits" data-i18n="nav.credits" role="menuitem">เครดิต</a> <a href="#/credits" data-i18n="nav.credits" role="menuitem">เครดิต</a>
</div> </div>
</details> </details>
<div class="mu-lang-switch" role="group" aria-label="ภาษา / Language" data-i18n-attr="aria-label:aria.langSwitch"> <div class="mu-topbar-tools">
<button type="button" class="mu-lang-btn" data-i18n-switch="th">ไทย</button> <div class="mu-pop" id="theme-switch">
<button type="button" class="mu-lang-btn" data-i18n-switch="en">EN</button> <button type="button" class="mu-pop-btn" id="theme-btn" aria-haspopup="menu"
aria-expanded="false" aria-label="ธีม / Theme">
<span id="theme-icon" aria-hidden="true"></span>
</button>
<div class="mu-pop-panel" id="theme-menu" role="menu" hidden aria-label="ธีม / Theme">
<button type="button" class="mu-pop-item" role="menuitemradio" aria-checked="false" data-theme-mode="light">
<span class="mu-pop-item-th mu-theme-label">สว่าง</span><span class="mu-pop-item-en">Light</span>
</button>
<button type="button" class="mu-pop-item" role="menuitemradio" aria-checked="false" data-theme-mode="dark">
<span class="mu-pop-item-th mu-theme-label">มืด</span><span class="mu-pop-item-en">Dark</span>
</button>
<button type="button" class="mu-pop-item" role="menuitemradio" aria-checked="true" data-theme-mode="auto">
<span class="mu-pop-item-th mu-theme-label">ตามอุปกรณ์</span><span class="mu-pop-item-en">Device</span>
</button>
</div>
</div>
<div class="mu-pop" id="lang-switch">
<button type="button" class="mu-pop-btn mu-pop-btn-lang" id="lang-btn" aria-haspopup="menu"
aria-expanded="false" aria-label="ภาษา / Language" data-i18n-attr="aria-label:aria.langSwitch">
<span id="lang-label">ไทย</span>
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2.5"
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
</button>
<div class="mu-pop-panel" id="lang-menu" role="menu" hidden aria-label="ภาษา / Language">
<button type="button" class="mu-pop-item" role="menuitemradio" aria-checked="true" data-i18n-switch="th">
<span class="mu-pop-item-th">ภาษาไทย</span><span class="mu-pop-item-en">TH</span>
</button>
<button type="button" class="mu-pop-item" role="menuitemradio" aria-checked="false" data-i18n-switch="en">
<span class="mu-pop-item-th">English</span><span class="mu-pop-item-en">EN</span>
</button>
</div>
</div>
</div> </div>
<a class="mu-action-btn" href="#/check" data-i18n="cta.check">เช็กเวลาเดินรถ</a> <a class="mu-action-btn" href="#/check" data-i18n="cta.check">เช็กเวลาเดินรถ</a>
</div> </div>
</header> </header>
@@ -487,7 +504,7 @@
<div class="mu-footer-grid"> <div class="mu-footer-grid">
<div class="mu-footer-brand"> <div class="mu-footer-brand">
<div class="mu-footer-brand-row"> <div class="mu-footer-brand-row">
<img src="../.image/icons/minibus-512x512.png?v=2026.09.27.103" alt="Atroute"> <img src="../.image/icons/minibus-512x512.png?v=2026.09.27.129" alt="Atroute">
<div> <div>
<strong>Atroute</strong> <strong>Atroute</strong>
<span data-i18n="brand.subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span> <span data-i18n="brand.subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span>
@@ -503,7 +520,8 @@
<li><a href="#/routes" data-i18n="nav.routes">รายละเอียดสายรถ</a></li> <li><a href="#/routes" data-i18n="nav.routes">รายละเอียดสายรถ</a></li>
<li><a href="#/about" data-i18n="nav.about">เกี่ยวกับเรา</a></li> <li><a href="#/about" data-i18n="nav.about">เกี่ยวกับเรา</a></li>
<li><a href="#/blog" data-i18n="nav.blog">บ่นไปเรื่อย</a></li> <li><a href="#/blog" data-i18n="nav.blog">บ่นไปเรื่อย</a></li>
<li><a href="#/credits" data-i18n="nav.credits">เครดิต</a></li></ul> <li><a href="#/credits" data-i18n="nav.credits">เครดิต</a></li>
<li><a href="#/stats" data-i18n="nav.stats">สถิติ</a></li></ul>
</div> </div>
<div class="mu-footer-col"> <div class="mu-footer-col">
<h4 data-i18n="footer.popular">สายที่เปิดดูบ่อย</h4> <h4 data-i18n="footer.popular">สายที่เปิดดูบ่อย</h4>
@@ -517,17 +535,12 @@
</div> </div>
<div class="mu-footer-col mu-footer-contact"> <div class="mu-footer-col mu-footer-contact">
<h4 data-i18n="footer.contact">ติดต่อ</h4> <h4 data-i18n="footer.contact">ติดต่อ</h4>
<div class="row"><a href="mailto:atroute@hobbygirds.com"><svg class="ic" aria-hidden="true"><use href="#ic-mail"/></svg> atroute@hobbygirds.com</a></div> <div class="row"><a href="mailto:atroute@hobbypj.com"><svg class="ic" aria-hidden="true"><use href="#ic-mail"/></svg> atroute@hobbypj.com</a></div>
</div> </div>
</div> </div>
<div class="mu-footer-bottom"> <div class="mu-footer-bottom">
<p>© 2026 Atroute</p> <p>© 2026 Atroute</p>
<span class="mu-visitor" title="จำนวนผู้เข้าชมเว็บไซต์" data-i18n-attr="title:visitors.tip">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/></svg>
<span data-i18n="visitors.label">ผู้เข้าชม</span>
<strong id="visitor-count">12,834</strong>
</span>
</div> </div>
</div> </div>
</footer> </footer>
+45 -13
View File
@@ -131,10 +131,10 @@
"stops.noOffset": "No travel time from the first stop yet", "stops.noOffset": "No travel time from the first stop yet",
"stops.noBusLine": "No bus line listed", "stops.noBusLine": "No bus line listed",
"stops.modeCode": "Search by stop code", "stops.modeCode": "Search by stop code",
"stops.modeNear": "Near me", "stops.modeNear": "Near me",
"stops.nearCta": "Use my location", "stops.nearCta": "Use my location",
"stops.nearHint": "We ask your device for a location, then rank stops by real distance from their coordinates.", "stops.nearHint": "We ask your device for a location, then rank stops by real distance from their coordinates.",
"stops.modePlace": "Search by place name", "stops.modePlace": "Search by place name",
"stops.codePh": "3+000", "stops.codePh": "3+000",
"stops.codeHint": "Type 4 digits and the + sign is added automatically (e.g. 3000 → 3+000)", "stops.codeHint": "Type 4 digits and the + sign is added automatically (e.g. 3000 → 3+000)",
"stops.codeHintBox": "Type digits in the boxes — empty boxes are filled with 0 automatically. For 4-digit codes such as 8+591, enter 08+591", "stops.codeHintBox": "Type digits in the boxes — empty boxes are filled with 0 automatically. For 4-digit codes such as 8+591, enter 08+591",
@@ -300,13 +300,6 @@
"day.thuS": "Thu", "day.thuS": "Thu",
"day.friS": "Fri", "day.friS": "Fri",
"day.satS": "Sat", "day.satS": "Sat",
"visitors.resetTitle": "Reset visitor counter",
"visitors.resetPass": "Reset code",
"visitors.cancel": "Cancel",
"visitors.confirm": "Reset",
"visitors.done": "Reset done — counting restarts from 0",
"visitors.unsupported": "Browser not supported — needs https or localhost",
"visitors.badPass": "Incorrect code",
"aria.mapsView": "View", "aria.mapsView": "View",
"aria.searchMode": "Search mode", "aria.searchMode": "Search mode",
"aria.stopCode": "Stop code", "aria.stopCode": "Stop code",
@@ -341,9 +334,6 @@
"credits.breadHome": "Home", "credits.breadHome": "Home",
"credits.breadSelf": "Credits", "credits.breadSelf": "Credits",
"credits.lineRed": "SRT Red Line", "credits.lineRed": "SRT Red Line",
"visitors.label": "Visitors",
"visitors.tip": "Site visitor count",
"pwa.install": "Install app",
"aria.brandHome": "Atroute — home", "aria.brandHome": "Atroute — home",
"aria.mainMenu": "Main menu", "aria.mainMenu": "Main menu",
"aria.langSwitch": "Language", "aria.langSwitch": "Language",
@@ -352,5 +342,47 @@
"credits.osmCredit": "OpenStreetMap © contributors (ODbL)", "credits.osmCredit": "OpenStreetMap © contributors (ODbL)",
"credits.facebookGroup": "Facebook group (web.facebook.com)", "credits.facebookGroup": "Facebook group (web.facebook.com)",
"credits.from": "from", "credits.from": "from",
"credits.routeN": "Route {n}" "credits.routeN": "Route {n}",
"nav.stats": "Stats",
"page.stats": "Search stats",
"stats.title": "Search statistics on this device",
"stats.lead": "Only counts and search terms are kept — no cookies, no user id, no IP, and nothing leaves this device unless the site owner connects Umami.",
"stats.kpi.views": "Page views",
"stats.kpi.searches": "Searches",
"stats.kpi.terms": "Unique terms",
"stats.kpi.noResult": "No results",
"stats.chart.title": "Last 14 days",
"stats.chart.lead": "Solid bar = page views · light bar = searches",
"stats.terms.title": "Top search terms",
"stats.terms.lead": "Terms are sanitised — emails, phone numbers and long digit runs are stripped before saving",
"stats.terms.empty": "No searches on this device yet — try the stop search page, then come back",
"stats.views.title": "Most opened pages",
"stats.views.lead": "Counts route and stop detail pages only (not tied to any user)",
"stats.views.empty": "No data yet — open a route or stop detail once",
"stats.views.stopPrefix": "Stop {code}",
"stats.col.term": "Term",
"stats.col.count": "Hits",
"stats.col.last": "Last",
"stats.col.target": "Page",
"stats.noresult.title": "Searched, nothing found",
"stats.noresult.lead": "A signal that data is missing — these terms should exist if they are real routes",
"stats.privacy.title": "Privacy",
"stats.privacy.collect": "Stored: page-view counts · sanitised search terms · no-result counts · last-used time",
"stats.privacy.reject": "Not stored: IP · User-Agent · location · cookies · device id · cross-site history",
"stats.privacy.local": "Data lives in this browser's localStorage only — clear it anytime",
"stats.privacy.optoutTitle": "Turn off stats on this device",
"stats.privacy.optoutLead": "Switching this on stops recording immediately (existing numbers stay visible). Do Not Track / GPC are respected anyway.",
"stats.privacy.off": "Stats turned off — nothing new is recorded",
"stats.privacy.on": "Stats turned on",
"stats.btn.export": "Download data (JSON)",
"stats.btn.clear": "Clear data on this device",
"stats.clear.confirm": "Clear all stats on this device? This cannot be undone.",
"stats.clear.done": "Data cleared",
"stats.export.done": "File downloaded",
"stats.since": "Collecting since",
"credits.analyticsTitle": "Analytics — inspired by Umami",
"credits.analyticsBody": "The analytics layer is written here in",
"credits.analyticsBody2": "(no dependencies) — it borrows only the privacy-first approach and the /api/send payload shape from Umami; no Umami code is copied",
"credits.analyticsLocal": "Stats live in the user's browser only (localStorage) — view or clear them on the Stats page",
"update.applying": "New version — updating…"
} }
+45 -13
View File
@@ -131,10 +131,10 @@
"stops.noOffset": "ยังไม่ระบุเวลาเดินทางจากจุดแรก", "stops.noOffset": "ยังไม่ระบุเวลาเดินทางจากจุดแรก",
"stops.noBusLine": "ยังไม่ระบุสายรถ", "stops.noBusLine": "ยังไม่ระบุสายรถ",
"stops.modeCode": "ค้นหาด้วยรหัสป้าย", "stops.modeCode": "ค้นหาด้วยรหัสป้าย",
"stops.modeNear": "ป้ายใกล้ฉัน", "stops.modeNear": "ป้ายใกล้ฉัน",
"stops.nearCta": "ขอพิกัดและหาป้ายใกล้ฉัน", "stops.nearCta": "ขอพิกัดและหาป้ายใกล้ฉัน",
"stops.nearHint": "ระบบจะขอตำแหน่งจากเครื่อง แล้วคำนวณระยะจากพิกัดป้าย/ศาลารถ เรียงจากใกล้ไปไกล", "stops.nearHint": "ระบบจะขอตำแหน่งจากเครื่อง แล้วคำนวณระยะจากพิกัดป้าย/ศาลารถ เรียงจากใกล้ไปไกล",
"stops.modePlace": "ค้นหาด้วยชื่อสถานที่", "stops.modePlace": "ค้นหาด้วยชื่อสถานที่",
"stops.codePh": "3+000", "stops.codePh": "3+000",
"stops.codeHint": "พิมพ์ตัวเลข 4 หลัก ระบบจะเติมเครื่องหมาย + ให้อัตโนมัติ (เช่น 3000 → 3+000)", "stops.codeHint": "พิมพ์ตัวเลข 4 หลัก ระบบจะเติมเครื่องหมาย + ให้อัตโนมัติ (เช่น 3000 → 3+000)",
"stops.codeHintBox": "พิมพ์ตัวเลขในช่อง ระบบจะเติม 0 ให้อัตโนมัติเมื่อเว้นว่าง และถ้าเจอรหัส 4 หลัก เช่น 8+591 ให้กรอก 08+591", "stops.codeHintBox": "พิมพ์ตัวเลขในช่อง ระบบจะเติม 0 ให้อัตโนมัติเมื่อเว้นว่าง และถ้าเจอรหัส 4 หลัก เช่น 8+591 ให้กรอก 08+591",
@@ -300,13 +300,6 @@
"day.thuS": "พฤ.", "day.thuS": "พฤ.",
"day.friS": "ศ.", "day.friS": "ศ.",
"day.satS": "ส.", "day.satS": "ส.",
"visitors.resetTitle": "รีเซ็ตจำนวนผู้เข้าชม",
"visitors.resetPass": "รหัสรีเซ็ต",
"visitors.cancel": "ยกเลิก",
"visitors.confirm": "รีเซ็ต",
"visitors.done": "รีเซ็ตแล้ว — เริ่มนับใหม่จาก 0",
"visitors.unsupported": "เบราว์เซอร์ไม่รองรับ — ต้องเปิดผ่าน https หรือ localhost",
"visitors.badPass": "รหัสไม่ถูกต้อง",
"aria.mapsView": "มุมมอง", "aria.mapsView": "มุมมอง",
"aria.searchMode": "รูปแบบการค้นหา", "aria.searchMode": "รูปแบบการค้นหา",
"aria.stopCode": "รหัสป้าย", "aria.stopCode": "รหัสป้าย",
@@ -341,9 +334,6 @@
"credits.breadHome": "หน้าแรก", "credits.breadHome": "หน้าแรก",
"credits.breadSelf": "เครดิต", "credits.breadSelf": "เครดิต",
"credits.lineRed": "รถไฟฟ้าสายสีแดง", "credits.lineRed": "รถไฟฟ้าสายสีแดง",
"visitors.label": "ผู้เข้าชม",
"visitors.tip": "จำนวนผู้เข้าชมเว็บไซต์",
"pwa.install": "ติดตั้งแอป",
"aria.brandHome": "Atroute — หน้าแรก", "aria.brandHome": "Atroute — หน้าแรก",
"aria.mainMenu": "เมนูหลัก", "aria.mainMenu": "เมนูหลัก",
"aria.langSwitch": "ภาษา / Language", "aria.langSwitch": "ภาษา / Language",
@@ -352,5 +342,47 @@
"credits.osmCredit": "OpenStreetMap © ผู้มีส่วนร่วม (ODbL)", "credits.osmCredit": "OpenStreetMap © ผู้มีส่วนร่วม (ODbL)",
"credits.facebookGroup": "กลุ่ม Facebook (web.facebook.com)", "credits.facebookGroup": "กลุ่ม Facebook (web.facebook.com)",
"credits.from": "จาก", "credits.from": "จาก",
"credits.routeN": "สาย {n}" "credits.routeN": "สาย {n}",
"nav.stats": "สถิติ",
"page.stats": "สถิติการค้นหา",
"stats.title": "สถิติการค้นหาในเครื่องนี้",
"stats.lead": "เก็บเฉพาะจำนวนครั้งและคำที่ค้น — ไม่มีคุกกี้ ไม่มีรหัสผู้ใช้ ไม่เก็บ IP และไม่ส่งออกนอกเครื่อง เว้นแต่เจ้าของเว็บจะตั้งค่าเชื่อม Umami เอง",
"stats.kpi.views": "ครั้งที่เปิดหน้า",
"stats.kpi.searches": "ครั้งที่ค้นหา",
"stats.kpi.terms": "คำค้นต่างกัน",
"stats.kpi.noResult": "ค้นแล้วไม่พบ",
"stats.chart.title": "14 วันล่าสุด",
"stats.chart.lead": "แท่งเข้ม = เปิดหน้า · แท่งอ่อน = ค้นหา",
"stats.terms.title": "คำที่ค้นมากที่สุด",
"stats.terms.lead": "คำถูกทำให้ปลอดภัยแล้ว — ตัดอีเมล เบอร์โทร และเลขยาวออกก่อนบันทึก",
"stats.terms.empty": "ยังไม่มีคำค้นในเครื่องนี้ — ลองค้นหาป้ายที่หน้า “ป้ายหยุดรถ” แล้วกลับมาดู",
"stats.views.title": "หน้าที่ถูกเปิดบ่อย",
"stats.views.lead": "นับเฉพาะรายละเอียดสายรถและรายละเอียดป้าย (ไม่ผูกกับผู้ใช้)",
"stats.views.empty": "ยังไม่มีข้อมูล — เปิดรายละเอียดสายหรือป้ายสักครั้ง",
"stats.views.stopPrefix": "ป้าย {code}",
"stats.col.term": "คำค้น",
"stats.col.count": "ครั้ง",
"stats.col.last": "ล่าสุด",
"stats.col.target": "หน้า",
"stats.noresult.title": "ค้นแล้วไม่พบ",
"stats.noresult.lead": "สัญญาณว่าข้อมูลยังขาด — คำเหล่านี้ควรมีในระบบถ้าเป็นเส้นทางจริง",
"stats.privacy.title": "ความเป็นส่วนตัว",
"stats.privacy.collect": "เก็บ: จำนวนเปิดหน้า · คำที่ค้น (ตัดข้อมูลส่วนตัวออก) · จำนวนครั้งที่ค้นไม่พบ · เวลาล่าสุด",
"stats.privacy.reject": "ไม่เก็บ: IP · User-Agent · ตำแหน่ง · คุกกี้ · รหัสเครื่อง · ประวัติข้ามเว็บ",
"stats.privacy.local": "ข้อมูลอยู่ใน localStorage ของเบราว์เซอร์นี้เท่านั้น — ล้างได้ทุกเมื่อ",
"stats.privacy.optoutTitle": "ปิดการเก็บสถิติในเครื่องนี้",
"stats.privacy.optoutLead": "เปิดสวิตช์นี้ = หยุดบันทึกทันที (ยังดูตัวเลขเดิมได้) · ระบบเคารพ Do Not Track / GPC อยู่แล้ว",
"stats.privacy.off": "ปิดการเก็บสถิติแล้ว — ไม่มีการบันทึกใหม่",
"stats.privacy.on": "เปิดการเก็บสถิติแล้ว",
"stats.btn.export": "ดาวน์โหลดข้อมูล (JSON)",
"stats.btn.clear": "ล้างข้อมูลในเครื่อง",
"stats.clear.confirm": "ล้างสถิติทั้งหมดในเครื่องนี้? การลบย้อนกลับไม่ได้",
"stats.clear.done": "ล้างข้อมูลเรียบร้อย",
"stats.export.done": "ดาวน์โหลดไฟล์แล้ว",
"stats.since": "เริ่มเก็บเมื่อ",
"credits.analyticsTitle": "สถิติ — แนวคิดจาก Umami",
"credits.analyticsBody": "ระบบสถิติของเว็บนี้เขียนเองใน",
"credits.analyticsBody2": "(ไม่มี dependency) — ยืมเฉพาะแนวคิด privacy-first และรูปแบบ payload ของ Umami (/api/send) ไม่ได้คัดลอกโค้ดของ Umami มาใช้",
"credits.analyticsLocal": "ข้อมูลสถิติเก็บในเบราว์เซอร์ของผู้ใช้เท่านั้น (localStorage) — ดู/ล้างได้ที่หน้า “สถิติ”",
"update.applying": "มีเวอร์ชันใหม่ — กำลังอัปเดต…"
} }
+26 -26
View File
@@ -21,12 +21,12 @@
.at-map .leaflet-control-zoom a { .at-map .leaflet-control-zoom a {
border-radius: 4px; border-radius: 4px;
border: 1px solid #ddd5c0; border: 1px solid #ddd5c0;
background: #fffdf6; background: var(--c-tint-amber);
color: #14211a; color: var(--c-ink);
font-weight: 700; font-weight: 700;
box-shadow: none; box-shadow: none;
} }
.at-map .leaflet-control-zoom a:hover { background: #e4efe4; color: #14532d; } .at-map .leaflet-control-zoom a:hover { background: #e4efe4; color: var(--c-ok); }
.at-map .leaflet-bar { border: 0; box-shadow: none; } .at-map .leaflet-bar { border: 0; box-shadow: none; }
/* attribution — เล็ก อ่านได้ ไม่ทับข้อมูล */ /* attribution — เล็ก อ่านได้ ไม่ทับข้อมูล */
@@ -52,18 +52,18 @@
/* ป้ายที่กำลังเปิดดูอยู่ — ใหญ่กว่าเพื่อให้เห็นชัด */ /* ป้ายที่กำลังเปิดดูอยู่ — ใหญ่กว่าเพื่อให้เห็นชัด */
.at-pin.here { background: #f2a900; width: 18px; height: 18px; border-width: 3px; } .at-pin.here { background: #f2a900; width: 18px; height: 18px; border-width: 3px; }
/* จุดย่อย (จุดขึ้นรถประจำทางอื่นๆ) — สี่เหลี่ยมม่วง ต่างจากหมุดกลม */ /* จุดย่อย (จุดขึ้นรถประจำทางอื่นๆ) — สี่เหลี่ยมม่วง ต่างจากหมุดกลม */
.at-pin.sub { background: #7a4cc0; border-radius: 2px; } .at-pin.sub { background: var(--c-brand); border-radius: 2px; }
.at-map .leaflet-tooltip { .at-map .leaflet-tooltip {
border-radius: 4px; border-radius: 4px;
border: 1px solid #ddd5c0; border: 1px solid #ddd5c0;
background: #fffdf6; background: var(--c-tint-amber);
color: #14211a; color: var(--c-ink);
box-shadow: none; box-shadow: none;
font-size: .78rem; font-size: .78rem;
padding: 5px 8px; padding: 5px 8px;
} }
.at-map .leaflet-tooltip b { color: #14532d; } .at-map .leaflet-tooltip b { color: var(--c-ok); }
/* ---------- legend (มุมซ้ายล่าง) ---------- */ /* ---------- legend (มุมซ้ายล่าง) ---------- */
.at-legend { .at-legend {
@@ -75,7 +75,7 @@
border-radius: 4px; border-radius: 4px;
padding: 7px 10px; padding: 7px 10px;
font-size: .74rem; font-size: .74rem;
color: #14211a; color: var(--c-ink);
line-height: 1.65; line-height: 1.65;
pointer-events: none; pointer-events: none;
} }
@@ -94,8 +94,8 @@
color: #6b7268; color: #6b7268;
font-size: .82rem; font-size: .82rem;
} }
.at-map-caption b { color: #14211a; } .at-map-caption b { color: var(--c-ink); }
.at-map-caption .at-offline { color: #8a6100; } .at-map-caption .at-offline { color: var(--c-warn); }
@media (min-width: 768px) { @media (min-width: 768px) {
.at-map { height: 380px; } .at-map { height: 380px; }
@@ -105,45 +105,45 @@
.at-map .leaflet-popup-content-wrapper { .at-map .leaflet-popup-content-wrapper {
border-radius: 4px; border-radius: 4px;
border: 1px solid #ddd5c0; border: 1px solid #ddd5c0;
background: #fffdf6; background: var(--c-tint-amber);
box-shadow: none; box-shadow: none;
color: #14211a; color: var(--c-ink);
} }
.at-map .leaflet-popup-tip { background: #fffdf6; box-shadow: none; } .at-map .leaflet-popup-tip { background: var(--c-tint-amber); box-shadow: none; }
.at-map .leaflet-popup-content { margin: 10px 12px; font-size: .8rem; } .at-map .leaflet-popup-content { margin: 10px 12px; font-size: .8rem; }
.at-pop { display: flex; flex-direction: column; gap: 3px; min-width: 150px; } .at-pop { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.at-pop b { font-size: .86rem; color: #14532d; } .at-pop b { font-size: .86rem; color: var(--c-ok); }
.at-pop span { color: #6b7268; } .at-pop span { color: #6b7268; }
.at-pop a { margin-top: 4px; color: #14532d; font-weight: 700; text-decoration: none; border-bottom: 1px solid #1f7a3d; align-self: flex-start; } .at-pop a { margin-top: 4px; color: var(--c-ok); font-weight: 700; text-decoration: none; border-bottom: 1px solid #1f7a3d; align-self: flex-start; }
.at-pop a:hover { color: #1f7a3d; } .at-pop a:hover { color: var(--c-ok); }
/* ---------- รายการจุดจอดตามเส้นทาง + กม. จากต้นทาง ---------- */ /* ---------- รายการจุดจอดตามเส้นทาง + กม. จากต้นทาง ---------- */
.at-km-wrap { margin-top: 14px; border-top: 1px solid #ddd5c0; padding-top: 12px; } .at-km-wrap { margin-top: 14px; border-top: 1px solid #ddd5c0; padding-top: 12px; }
.at-km-wrap > h3 { margin: 0 0 8px; font-size: .9rem; font-weight: 800; color: #14211a; } .at-km-wrap > h3 { margin: 0 0 8px; font-size: .9rem; font-weight: 800; color: var(--c-ink); }
.at-km-wrap ul { list-style: none; margin: 0; padding: 0; } .at-km-wrap ul { list-style: none; margin: 0; padding: 0; }
.at-km-wrap li + li { border-top: 1px dashed #ddd5c0; } .at-km-wrap li + li { border-top: 1px dashed #ddd5c0; }
.at-km-row { display: flex; align-items: center; gap: 9px; padding: 7px 2px; text-decoration: none; color: #14211a; font-size: .86rem; } .at-km-row { display: flex; align-items: center; gap: 9px; padding: 7px 2px; text-decoration: none; color: var(--c-ink); font-size: .86rem; }
.at-km-row:hover .at-km-name { color: #1f7a3d; text-decoration: underline; } .at-km-row:hover .at-km-name { color: var(--c-ok); text-decoration: underline; }
.at-km-dot { width: 9px; height: 9px; border-radius: 3px; background: #f2a900; flex: none; } .at-km-dot { width: 9px; height: 9px; border-radius: 3px; background: #f2a900; flex: none; }
.at-km-name { flex: 1; font-weight: 600; } .at-km-name { flex: 1; font-weight: 600; }
.at-km-val { font-variant-numeric: tabular-nums; font-weight: 700; color: #14532d; } .at-km-val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--c-ok); }
/* จุดจอดที่ไม่มีหน้ารายละเอียด (มาจาก 8 other_stop.json) — ไม่ใช่ลิงก์ */ /* จุดจอดที่ไม่มีหน้ารายละเอียด (มาจาก 8 other_stop.json) — ไม่ใช่ลิงก์ */
.at-km-row.is-plain { cursor: default; } .at-km-row.is-plain { cursor: default; }
.at-km-row.is-plain .at-km-dot { background: #7a4cc0; } .at-km-row.is-plain .at-km-dot { background: var(--c-brand); }
.at-km-row.is-sub .at-km-dot { background: #7a4cc0; } /* จุดย่อย (จุดขึ้นรถอื่นๆ) — ม่วง ให้ตรงกับหมุดบนแผนที่ */ .at-km-row.is-sub .at-km-dot { background: var(--c-brand); } /* จุดย่อย (จุดขึ้นรถอื่นๆ) — ม่วง ให้ตรงกับหมุดบนแผนที่ */
.at-km-row.is-plain:hover .at-km-name { color: inherit; text-decoration: none; } .at-km-row.is-plain:hover .at-km-name { color: inherit; text-decoration: none; }
.at-km-row .at-km-val.is-off { color: #a3560f; font-weight: 600; font-size: .78rem; } .at-km-row .at-km-val.is-off { color: #a3560f; font-weight: 600; font-size: .78rem; }
/* ---------- ป้ายใกล้ฉัน ---------- */ /* ---------- ป้ายใกล้ฉัน ---------- */
.at-near-msg { margin: 14px 0 0; color: #6b7268; font-size: .86rem; } .at-near-msg { margin: 14px 0 0; color: #6b7268; font-size: .86rem; }
.at-near-err { color: #8a6100; } .at-near-err { color: var(--c-warn); }
.at-near-list { list-style: none; margin: 12px 0 0; padding: 0; } .at-near-list { list-style: none; margin: 12px 0 0; padding: 0; }
.at-near-list li + li { border-top: 1px dashed #ddd5c0; } .at-near-list li + li { border-top: 1px dashed #ddd5c0; }
.at-near-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 2px; text-decoration: none; color: #14211a; align-items: center; } .at-near-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 2px; text-decoration: none; color: var(--c-ink); align-items: center; }
.at-near-row:hover .at-near-name { color: #1f7a3d; text-decoration: underline; } .at-near-row:hover .at-near-name { color: var(--c-ok); text-decoration: underline; }
.at-near-name { font-weight: 700; font-size: .9rem; } .at-near-name { font-weight: 700; font-size: .9rem; }
.at-near-meta { grid-column: 1; color: #6b7268; font-size: .76rem; } .at-near-meta { grid-column: 1; color: #6b7268; font-size: .76rem; }
.at-near-dist { grid-column: 2; grid-row: 1 / span 2; font-variant-numeric: tabular-nums; font-weight: 800; color: #14532d; white-space: nowrap; } .at-near-dist { grid-column: 2; grid-row: 1 / span 2; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--c-ok); white-space: nowrap; }
/* ---------- กัน CSS ภายนอกทำลายขนาด SVG ของ Leaflet ---------- /* ---------- กัน CSS ภายนอกทำลายขนาด SVG ของ Leaflet ----------
responsive.css ตั้ง `img, svg, video { max-width: 100%; height: auto; }` และบาง partial responsive.css ตั้ง `img, svg, video { max-width: 100%; height: auto; }` และบาง partial
+226
View File
@@ -0,0 +1,226 @@
/* ============================================================
Atroute — motion layer
------------------------------------------------------------
อนิเมชันเบา ๆ ที่ใช้ร่วมทุกหน้า (โหลดจาก shell ก่อน router.js)
1) แถบโหลดบาง ๆ บนสุด Motion.loading(true|false)
2) หน้าใหม่ค่อย ๆ โผล่ Motion.enter(#view) ← router เรียกหลัง inject
3) เลื่อนแล้วค่อยโผล่ สแกนอัตโนมัติใน #view + MutationObserver
(การ์ดที่ JS สร้างทีหลังก็ได้อนิเมชัน)
หลักการ
- แตะเฉพาะ opacity + transform → ไม่เกิด layout shift (CLS) และไม่กระตุก
- ทำเฉพาะอิลิเมนต์ที่ยังไม่เห็นบนจอ → ของที่เห็นอยู่แล้วไม่กะพริบ
- เคลียร์คลาส/transform ทิ้งหลังจบ → hover/transform เดิมของแต่ละหน้าไม่ถูกทับ
- prefers-reduced-motion: reduce → ปิดทั้งหมด (ไม่แตะ DOM เลย)
============================================================ */
(function () {
'use strict';
var mqReduce = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;
function reduced() { return !!(mqReduce && mqReduce.matches); }
/* ----------------------------------------------------------
1) แถบโหลดด้านบน (บอกว่ากำลังโหลดหน้า — ไม่บล็อกการคลิก)
---------------------------------------------------------- */
var bar = null, barFill = null, growTimer = null, outTimer = null;
function ensureBar() {
if (bar && document.body.contains(bar)) return;
bar = document.createElement('div');
bar.className = 'mu-loadbar';
bar.setAttribute('aria-hidden', 'true');
barFill = document.createElement('div');
barFill.className = 'mu-loadbar-fill';
bar.appendChild(barFill);
document.body.appendChild(bar);
}
function setProgress(p) {
if (!barFill) return;
barFill.style.transition = 'transform .4s cubic-bezier(.22,.61,.36,1)';
barFill.style.transform = 'scaleX(' + p + ')';
barFill.style.transformOrigin = '0 50%';
barFill.style.width = '100%';
}
function loading(on) {
if (reduced() || !document.body) return;
ensureBar();
clearTimeout(growTimer);
clearTimeout(outTimer);
if (on) {
bar.classList.add('is-on');
barFill.style.transition = 'none';
barFill.style.transform = 'scaleX(0)';
void barFill.offsetWidth; // reflow → ให้เริ่มจาก 0 จริง
setProgress(0.18);
growTimer = setTimeout(function () { setProgress(0.5); }, 200);
growTimer = setTimeout(function () { setProgress(0.78); }, 700);
return;
}
setProgress(1);
outTimer = setTimeout(function () {
bar.classList.remove('is-on');
outTimer = setTimeout(function () {
if (!barFill) return;
barFill.style.transition = 'none';
barFill.style.transform = 'scaleX(0)';
}, 260);
}, 180);
}
/* ----------------------------------------------------------
2) หน้าใหม่ค่อย ๆ โผล่ (เรียกจาก router ทุกครั้งที่ inject)
---------------------------------------------------------- */
function enter(el) {
if (!el || reduced()) { firstPass = false; return; }
el.classList.remove('mu-view-in');
void el.offsetWidth; // รีสตาร์ทอนิเมชันได้ทุกครั้ง
el.classList.add('mu-view-in');
firstPass = true;
scan(el);
/* partial บางหน้าเรนเดอร์การ์ดหลัง fetch JSON — รอบสองรับของที่มาช้า */
setTimeout(function () { firstPass = false; scan(el); }, 400);
}
/* ----------------------------------------------------------
3) เลื่อนแล้วค่อยโผล่
---------------------------------------------------------- */
var SELECTOR = [
'.mu-zone', '.mu-card', '.mu-stop-card', '.mu-blog-card', '.mu-blog-row',
'.mu-credit-section', '.mu-summary', '.mu-stat', '.mu-zone-head',
'.mu-sponsor-head', '.mu-schedule', '.mu-kpi', '.mu-post-figure',
'.mu-nearby', '.mu-route-tools'
].join(',');
/* ห้ามใส่ transform ให้ของที่ครอบแผนที่ (Leaflet คำนวณพิกัดจากกล่องแม่) */
var SKIP_INSIDE = '.leaflet-container, .at-map, .blog-mapx, [data-no-reveal]';
var io = ('IntersectionObserver' in window)
? new IntersectionObserver(onIntersect, { rootMargin: '0px 0px -8% 0px', threshold: 0.05 })
: null;
var firstPass = false;
var pending = []; // อิลิเมนต์ที่ยังรอโผล่ (ใช้ตอนกระโดดข้ามหน้า)
function reveal(el) {
if (!el || el.classList.contains('is-in')) return;
var at = pending.indexOf(el);
if (at !== -1) pending.splice(at, 1);
io.unobserve(el);
el.classList.add('is-in');
var d = parseFloat(el.style.getPropertyValue('--mu-d')) || 0;
setTimeout(function () {
el.classList.remove('mu-reveal', 'is-in');
el.style.removeProperty('--mu-d');
}, 700 + d);
}
function onIntersect(entries) {
for (var i = 0; i < entries.length; i++) {
if (entries[i].isIntersecting) reveal(entries[i].target);
}
sweep(); // กันของที่ถูก "ข้าม" ตอนเลื่อนจัมป์
}
/* เปิดของที่ผ่านขึ้นไปเหนือจอแล้วโดยไม่ต้องรอIntersect
(กด End / กดลิงก์ข้ามส่วน / เบราว์เซอร์คืนตำแหน่งเดิม → IO ไม่เคยเห็นของกลางทาง) */
function sweep() {
if (!pending.length) return;
var vh = window.innerHeight || document.documentElement.clientHeight;
for (var i = pending.length - 1; i >= 0; i--) {
var el = pending[i];
if (!el.isConnected) { pending.splice(i, 1); io.unobserve(el); continue; }
if (el.getBoundingClientRect().top < vh) reveal(el);
}
}
var sweepQueued = 0;
function queueSweep() {
if (sweepQueued) return;
sweepQueued = 1;
setTimeout(function () { sweepQueued = 0; sweep(); }, 90);
}
function scan(root) {
if (!io || reduced()) return;
root = root || document.getElementById('view');
if (!root) return;
var nodes = root.querySelectorAll(SELECTOR);
if (!nodes.length) return;
/* ตัดของจากหน้าจอเก่าที่ถูกแทนที่แล้วออกจากคิว */
pending = pending.filter(function (el) { return el.isConnected; });
var vh = window.innerHeight || document.documentElement.clientHeight;
var idx = 0;
for (var i = 0; i < nodes.length; i++) {
var el = nodes[i];
if (el.classList.contains('mu-reveal') || el.classList.contains('is-in')) continue;
if (el.closest(SKIP_INSIDE)) continue;
/* ซ้อนกันอยู่ → ปล่อยให้ตัวแม่เป็นคนอนิเมต (ลด observer + ไม่กระตุกซ้อน) */
if (el.parentElement && el.parentElement.closest(SELECTOR) && root.contains(el.parentElement.closest(SELECTOR))) continue;
var rect = el.getBoundingClientRect();
if (rect.width === 0 && rect.height === 0) continue; // ซ่อนอยู่
if (firstPass && rect.top < vh) continue; // เห็นอยู่แล้ว → ไม่ต้องอนิเมต
el.style.setProperty('--mu-d', (Math.min(idx, 4) * 45) + 'ms');
el.classList.add('mu-reveal');
pending.push(el);
idx++;
io.observe(el);
}
/* ของใหม่ดันความสูงหน้า → กวาดซ้ำอีกรอบหลังเลย์เอาต์นิ่ง */
if (idx) setTimeout(sweep, 300);
}
/* เลื่อน/ย่อหน้า → เปิดของที่เลยขึ้นไปแล้ว (กันค้าง opacity 0) */
window.addEventListener('scroll', queueSweep, { passive: true });
window.addEventListener('resize', queueSweep);
/* กลับมาที่แท็บ (จากพื้นหลัง) → ตรวจอีกรอบ เผื่อของค้างจากตอนที่ยังไม่วาดจอ */
document.addEventListener('visibilitychange', function () {
if (document.visibilityState === 'visible') queueSweep();
});
/* ปริ้นต์/บันทึก PDF ต้องเห็นครบทุกการ์ด */
window.addEventListener('beforeprint', function () {
var rest = pending.slice();
for (var i = 0; i < rest.length; i++) reveal(rest[i]);
});
/* การ์ดที่ JS สร้างทีหลัง (fetch JSON / กรอง / เปลี่ยนภาษา) → สแกนซ้ำให้เอง
ใช้ setTimeout ไม่ใช่ rAF เพราะแท็บที่ถูกซ่อนจะไม่ยิง rAF */
var scanTimer = 0;
function scheduleScan() {
if (scanTimer) return;
scanTimer = setTimeout(function () {
scanTimer = 0;
scan();
}, 80);
}
function watch() {
var host = document.getElementById('view');
if (!host || !window.MutationObserver) return;
new MutationObserver(function (list) {
for (var i = 0; i < list.length; i++) {
if (list[i].addedNodes && list[i].addedNodes.length) { scheduleScan(); return; }
}
}).observe(host, { childList: true, subtree: true });
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', watch);
} else {
watch();
}
window.Motion = { enter: enter, scan: scan, loading: loading, reduced: reduced };
})();
+1 -1
View File
@@ -2,7 +2,7 @@
"th": { "th": {
"title": "ไม่มีจิตรกรคนไหนนั่งวาดภาพจากอากาศ", "title": "ไม่มีจิตรกรคนไหนนั่งวาดภาพจากอากาศ",
"body": [ "body": [
"บางคนอาจจะสงสัยว่าวลีนี้เกี่ยวกับเว็ปเราอย่างไร อย่างที่สำนวนบอกไม่มีจิตรกรวาดรูปจากอากาศ เว็ปเราก็ไม่ได้มโนจากอากาศเหมือนกันจะสร้างอะไรได้มันต้องมีต้นแบบให้ดู ขอให้เครดิตและขอบคุณต้นแบบของเราทุกๆคน", "อย่หน้านี้เขียนเพื่อขอบคุณต้นแบบของเรา บางคนอาจจะสงสัยว่าวลีนี้เกี่ยวกับเว็ปเราอย่างไร อย่างที่สำนวนบอกไม่มีจิตรกรวาดรูปจากอากาศ เว็ปเราก็ไม่ได้มโนจากอากาศเหมือนกันจะสร้างอะไรได้มันต้องมีต้นแบบให้ดู เช่น",
"- Mayday กลุ่มคนรณรงค์เรื่องรถเมล์ในกรุงเทพ ปริมณฑล", "- Mayday กลุ่มคนรณรงค์เรื่องรถเมล์ในกรุงเทพ ปริมณฑล",
"- AyuthayaBusMap เป็นธุรกิจในอยุธยาทำแผนที่รถประจำทางบริการนักท่องเที่ยว", "- AyuthayaBusMap เป็นธุรกิจในอยุธยาทำแผนที่รถประจำทางบริการนักท่องเที่ยว",
"- กลุ่มไลน์รถตู้ กรุงเทพ-อ่างทอง (สายใน) เป็นต้นแบบว่าถึงเราไม่ใช่ผู้ประกอบการเราก็ลุกขึ้นมาทำอะไรซักอย่างได้" "- กลุ่มไลน์รถตู้ กรุงเทพ-อ่างทอง (สายใน) เป็นต้นแบบว่าถึงเราไม่ใช่ผู้ประกอบการเราก็ลุกขึ้นมาทำอะไรซักอย่างได้"
+2 -5
View File
@@ -2,11 +2,8 @@
"th": { "th": {
"title": "ความตั้งใจในปัจจุบัน", "title": "ความตั้งใจในปัจจุบัน",
"body": [ "body": [
"ความตั้งใจของเราคือ พยายามรวบรวมช่องทางการติดต่อถามเวลาเดินรถหรือติดตามข่าวสาร เช่น เบอร์โทร เพจFB กลุ่มFBหรือline หรือwww ที่รถประจำทางแต่ละสายประกาศไว้", "ความตั้งใจของเราคือ พยายามรวบรวมช่องทางการติดต่อถามเวลาเดินรถ หรือติดตามข่าวสารช่องทางต่างๆ เช่น เบอร์โทรศัพท์ เพจและกลุ่ม FaceBook หรือ lineOA หรือ www ที่นายท่าของรถประจำทางแต่ละสายประกาศไว้",
"ส่วนเรื่อตารางเวลาเดินรถที่เวปเราบอกตรงๆว่า เราอยากทำเป็นไอเดีย ว่าถ้าอ่างทองมีตารางเดินรถออนไลน์คงจะดีแต่ไม่ต้องไปเชื่อมาก เราคาดสีสถานะใว้", "ส่วนเรื่อตารางเวลาเดินรถที่เห็นในเว็ปเราบอกตรงๆว่าอย่าไปเชื่อมากเพราะเราไม่มีเวลาแก้เวลาทุกวันของทุกสาย เราอยากทำเป็นแนวคิดเป็นตัวอย่างถ้าอ่างทองมีตารางเดินรถออนไลน์คงจะดีเราระบุไว้ว่าตารางเวลาสร้างผ่านไปแล้วกี่วัน"
"สีแดง คือตารางเวลาที่ไม่ได้อัปเดพเกิน 1 อาทิตย์น่าจะเป็นสีที่เห็นได้บ่อยที่สุด",
"สีเขียว คือตารางเวลาที่ได้อัพเดตไม่เกิน 1 วัน",
"สีส้ม คือตารางเวลาที่ไม่ได้อัพเดตเกิน 1 วันแต่น้อยกว่า 1 อาทิตย์"
] ]
}, },
"en": { "en": {
+3 -1
View File
@@ -2,7 +2,9 @@
"th": { "th": {
"title": "แผนพัฒนาในอนาคต", "title": "แผนพัฒนาในอนาคต",
"body": [ "body": [
"ถ้ามีคนถามถึงแผนพัฒนาในอนาคตมั้ยก็ต้องบอกตรงๆว่าไม่มีการที่ใครเข้าเวปมาแล้วได้โทรถามเวลาเดินรถ หรือเข้ากลุ่มไลน์รถสองแถว รถมินิบัสถือว่าเว็ปนี้ทำหน้าที่ครบแล้ว จริงๆเว็ปนี้ตอนแรกตั้งใจเป็นเว็บชั่วคราวเราอยากให้หน่วยงานราชการและเอกชนใช้กฎหมาย PPP ร่วมทุนระหว่างราชการและเอกขนเพื่อสร้างระบบขนส่งมวลชนของอ่างทอง มีเว็ปแบบเรา มีสถานีขนส่งผดสประจำอำเภอ มีรถประจำทางเส้นเลือดฝอยที่ให้บริการได้ทั้งวัน มีเรือโดยสารแม่น้ำน้อย มีเรือข้ามฟากไชโย หรือใครมีไอเดียก็เมลล์มาบอกได้เผื่อจะนำไปปรับปรุงอนาคต" "ถ้ามีคนถามถึงแผนพัฒนาในอนาคตมั้ยก็ต้องบอกว่า ไม่มี ใครเข้าเว็ปมาแล้วได้โทรถามเวลาเดินรถ หรือเข้ากลุ่มไลน์รถสองแถว รถมินิบัสถือว่าเว็ปเราทำหน้าที่เรียบร้อยแล้ว",
"เว็ปนี้ตอนแรกตั้งใจเป็นเว็บชั่วคราว เป็นแค่ตัวอย่างเฉยๆอยากให้หน่วยงานราชการและเอกชนใช้กฎหมายร่วมทุนระหว่างหน่วยงานราชการและเอกขน เพื่อสร้างระบบขนส่งมวลชนจังหวัดอ่างทองมีสถานีขนส่งอำเภอพร้อมอาคารจอดรถ(ไม่รู้เป็นอะไรสถานีขนส่งต้องไม่มีอาคาจอดรถรถมินบัสหมวด 1/4 ก็ไม่มีจะให้ญาติมาส่งทกครั้งหรือเดินมาขึ้นรถหรือไง)",
"สถานีขนส่งรถทัวร์สายเหนือ มีรถประจำทางเส้นเลือดฝอยที่ให้บริการได้ทั้งวัน มีเรือโดยสารแม่น้ำน้อย มีเรือข้ามฟากไชโย มีเว็ปดูเวลาเดินรถและตำแหน่งรถปัจจุบันได้ทัน เราตั้งใจทำยังไงก็เรียกว่าทางการไม่ได้"
] ]
}, },
"en": { "en": {
+5 -5
View File
@@ -3,7 +3,7 @@
.mu-hero-lead { .mu-hero-lead {
margin: 14px auto 0; margin: 14px auto 0;
max-width: 640px; max-width: 640px;
color: #5b3b71; color: var(--c-ink-2);
font-size: .95rem; font-size: .95rem;
} }
@@ -15,7 +15,7 @@
grid-template-columns: 1fr; grid-template-columns: 1fr;
gap: 16px; gap: 16px;
align-items: center; align-items: center;
background: #fff; background: var(--c-surface);
border: 1px solid #ebe8f4; border: 1px solid #ebe8f4;
border-radius: 18px; border-radius: 18px;
padding: 16px; padding: 16px;
@@ -31,11 +31,11 @@
display: block; display: block;
box-shadow: 0 10px 24px rgba(63, 43, 94, .14); box-shadow: 0 10px 24px rgba(63, 43, 94, .14);
} }
.mu-about-block h2 { margin: 0 0 10px; font-size: 1.2rem; color: #1f2a44; font-weight: 800; line-height: 1.35; } .mu-about-block h2 { margin: 0 0 10px; font-size: 1.2rem; color: var(--c-ink); font-weight: 800; line-height: 1.35; }
.mu-about-block p { margin: 0 0 10px; color: #4a5568; font-size: .95rem; line-height: 1.8; } .mu-about-block p { margin: 0 0 10px; color: var(--c-ink-2); font-size: .95rem; line-height: 1.8; }
.mu-about-block p:last-child { margin-bottom: 0; } .mu-about-block p:last-child { margin-bottom: 0; }
.mu-about-skeleton { color: #6f7b95; font-size: .9rem; text-align: center; padding: 18px 0; } .mu-about-skeleton { color: var(--c-ink-2); font-size: .9rem; text-align: center; padding: 18px 0; }
.mu-about-skel-card { height: 180px; border-radius: 18px; background: linear-gradient(90deg, #f4f2fa 25%, #ece8f6 37%, #f4f2fa 63%); background-size: 400% 100%; animation: muSkel 1.4s ease infinite; } .mu-about-skel-card { height: 180px; border-radius: 18px; background: linear-gradient(90deg, #f4f2fa 25%, #ece8f6 37%, #f4f2fa 63%); background-size: 400% 100%; animation: muSkel 1.4s ease infinite; }
@keyframes muSkel { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } } @keyframes muSkel { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
+2 -2
View File
@@ -77,8 +77,8 @@
"tag": "ความฝัน", "tag": "ความฝัน",
"body": [ "body": [
"เราเกิดและเติบโตมาที่อ่างทอง ก็เห็นความเปลี่ยนแปลงแม้ว่าจะไม่ทันช่วงที่การขนส่งสาธารณะรุ่งเรือง ลุงๆป้าๆบอกว่าคนที่บขส คึกคักมากรถออกทุก 10 นาที มีรถอ่างทองไปพระพุทธบาท โผงเผง วัดสระแก้ว วัดเอกราช วัดมหานาม วัดพิกุลทอง และอื่นๆอีก แต่เท่าที่เราจำได้มีเมล์แดง เมล์ฟ้า เมล์เนื้อ แล้วมีรถตู้ผี 555 ไปถึงอนุเสาวรีย์ แล้วก็มาจัดระเบียบ และก็เริ่มทรุดลงมาเพราะคนมีรถมอไซ รถยนต์ จนมาช่วงโควิค ที่บางคนกลัวติดโรค ถึงขั้นซื้อรถใหม่", "เราเกิดและเติบโตมาที่อ่างทอง ก็เห็นความเปลี่ยนแปลงแม้ว่าจะไม่ทันช่วงที่การขนส่งสาธารณะรุ่งเรือง ลุงๆป้าๆบอกว่าคนที่บขส คึกคักมากรถออกทุก 10 นาที มีรถอ่างทองไปพระพุทธบาท โผงเผง วัดสระแก้ว วัดเอกราช วัดมหานาม วัดพิกุลทอง และอื่นๆอีก แต่เท่าที่เราจำได้มีเมล์แดง เมล์ฟ้า เมล์เนื้อ แล้วมีรถตู้ผี 555 ไปถึงอนุเสาวรีย์ แล้วก็มาจัดระเบียบ และก็เริ่มทรุดลงมาเพราะคนมีรถมอไซ รถยนต์ จนมาช่วงโควิค ที่บางคนกลัวติดโรค ถึงขั้นซื้อรถใหม่",
"เราพอเข้าใจสถานการณ์ปัจจุบันถ้าจะให้กลับมาทั้งหมดไม่มีวันเป้นไปได้แล้ว เวลาฟังนักวิชาการ นักข่าว นักเคลื่อนไหวบอกว่า ภาครัฐต้องมาดูแล มันก็ขำนะพอรถประจำทางวิ่งกันได้เอกชนก็ทำกันเอง แต่พอวิ่งมีแต่เจ๊งกลับโยนใหห้ภาครัฐทำ", "เราพอเข้าใจสถานการณ์ปัจจุบันถ้าจะให้กลับมาทั้งหมดไม่มีวันเป้นไปได้แล้ว เวลาฟังนักวิชาการ นักข่าว นักเคลื่อนไหวบอกว่า ภาครัฐต้องมาดูแล บางทีก็ขำนะพอรถประจำทางวิ่งมีกำไรกันเอกชนก็ทำกันเอง แต่พอปัจจุบันวิ่งรถไปมีแต่เจ๊งกลับโยนให้ภาครัฐทำ",
"แต่ก็นั่นแหละมันอยู่ในกฎหมาย ว่าองค์กรปกครองส่วนท้องถิ่นมีหน้าที่จัดหาบริการขนส่งสาธารณะ เราก็ไม่แม่นกฎหมายแต่มันก็จะมีแนวคิดประมาณว่า ถ้าโครงการขาดทุนสะสมทุกวันต้องเอาหลวงถมทุกวันหนวยงานตรวจสอบอาจไม่ชอบ และฟ้องเรียกเงินคืนก็ได้ บางครั้งรัฐไม่เสียประโยชน์อาจไม่เท่ากับประชาชนเสียประโยชน์", "แต่ก็นั่นแหละมันอยู่ในกฎหมาย ว่าองค์กรปกครองส่วนท้องถิ่นมีหน้าที่จัดหาบริการขนส่งสาธารณะ เราก็ไม่แม่นกฎหมายแต่มันก็จะมีแนวคิดประมาณว่า ถ้าโครงการขาดทุนสะสมทุกวันต้องเอางบประมาณราชการถมทุกวันหน่วยงานตรวจสอบอาจไม่ชอบ และฟ้องเรียกเงินคืนก็ได้ เหมือนอย่างกรณีหลายปีก่อนที่องค์กรปกครองส่วนท้องถิ่นจัดการฉีดวัคซีนป้องกันพิษสุนัขบ้าแต่หน่วยงานตรวจสอบฟ้องศาลปกครองว่าอปทไม่สามารถทำได้เป็นหน้าที่ของปศุสัตว์จังหวัด/อำเภอสุดท้ายถึงจะแพ้ในชั้นศาลแต่บั่นทอนกำลังใจข้าราชการที่ทำงานกรณีรถประจำทางก็เหมือนกันต่อให้มีเขียนว่าเป็นหน้าที่อปทแต่ถ้ามีข้อความในกฎหมาย ระเบียบให้สามารถตีความได้ข้าราชการจะสบายใจในการทำงานได้อย่างไรการขึ้นศาลมันเสียพลังชีวิต บางครั้งคำว่ารัฐไม่เสียประโยชน์อาจไม่เท่ากับประชาชนเสียประโยชน์ก็ได้",
"มาถึงข้อเสนอเรา เราว่าขั้นต่ำที่สุดอยากให้กู้รถประจำทางเชื่อมต่อำเภอเข้าสู่ตัวเมือง ได้แก่", "มาถึงข้อเสนอเรา เราว่าขั้นต่ำที่สุดอยากให้กู้รถประจำทางเชื่อมต่อำเภอเข้าสู่ตัวเมือง ได้แก่",
"1. สามโก้-วิเศษ-อ่างทอง", "1. สามโก้-วิเศษ-อ่างทอง",
"2. แสวงหา-โพธิ์ทอง-อ่างทอง", "2. แสวงหา-โพธิ์ทอง-อ่างทอง",
+2 -1
View File
@@ -6,7 +6,8 @@
"body": [ "body": [
"ตามกฎหมายควบคุมการขนส่งทางบกแบ่งรถประจำทางออกเป็น 4 หมวด ได้แก่ 1.รถประจำทางในเขตเทศบาล 2.รถจากต่างจังหวัดเข้ากรุงเทพ 3.รถจากจังหวัดหนึ่งถึงอีกจังหวัดหนึ่ง 4.รถภายในจังหวัด", "ตามกฎหมายควบคุมการขนส่งทางบกแบ่งรถประจำทางออกเป็น 4 หมวด ได้แก่ 1.รถประจำทางในเขตเทศบาล 2.รถจากต่างจังหวัดเข้ากรุงเทพ 3.รถจากจังหวัดหนึ่งถึงอีกจังหวัดหนึ่ง 4.รถภายในจังหวัด",
"กรมการขนส่งใช้ระบบให้นิติบุคคล พวก บริษัท ห้างหุ้นส่วน หรือสหกรณ์ใครสนใจก็เข้าไปของใบอนุญาต ซึ่งหลักการนี้ก็ใช้มาตั้งแต่ ปี 2520 กว่าๆ ถึงจะออกกฎระเบียบรองๆตามสภาพบ้านเมืองแต่ปัจจุบันเราก็เห็นสภาพกันอยู่ว่ามันแย่แค่ไหน", "กรมการขนส่งใช้ระบบให้นิติบุคคล พวก บริษัท ห้างหุ้นส่วน หรือสหกรณ์ใครสนใจก็เข้าไปของใบอนุญาต ซึ่งหลักการนี้ก็ใช้มาตั้งแต่ ปี 2520 กว่าๆ ถึงจะออกกฎระเบียบรองๆตามสภาพบ้านเมืองแต่ปัจจุบันเราก็เห็นสภาพกันอยู่ว่ามันแย่แค่ไหน",
"อยากเสนอให้ องค์กรปกครองส่วนท้องถิ่นเข้ามาเดินรถ หมวด1 และหมวด4 ไม่ว่าจะดำเนินการเอง จ้างเหมาเอกชนหรือทำข้อตกลงสำรองจ่ายเฉพาะส่วนต่างที่เอกชน เราก็อาจจะเห็นบางจังหวัดเริ่มทำบ้างแล้ว แต่สำหรับอ่างทองจะเอาเงินจากไหนมาจัดบริการแบบนี้ ส่วนรถหมวด 2 และ 3 ถึงเราจะอยากให้อุดหนุนแต่มันก็เลยคำว่า บริการพื้นฐานไปแล้วก็คงได้แต่ส่งกำลังใจให้มีกำไรและจัดบริการดีๆ" "อยากเสนอให้ องค์กรปกครองส่วนท้องถิ่นเข้ามาเดินรถ หมวด 1 และหมวด 4 ไม่ว่าจะดำเนินการเอง จ้างเหมาเอกชนหรือทำข้อตกลงสำรองจ่ายเฉพาะส่วนต่างที่เอกชน เราก็อาจจะเห็นบางจังหวัดเริ่มทำบ้างแล้ว แต่สำหรับอ่างทองจะเอาเงินจากไหนมาจัดบริการแบบนี้",
" ส่วนรถประจำทางหมวด 2 และ 3 เราก็อยากให้อุดหนุนแต่มันเลยคำว่า บริการพื้นฐานไปแล้วก็คงได้แต่ส่งกำลังใจให้มีกำไรและมีคนใช้บริการเยอะๆ"
] ]
}, },
"en": { "en": {
+35 -35
View File
@@ -3,7 +3,7 @@
.mu-hero-lead { .mu-hero-lead {
margin: 14px auto 0; margin: 14px auto 0;
max-width: 640px; max-width: 640px;
color: #5b3b71; color: var(--c-ink-2);
font-size: .95rem; font-size: .95rem;
} }
@@ -17,12 +17,12 @@
gap: 12px; gap: 12px;
margin-bottom: 18px; margin-bottom: 18px;
} }
.mu-blog-count { margin: 0; color: #6f7b95; font-size: .88rem; } .mu-blog-count { margin: 0; color: var(--c-ink-2); font-size: .88rem; }
.mu-view-switch { .mu-view-switch {
margin-left: auto; margin-left: auto;
display: inline-flex; display: inline-flex;
gap: 2px; gap: 2px;
background: #f0edf7; background: var(--c-surface-3);
border: 1px solid #e4dcf2; border: 1px solid #e4dcf2;
border-radius: 999px; border-radius: 999px;
padding: 3px; padding: 3px;
@@ -33,7 +33,7 @@
gap: 6px; gap: 6px;
border: 0; border: 0;
background: transparent; background: transparent;
color: #6d28d9; color: var(--c-brand-ink);
font-family: inherit; font-family: inherit;
font-weight: 700; font-weight: 700;
font-size: .8rem; font-size: .8rem;
@@ -44,7 +44,7 @@
transition: background .15s ease, color .15s ease; transition: background .15s ease, color .15s ease;
} }
.mu-view-btn .ic { width: 15px; height: 15px; } .mu-view-btn .ic { width: 15px; height: 15px; }
.mu-view-btn.active { background: #fff; color: #7a4cc0; box-shadow: 0 1px 4px rgba(63, 43, 94, .18); } .mu-view-btn.active { background: var(--c-surface); color: var(--c-brand-ink); box-shadow: 0 1px 4px rgba(63, 43, 94, .18); }
.mu-view-btn:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 2px; } .mu-view-btn:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 2px; }
/* --- โหมดตาราง (grid) --- */ /* --- โหมดตาราง (grid) --- */
@@ -56,7 +56,7 @@
.mu-blog-card { .mu-blog-card {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background: #fff; background: var(--c-surface);
border: 1px solid #ebe8f4; border: 1px solid #ebe8f4;
border-radius: 18px; border-radius: 18px;
overflow: hidden; overflow: hidden;
@@ -70,11 +70,11 @@
.mu-blog-card .mu-cover.no-img { background: linear-gradient(135deg, #7a4cc0, #3071b8); } .mu-blog-card .mu-cover.no-img { background: linear-gradient(135deg, #7a4cc0, #3071b8); }
.mu-blog-card .mu-cover.no-img::after { background: linear-gradient(180deg, rgba(15,23,42,0) 40%, rgba(15,23,42,.4) 100%); } .mu-blog-card .mu-cover.no-img::after { background: linear-gradient(180deg, rgba(15,23,42,0) 40%, rgba(15,23,42,.4) 100%); }
.mu-blog-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; } .mu-blog-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.mu-blog-meta { display: flex; align-items: center; gap: 8px; color: #6f7b95; font-size: .78rem; } .mu-blog-meta { display: flex; align-items: center; gap: 8px; color: var(--c-ink-2); font-size: .78rem; }
.mu-blog-meta time { font-variant-numeric: tabular-nums; } .mu-blog-meta time { font-variant-numeric: tabular-nums; }
.mu-blog-card h2 { margin: 0; font-size: 1.02rem; color: #1f2a44; font-weight: 800; line-height: 1.4; } .mu-blog-card h2 { margin: 0; font-size: 1.02rem; color: var(--c-ink); font-weight: 800; line-height: 1.4; }
.mu-blog-excerpt { margin: 0; color: #4a5568; font-size: .88rem; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; } .mu-blog-excerpt { margin: 0; color: var(--c-ink-2); font-size: .88rem; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mu-blog-more { margin-top: auto; padding-top: 6px; color: #7a4cc0; font-weight: 700; font-size: .85rem; } .mu-blog-more { margin-top: auto; padding-top: 6px; color: var(--c-brand-ink); font-weight: 700; font-size: .85rem; }
/* --- โหมดรายการ (list) --- */ /* --- โหมดรายการ (list) --- */
#blog-list.mode-list { display: flex; flex-direction: column; gap: 14px; } #blog-list.mode-list { display: flex; flex-direction: column; gap: 14px; }
@@ -83,7 +83,7 @@
grid-template-columns: 108px 1fr; grid-template-columns: 108px 1fr;
gap: 14px; gap: 14px;
align-items: center; align-items: center;
background: #fff; background: var(--c-surface);
border: 1px solid #ebe8f4; border: 1px solid #ebe8f4;
border-radius: 16px; border-radius: 16px;
padding: 12px; padding: 12px;
@@ -100,14 +100,14 @@
display: block; display: block;
background: linear-gradient(135deg, #7a4cc0, #3071b8); background: linear-gradient(135deg, #7a4cc0, #3071b8);
} }
.mu-blog-row h2 { margin: 4px 0 6px; font-size: .98rem; color: #1f2a44; font-weight: 800; line-height: 1.4; } .mu-blog-row h2 { margin: 4px 0 6px; font-size: .98rem; color: var(--c-ink); font-weight: 800; line-height: 1.4; }
.mu-blog-row .mu-blog-excerpt { -webkit-line-clamp: 2; } .mu-blog-row .mu-blog-excerpt { -webkit-line-clamp: 2; }
.mu-blog-empty { color: #6f7b95; text-align: center; padding: 34px 0; } .mu-blog-empty { color: var(--c-ink-2); text-align: center; padding: 34px 0; }
.mu-blog-skel { height: 220px; border-radius: 18px; background: linear-gradient(90deg, #f4f2fa 25%, #ece8f6 37%, #f4f2fa 63%); background-size: 400% 100%; animation: muSkelB 1.4s ease infinite; } .mu-blog-skel { height: 220px; border-radius: 18px; background: linear-gradient(90deg, #f4f2fa 25%, #ece8f6 37%, #f4f2fa 63%); background-size: 400% 100%; animation: muSkelB 1.4s ease infinite; }
@keyframes muSkelB { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } } @keyframes muSkelB { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
/* --- หน้าอ่านบทความ --- */ /* --- หน้าอ่านบทความ --- */
.mu-post { background: #fff; border: 1px solid #ebe8f4; border-radius: 20px; overflow: hidden; box-shadow: 0 12px 30px rgba(63, 43, 94, .08); } .mu-post { background: var(--c-surface); border: 1px solid #ebe8f4; border-radius: 20px; overflow: hidden; box-shadow: 0 12px 30px rgba(63, 43, 94, .08); }
.mu-post .mu-cover { aspect-ratio: 16 / 8; } .mu-post .mu-cover { aspect-ratio: 16 / 8; }
/* --- แผนที่เส้นทางแทนรูปปก (textN.json → "map") --- */ /* --- แผนที่เส้นทางแทนรูปปก (textN.json → "map") --- */
@@ -129,7 +129,7 @@
display: inline-flex; align-items: center; gap: 6px; display: inline-flex; align-items: center; gap: 6px;
padding: 5px 10px; border-radius: 999px; padding: 5px 10px; border-radius: 999px;
font-size: .72rem; font-weight: 800; letter-spacing: .02em; font-size: .72rem; font-weight: 800; letter-spacing: .02em;
background: rgba(255, 255, 255, .92); color: #1f2a44; background: var(--c-glass); color: var(--c-ink);
backdrop-filter: blur(8px); backdrop-filter: blur(8px);
box-shadow: 0 4px 10px rgba(15, 23, 42, .15); box-shadow: 0 4px 10px rgba(15, 23, 42, .15);
pointer-events: none; pointer-events: none;
@@ -138,7 +138,7 @@
.blog-mapx-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; } .blog-mapx-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.blog-mapx-group { .blog-mapx-group {
margin: 10px 0 2px; font-size: .78rem; font-weight: 700; letter-spacing: .01em; margin: 10px 0 2px; font-size: .78rem; font-weight: 700; letter-spacing: .01em;
color: #7a4cc0; list-style: none; color: var(--c-brand-ink); list-style: none;
} }
.blog-mapx-group:first-child { margin-top: 0; } .blog-mapx-group:first-child { margin-top: 0; }
.blog-mapx-group::before { content: ''; display: inline-block; width: 14px; height: 2px; .blog-mapx-group::before { content: ''; display: inline-block; width: 14px; height: 2px;
@@ -146,27 +146,27 @@
.blog-mapx-row { .blog-mapx-row {
display: flex; align-items: center; gap: 8px; flex-wrap: wrap; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
padding: 9px 11px; border: 1px solid #e8e4f2; border-radius: 12px; padding: 9px 11px; border: 1px solid #e8e4f2; border-radius: 12px;
background: #fff; cursor: pointer; font-size: .88rem; color: #3d4a63; background: var(--c-surface); cursor: pointer; font-size: .88rem; color: var(--c-ink-2);
} }
.blog-mapx-row:hover { border-color: #cbb8e8; background: #faf8ff; } .blog-mapx-row:hover { border-color: #cbb8e8; background: #faf8ff; }
.blog-mapx-row.is-on { border-color: #7a4cc0; background: #f6f2ff; } .blog-mapx-row.is-on { border-color: var(--c-brand); background: #f6f2ff; }
.blog-mapx-row:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 1px; } .blog-mapx-row:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 1px; }
.blog-mapx-sw { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; } .blog-mapx-sw { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.blog-mapx-nm { font-weight: 700; color: #1f2a44; } .blog-mapx-nm { font-weight: 700; color: var(--c-ink); }
.blog-mapx-ds { color: #6b7a94; } .blog-mapx-ds { color: #6b7a94; }
.blog-mapx-ds::before { content: '\00b7'; margin-right: 6px; color: #c9c2dc; } .blog-mapx-ds::before { content: '\00b7'; margin-right: 6px; color: #c9c2dc; }
.blog-mapx-badge { .blog-mapx-badge {
margin-left: auto; font-size: .72rem; padding: 2px 8px; border-radius: 999px; margin-left: auto; font-size: .72rem; padding: 2px 8px; border-radius: 999px;
background: #fdf4e3; color: #8a6100; border: 1px solid #f0dfb8; background: #fdf4e3; color: var(--c-warn); border: 1px solid #f0dfb8;
} }
.blog-mapx-panel { margin-top: 10px; padding: 12px 14px; border: 1px solid #e8e4f2; border-radius: 14px; background: #fbfaff; } .blog-mapx-panel { margin-top: 10px; padding: 12px 14px; border: 1px solid #e8e4f2; border-radius: 14px; background: var(--c-surface-2); }
.blog-mapx-panel[hidden] { display: none; } .blog-mapx-panel[hidden] { display: none; }
.blog-mapx-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; } .blog-mapx-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.blog-mapx-head strong { color: #1f2a44; font-size: .95rem; } .blog-mapx-head strong { color: var(--c-ink); font-size: .95rem; }
.blog-mapx-line { margin: 4px 0; font-size: .85rem; color: #6b7a94; } .blog-mapx-line { margin: 4px 0; font-size: .85rem; color: #6b7a94; }
.blog-mapx-line span::after { content: ':'; margin-right: 6px; } .blog-mapx-line span::after { content: ':'; margin-right: 6px; }
.blog-mapx-line b { color: #1f2a44; font-weight: 600; } .blog-mapx-line b { color: var(--c-ink); font-weight: 600; }
.blog-mapx-facts { margin: 8px 0 0; font-size: .82rem; color: #7a4cc0; font-weight: 700; } .blog-mapx-facts { margin: 8px 0 0; font-size: .82rem; color: var(--c-brand-ink); font-weight: 700; }
.blog-mapx-hint { margin: 8px 0 0; font-size: .8rem; color: #8b93a7; } .blog-mapx-hint { margin: 8px 0 0; font-size: .8rem; color: #8b93a7; }
.blog-mapx-src { margin: 0 0 14px; font-size: .78rem; color: #8b93a7; word-break: break-all; } .blog-mapx-src { margin: 0 0 14px; font-size: .78rem; color: #8b93a7; word-break: break-all; }
.at-tip-org { background: #1f2a44; color: #fff; border: 0; font-weight: 700; } .at-tip-org { background: #1f2a44; color: #fff; border: 0; font-weight: 700; }
@@ -175,30 +175,30 @@
.mu-cover-note { .mu-cover-note {
position: absolute; left: 12px; bottom: 12px; z-index: 500; position: absolute; left: 12px; bottom: 12px; z-index: 500;
padding: 4px 10px; border-radius: 999px; font-size: .78rem; padding: 4px 10px; border-radius: 999px; font-size: .78rem;
background: rgba(255, 255, 255, .9); color: #8a6100; border: 1px solid #f0d9a8; background: var(--c-glass-24); color: var(--c-warn); border: 1px solid #f0d9a8;
} }
.mu-post-body { padding: 20px 18px 26px; } .mu-post-body { padding: 20px 18px 26px; }
.mu-post-body h1 { margin: 6px 0 12px; font-size: 1.35rem; color: #1f2a44; font-weight: 800; line-height: 1.4; } .mu-post-body h1 { margin: 6px 0 12px; font-size: 1.35rem; color: var(--c-ink); font-weight: 800; line-height: 1.4; }
/* ย่อหน้า: เว้นระยะ 20px + ย่อหน้าหน้าบรรทัด 1.5em (แบบหนังสือไทย) */ /* ย่อหน้า: เว้นระยะ 20px + ย่อหน้าหน้าบรรทัด 1.5em (แบบหนังสือไทย) */
.mu-post-body p { margin: 0 0 20px; color: #4a5568; font-size: .96rem; line-height: 1.9; text-indent: 1.5em; } .mu-post-body p { margin: 0 0 20px; color: var(--c-ink-2); font-size: .96rem; line-height: 1.9; text-indent: 1.5em; }
.mu-post-body p:last-child { margin-bottom: 0; } .mu-post-body p:last-child { margin-bottom: 0; }
/* ย่อหน้าที่เป็นรูป/บรรทัดข้อมูลไม่ต้องย่อหน้า */ /* ย่อหน้าที่เป็นรูป/บรรทัดข้อมูลไม่ต้องย่อหน้า */
.mu-post-body p.mu-post-figure, .mu-post-figure, .mu-post-body p:empty { text-indent: 0; } .mu-post-body p.mu-post-figure, .mu-post-figure, .mu-post-body p:empty { text-indent: 0; }
/* มาร์กดาวน์เบา ๆ ในเนื้อหา (จาก textN.json) */ /* มาร์กดาวน์เบา ๆ ในเนื้อหา (จาก textN.json) */
.mu-post-body strong { color: #1f2a44; font-weight: 800; } .mu-post-body strong { color: var(--c-ink); font-weight: 800; }
.mu-post-body em { font-style: italic; } .mu-post-body em { font-style: italic; }
.mu-post-body a { color: #7a4cc0; font-weight: 700; text-decoration: none; border-bottom: 1px solid #d9cbf3; } .mu-post-body a { color: var(--c-brand-ink); font-weight: 700; text-decoration: none; border-bottom: 1px solid #d9cbf3; }
.mu-post-body a:hover { border-bottom-color: #7a4cc0; } .mu-post-body a:hover { border-bottom-color: var(--c-brand); }
.mu-post-body code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .88em; .mu-post-body code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .88em;
background: #f4f1fb; border: 1px solid #e7e0f6; border-radius: 4px; padding: 1px 5px; color: #5b4a80; } background: var(--c-tint-purple); border: 1px solid var(--c-border); border-radius: 4px; padding: 1px 5px; color: #5b4a80; }
.mu-post-body ul { margin: 0 0 20px; padding-left: 20px; } .mu-post-body ul { margin: 0 0 20px; padding-left: 20px; }
.mu-post-body li { color: #4a5568; font-size: .96rem; line-height: 1.9; margin-bottom: 4px; } .mu-post-body li { color: var(--c-ink-2); font-size: .96rem; line-height: 1.9; margin-bottom: 4px; }
.mu-post-figure { margin: 4px 0 16px; } .mu-post-figure { margin: 4px 0 16px; }
.mu-post-figure img { width: 100%; height: auto; border-radius: 10px; border: 1px solid #e7e0f6; display: block; } .mu-post-figure img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--c-border); display: block; }
.mu-post-figure figcaption { margin-top: 6px; color: #6f7b95; font-size: .82rem; text-align: center; } .mu-post-figure figcaption { margin-top: 6px; color: var(--c-ink-2); font-size: .82rem; text-align: center; }
.mu-post-back { .mu-post-back {
display: inline-flex; align-items: center; gap: 6px; display: inline-flex; align-items: center; gap: 6px;
margin-bottom: 16px; color: #7a4cc0; font-weight: 700; margin-bottom: 16px; color: var(--c-brand-ink); font-weight: 700;
text-decoration: none; font-size: .9rem; text-decoration: none; font-size: .9rem;
} }
.mu-post-back:hover { text-decoration: underline; } .mu-post-back:hover { text-decoration: underline; }
+23 -23
View File
@@ -7,11 +7,11 @@
.mu-page { padding: 20px 0 48px; } .mu-page { padding: 20px 0 48px; }
/* --- header --- */ /* --- header --- */
.mu-breadcrumb { color: #6f7b95; font-size: .88rem; margin: 0 0 12px; } .mu-breadcrumb { color: var(--c-ink-2); font-size: .88rem; margin: 0 0 12px; }
.mu-breadcrumb a { color: #7a4cc0; text-decoration: none; font-weight: 600; } .mu-breadcrumb a { color: var(--c-brand-ink); text-decoration: none; font-weight: 600; }
.mu-page-title { .mu-page-title {
display: flex; align-items: center; gap: 14px; flex-wrap: wrap; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
margin: 0 0 16px; font-size: 1.6rem; color: #1f2a44; font-weight: 800; line-height: 1.25; margin: 0 0 16px; font-size: 1.6rem; color: var(--c-ink); font-weight: 800; line-height: 1.25;
} }
.mu-route-chip { .mu-route-chip {
display: inline-flex; align-items: center; justify-content: center; display: inline-flex; align-items: center; justify-content: center;
@@ -28,20 +28,20 @@
.mu-route-chip.grp-municipal { background: linear-gradient(135deg, #5b6560, #8b948f); box-shadow: 0 6px 14px rgba(107, 114, 104, .25); } .mu-route-chip.grp-municipal { background: linear-gradient(135deg, #5b6560, #8b948f); box-shadow: 0 6px 14px rgba(107, 114, 104, .25); }
.mu-toolbar { .mu-toolbar {
display: flex; flex-wrap: wrap; gap: 10px; align-items: center; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
background: #fff; border: 1px solid #e7e2f6; border-radius: 14px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px;
padding: 12px; margin-bottom: 22px; padding: 12px; margin-bottom: 22px;
box-shadow: 0 8px 20px rgba(63, 43, 94, .06); box-shadow: 0 8px 20px rgba(63, 43, 94, .06);
} }
.mu-toolbar select { .mu-toolbar select {
flex: 1; min-width: 180px; min-height: 46px; flex: 1; min-width: 180px; min-height: 46px;
border: 1px solid #dfe6f1; background: linear-gradient(180deg, #fff, #f8fbff); border: 1px solid #dfe6f1; background: linear-gradient(180deg, var(--c-surface), #f8fbff);
border-radius: 10px; padding: 0 12px; font-family: inherit; font-size: .95rem; color: #1f2a44; border-radius: 10px; padding: 0 12px; font-family: inherit; font-size: .95rem; color: var(--c-ink);
} }
/* --- รถประจำสาย + ติดต่อ (การ์ดเดียว ขึ้นก่อน) --- */ /* --- รถประจำสาย + ติดต่อ (การ์ดเดียว ขึ้นก่อน) --- */
.mu-vehicle-card { .mu-vehicle-card {
background: #fff; background: var(--c-surface);
border: 1px solid #e7e2f6; border: 1px solid var(--c-border);
border-radius: 18px; border-radius: 18px;
overflow: hidden; overflow: hidden;
box-shadow: 0 4px 14px rgba(20, 40, 90, .06); box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
@@ -61,11 +61,11 @@
display: flex; flex-direction: column; justify-content: center; gap: 8px; display: flex; flex-direction: column; justify-content: center; gap: 8px;
} }
.mu-vehicle-card .meta .label { .mu-vehicle-card .meta .label {
margin: 0; font-size: .78rem; font-weight: 700; color: #7a4cc0; margin: 0; font-size: .78rem; font-weight: 700; color: var(--c-brand-ink);
text-transform: uppercase; letter-spacing: .05em; text-transform: uppercase; letter-spacing: .05em;
} }
.mu-vehicle-card .meta h2 { margin: 0; font-size: 1.25rem; color: #1f2a44; } .mu-vehicle-card .meta h2 { margin: 0; font-size: 1.25rem; color: var(--c-ink); }
.mu-vehicle-card .meta p { margin: 0; color: #6f7b95; font-size: .95rem; line-height: 1.6; } .mu-vehicle-card .meta p { margin: 0; color: var(--c-ink-2); font-size: .95rem; line-height: 1.6; }
/* ติดต่อผู้ประกอบการ — อยู่ใน footer ของการ์ด */ /* ติดต่อผู้ประกอบการ — อยู่ใน footer ของการ์ด */
.mu-vehicle-contact { .mu-vehicle-contact {
@@ -80,7 +80,7 @@
display: flex; align-items: center; gap: 12px; display: flex; align-items: center; gap: 12px;
padding: 12px 14px; padding: 12px 14px;
border-radius: 12px; border-radius: 12px;
background: #fff; border: 1px solid #eee; background: var(--c-surface); border: 1px solid #eee;
text-decoration: none; color: inherit; text-decoration: none; color: inherit;
transition: transform .15s ease, box-shadow .15s ease; transition: transform .15s ease, box-shadow .15s ease;
} }
@@ -94,15 +94,15 @@
.mu-contact-item .ic-wrap.tone-green { background: linear-gradient(135deg, #1f8765, #51c39c); } .mu-contact-item .ic-wrap.tone-green { background: linear-gradient(135deg, #1f8765, #51c39c); }
.mu-contact-item .ic-wrap.tone-sky { background: linear-gradient(135deg, #1877f2, #4a9bf8); } .mu-contact-item .ic-wrap.tone-sky { background: linear-gradient(135deg, #1877f2, #4a9bf8); }
.mu-contact-item .ic-wrap.tone-purple { background: linear-gradient(135deg, #7a4cc0, #a583e0); } .mu-contact-item .ic-wrap.tone-purple { background: linear-gradient(135deg, #7a4cc0, #a583e0); }
.mu-contact-item .mu-link-go { flex: 0 0 auto; display: flex; align-items: center; color: #7a4cc0; opacity: .8; } .mu-contact-item .mu-link-go { flex: 0 0 auto; display: flex; align-items: center; color: var(--c-brand-ink); opacity: .8; }
.mu-contact-item:hover .mu-link-go { opacity: 1; transform: translateX(2px); } .mu-contact-item:hover .mu-link-go { opacity: 1; transform: translateX(2px); }
.mu-contact-item .ic-wrap svg { width: 22px; height: 22px; } .mu-contact-item .ic-wrap svg { width: 22px; height: 22px; }
.mu-contact-item .txt { flex: 1; min-width: 0; } .mu-contact-item .txt { flex: 1; min-width: 0; }
.mu-contact-item .txt strong { display: block; color: #1f2a44; font-size: .98rem; margin-bottom: 2px; } .mu-contact-item .txt strong { display: block; color: var(--c-ink); font-size: .98rem; margin-bottom: 2px; }
.mu-contact-item .txt span { display: block; color: #6f7b95; font-size: .86rem; } .mu-contact-item .txt span { display: block; color: var(--c-ink-2); font-size: .86rem; }
.mu-qr-img { .mu-qr-img {
width: 72px; height: 72px; flex: none; display: block; width: 72px; height: 72px; flex: none; display: block;
object-fit: contain; background: #fff; object-fit: contain; background: var(--c-surface);
border-radius: 10px; padding: 4px; border: 1px solid #eee; border-radius: 10px; padding: 4px; border: 1px solid #eee;
} }
/* ปุ่มครอบ QR — กดเพื่อขยาย (ไม่ให้หน้าตาเปลี่ยน) */ /* ปุ่มครอบ QR — กดเพื่อขยาย (ไม่ให้หน้าตาเปลี่ยน) */
@@ -116,15 +116,15 @@
.mu-qr-modal::backdrop { background: rgba(20, 28, 48, .55); } .mu-qr-modal::backdrop { background: rgba(20, 28, 48, .55); }
.mu-qr-modal-card { .mu-qr-modal-card {
position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px;
padding: 22px 22px 18px; border-radius: 14px; background: #fff; border: 1px solid #e7e2f6; padding: 22px 22px 18px; border-radius: 14px; background: var(--c-surface); border: 1px solid var(--c-border);
max-width: min(92vw, 360px); max-width: min(92vw, 360px);
} }
.mu-qr-modal-card strong { color: #1f2a44; font-size: 1.02rem; text-align: center; } .mu-qr-modal-card strong { color: var(--c-ink); font-size: 1.02rem; text-align: center; }
.mu-qr-big { width: min(72vw, 260px); height: auto; border-radius: 10px; background: #fff; } .mu-qr-big { width: min(72vw, 260px); height: auto; border-radius: 10px; background: var(--c-surface); }
.mu-qr-close { .mu-qr-close {
position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; padding: 0; position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; padding: 0;
display: flex; align-items: center; justify-content: center; display: flex; align-items: center; justify-content: center;
border: 0; border-radius: 10px; background: #f4f1fb; color: #5b4a80; cursor: pointer; border: 0; border-radius: 10px; background: var(--c-tint-purple); color: #5b4a80; cursor: pointer;
} }
.mu-qr-close:hover { background: #e9e2f8; } .mu-qr-close:hover { background: #e9e2f8; }
.mu-qr-close svg { width: 18px; height: 18px; } .mu-qr-close svg { width: 18px; height: 18px; }
@@ -134,12 +134,12 @@
.mu-qr-link { display: block; line-height: 0; border-radius: 10px; } .mu-qr-link { display: block; line-height: 0; border-radius: 10px; }
.mu-qr-link:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 3px; } .mu-qr-link:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 3px; }
.mu-qr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; } .mu-qr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mu-copy-link.is-done { border-color: #1f8765; color: #1f8765; } .mu-copy-link.is-done { border-color: #1f8765; color: var(--c-ok); }
/* --- แผนที่ --- */ /* --- แผนที่ --- */
.mu-map-card { .mu-map-card {
background: #fff; background: var(--c-surface);
border: 1px solid #e7e2f6; border: 1px solid var(--c-border);
border-radius: 16px; border-radius: 16px;
padding: 16px; padding: 16px;
box-shadow: 0 4px 14px rgba(20, 40, 90, .06); box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
+44 -44
View File
@@ -1,11 +1,11 @@
<style> <style>
.mu-page { .mu-page {
background: background:
linear-gradient(180deg, #ffffff 0%, #faf7ff 55%, #f4f0fd 100%); linear-gradient(180deg, var(--c-surface) 0%, #faf7ff 55%, #f4f0fd 100%);
} }
.mu-hero-panel { .mu-hero-panel {
background: #ffffff; background: var(--c-surface);
border: 1px solid #1f2a44; border: 1px solid #1f2a44;
border-radius: 8px; border-radius: 8px;
padding: 18px; padding: 18px;
@@ -15,8 +15,8 @@
gap: 16px; gap: 16px;
align-items: stretch; align-items: stretch;
} }
.mu-hero-title { margin: 0; font-size: 1.6rem; line-height: 1.2; color: #1f2a44; } .mu-hero-title { margin: 0; font-size: 1.6rem; line-height: 1.2; color: var(--c-ink); }
.mu-hero-subtitle { margin: 8px 0 0; color: #66728f; font-size: .95rem; max-width: 48rem; } .mu-hero-subtitle { margin: 8px 0 0; color: var(--c-ink-2); font-size: .95rem; max-width: 48rem; }
.mu-kpi-grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; } .mu-kpi-grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.mu-kpi { .mu-kpi {
border: 1px solid #d9c9f2; border: 1px solid #d9c9f2;
@@ -24,10 +24,10 @@
padding: 12px; padding: 12px;
background: linear-gradient(135deg, #f0e7fc, #e6d8f8); background: linear-gradient(135deg, #f0e7fc, #e6d8f8);
} }
.mu-kpi .label { margin: 0; color:#6b5b8a; font-size:.76rem; font-weight:700; letter-spacing:.03em; text-transform: uppercase; } .mu-kpi .label { margin: 0; color:var(--c-ink-3); font-size:.76rem; font-weight:700; letter-spacing:.03em; text-transform: uppercase; }
.mu-kpi .value { margin:4px 0 0; color:#2b1f4d; font-size:1.03rem; font-weight:800; font-variant-numeric: tabular-nums; } .mu-kpi .value { margin:4px 0 0; color:var(--c-ink); font-size:1.03rem; font-weight:800; font-variant-numeric: tabular-nums; }
.mu-hero-map { .mu-hero-map {
border: 1px solid #e7e0f6; border: 1px solid var(--c-border);
border-radius: 8px; border-radius: 8px;
padding: 14px; padding: 14px;
display:flex; display:flex;
@@ -35,7 +35,7 @@
gap: 10px; gap: 10px;
justify-content:space-between; justify-content:space-between;
} }
.mu-hero-map-title { margin:0; font-size:1rem; font-weight:800; color:#2c3e50; } .mu-hero-map-title { margin:0; font-size:1rem; font-weight:800; color:var(--c-ink); }
.mu-hero-map-box { .mu-hero-map-box {
flex:1; flex:1;
min-height: 160px; min-height: 160px;
@@ -45,7 +45,7 @@
display:flex; display:flex;
align-items:center; align-items:center;
justify-content:center; justify-content:center;
color:#66728f; color:var(--c-ink-2);
font-weight:700; font-weight:700;
text-align:center; text-align:center;
padding: 18px; padding: 18px;
@@ -53,7 +53,7 @@
/* ===== Search toolbar: 2 โหมด ===== */ /* ===== Search toolbar: 2 โหมด ===== */
.mu-toolbar { .mu-toolbar {
background: #ffffff; background: var(--c-surface);
border: 1px solid #d9c9f2; border: 1px solid #d9c9f2;
border-radius: 8px; border-radius: 8px;
padding: 14px; padding: 14px;
@@ -76,8 +76,8 @@
padding: 10px 18px; padding: 10px 18px;
border: none; border: none;
border-right: 1px solid #d5c3f0; border-right: 1px solid #d5c3f0;
background: #fff; background: var(--c-surface);
color: #5b3b71; color: var(--c-ink-2);
cursor: pointer; cursor: pointer;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
@@ -100,7 +100,7 @@
gap: 10px; gap: 10px;
border: 1px solid #d5c3f0; border: 1px solid #d5c3f0;
border-radius: 8px; border-radius: 8px;
background: #fff; background: var(--c-surface);
padding: 0 12px; padding: 0 12px;
min-height: 48px; min-height: 48px;
transition: border-color .15s ease; transition: border-color .15s ease;
@@ -116,10 +116,10 @@
font-family: inherit; font-family: inherit;
font-size: 1rem; font-size: 1rem;
font-weight: 600; font-weight: 600;
color: #1f2a44; color: var(--c-ink);
padding: 12px 0; padding: 12px 0;
} }
.mu-search-field input::placeholder { color: #6f7b95; font-weight: 500; opacity: .8; } .mu-search-field input::placeholder { color: var(--c-ink-2); font-weight: 500; opacity: .8; }
/* ===== ช่องรหัสป้าย 6 ช่อง: [x] + [x][x][x][x] ===== */ /* ===== ช่องรหัสป้าย 6 ช่อง: [x] + [x][x][x][x] ===== */
.mu-code-boxes { .mu-code-boxes {
@@ -135,8 +135,8 @@
font-size: 1.35rem; font-size: 1.35rem;
font-weight: 700; font-weight: 700;
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
color: #1f2a44; color: var(--c-ink);
background: #fff; background: var(--c-surface);
border: 2px solid #e0d6f5; border: 2px solid #e0d6f5;
border-radius: 8px; border-radius: 8px;
outline: none; outline: none;
@@ -149,7 +149,7 @@
.mu-code-cell::placeholder { color: #7a6a9e; font-weight: 600; opacity: 1; } .mu-code-cell::placeholder { color: #7a6a9e; font-weight: 600; opacity: 1; }
.mu-code-cell:focus { .mu-code-cell:focus {
border-color: #a855f7; border-color: #a855f7;
background: #faf7ff; background: var(--c-surface-2);
} }
.mu-code-cell:disabled { opacity: .45; } .mu-code-cell:disabled { opacity: .45; }
/* 2 หลักหน้า (ก่อน +) — เน้นให้เห็นว่าเป็นหัวของรหัส */ /* 2 หลักหน้า (ก่อน +) — เน้นให้เห็นว่าเป็นหัวของรหัส */
@@ -167,7 +167,7 @@
font-family: "IBM Plex Mono", ui-monospace, monospace; font-family: "IBM Plex Mono", ui-monospace, monospace;
font-size: 1.5rem; font-size: 1.5rem;
font-weight: 700; font-weight: 700;
color: #7a4cc0; color: var(--c-brand-ink);
line-height: 1; line-height: 1;
padding: 0 2px; padding: 0 2px;
} }
@@ -176,10 +176,10 @@
font-family: "IBM Plex Mono", ui-monospace, monospace; font-family: "IBM Plex Mono", ui-monospace, monospace;
font-size: .9rem; font-size: .9rem;
font-weight: 700; font-weight: 700;
color: #6d28d9; color: var(--c-brand-ink);
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
} }
.mu-search-hint { margin: 8px 0 0; font-size: .85rem; color: #5f6b83; } .mu-search-hint { margin: 8px 0 0; font-size: .85rem; color: var(--c-ink-2); }
/* numpad — โชว์เฉพาะจอเล็ก */ /* numpad — โชว์เฉพาะจอเล็ก */
.mu-numpad { display: none; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; max-width: 320px; } .mu-numpad { display: none; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; max-width: 320px; }
@@ -190,8 +190,8 @@
padding: 14px 0; padding: 14px 0;
border: 1px solid #e0d6f5; border: 1px solid #e0d6f5;
border-radius: 8px; border-radius: 8px;
background: #fff; background: var(--c-surface);
color: #1f2a44; color: var(--c-ink);
cursor: pointer; cursor: pointer;
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
transition: background .12s ease, border-color .12s ease; transition: background .12s ease, border-color .12s ease;
@@ -205,7 +205,7 @@
border-radius: 8px; border-radius: 8px;
margin-top: 8px; margin-top: 8px;
overflow: hidden; overflow: hidden;
background: #fff; background: var(--c-surface);
max-height: 260px; max-height: 260px;
overflow-y: auto; overflow-y: auto;
} }
@@ -218,15 +218,15 @@
padding: 11px 14px; padding: 11px 14px;
border: none; border: none;
border-bottom: 1px solid #f1edfa; border-bottom: 1px solid #f1edfa;
background: #fff; background: var(--c-surface);
font-family: inherit; font-family: inherit;
font-size: .9rem; font-size: .9rem;
text-align: left; text-align: left;
cursor: pointer; cursor: pointer;
color: #1f2a44; color: var(--c-ink);
} }
.mu-suggest-item:last-child { border-bottom: none; } .mu-suggest-item:last-child { border-bottom: none; }
.mu-suggest-item:hover { background: #faf7ff; } .mu-suggest-item:hover { background: var(--c-surface-2); }
.mu-suggest-code { .mu-suggest-code {
font-family: "IBM Plex Mono", ui-monospace, monospace; font-family: "IBM Plex Mono", ui-monospace, monospace;
font-size: .85rem; font-size: .85rem;
@@ -244,8 +244,8 @@
.mu-show-more .mu-btn { min-width: 220px; } .mu-show-more .mu-btn { min-width: 220px; }
.mu-stop-card.is-stub { min-height: 120px; background: #faf8ff; border: 1px dashed #ddd2f2; box-shadow: none; } .mu-stop-card.is-stub { min-height: 120px; background: #faf8ff; border: 1px dashed #ddd2f2; box-shadow: none; }
.mu-toolbar-count { margin: 10px 0 0; font-size: .84rem; color: #6f7b95; } .mu-toolbar-count { margin: 10px 0 0; font-size: .84rem; color: var(--c-ink-2); }
.mu-toolbar-count b { color: #7a4cc0; font-variant-numeric: tabular-nums; } .mu-toolbar-count b { color: var(--c-brand-ink); font-variant-numeric: tabular-nums; }
/* ===== การ์ดป้าย ===== */ /* ===== การ์ดป้าย ===== */
.mu-stop-grid[hidden] { display: none; } .mu-stop-grid[hidden] { display: none; }
@@ -260,15 +260,15 @@
margin: 0; margin: 0;
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
border: 1px solid #e7e0f6; border: 1px solid var(--c-border);
background: #fff; background: var(--c-surface);
transition: border-color .15s ease, transform .15s ease; transition: border-color .15s ease, transform .15s ease;
} }
.mu-stop-grid li:hover { border-color: #a855f7; transform: translateY(-1px); } .mu-stop-grid li:hover { border-color: #a855f7; transform: translateY(-1px); }
.mu-stop-card { .mu-stop-card {
height: 100%; height: 100%;
padding: 16px; padding: 16px;
background: #fff; background: var(--c-surface);
display:flex; display:flex;
flex-direction:column; flex-direction:column;
gap: 12px; gap: 12px;
@@ -283,9 +283,9 @@
font-weight:800; font-weight:800;
letter-spacing:.01em; letter-spacing:.01em;
} }
.mu-type-pill.local { background: #f3ecff; color: #6d28d9; } .mu-type-pill.local { background: #f3ecff; color: var(--c-brand-ink); }
.mu-stop-title { margin:6px 0 0; font-size:1.05rem; line-height:1.3; color:#1f2a44; } .mu-stop-title { margin:6px 0 0; font-size:1.05rem; line-height:1.3; color:var(--c-ink); }
.mu-loc { color:#6f7b95; font-size:.85rem; margin-top:4px; } .mu-loc { color:var(--c-ink-2); font-size:.85rem; margin-top:4px; }
.mu-chip-row { display:flex; flex-wrap:wrap; gap:8px; } .mu-chip-row { display:flex; flex-wrap:wrap; gap:8px; }
.mu-chip { .mu-chip {
display:inline-flex; display:inline-flex;
@@ -293,13 +293,13 @@
gap:6px; gap:6px;
padding:5px 10px; padding:5px 10px;
border-radius: 4px; border-radius: 4px;
background: #faf7ff; background: var(--c-surface-2);
border: 1px solid #e7e0f6; border: 1px solid var(--c-border);
color:#5b3b71; color:var(--c-ink-2);
font-size:.8rem; font-size:.8rem;
font-weight:700; font-weight:700;
} }
.mu-chip.route { background: #f3ecff; color:#6d28d9; border-color: #e0d6f5; } .mu-chip.route { background: #f3ecff; color:var(--c-brand-ink); border-color: #e0d6f5; }
/* ชิปสายที่เป็นลิงก์ → ไปหน้าเช็กเวลาของสายนั้น (หน้าตาเหมือนชิปเดิม + มี hover/focus) */ /* ชิปสายที่เป็นลิงก์ → ไปหน้าเช็กเวลาของสายนั้น (หน้าตาเหมือนชิปเดิม + มี hover/focus) */
a.mu-chip.route { text-decoration: none; cursor: pointer; } a.mu-chip.route { text-decoration: none; cursor: pointer; }
a.mu-chip.route:hover { background:#e9dcff; border-color:#cdb5f2; } a.mu-chip.route:hover { background:#e9dcff; border-color:#cdb5f2; }
@@ -318,15 +318,15 @@
padding: 7px 11px; padding: 7px 11px;
} }
.mu-stop-action { margin-top:auto; display:flex; justify-content:space-between; align-items:center; gap:12px; } .mu-stop-action { margin-top:auto; display:flex; justify-content:space-between; align-items:center; gap:12px; }
.mu-stop-note { color:#6f7b95; font-size:.8rem; margin:0; } .mu-stop-note { color:var(--c-ink-2); font-size:.8rem; margin:0; }
.mu-stop-thumb { .mu-stop-thumb {
display: block; display: block;
width: 100%; width: 100%;
height: 180px; height: 180px;
object-fit: cover; object-fit: cover;
background: #f7f9fd; background: var(--c-bg);
border-bottom: 1px solid #e7e0f6; border-bottom: 1px solid var(--c-border);
} }
/* รูป placeholder — ย่อและจัดกลาง ไม่ให้ครอปโลโก้ */ /* รูป placeholder — ย่อและจัดกลาง ไม่ให้ครอปโลโก้ */
.mu-stop-thumb.is-placeholder { .mu-stop-thumb.is-placeholder {
@@ -340,10 +340,10 @@
list-style: none; list-style: none;
padding: 40px 16px; padding: 40px 16px;
text-align: center; text-align: center;
color: #6f7b95; color: var(--c-ink-2);
border: 1px dashed #e0d6f5; border: 1px dashed #e0d6f5;
border-radius: 8px; border-radius: 8px;
background: #fff; background: var(--c-surface);
} }
@media (max-width: 980px) { @media (max-width: 980px) {
+9
View File
@@ -159,6 +159,15 @@
var searching = !!f.value; var searching = !!f.value;
var limit = (searching || state.showAll) ? filtered.length : PREVIEW_LIMIT; var limit = (searching || state.showAll) ? filtered.length : PREVIEW_LIMIT;
/* สถิติคำค้น (เฉพาะตอนมีคำจริง · Analytics ทำ debounce 900ms ให้เอง) */
if (searching && window.Analytics) {
window.Analytics.search({
q: f.value,
scope: state.mode === MODE_CODE ? 'code' : 'place',
results: filtered.length
});
}
var cards = [].filter.call(host.children, function (el) { return el.tagName === 'LI' && el.hasAttribute('data-idx'); }); var cards = [].filter.call(host.children, function (el) { return el.tagName === 'LI' && el.hasAttribute('data-idx'); });
var shown = 0; var shown = 0;
Array.prototype.forEach.call(cards, function (li) { Array.prototype.forEach.call(cards, function (li) {
+17 -8
View File
@@ -10,7 +10,7 @@
.mu-hero-lead { .mu-hero-lead {
margin: 14px auto 0; margin: 14px auto 0;
max-width: 640px; max-width: 640px;
color: #5b3b71; color: var(--c-ink-2);
font-size: .95rem; font-size: .95rem;
} }
@@ -26,7 +26,7 @@
gap: 14px; gap: 14px;
} }
.mu-stop-card { .mu-stop-card {
background: #fff; background: var(--c-surface);
border-radius: 16px; border-radius: 16px;
overflow: hidden; overflow: hidden;
box-shadow: 0 4px 14px rgba(20, 40, 90, .06); box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
@@ -58,7 +58,7 @@
gap: 6px; gap: 6px;
padding: 5px 12px; padding: 5px 12px;
border-radius: 999px; border-radius: 999px;
background: rgba(255, 255, 255, .24); background: var(--c-glass-24);
font-size: .74rem; font-size: .74rem;
font-weight: 700; font-weight: 700;
white-space: nowrap; white-space: nowrap;
@@ -70,9 +70,9 @@
.mu-stop-card[open] > summary .mu-stop-chevron { transform: rotate(180deg); } .mu-stop-card[open] > summary .mu-stop-chevron { transform: rotate(180deg); }
.mu-stop-body { padding: 16px; } .mu-stop-body { padding: 16px; }
.mu-stop-sub { font-weight: 700; color: #1f2a44; margin: 0 0 10px; font-size: .9rem; } .mu-stop-sub { font-weight: 700; color: var(--c-ink); margin: 0 0 10px; font-size: .9rem; }
.mu-direction-tag { .mu-direction-tag {
background: #7a4cc0; background: var(--c-brand);
color: #fff; color: #fff;
border-radius: 999px; border-radius: 999px;
padding: 3px 10px; padding: 3px 10px;
@@ -85,7 +85,7 @@
padding: 6px 12px; padding: 6px 12px;
border-radius: 10px; border-radius: 10px;
background: #f1f4fb; background: #f1f4fb;
color: #2b2f42; color: var(--c-ink);
font-weight: 700; font-weight: 700;
font-size: .85rem; font-size: .85rem;
border: 1px solid #e6eaf3; border: 1px solid #e6eaf3;
@@ -99,11 +99,11 @@
} }
.mu-schedule-note { .mu-schedule-note {
color: #9a3b6e; color: var(--c-danger);
font-size: .82rem; font-size: .82rem;
margin: 12px 0 0; margin: 12px 0 0;
padding: 8px 12px; padding: 8px 12px;
background: #fff5f9; background: var(--c-tint-pink);
border-left: 3px solid #bb3a78; border-left: 3px solid #bb3a78;
border-radius: 8px; border-radius: 8px;
display: flex; display: flex;
@@ -172,6 +172,15 @@
<!-- การ์ดจุดจอด + ชิปเวลา: สร้างจาก resource/data/schedules.json (checkSchedule.init.js) --> <!-- การ์ดจุดจอด + ชิปเวลา: สร้างจาก resource/data/schedules.json (checkSchedule.init.js) -->
<ul class="mu-schedule-list" id="check-schedule-list"></ul> <ul class="mu-schedule-list" id="check-schedule-list"></ul>
</div> </div>
<!-- ปุ่มแชร์หน้านี้ (ใช้ ui/share.js ร่วมกับหน้าอื่น) -->
<div class="mu-share-row">
<button type="button" class="mu-share-btn" id="share-btn">
<svg class="ic" aria-hidden="true"><use href="#ic-navigation"/></svg>
<span data-i18n="share.label">แชร์หน้านี้</span>
</button>
<p class="mu-share-status" id="share-status" aria-live="polite"></p>
</div>
</div> </div>
</section> </section>
+18 -9
View File
@@ -2,18 +2,18 @@
.mu-page { background: linear-gradient(180deg, #fcfbff 0%, #f5f9ff 100%); } .mu-page { background: linear-gradient(180deg, #fcfbff 0%, #f5f9ff 100%); }
.mu-credit-wrap { max-width: 46rem; margin: 0 auto; padding: 40px 28px 56px; } .mu-credit-wrap { max-width: 46rem; margin: 0 auto; padding: 40px 28px 56px; }
.mu-credit-hero { margin-bottom: 28px; } .mu-credit-hero { margin-bottom: 28px; }
.mu-credit-hero h1 { margin: 0 0 8px; font-size: 1.9rem; color: #1f2a44; } .mu-credit-hero h1 { margin: 0 0 8px; font-size: 1.9rem; color: var(--c-ink); }
.mu-credit-hero p { margin: 0; color: #66728f; } .mu-credit-hero p { margin: 0; color: var(--c-ink-2); }
.mu-credit-section { .mu-credit-section {
background: #fff; border: 1px solid #e7e0f6; border-radius: 16px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 16px;
padding: 20px 22px; margin-bottom: 16px; padding: 20px 22px; margin-bottom: 16px;
} }
.mu-credit-section h2 { margin: 0 0 6px; font-size: 1.05rem; color: #1f2a44; } .mu-credit-section h2 { margin: 0 0 6px; font-size: 1.05rem; color: var(--c-ink); }
.mu-credit-section .src { margin: 0 0 12px; color: #6f7b95; font-size: .85rem; } .mu-credit-section .src { margin: 0 0 12px; color: var(--c-ink-2); font-size: .85rem; }
.mu-credit-section ul { margin: 0; padding-left: 1.2rem; color: #3a4462; font-size: .92rem; line-height: 1.7; } .mu-credit-section ul { margin: 0; padding-left: 1.2rem; color: var(--c-ink); font-size: .92rem; line-height: 1.7; }
.mu-credit-section code { background: #f5eeff; color: #7a4cc0; padding: 1px 6px; border-radius: 6px; font-size: .85em; } .mu-credit-section code { background: var(--c-brand-soft); color: var(--c-brand-ink); padding: 1px 6px; border-radius: 6px; font-size: .85em; }
.mu-credit-section a { color: #7a4cc0; } .mu-credit-section a { color: var(--c-brand-ink); }
.mu-license { margin: 14px 0 0; padding: 12px 14px; background: #f9f7ff; border-left: 3px solid #7a4cc0; border-radius: 8px; font-size: .85rem; color: #4a5573; line-height: 1.6; } .mu-license { margin: 14px 0 0; padding: 12px 14px; background: var(--c-surface-2); border-left: 3px solid #7a4cc0; border-radius: 8px; font-size: .85rem; color: var(--c-ink-2); line-height: 1.6; }
</style> </style>
<main class="mu-page"> <main class="mu-page">
@@ -72,5 +72,14 @@
</p> </p>
</section> </section>
<section class="mu-credit-section">
<h2><span data-i18n="credits.analyticsTitle">สถิติ — แนวคิดจาก Umami</span></h2>
<p class="src"><span data-i18n="credits.src">แหล่งที่มา:</span> <a href="https://github.com/umami-software/umami" rel="noopener">github.com/umami-software/umami</a> · <span data-i18n="credits.lic">ใบอนุญาต:</span> <a href="https://github.com/umami-software/umami/blob/master/LICENSE" rel="noopener">MIT License</a></p>
<ul>
<li><span data-i18n="credits.analyticsBody">ระบบสถิติของเว็บนี้เขียนเองใน</span> <code>ui/analytics.js</code> <span data-i18n="credits.analyticsBody2">(ไม่มี dependency) — ยืมเฉพาะแนวคิด privacy-first และรูปแบบ payload ของ Umami (/api/send) ไม่ได้คัดลอกโค้ดของ Umami มาใช้</span></li>
<li data-i18n="credits.analyticsLocal">ข้อมูลสถิติเก็บในเบราว์เซอร์ของผู้ใช้เท่านั้น (localStorage) — ดู/ล้างได้ที่หน้า “สถิติ”</li>
</ul>
</section>
</div> </div>
</main> </main>
+2 -15
View File
@@ -1,23 +1,10 @@
<style> <style>
/* ปุ่มแชร์ลิงก์สั้น — มุมล่างขวา ต่อจากการ์ดหมวดเส้นทาง */ /* ปุ่มแชร์ลิงก์สั้น — มุมล่างขวา ต่อจากการ์ดหมวดเส้นทาง */
.mu-share-row { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin: 22px 0 44px; }
.mu-share-btn {
display: inline-flex; align-items: center; gap: 8px; display: inline-flex; align-items: center; gap: 8px;
padding: 10px 16px; border: 1px solid #7a4cc0; border-radius: 8px; padding: 10px 16px; border: 1px solid #7a4cc0; border-radius: 8px;
background: #7a4cc0; color: #fff; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; background: var(--c-brand); color: #fff; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer;
} }
.mu-share-btn:hover { background: #6a3cae; }
.mu-share-btn:focus-visible { outline: 2px solid #2b2f42; outline-offset: 2px; }
.mu-share-btn .ic { width: 18px; height: 18px; }
.mu-share-status { margin: 0; font-size: .82rem; line-height: 1.7; color: #4b5570; text-align: right; }
.mu-share-status:empty { display: none; }
.mu-share-url { display: inline-block; padding: 2px 6px; border: 1px solid #e7e2f6; border-radius: 8px; background: #faf9ff; font-size: .8rem; }
.mu-share-line { display: inline-block; margin-left: 6px; font-weight: 700; color: #06c755; text-decoration: none; }
.mu-share-line:hover { text-decoration: underline; }
@media (max-width: 560px) { @media (max-width: 560px) {
.mu-share-row { align-items: stretch; }
.mu-share-btn { justify-content: center; }
.mu-share-status { text-align: left; }
} }
</style> </style>
+1
View File
@@ -419,6 +419,7 @@
var btn = document.getElementById('share-btn'); var btn = document.getElementById('share-btn');
var status = document.getElementById('share-status'); var status = document.getElementById('share-status');
if (!btn) return; if (!btn) return;
btn.dataset.bound = '1'; /* หน้าแรกมี logic ลิงก์สั้นของตัวเอง */
var tr = window.I18N ? window.I18N.t : function (k) { return k; }; var tr = window.I18N ? window.I18N.t : function (k) { return k; };
function paint(msg) { function paint(msg) {
+153
View File
@@ -0,0 +1,153 @@
<style>
.mu-page { background: linear-gradient(180deg, #fcfbff 0%, #f5f9ff 100%); }
.st-wrap { max-width: 62rem; margin: 0 auto; padding: 32px 20px 64px; }
.st-hero { margin-bottom: 22px; }
.st-hero h1 { margin: 0 0 8px; font-size: clamp(1.5rem, 1.2rem + 1.4vw, 1.9rem); color: var(--c-ink); letter-spacing: -.01em; }
.st-hero p { margin: 0; color: var(--c-ink-2); font-size: .92rem; line-height: 1.65; max-width: 62ch; }
.st-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.st-kpi { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.st-kpi b { display: block; font-size: 1.55rem; line-height: 1.2; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.st-kpi span { display: block; margin-top: 4px; font-size: .76rem; font-weight: 700; color: var(--c-ink-2); letter-spacing: .01em; }
.st-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 16px; padding: 18px 20px; margin-top: 16px; }
.st-card h2 { margin: 0 0 4px; font-size: 1rem; color: var(--c-ink); }
.st-card .lead { margin: 0 0 14px; color: var(--c-ink-2); font-size: .84rem; line-height: 1.6; }
.st-grid2 { display: grid; gap: 16px; margin-top: 16px; }
.st-grid2 > .st-card { margin-top: 0; }
/* กราฟแท่ง 14 วัน — CSS ล้วน ไม่มีไลบรารี */
.st-chart { display: flex; align-items: flex-end; gap: 5px; height: 128px; padding-top: 10px; }
.st-bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.st-bar i, .st-bar u { display: block; border-radius: 4px 4px 0 0; min-height: 2px; }
.st-bar i { background: linear-gradient(180deg, #b694f6, #7a4cc0); }
.st-bar u { background: #e9dffb; }
.st-bar em { font-style: normal; font-size: .6rem; color: var(--c-ink-3); text-align: center; margin-top: 4px; white-space: nowrap; }
.st-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: .76rem; color: var(--c-ink-2); }
.st-legend b { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.st-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.st-table th { text-align: left; padding: 0 8px 6px 0; font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--c-ink-3); border-bottom: 1px solid #efe9fb; }
.st-table td { padding: 8px 8px 8px 0; border-bottom: 1px solid #f5f1fc; color: var(--c-ink); vertical-align: top; }
.st-table tr:last-child td { border-bottom: 0; }
.st-table .num { width: 3.5rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--c-ink); }
.st-table .when { color: var(--c-ink-3); font-size: .74rem; white-space: nowrap; }
.st-table .term { font-weight: 700; color: var(--c-ink); word-break: break-word; }
.st-table a { color: var(--c-brand-ink); text-decoration: none; font-weight: 600; }
.st-table a:hover { text-decoration: underline; }
.st-empty { margin: 0; padding: 14px 0 4px; color: var(--c-ink-3); font-size: .86rem; }
.st-list { margin: 0 0 14px; padding-left: 1.15rem; color: var(--c-ink); font-size: .88rem; line-height: 1.75; }
.st-toggle { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--c-border); border-radius: 12px; background: #fbf9ff; font-size: .88rem; color: var(--c-ink); cursor: pointer; }
.st-toggle input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--c-brand-ink); flex: none; }
.st-toggle strong { display: block; color: var(--c-ink); font-size: .9rem; margin-bottom: 2px; }
.st-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.st-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 9px 16px; border-radius: 10px; border: 1px solid #ddcff5; background: var(--c-surface); color: var(--c-brand-ink); font: inherit; font-size: .86rem; font-weight: 700; cursor: pointer; }
.st-btn:hover { background: #f7f2ff; }
.st-btn.is-solid { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.st-btn.is-solid:hover { background: #6a3fb0; }
.st-btn.is-danger { border-color: #f0c9c9; color: var(--c-danger); }
.st-btn.is-danger:hover { background: #fdf3f3; }
.st-note { margin: 12px 0 0; font-size: .78rem; color: var(--c-ink-3); }
.st-status { margin: 10px 0 0; min-height: 18px; font-size: .82rem; color: var(--c-ok); }
@media (min-width: 520px) { .st-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 768px) { .st-grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .st-wrap { padding: 40px 28px 72px; } }
</style>
<main class="mu-page">
<div class="st-wrap">
<div class="st-hero">
<p class="mu-breadcrumb"><a href="#/" data-i18n="credits.breadHome">หน้าแรก</a>/ <span data-i18n="nav.stats">สถิติ</span></p>
<h1 data-i18n="stats.title">สถิติการค้นหาในเครื่องนี้</h1>
<p data-i18n="stats.lead">เก็บเฉพาะจำนวนครั้งและคำที่ค้น — ไม่มีคุกกี้ ไม่มีรหัสผู้ใช้ ไม่เก็บ IP และไม่ส่งออกนอกเครื่อง เว้นแต่เจ้าของเว็บจะตั้งค่าเชื่อม Umami เอง</p>
</div>
<section class="st-kpis" aria-label="สรุปตัวเลข">
<div class="st-kpi"><b id="st-kpi-views">0</b><span data-i18n="stats.kpi.views">ครั้งที่เปิดหน้า</span></div>
<div class="st-kpi"><b id="st-kpi-searches">0</b><span data-i18n="stats.kpi.searches">ครั้งที่ค้นหา</span></div>
<div class="st-kpi"><b id="st-kpi-terms">0</b><span data-i18n="stats.kpi.terms">คำค้นต่างกัน</span></div>
<div class="st-kpi"><b id="st-kpi-nores">0</b><span data-i18n="stats.kpi.noResult">ค้นแล้วไม่พบ</span></div>
</section>
<section class="st-card">
<h2 data-i18n="stats.chart.title">14 วันล่าสุด</h2>
<p class="lead" data-i18n="stats.chart.lead">แท่งเข้ม = เปิดหน้า · แท่งอ่อน = ค้นหา</p>
<div class="st-chart" id="st-chart" role="img" aria-label="กราฟ 14 วันล่าสุด"></div>
<div class="st-legend">
<span><b style="background:linear-gradient(180deg,#b694f6,#7a4cc0)"></b><span data-i18n="stats.kpi.views">ครั้งที่เปิดหน้า</span></span>
<span><b style="background:#e9dffb"></b><span data-i18n="stats.kpi.searches">ครั้งที่ค้นหา</span></span>
</div>
</section>
<div class="st-grid2">
<section class="st-card">
<h2 data-i18n="stats.terms.title">คำที่ค้นมากที่สุด</h2>
<p class="lead" data-i18n="stats.terms.lead">คำถูกทำให้ปลอดภัยแล้ว — ตัดอีเมล เบอร์โทร และเลขยาวออกก่อนบันทึก</p>
<table class="st-table">
<thead>
<tr>
<th data-i18n="stats.col.term">คำค้น</th>
<th class="num" data-i18n="stats.col.count">ครั้ง</th>
<th data-i18n="stats.col.last">ล่าสุด</th>
</tr>
</thead>
<tbody id="st-terms"></tbody>
</table>
<p class="st-empty" id="st-terms-empty" hidden data-i18n="stats.terms.empty">ยังไม่มีคำค้นในเครื่องนี้ — ลองค้นหาป้ายที่หน้า “ป้ายหยุดรถ” แล้วกลับมาดู</p>
</section>
<section class="st-card">
<h2 data-i18n="stats.views.title">หน้าที่ถูกเปิดบ่อย</h2>
<p class="lead" data-i18n="stats.views.lead">นับเฉพาะรายละเอียดสายรถและรายละเอียดป้าย (ไม่ผูกกับผู้ใช้)</p>
<table class="st-table">
<thead>
<tr>
<th data-i18n="stats.col.target">หน้า</th>
<th class="num" data-i18n="stats.col.count">ครั้ง</th>
<th data-i18n="stats.col.last">ล่าสุด</th>
</tr>
</thead>
<tbody id="st-views"></tbody>
</table>
<p class="st-empty" id="st-views-empty" hidden data-i18n="stats.views.empty">ยังไม่มีข้อมูล — เปิดรายละเอียดสายหรือป้ายสักครั้ง</p>
</section>
</div>
<section class="st-card" id="st-nores-card" hidden>
<h2 data-i18n="stats.noresult.title">ค้นแล้วไม่พบ</h2>
<p class="lead" data-i18n="stats.noresult.lead">สัญญาณว่าข้อมูลยังขาด — คำเหล่านี้ควรมีในระบบถ้าเป็นเส้นทางจริง</p>
<table class="st-table">
<thead>
<tr><th data-i18n="stats.col.term">คำค้น</th><th class="num" data-i18n="stats.col.count">ครั้ง</th><th data-i18n="stats.col.last">ล่าสุด</th></tr>
</thead>
<tbody id="st-nores"></tbody>
</table>
</section>
<section class="st-card">
<h2 data-i18n="stats.privacy.title">ความเป็นส่วนตัว</h2>
<ul class="st-list">
<li data-i18n="stats.privacy.collect">เก็บ: จำนวนเปิดหน้า · คำที่ค้น (ตัดข้อมูลส่วนตัวออก) · จำนวนครั้งที่ค้นไม่พบ · เวลาล่าสุด</li>
<li data-i18n="stats.privacy.reject">ไม่เก็บ: IP · User-Agent · ตำแหน่ง · คุกกี้ · รหัสเครื่อง · ประวัติข้ามเว็บ</li>
<li data-i18n="stats.privacy.local">ข้อมูลอยู่ใน localStorage ของเบราว์เซอร์นี้เท่านั้น — ล้างได้ทุกเมื่อ</li>
</ul>
<label class="st-toggle" for="st-optout">
<input type="checkbox" id="st-optout">
<span>
<strong data-i18n="stats.privacy.optoutTitle">ปิดการเก็บสถิติในเครื่องนี้</strong>
<span data-i18n="stats.privacy.optoutLead">เปิดสวิตช์นี้ = หยุดบันทึกทันที (ยังดูตัวเลขเดิมได้) · ระบบเคารพ Do Not Track / GPC อยู่แล้ว</span>
</span>
</label>
<div class="st-actions">
<button type="button" class="st-btn is-solid" id="st-export" data-i18n="stats.btn.export">ดาวน์โหลดข้อมูล (JSON)</button>
<button type="button" class="st-btn is-danger" id="st-clear" data-i18n="stats.btn.clear">ล้างข้อมูลในเครื่อง</button>
</div>
<p class="st-status" id="st-status" role="status" aria-live="polite"></p>
<p class="st-note"><span data-i18n="stats.since">เริ่มเก็บเมื่อ</span>: <span id="st-since">—</span></p>
</section>
</div>
</main>
<script src="./partials/stats.init.js"></script>
+238
View File
@@ -0,0 +1,238 @@
/* stats.init.js — หน้า #/stats : อ่านรายงานจาก Analytics แล้ววาด (ไม่มีการยิงเน็ต) */
(function () {
'use strict';
var $ = function (id) { return document.getElementById(id); };
var A = window.Analytics;
if (!A) {
var host = document.querySelector('.st-wrap');
if (host) host.innerHTML = '<p class="st-empty">analytics.js ยังไม่ถูกโหลด</p>';
return;
}
function t(key, vars) {
return window.I18N ? window.I18N.t(key, vars) : key;
}
function num(n) {
try { return (Number(n) || 0).toLocaleString('th-TH'); } catch (e) { return String(n || 0); }
}
function when(ts) {
if (!ts) return '—';
var d = new Date(ts);
var p = function (v) { return ('0' + v).slice(-2); };
var now = new Date();
var sameDay = d.toDateString() === now.toDateString();
var hm = p(d.getHours()) + ':' + p(d.getMinutes());
return sameDay ? hm : (p(d.getDate()) + '/' + p(d.getMonth() + 1) + ' ' + hm);
}
function short(s, n) {
s = String(s || '');
return s.length > n ? s.slice(0, n - 1) + '…' : s;
}
/* ---------- KPI ---------- */
function renderKpis(r) {
$('st-kpi-views').textContent = num(r.totals.pageviews);
$('st-kpi-searches').textContent = num(r.totals.searches);
$('st-kpi-terms').textContent = num(r.totals.terms);
$('st-kpi-nores').textContent = num(r.totals.noResult);
$('st-since').textContent = r.since ? new Date(r.since).toLocaleDateString('th-TH', { year: 'numeric', month: 'short', day: 'numeric' }) : '—';
}
/* ---------- กราฟ 14 วัน ---------- */
function renderChart(r) {
var host = $('st-chart');
if (!host) return;
host.innerHTML = '';
/* เติมวันที่ขาดให้ครบ 14 วัน (วันไหนไม่มีข้อมูล = 0) */
var byDate = {};
r.days.forEach(function (d) { byDate[d.date] = d; });
var series = [];
var today = new Date();
today.setHours(12, 0, 0, 0);
for (var i = 13; i >= 0; i--) {
var d = new Date(today.getTime() - i * 86400000);
var k = d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2);
series.push({ date: k, day: d.getDate(), pv: (byDate[k] && byDate[k].pageviews) || 0, q: (byDate[k] && byDate[k].searches) || 0 });
}
var max = 1;
series.forEach(function (s) { max = Math.max(max, s.pv, s.q); });
series.forEach(function (s, idx) {
var col = document.createElement('div');
col.className = 'st-bar';
col.title = s.date + ' · ' + num(s.pv) + ' / ' + num(s.q);
var pv = document.createElement('i');
pv.style.height = Math.round((s.pv / max) * 92) + 'px';
var q = document.createElement('u');
q.style.height = Math.round((s.q / max) * 92) + 'px';
var lab = document.createElement('em');
lab.textContent = s.day;
if (idx % 2 === 1 && series.length > 8) lab.style.opacity = '0'; /* เว้นวรรคให้อ่านง่ายบนมือถือ */
col.appendChild(pv);
col.appendChild(q);
col.appendChild(lab);
host.appendChild(col);
});
}
/* ---------- ตารางคำค้น / หน้า ---------- */
function emptyRow(tbody, colSpan, text) {
tbody.innerHTML = '';
var tr = document.createElement('tr');
var td = document.createElement('td');
td.colSpan = colSpan;
td.className = 'st-empty';
td.textContent = text;
tr.appendChild(td);
tbody.appendChild(tr);
}
function renderTerms(r) {
var body = $('st-terms');
var empty = $('st-terms-empty');
body.innerHTML = '';
if (!r.topTerms.length) { empty.hidden = false; return; }
empty.hidden = true;
r.topTerms.forEach(function (row) {
var tr = document.createElement('tr');
var td1 = document.createElement('td');
td1.className = 'term';
td1.textContent = short(row.term, 42);
td1.title = row.term;
var td2 = document.createElement('td');
td2.className = 'num';
td2.textContent = num(row.count);
var td3 = document.createElement('td');
td3.className = 'when';
td3.textContent = when(row.last);
tr.appendChild(td1); tr.appendChild(td2); tr.appendChild(td3);
body.appendChild(tr);
});
}
function renderViews(r) {
var body = $('st-views');
var empty = $('st-views-empty');
body.innerHTML = '';
if (!r.topViews.length) { empty.hidden = false; return; }
empty.hidden = true;
r.topViews.forEach(function (row) {
var tr = document.createElement('tr');
var td1 = document.createElement('td');
var a = document.createElement('a');
a.href = row.kind === 'route' ? ('#/routes/' + encodeURIComponent(row.id)) : ('#/stops/' + encodeURIComponent(row.id));
a.textContent = row.kind === 'route'
? t('common.routePrefix', { n: row.id })
: t('stats.views.stopPrefix', { code: row.id });
td1.appendChild(a);
var td2 = document.createElement('td');
td2.className = 'num';
td2.textContent = num(row.count);
var td3 = document.createElement('td');
td3.className = 'when';
td3.textContent = when(row.last);
tr.appendChild(td1); tr.appendChild(td2); tr.appendChild(td3);
body.appendChild(tr);
});
}
function renderNoResult(r) {
var card = $('st-nores-card');
if (!card) return;
if (!r.topEmpty.length) { card.hidden = true; return; }
card.hidden = false;
var body = $('st-nores');
body.innerHTML = '';
r.topEmpty.forEach(function (row) {
var tr = document.createElement('tr');
var td1 = document.createElement('td');
td1.className = 'term';
td1.textContent = short(row.term, 42);
td1.title = row.term;
var td2 = document.createElement('td');
td2.className = 'num';
td2.textContent = num(row.count);
var td3 = document.createElement('td');
td3.className = 'when';
td3.textContent = when(row.last);
tr.appendChild(td1); tr.appendChild(td2); tr.appendChild(td3);
body.appendChild(tr);
});
}
/* ---------- สวิตช์ / ปุ่ม ---------- */
function status(msg) {
var el = $('st-status');
if (el) el.textContent = msg || '';
}
function wire() {
var opt = $('st-optout');
if (opt) {
opt.checked = !A.tracking();
opt.addEventListener('change', function () {
A.optOut(opt.checked);
status(opt.checked ? t('stats.privacy.off') : t('stats.privacy.on'));
});
}
var exp = $('st-export');
if (exp) {
exp.addEventListener('click', function () {
var d = new Date();
var name = 'atroute-stats-' + d.getFullYear() + ('0' + (d.getMonth() + 1)).slice(-2) + ('0' + d.getDate()).slice(-2) + '.json';
var blob = new Blob([A.exportJSON()], { type: 'application/json' });
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = name;
document.body.appendChild(a);
a.click();
a.remove();
setTimeout(function () { URL.revokeObjectURL(url); }, 1500);
status(t('stats.export.done'));
});
}
var clr = $('st-clear');
if (clr) {
clr.addEventListener('click', function () {
if (!window.confirm(t('stats.clear.confirm'))) return;
A.clear();
render();
status(t('stats.clear.done'));
});
}
}
/* ---------- วาดทั้งหมด ---------- */
function render() {
var r = A.report();
renderKpis(r);
renderChart(r);
renderTerms(r);
renderViews(r);
renderNoResult(r);
}
render();
wire();
})();
+39 -39
View File
@@ -1,27 +1,27 @@
<style> <style>
.mu-other-stops { margin: 16px 0 6px; } .mu-other-stops { margin: 16px 0 6px; }
.mu-other-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; } .mu-other-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mu-other-item { display: block; padding: 10px 12px; background: #fff; .mu-other-item { display: block; padding: 10px 12px; background: var(--c-surface);
border: 1px solid #eef0f6; border-radius: 12px; min-width: 0; } border: 1px solid #eef0f6; border-radius: 12px; min-width: 0; }
.mu-other-row { display: flex; align-items: center; gap: 10px; min-width: 0; } .mu-other-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mu-other-item .mu-time-grid { margin-top: 8px; } .mu-other-item .mu-time-grid { margin-top: 8px; }
.mu-other-item .mu-est-note { margin-top: 4px; } .mu-other-item .mu-est-note { margin-top: 4px; }
.mu-other-idx { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: #f1e9ff; .mu-other-idx { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: #f1e9ff;
color: #7a4cc0; font-size: .78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; } color: var(--c-brand-ink); font-size: .78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.mu-other-txt { flex: 1; min-width: 0; } .mu-other-txt { flex: 1; min-width: 0; }
.mu-other-txt strong { display: block; color: #1f2a44; font-size: .94rem; } .mu-other-txt strong { display: block; color: var(--c-ink); font-size: .94rem; }
.mu-other-txt span { display: block; color: #6f7b95; font-size: .8rem; } .mu-other-txt span { display: block; color: var(--c-ink-2); font-size: .8rem; }
.mu-other-item .mu-chip { flex: 0 0 auto; font-family: ui-monospace, Consolas, monospace; font-size: .72rem; } .mu-other-item .mu-chip { flex: 0 0 auto; font-family: ui-monospace, Consolas, monospace; font-size: .72rem; }
.mu-other-item .mu-chip.warn { background: #fff5e6; color: #9a6b00; border-color: #f2d9a8; } .mu-other-item .mu-chip.warn { background: #fff5e6; color: var(--c-warn); border-color: #f2d9a8; }
:root { :root {
--mu-accent: #7a4cc0; --mu-accent: var(--c-brand);
--mu-accent-soft: #f3eafe; --mu-accent-soft: #f3eafe;
--mu-ink: #1f2a44; --mu-ink: var(--c-ink);
--mu-muted: #6f7b95; --mu-muted: var(--c-ink-2);
--mu-border: #ecd7e6; --mu-border: #ecd7e6;
--mu-surface: #ffffff; --mu-surface: var(--c-surface);
--mu-rose: #ec4899; --mu-rose: #ec4899;
--mu-sky: #3071b8; --mu-sky: var(--c-info);
--mu-mint: #1f8765; --mu-mint: #1f8765;
} }
.mu-page { .mu-page {
@@ -35,7 +35,7 @@
overflow: hidden; overflow: hidden;
border: 1px solid rgba(231, 224, 246, 0.95); border: 1px solid rgba(231, 224, 246, 0.95);
border-radius: 22px; border-radius: 22px;
background: linear-gradient(135deg, #f8f4ff 0%, #f2f6ff 45%, #eefaf5 100%); background: linear-gradient(135deg, var(--c-surface-2) 0%, var(--c-tint-cyan) 45%, var(--c-tint-green) 100%);
box-shadow: 0 16px 34px rgba(122, 76, 192, 0.12); box-shadow: 0 16px 34px rgba(122, 76, 192, 0.12);
padding: 18px; padding: 18px;
margin-bottom: 14px; margin-bottom: 14px;
@@ -84,12 +84,12 @@
font-size: .9rem; font-size: .9rem;
} }
.mu-meta-row { display:flex; flex-wrap:wrap; gap:8px; margin: 12px 0 0; } .mu-meta-row { display:flex; flex-wrap:wrap; gap:8px; margin: 12px 0 0; }
.mu-meta-pill { max-width: 100%; overflow-wrap: anywhere; background:linear-gradient(135deg, #ffffff, #f7f9ff); border:1px solid rgba(231, 224, 246, 0.9); color:#5b3b71; padding:6px 14px; border-radius:999px; font-size:.85rem; font-weight:600; box-shadow: 0 4px 10px rgba(122, 76, 192, 0.08); } .mu-meta-pill { max-width: 100%; overflow-wrap: anywhere; background:linear-gradient(135deg, var(--c-surface), #f7f9ff); border:1px solid rgba(231, 224, 246, 0.9); color:var(--c-ink-2); padding:6px 14px; border-radius:999px; font-size:.85rem; font-weight:600; box-shadow: 0 4px 10px rgba(122, 76, 192, 0.08); }
.mu-meta-pill.purple { background:linear-gradient(135deg, #f5eeff, #fce7f3); color:#7a4cc0; border-color:#e8d9f0; } .mu-meta-pill.purple { background:linear-gradient(135deg, #f5eeff, #fce7f3); color:var(--c-brand-ink); border-color:#e8d9f0; }
.mu-meta-pill.sky { background:linear-gradient(135deg, #ebf5ff, #eff6ff); color:#3071b8; border-color:#d7e7fb; } .mu-meta-pill.sky { background:linear-gradient(135deg, #ebf5ff, #eff6ff); color:var(--c-info); border-color:#d7e7fb; }
.mu-meta-pill.mint { background:linear-gradient(135deg, #eafaf4, #ecfeff); color:#1f8765; border-color:#d1efdf; } .mu-meta-pill.mint { background:linear-gradient(135deg, #eafaf4, #ecfeff); color:var(--c-ok); border-color:#d1efdf; }
.mu-direction-tag { background:#7a4cc0; color:#fff; border-radius:999px; padding:2px 10px; font-size:.78rem; margin-left:8px; } .mu-direction-tag { background:var(--c-brand); color:#fff; border-radius:999px; padding:2px 10px; font-size:.78rem; margin-left:8px; }
.mu-schedule-note { color:#9a3b6e; font-size:.8rem; margin-top:8px; padding:8px 12px; background:#fff5f9; border-left:3px solid #bb3a78; border-radius:4px; } .mu-schedule-note { color:var(--c-danger); font-size:.8rem; margin-top:8px; padding:8px 12px; background:var(--c-tint-pink); border-left:3px solid #bb3a78; border-radius:4px; }
.mu-hero-metric-grid { .mu-hero-metric-grid {
display: grid; display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -100,15 +100,15 @@
border: 1px solid rgba(231, 224, 246, 0.9); border: 1px solid rgba(231, 224, 246, 0.9);
border-radius: 12px; border-radius: 12px;
padding: 10px; padding: 10px;
background: #fff; background: var(--c-surface);
box-shadow: 0 6px 14px rgba(122, 76, 192, 0.08); box-shadow: 0 6px 14px rgba(122, 76, 192, 0.08);
min-width: 0; min-width: 0;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
.mu-hero-metric:nth-child(1) { background: linear-gradient(135deg, #f5efff, #fdf2f8); } .mu-hero-metric:nth-child(1) { background: linear-gradient(135deg, var(--c-tint-purple), var(--c-tint-pink)); }
.mu-hero-metric:nth-child(2) { background: linear-gradient(135deg, #ecfeff, #eef6ff); } .mu-hero-metric:nth-child(2) { background: linear-gradient(135deg, #ecfeff, #eef6ff); }
.mu-hero-metric:nth-child(3) { background: linear-gradient(135deg, #fff1f2, #fff7ed); } .mu-hero-metric:nth-child(3) { background: linear-gradient(135deg, #fff1f2, #fff7ed); }
.mu-hero-metric:nth-child(4) { background: linear-gradient(135deg, #ecfdf5, #f0fdfa); } .mu-hero-metric:nth-child(4) { background: linear-gradient(135deg, var(--c-tint-green), var(--c-tint-cyan)); }
.mu-hero-metric-label { .mu-hero-metric-label {
margin: 0; margin: 0;
color: var(--mu-muted); color: var(--mu-muted);
@@ -126,11 +126,11 @@
} }
.mu-stop-summary-main { order: 2; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; } .mu-stop-summary-main { order: 2; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.mu-stop-summary-main strong { font-size: .95rem; line-height: 1.3; } .mu-stop-summary-main strong { font-size: .95rem; line-height: 1.3; }
.mu-stop-summary-main .mu-stop-summary-meta { color: #6f7b95; font-size: .78rem; } .mu-stop-summary-main .mu-stop-summary-meta { color: var(--c-ink-2); font-size: .78rem; }
.mu-route-type-badge { display: inline-flex; align-items: center; gap: 5px; order: 3; flex: none; background: linear-gradient(135deg, #f5eeff, #fce7f3); color: #7a4cc0; padding: 4px 8px; border-radius: 8px; font-size: .8rem; font-weight: 700; border: 1px solid #e8d9f0; white-space: nowrap; } .mu-route-type-badge { display: inline-flex; align-items: center; gap: 5px; order: 3; flex: none; background: linear-gradient(135deg, #f5eeff, #fce7f3); color: var(--c-brand-ink); padding: 4px 8px; border-radius: 8px; font-size: .8rem; font-weight: 700; border: 1px solid #e8d9f0; white-space: nowrap; }
.mu-stop-summary-rail { order: 4; flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; } .mu-stop-summary-rail { order: 4; flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.mu-route-chip { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 38px; padding: 5px 9px; border-radius: 8px; background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff; font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; } .mu-route-chip { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 38px; padding: 5px 9px; border-radius: 8px; background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff; font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.mu-stop-chevron { display: inline-block; color: #7a4cc0; font-size: .9rem; line-height: 1; transition: transform .2s ease; } .mu-stop-chevron { display: inline-block; color: var(--c-brand-ink); font-size: .9rem; line-height: 1; transition: transform .2s ease; }
.mu-stop-expander[open] .mu-stop-chevron { transform: rotate(180deg); } .mu-stop-expander[open] .mu-stop-chevron { transform: rotate(180deg); }
.mu-live-clock-card { .mu-live-clock-card {
display: flex; display: flex;
@@ -141,12 +141,12 @@
padding: 12px 14px; padding: 12px 14px;
border: 1px solid rgba(240, 191, 224, 0.9); border: 1px solid rgba(240, 191, 224, 0.9);
border-radius: 14px; border-radius: 14px;
background: linear-gradient(135deg, #ffe8f4 0%, #f5f0ff 50%, #e8f7ff 100%); background: linear-gradient(135deg, var(--c-tint-pink) 0%, var(--c-tint-purple) 50%, var(--c-tint-cyan) 100%);
box-shadow: 0 8px 20px rgba(122, 76, 192, 0.10); box-shadow: 0 8px 20px rgba(122, 76, 192, 0.10);
} }
.mu-live-clock-title { .mu-live-clock-title {
margin: 0; margin: 0;
color: #6f7b95; color: var(--c-ink-2);
font-size: .78rem; font-size: .78rem;
font-weight: 700; font-weight: 700;
letter-spacing: .04em; letter-spacing: .04em;
@@ -156,7 +156,7 @@
margin: 2px 0 0; margin: 2px 0 0;
font-size: 1.65rem; font-size: 1.65rem;
line-height: 1; line-height: 1;
color: #1f2a44; color: var(--c-ink);
font-weight: 800; font-weight: 800;
font-family: "K2D", "Prompt", "Noto Sans Thai", sans-serif; font-family: "K2D", "Prompt", "Noto Sans Thai", sans-serif;
} }
@@ -164,7 +164,7 @@
margin: 0; margin: 0;
padding: 6px 10px; padding: 6px 10px;
border-radius: 999px; border-radius: 999px;
background: linear-gradient(135deg, #ffffff, #fff7fb); background: linear-gradient(135deg, var(--c-surface), var(--c-tint-pink));
border: 1px solid #eec7df; border: 1px solid #eec7df;
color: #9333ea; color: #9333ea;
font-size: .78rem; font-size: .78rem;
@@ -185,9 +185,9 @@
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
background: #fff; background: var(--c-surface);
border: 1px solid #f0d6e6; border: 1px solid #f0d6e6;
color: #9a3b6e; color: var(--c-danger);
border-radius: 999px; border-radius: 999px;
padding: 3px 10px; padding: 3px 10px;
font-size: .76rem; font-size: .76rem;
@@ -209,7 +209,7 @@
.mu-panel { .mu-panel {
border: 1px solid rgba(231, 224, 246, 0.95); border: 1px solid rgba(231, 224, 246, 0.95);
border-radius: 18px; border-radius: 18px;
background: linear-gradient(180deg, #ffffff, #fffbfe); background: linear-gradient(180deg, var(--c-surface), var(--c-surface-2));
box-shadow: 0 10px 24px rgba(122, 76, 192, 0.09); box-shadow: 0 10px 24px rgba(122, 76, 192, 0.09);
} }
@@ -225,8 +225,8 @@
border: 1px solid #e9e2fb; border: 1px solid #e9e2fb;
box-shadow: 0 8px 24px rgba(67, 56, 202, 0.08); box-shadow: 0 8px 24px rgba(67, 56, 202, 0.08);
} }
.mu-info-card .label { font-size: .78rem; color:#66728f; margin:0; font-weight:700; } .mu-info-card .label { font-size: .78rem; color:var(--c-ink-2); margin:0; font-weight:700; }
.mu-info-card .value { margin:4px 0 0; font-size:1rem; font-weight:700; color:#2b2f42; } .mu-info-card .value { margin:4px 0 0; font-size:1rem; font-weight:700; color:var(--c-ink); }
.mu-layout-grid { .mu-layout-grid {
display: grid; display: grid;
@@ -236,7 +236,7 @@
} }
.mu-card-panel { .mu-card-panel {
background: #fff; background: var(--c-surface);
border: 1px solid #ebe8f4; border: 1px solid #ebe8f4;
border-radius: 16px; border-radius: 16px;
padding: 18px; padding: 18px;
@@ -289,7 +289,7 @@
padding: 10px 12px; padding: 10px 12px;
font-size: .9rem; font-size: .9rem;
color: var(--mu-ink); color: var(--mu-ink);
background: linear-gradient(180deg, #ffffff, #f8fbff); background: linear-gradient(180deg, var(--c-surface), #f8fbff);
outline: none; outline: none;
box-shadow: 0 2px 4px rgba(0,0,0,.02); box-shadow: 0 2px 4px rgba(0,0,0,.02);
} }
@@ -299,7 +299,7 @@
} }
.mu-route-count { .mu-route-count {
border: 1px solid rgba(233, 200, 251, 0.9); border: 1px solid rgba(233, 200, 251, 0.9);
background: linear-gradient(135deg, #faf5ff, #fdf2f8); background: linear-gradient(135deg, #faf5ff, var(--c-tint-pink));
color: #6b21a8; color: #6b21a8;
border-radius: 999px; border-radius: 999px;
padding: 8px 12px; padding: 8px 12px;
@@ -311,14 +311,14 @@
border-radius: 14px; border-radius: 14px;
margin-bottom: 8px; margin-bottom: 8px;
overflow: hidden; overflow: hidden;
background: linear-gradient(180deg, #fff, #fffafe); background: linear-gradient(180deg, var(--c-surface), #fffafe);
} }
.mu-stop-expander[open] { .mu-stop-expander[open] {
border-color: rgba(226, 201, 245, 0.95); border-color: rgba(226, 201, 245, 0.95);
box-shadow: 0 8px 18px rgba(122, 76, 192, 0.10); box-shadow: 0 8px 18px rgba(122, 76, 192, 0.10);
} }
.mu-stop-expander > summary { .mu-stop-expander > summary {
background: linear-gradient(180deg, #fff, #fff6fb); background: linear-gradient(180deg, var(--c-surface), #fff6fb);
padding: 14px; padding: 14px;
/* flex + wrap: จอกว้างเรียงบรรทัดเดียว / จอแคบพับลงมา ไม่ทับกัน */ /* flex + wrap: จอกว้างเรียงบรรทัดเดียว / จอแคบพับลงมา ไม่ทับกัน */
display: flex; display: flex;
@@ -341,7 +341,7 @@
.mu-toolbar { .mu-toolbar {
margin-top: 10px; margin-top: 10px;
margin-bottom: 12px; margin-bottom: 12px;
background: rgba(255,255,255,.8); background: var(--c-glass-24);
backdrop-filter: blur(8px); backdrop-filter: blur(8px);
border: 1px solid rgba(231, 224, 246, 0.9); border: 1px solid rgba(231, 224, 246, 0.9);
border-radius: 14px; border-radius: 14px;
@@ -398,7 +398,7 @@
background: #f7f4fd; box-shadow: none; border: 1px solid #e8e4f2; background: #f7f4fd; box-shadow: none; border: 1px solid #e8e4f2;
} }
.mu-nearby { .mu-nearby {
background: #fff; border: 1px solid var(--mu-border); border-radius: 20px; background: var(--c-surface); border: 1px solid var(--mu-border); border-radius: 20px;
padding: 18px; margin: 14px 0; box-shadow: 0 10px 24px rgba(63,43,94,.06); padding: 18px; margin: 14px 0; box-shadow: 0 10px 24px rgba(63,43,94,.06);
} }
.mu-nearby h2 { margin: 0 0 4px; font-size: 1.15rem; color: var(--mu-ink); } .mu-nearby h2 { margin: 0 0 4px; font-size: 1.15rem; color: var(--mu-ink); }
+5
View File
@@ -333,6 +333,11 @@
if (ok) shown++; if (ok) shown++;
}); });
setCount(shown, items.length); setCount(shown, items.length);
/* สถิติคำค้นในหน้ารายละเอียดป้าย (debounce อยู่ใน Analytics) */
if (kw.length >= 2 && window.Analytics) {
window.Analytics.search({ q: kw, scope: 'stop', results: shown });
}
} }
function setupFilter() { function setupFilter() {
var input = $('mu-route-filter'); var input = $('mu-route-filter');
+145 -56
View File
@@ -1,77 +1,166 @@
/* ============================================================ /* ============================================================
Atroute — PWA registration + auto-update Atroute — PWA registration + auto-update (ผู้ใช้ไม่ต้องกดอะไรเลย)
ผู้ใช้ไม่ต้องล้างแคชเอง: ------------------------------------------------------------
1. register แบบ updateViaCache:"none" → ไม่เชื่อ HTTP cache ของ sw.js ชั้นกันแคชที่ทำงานร่วมกัน — "ไม่มีใครต้องกด Ctrl+Shift+R"
2. เรียก reg.update() ทุกครั้งที่โหลดหน้า → ตรวจ SW ใหม่ทันที
(ปกติ browser เช็คแค่ทุก 24 ชม.) 1. shell assets (js/css) มี ?v=<version> → HTTP cache เห็นเป็นไฟล์ใหม่ทันที
3. ตรวจซ้ำทุก 30 นาที → เหมาะกับจอแสดงข้อมูลที่เปิดทิ้งไว้ (bump-version.py เติมให้อัตโนมัติ)
4. SW ใหม่ skipWaiting+claim → controllerchange → reload เงียบ ๆ 2. SW network-first + cache:"no-store" → ออนไลน์ได้ของใหม่เสมอ (ui/sw.js)
3. reg.update() ทุกครั้งที่เปิดหน้า + ทุก 30 นาที
4. version.json ← ตัวชี้ขาด: เวอร์ชันบนเซิร์ฟเวอร์ ≠ meta ในหน้า
→ ขึ้น toast แล้วรีโหลดเอง (รีโหลดครั้งเดียวต่อเวอร์ชัน กันลูป)
ตรวจตอนเปิดหน้า · ทุก 5 นาที · ตอนกลับมาที่แท็บ · ตอนเน็ตกลับมา
หมายเหตุ: ไม่มีปุ่ม "ติดตั้งแอป" ลอยมุมขวาล่าง (เอาออกตามคำขอ)
============================================================ */ ============================================================ */
(function () { (function () {
if (!("serviceWorker" in navigator)) return; var CHECK_INTERVAL_MS = 5 * 60 * 1000; // ตรวจ version.json ทุก 5 นาที
var SW_INTERVAL_MS = 30 * 60 * 1000; // ตรวจ sw.js ทุก 30 นาที
var RELOAD_GUARD = 'at_reloaded_for'; // sessionStorage — กันรีโหลดวน
var CHECK_INTERVAL_MS = 30 * 60 * 1000; // ตรวจอัปเดตทุก 30 นาที var metaEl = document.querySelector('meta[name="app-version"]');
var currentVersion = metaEl ? metaEl.content : '';
/* ---- ปุ่มติดตั้งแอป (ก่อน install prompt) ---- */ function t(key, fallback) {
var deferredPrompt = null; var v = (window.I18N && I18N.t) ? I18N.t(key) : key;
var installBtn = null; return (!v || v === key) ? fallback : v;
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) { /* ---------- toast เล็ก ๆ ล่างจอ (ไม่บล็อกการใช้งาน) ---------- */
e.preventDefault(); var toastEl = null, toastTimer = null;
deferredPrompt = e; function showToast(msg) {
if (!installBtn) installBtn = makeInstallBtn(); if (document.querySelector('.mu-update-toast')) return;
installBtn.style.display = "inline-flex"; toastEl = document.createElement('div');
}); toastEl.className = 'mu-update-toast';
toastEl.setAttribute('role', 'status');
toastEl.setAttribute('aria-live', 'polite');
window.addEventListener("appinstalled", function () { var dot = document.createElement('span');
if (installBtn) installBtn.style.display = "none"; dot.className = 'mu-update-dot';
}); dot.setAttribute('aria-hidden', 'true');
window.addEventListener("load", function () { var text = document.createElement('span');
text.textContent = msg;
toastEl.appendChild(dot);
toastEl.appendChild(text);
document.body.appendChild(toastEl);
toastTimer = setTimeout(function () { if (toastEl) toastEl.classList.add('is-in'); }, 20);
}
function hideToast() {
clearTimeout(toastTimer);
if (!toastEl) return;
toastEl.classList.remove('is-in');
var el = toastEl;
toastEl = null;
setTimeout(function () { if (el) el.remove(); }, 300);
}
/* ---------- รีโหลดครั้งเดียวต่อเวอร์ชัน (กันลูป) ---------- */
function alreadyReloaded(ver) {
try { return sessionStorage.getItem(RELOAD_GUARD) === ver; } catch (e) { return false; }
}
function reloadOnce(ver) {
try {
if (alreadyReloaded(ver)) return;
sessionStorage.setItem(RELOAD_GUARD, ver);
} catch (e) { /* โหมดส่วนตัว: ยอมให้รีโหลดได้ */ }
location.reload();
}
/* ---------- พบเวอร์ชันใหม่ → แจ้ง + อัปเดตเอง ---------- */
var applying = false;
function applyUpdate(nextVersion) {
if (applying) return;
/* รีโหลดเพื่อเวอร์ชันนี้ไปแล้วแต่ยังไม่ตรง (เช่นเซิร์ฟเวอร์ยังไม่ลงไฟล์ครบ)
→ หยุดเงียบ ๆ ไม่เด้ง toast ซ้ำให้รำคาญ */
if (alreadyReloaded(nextVersion)) return;
applying = true;
showToast(t('update.applying', 'มีเวอร์ชันใหม่ — กำลังอัปเดต…'));
/* แท็บถูกซ่อน (ผู้ใช้ไม่ได้ดูอยู่) → รีโหลดเลย ไม่รบกวน */
if (document.hidden) { reloadOnce(nextVersion); return; }
var done = false;
function finish() {
if (done) return;
done = true;
reloadOnce(nextVersion);
}
/* ขอ SW ใหม่ก่อน — ถ้าได้ controllerchange จะรีโหลดจากตรงนั้น */
if (navigator.serviceWorker) {
navigator.serviceWorker.addEventListener('controllerchange', finish, { once: true });
navigator.serviceWorker.getRegistration()
.then(function (reg) { if (reg) return reg.update(); })
.catch(function () {});
}
/* ไม่ว่า SW จะทันหรือไม่ ภายใน 2.5 วิ รีโหลดเพื่อรับ HTML/JS/CSS ใหม่ */
setTimeout(finish, 2500);
}
/* ---------- ตรวจ version.json (ตัวชี้ขาดว่ามีของใหม่ไหม) ---------- */
function checkVersion() {
if (!currentVersion) return Promise.resolve(null);
return fetch('./version.json?t=' + Date.now(), { cache: 'no-store' })
.then(function (r) { return r.ok ? r.json() : null; })
.then(function (d) {
if (!d || !d.version) return null;
if (String(d.version) !== String(currentVersion)) {
applyUpdate(String(d.version));
return d.version;
}
return null;
})
.catch(function () { return null; }); /* ออฟไลน์/ยังไม่มีไฟล์ = ไม่ทำอะไร */
}
if (!('serviceWorker' in navigator)) {
/* ไม่มี SW (เบราว์เซอร์เก่า): ยังตรวจ version.json ได้ */
checkVersion();
setInterval(checkVersion, CHECK_INTERVAL_MS);
return;
}
window.addEventListener('load', function () {
navigator.serviceWorker navigator.serviceWorker
.register("./sw.js", { updateViaCache: "none" }) .register('./sw.js', { updateViaCache: 'none' })
.then(function (reg) { .then(function (reg) {
// ตรวจหา SW เวอร์ชันใหม่ทุกครั้งที่โหลดหน้า
reg.update(); reg.update();
// ตรวจซ้ำเป็นระยะ (กันจอที่เปิดค้างไม่เคยโหลดหน้าใหม่) setInterval(function () { reg.update(); }, SW_INTERVAL_MS);
setInterval(function () {
reg.update();
}, CHECK_INTERVAL_MS);
// SW ใหม่接管การควบคุมแล้ว → รีโหลดหน้ารับเวอร์ชันใหม่ทันที /* SW ใหม่接管แล้ว → รับเวอร์ชันใหม่ (รีโหลดครั้งเดียวต่อเวอร์ชัน) */
navigator.serviceWorker.addEventListener("controllerchange", function () { navigator.serviceWorker.addEventListener('controllerchange', function () {
window.location.reload(); reloadOnce(currentVersion || 'sw');
}); });
}) })
.catch(function () { .catch(function () {
/* ไม่มี SW = ไม่มีโหมดออฟไลน์ — เว็บยังใช้งานปกติ */ /* ไม่มี SW = ไม่มีโหมดออฟไลน์ — เว็บยังใช้งานปกติ */
}); });
checkVersion();
setInterval(checkVersion, CHECK_INTERVAL_MS);
/* กลับมาที่แท็บ/สลับแอปกลับมา (มือถือ) → ตรวจทันที */
document.addEventListener('visibilitychange', function () {
if (document.visibilityState === 'visible') {
hideToast();
checkVersion();
}
});
/* เน็ตกลับมา → ตรวจอีกรอบ */
window.addEventListener('online', function () { checkVersion(); });
}); });
/* เปิดให้ทดสอบ/สั่งเองได้ */
window.ATUpdate = {
check: checkVersion,
version: currentVersion,
apply: applyUpdate,
_toast: showToast
};
})(); })();
+10 -10
View File
@@ -57,7 +57,7 @@ main.mu-container { padding-top: 24px; padding-bottom: 24px; }
.mu-topbar-inner { gap: 8px; padding: 10px 14px; flex-wrap: wrap; } .mu-topbar-inner { gap: 8px; padding: 10px 14px; flex-wrap: wrap; }
.mu-logo-img { width: 36px; height: 36px; } .mu-logo-img { width: 36px; height: 36px; }
.mu-brand { gap: 8px; flex-shrink: 0; } .mu-brand { gap: 8px; flex-shrink: 0; }
.mu-brand-title { font-size: 1.05rem; white-space: nowrap; } .mu-brand-title { font-size: 1rem; white-space: nowrap; }
.mu-brand-subtitle { display: none; } /* กันล้น — โผล่กลับ ≥768px */ .mu-brand-subtitle { display: none; } /* กันล้น — โผล่กลับ ≥768px */
.mu-nav { display: none; } /* ซ่อน nav — ใช้ hamburger แทน */ .mu-nav { display: none; } /* ซ่อน nav — ใช้ hamburger แทน */
.mu-lang-switch { order: 3; margin-left: auto; padding: 2px; } .mu-lang-switch { order: 3; margin-left: auto; padding: 2px; }
@@ -70,7 +70,7 @@ main.mu-container { padding-top: 24px; padding-bottom: 24px; }
display: flex; align-items: center; justify-content: center; display: flex; align-items: center; justify-content: center;
width: 44px; height: 44px; width: 44px; height: 44px;
border: none; background: transparent; cursor: pointer; border: none; background: transparent; cursor: pointer;
color: #1f2a44; list-style: none; color: var(--c-ink); list-style: none;
border-radius: 10px; border-radius: 10px;
} }
.mu-menu-btn::-webkit-details-marker { display: none; } .mu-menu-btn::-webkit-details-marker { display: none; }
@@ -78,7 +78,7 @@ main.mu-container { padding-top: 24px; padding-bottom: 24px; }
.mu-menu-panel { .mu-menu-panel {
position: absolute; top: calc(100% + 8px); right: 0; position: absolute; top: calc(100% + 8px); right: 0;
min-width: 220px; min-width: 220px;
background: #fff; border: 1px solid #e7e2f6; border-radius: 14px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px;
box-shadow: 0 12px 28px rgba(20, 40, 90, .16); box-shadow: 0 12px 28px rgba(20, 40, 90, .16);
padding: 8px; padding: 8px;
z-index: 60; z-index: 60;
@@ -88,7 +88,7 @@ main.mu-container { padding-top: 24px; padding-bottom: 24px; }
display: flex; align-items: center; display: flex; align-items: center;
min-height: 48px; padding: 10px 14px; min-height: 48px; padding: 10px 14px;
border-radius: 10px; border-radius: 10px;
color: #1f2a44; text-decoration: none; color: var(--c-ink); text-decoration: none;
font-size: 1.05rem; font-weight: 600; font-size: 1.05rem; font-weight: 600;
} }
.mu-menu-panel a:hover, .mu-menu-panel a:active { background: #f5efff; } .mu-menu-panel a:hover, .mu-menu-panel a:active { background: #f5efff; }
@@ -125,8 +125,8 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
#view .mu-zone-seg { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; } #view .mu-zone-seg { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
#view .mu-zone-seg:not(:last-child)::after { content: "\00b7"; color: #c4bcd8; margin-left: 8px; } /* คั่นท้ายชิ้น → ตัดบรรทัดแล้วจุดไม่ไปอยู่ต้นบรรทัด */ #view .mu-zone-seg:not(:last-child)::after { content: "\00b7"; color: #c4bcd8; margin-left: 8px; } /* คั่นท้ายชิ้น → ตัดบรรทัดแล้วจุดไม่ไปอยู่ต้นบรรทัด */
#view .mu-zone-seg .ic { align-self: center; flex: none; } #view .mu-zone-seg .ic { align-self: center; flex: none; }
#view .mu-zone-now b { color: #1f2a44; font-variant-numeric: tabular-nums; } #view .mu-zone-now b { color: var(--c-ink); font-variant-numeric: tabular-nums; }
#view .mu-zone-at { color: #8a93a8; } /* ชื่อสถานีในวงเล็บ — จางกว่ารอบรถ */ #view .mu-zone-at { color: var(--c-ink-3); } /* ชื่อสถานีในวงเล็บ — จางกว่ารอบรถ */
#view .mu-zone-updated { color: #8a7aa8; font-size: .95rem; } #view .mu-zone-updated { color: #8a7aa8; font-size: .95rem; }
.mu-grid { gap: 12px; } .mu-grid { gap: 12px; }
.mu-route-info { padding: 16px 16px 18px; } .mu-route-info { padding: 16px 16px 18px; }
@@ -197,13 +197,13 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
@media (min-width: 640px) { @media (min-width: 640px) {
body { font-size: 16px; } body { font-size: 16px; }
.mu-container { padding: 0 28px; } .mu-container { padding: 0 28px; }
.mu-brand-title { font-size: 1.05rem; } .mu-brand-title { font-size: 1rem; }
.mu-topbar-inner { gap: 18px; padding: 14px 28px; flex-wrap: nowrap; } .mu-topbar-inner { gap: 18px; padding: 14px 28px; flex-wrap: nowrap; }
.mu-logo-img { width: 44px; height: 44px; } .mu-logo-img { width: 44px; height: 44px; }
.mu-nav { order: 0; width: auto; margin-left: auto; justify-content: flex-start; gap: 24px; display: flex; } .mu-nav { order: 0; width: auto; margin-left: auto; justify-content: flex-start; gap: 24px; display: flex; }
.mu-nav a { font-size: .92rem; } .mu-nav a { font-size: .95rem; }
.mu-menu { display: none; } .mu-menu { display: none; }
.mu-lang-btn { font-size: .72rem; padding: 6px 10px; }
.mu-hero { padding: 44px 0 52px; } .mu-hero { padding: 44px 0 52px; }
.mu-hero-actions { margin-top: 14px; } .mu-hero-actions { margin-top: 14px; }
.mu-marquee-tile { width: 170px; height: 96px; margin-right: 16px; } .mu-marquee-tile { width: 170px; height: 96px; margin-right: 16px; }
@@ -275,7 +275,7 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
/* เวลาที่ "คำนวณจากต้นทาง" (ไม่ใช่ตารางจริงของผู้ประกอบการ) — ทำเครื่องหมายให้ผู้ใช้รู้ ไม่ให้เข้าใจผิด */ /* เวลาที่ "คำนวณจากต้นทาง" (ไม่ใช่ตารางจริงของผู้ประกอบการ) — ทำเครื่องหมายให้ผู้ใช้รู้ ไม่ให้เข้าใจผิด */
.mu-time-grid.is-est .mu-time-chip { .mu-time-grid.is-est .mu-time-chip {
border: 1px dashed #a892d4; border: 1px dashed #a892d4;
background: #faf7ff; background: var(--c-surface-2);
color: #6b5a8e; color: #6b5a8e;
font-style: italic; font-style: italic;
} }
+8
View File
@@ -25,6 +25,7 @@
credits: { partial: 'partials/credits.html', nav: '/credits', title: 'เครดิต', tkey: 'page.credits' }, credits: { partial: 'partials/credits.html', nav: '/credits', title: 'เครดิต', tkey: 'page.credits' },
about: { partial: 'partials/about.html', nav: '/about', title: 'เกี่ยวกับเรา', tkey: 'page.about' }, about: { partial: 'partials/about.html', nav: '/about', title: 'เกี่ยวกับเรา', tkey: 'page.about' },
blog: { partial: 'partials/blog.html', nav: '/blog', title: 'บ่นไปเรื่อย', tkey: 'page.blog' }, blog: { partial: 'partials/blog.html', nav: '/blog', title: 'บ่นไปเรื่อย', tkey: 'page.blog' },
stats: { partial: 'partials/stats.html', nav: '/stats', title: 'สถิติการค้นหา', tkey: 'page.stats' },
}; };
function parseHash() { function parseHash() {
@@ -48,6 +49,7 @@
return { name: 'stops', params: {}, query: query }; return { name: 'stops', params: {}, query: query };
} }
if (seg[0] === 'credits') return { name: 'credits', params: {}, query: query }; if (seg[0] === 'credits') return { name: 'credits', params: {}, query: query };
if (seg[0] === 'stats') return { name: 'stats', params: {}, query: query };
if (seg[0] === 'about') return { name: 'about', params: {}, query: query }; if (seg[0] === 'about') return { name: 'about', params: {}, query: query };
if (seg[0] === 'blog') { if (seg[0] === 'blog') {
if (seg[1]) return { name: 'blog', params: { postId: decodeURIComponent(seg[1]) }, query: query }; if (seg[1]) return { name: 'blog', params: { postId: decodeURIComponent(seg[1]) }, query: query };
@@ -123,6 +125,8 @@
window.__route = route; // ให้ script ใน partial อ่าน params ได้ window.__route = route; // ให้ script ใน partial อ่าน params ได้
if (window.Motion) Motion.loading(true); // แถบโหลดบาง ๆ ระหว่าง fetch
fetch(view.partial, { cache: 'no-store' }) fetch(view.partial, { cache: 'no-store' })
.then(function (res) { .then(function (res) {
if (!res.ok) throw new Error('HTTP ' + res.status); if (!res.ok) throw new Error('HTTP ' + res.status);
@@ -140,10 +144,14 @@
document.title = (window.I18N && view.tkey) ? I18N.t(view.tkey) : ('Atroute — ' + view.title); document.title = (window.I18N && view.tkey) ? I18N.t(view.tkey) : ('Atroute — ' + view.title);
window.scrollTo(0, 0); window.scrollTo(0, 0);
/* อนิเมชันเข้าหน้า + สแกนการ์ดที่จะค่อย ๆ โผล่ตอนเลื่อน (ui/motion.js) */
if (window.Motion) { Motion.loading(false); Motion.enter(viewEl); }
/* footer "สายที่เปิดดูบ่อย" — เรนเดอร์ทุกครั้ง (ตามภาษา + อันดับล่าสุด) */ /* footer "สายที่เปิดดูบ่อย" — เรนเดอร์ทุกครั้ง (ตามภาษา + อันดับล่าสุด) */
mountPopular(); mountPopular();
}) })
.catch(function () { .catch(function () {
if (window.Motion) Motion.loading(false);
viewEl.innerHTML = viewEl.innerHTML =
'<div class="mu-container" style="padding:64px 28px;text-align:center;color:#6f7b95;">' + '<div class="mu-container" style="padding:64px 28px;text-align:center;color:#6f7b95;">' +
(window.I18N ? I18N.t('router.loadFail') : 'โหลดเนื้อหาไม่สำเร็จ') + '</div>'; (window.I18N ? I18N.t('router.loadFail') : 'โหลดเนื้อหาไม่สำเร็จ') + '</div>';
+88
View File
@@ -0,0 +1,88 @@
/* ============================================================
share.js — ปุ่ม "แชร์หน้านี้" ใช้ร่วมทุกหน้า (mock)
------------------------------------------------------------
พอร์ตจาก web-at-transit (lib/share.ts + ปุ่มในทุก view)
- ปุ่มต้องมี id="share-btn" · ข้อความสถานะ id="share-status"
- ลิงก์สั้น = origin + path + hash ของหน้าปัจจุบัน (ไม่ฝังชื่อเว็บ)
- มี navigator.share → เปิดแผงแชร์ของระบบ · พร้อมคัดลอกลงคลิปบอร์ด
- ไม่มี → คัดลอกอย่างเดียว
- ทำงานซ้ำได้หลัง router เปลี่ยนหน้า (ข้ามปุ่มที่ผูกแล้ว)
============================================================ */
(function () {
'use strict';
function t(key, fallback) {
var v = (window.I18N && I18N.t) ? I18N.t(key) : key;
return (!v || v === key) ? fallback : v;
}
function shortUrl() {
return location.origin + location.pathname + location.hash;
}
function esc(s) {
return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) {
return ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c];
});
}
function bind() {
var btn = document.getElementById('share-btn');
var status = document.getElementById('share-status');
if (!btn || btn.dataset.bound === '1') return;
btn.dataset.bound = '1';
function paint(msg) {
if (!status) return;
var url = shortUrl();
status.innerHTML = esc(msg) +
' <code class="mu-share-url">' + esc(url) + '</code> ' +
'<a class="mu-share-line" href="https://social-plugins.line.me/lineit/share?url=' +
encodeURIComponent(url) + '" target="_blank" rel="noopener">' +
esc(t('share.line', 'แชร์ผ่าน LINE')) + '</a>';
}
btn.addEventListener('click', function () {
var url = shortUrl();
if (navigator.share) {
navigator.share({ title: document.title, url: url }).catch(function () {});
}
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(url).then(function () {
paint(t('share.copied', 'คัดลอกลิงก์แล้ว'));
}).catch(function () {
paint(t('share.short', 'ลิงก์สั้น'));
});
} else {
paint(t('share.short', 'ลิงก์สั้น'));
}
});
}
window.AtShareInit = bind;
bind();
/* router inject partial ใหม่ทุกครั้งที่เปลี่ยนหน้า → ผูกปุ่มให้เอง */
(function watch() {
var host = document.getElementById('view');
if (!host || !window.MutationObserver) return;
var queued = 0;
new MutationObserver(function (list) {
for (var i = 0; i < list.length; i++) {
if (list[i].addedNodes && list[i].addedNodes.length) {
if (queued) return;
queued = 1;
setTimeout(function () { queued = 0; bind(); }, 60);
return;
}
}
}).observe(host, { childList: true, subtree: true });
})();
window.addEventListener('langchange', function () {
var btn = document.getElementById('share-btn');
if (btn) delete btn.dataset.bound;
bind();
});
})();
+1 -1
View File
@@ -360,7 +360,7 @@
<footer class="board-foot"> <footer class="board-foot">
<div class="wrap"> <div class="wrap">
<p>© 2026 Atroute — ข้อมูลรวบรวมจากผู้ประกอบการแต่ละสาย เวลาอาจเปลี่ยนแปลงได้ โปรดตรวจสอบกับผู้ประกอบการก่อนเดินทาง</p> <p>© 2026 Atroute — ข้อมูลรวบรวมจากผู้ประกอบการแต่ละสาย เวลาอาจเปลี่ยนแปลงได้ โปรดตรวจสอบกับผู้ประกอบการก่อนเดินทาง</p>
<p><a href="../index.html#/">กลับหน้าแรก Atroute</a> · <a href="mailto:atroute@hobbygirds.com">atroute@hobbygirds.com</a></p> <p><a href="../index.html#/">กลับหน้าแรก Atroute</a> · <a href="mailto:atroute@hobbypj.com">atroute@hobbypj.com</a></p>
</div> </div>
</footer> </footer>
+11 -4
View File
@@ -13,7 +13,7 @@
- ขั้นตอนอัปเดต: ดู AGENTS.md หัวข้อ PWA - ขั้นตอนอัปเดต: ดู AGENTS.md หัวข้อ PWA
============================================================ */ ============================================================ */
const VERSION = "2026.09.27.103"; // ← bump ทุกครั้งที่แก้ SW เอง const VERSION = "2026.09.27.129"; // ← bump ทุกครั้งที่แก้ SW เอง
const CACHE = `at-transit-${VERSION}`; const CACHE = `at-transit-${VERSION}`;
const PRECACHE = [ const PRECACHE = [
@@ -31,8 +31,12 @@ const PRECACHE = [
"./pwa.js", "./pwa.js",
"./i18n.js", "./i18n.js",
"./popular.js", "./popular.js",
"./visitors.js", "./analytics.js",
"./theme.js",
"./share.js",
"./theme.css",
"./router.js", "./router.js",
"./motion.js",
"./partials/home.html", "./partials/home.html",
"./partials/home.init.js", "./partials/home.init.js",
"./partials/busStop.html", "./partials/busStop.html",
@@ -47,6 +51,8 @@ const PRECACHE = [
"./partials/about.init.js", "./partials/about.init.js",
"./partials/blog.html", "./partials/blog.html",
"./partials/blog.init.js", "./partials/blog.init.js",
"./partials/stats.html",
"./partials/stats.init.js",
"./partials/busDetail.init.js", "./partials/busDetail.init.js",
"./partials/checkSchedule.init.js", "./partials/checkSchedule.init.js",
"./partials/schedules.js", "./partials/schedules.js",
@@ -163,7 +169,8 @@ async function networkFirst(request) {
if (res.ok) cache.put(request, res.clone()); if (res.ok) cache.put(request, res.clone());
return res; return res;
} catch { } catch {
const hit = await cache.match(request); /* ?v=<version> ทำให้ URL ต่างจากตอน precache → จับคู่แบบไม่สน query */
const hit = (await cache.match(request)) || (await cache.match(request, { ignoreSearch: true }));
return hit || Response.error(); return hit || Response.error();
} }
} }
@@ -184,7 +191,7 @@ async function networkFirstDocument(request) {
} }
async function cacheFirst(request) { async function cacheFirst(request) {
const hit = await caches.match(request); const hit = (await caches.match(request)) || (await caches.match(request, { ignoreSearch: true }));
if (hit) return hit; if (hit) return hit;
const cache = await caches.open(CACHE); const cache = await caches.open(CACHE);
try { try {
+252
View File
@@ -0,0 +1,252 @@
/* ============================================================
Atroute (mock) — Theme tokens (light / dark)
------------------------------------------------------------
พอร์ตจาก web-at-transit/frontend/src/styles/theme.css
⚠️ ค่าโทเคนต้อง "เหมือนกันเป๊ะ" กับฝั่ง Next — GUI สองโปรเจกต์ต้องหน้าตาตรงกัน
โหมด (ดู ui/theme.js + ปุ่มใน header)
light = สว่าง · dark = มืด · auto = ตามธีมอุปกรณ์ (prefers-color-scheme)
หลักการ
- สีทั้งหมดของ mock ต้องอ้าง var(--c-*) — ห้ามใส่ hex ใหม่ในไฟล์อื่น
- ถ้าต้องเพิ่มสี: เพิ่มเป็นโทเคนที่นี่ (light + dark คู่กัน) แล้วใช้ var()
- DESIGN.md เป็นรัฐธรรมนูญ — สีแบรนด์คือ #7a4cc0 (ม่วง) ห้ามเปลี่ยน
============================================================ */
@media (prefers-reduced-motion: no-preference) {
html { transition: background-color .18s ease; }
}
:root {
color-scheme: light;
/* พื้นผิว */
--c-surface: #ffffff;
--c-surface-2: #faf7ff;
--c-surface-3: #f4f2fa;
/* ตัวอักษร */
--c-ink: #1f2a44;
--c-ink-2: #5f6b83; /* ปรับให้ผ่าน AA บนพื้นขาว (4.25 → 5.1) */
--c-ink-3: #8b94a8;
/* เส้นขอบ */
--c-border: #e7e2f6;
--c-border-2: #ebe8f4;
/* แบรนด์ */
--c-brand: #7a4cc0;
--c-brand-ink: #7a4cc0; /* ม่วงที่ใช้เป็น "ตัวอักษร" บนพื้น */
--c-brand-soft: #f4f0fb;
--c-on-brand: #ffffff;
/* โฟกัส (คีย์บอร์ด) */
--c-focus: #7a4cc0;
/* มุมโค้ง — DESIGN.md §3: มีแค่ 4px / 8px (+ pill) */
--radius-sm: 4px;
--radius: 8px;
--radius-pill: 999px;
/* เงา */
--c-shadow: rgba(26, 18, 46, .10);
/* พื้นหลังหน้า (เข้มกว่าการ์ดเล็กน้อย) */
--c-bg: #f7f9fd;
/* tint พื้นผิวตามความหมาย (ม่วง/ชมพู/เขียว/เหลือง/ฟ้า) */
--c-tint-purple: #f4f1fb;
--c-tint-pink: #fff5f9;
--c-tint-green: #e8f8ef;
--c-tint-amber: #fffdf6;
--c-tint-cyan: #ecfeff;
/* สีความหมาย (ข้อความบนพื้น) */
--c-ok: #1f7a3d;
--c-warn: #8a6100;
--c-danger: #b02a37;
--c-info: #3071b8;
/* พื้นผิวโปร่งแสง (glass) */
--c-glass: rgba(255, 255, 255, .92);
--c-glass-70: rgba(255, 255, 255, .70);
--c-glass-24: rgba(255, 255, 255, .24);
}
:root[data-theme="dark"] {
color-scheme: dark;
--c-surface: #171225;
--c-surface-2: #1f1833;
--c-surface-3: #251d3d;
--c-ink: #ece9f7;
--c-ink-2: #a9a2c4;
--c-ink-3: #8d86ab;
--c-border: #352b52;
--c-border-2: #2c2444;
--c-brand: #7a4cc0;
--c-brand-ink: #b892f5; /* สว่างขึ้นเพื่อให้ผ่าน 4.5:1 บนพื้นมืด */
--c-brand-soft: #241b3b;
--c-on-brand: #ffffff;
--c-focus: #b892f5;
--c-shadow: rgba(0, 0, 0, .45);
--c-bg: #120e1e;
--c-tint-purple: #241c3b;
--c-tint-pink: #2e1a2a;
--c-tint-green: #15291f;
--c-tint-amber: #2b2416;
--c-tint-cyan: #16262b;
--c-ok: #6ee7a8;
--c-warn: #fbbf24;
--c-danger: #ff9db0;
--c-info: #7cc0ff;
--c-glass: rgba(23, 18, 37, .92);
--c-glass-70: rgba(23, 18, 37, .80);
--c-glass-24: rgba(255, 255, 255, .10);
}
/* ---------- ฐาน ---------- */
html {
background: var(--c-surface);
}
body {
color: var(--c-ink);
background: var(--c-bg);
}
/* ฟอร์ม/คอนโทรลใช้สีระบบให้เข้ากับธีม */
input,
select,
textarea,
button {
color-scheme: inherit;
}
/* ภาพที่อาจสว่างเกินไปบนพื้นมืด (โลโก้พาร์ทเนอร์/แผนที่) — ลดความจ้าเล็กน้อย */
:root[data-theme="dark"] img.mu-marquee-tile img,
:root[data-theme="dark"] .mu-marquee-tile img {
filter: brightness(.92);
}
/* กันจอขาววูบตอนสลับธีม */
@media (prefers-reduced-motion: no-preference) {
html,
body {
transition: background-color .18s ease, color .18s ease;
}
}
/* ============================================================
dark overrides — เฉพาะจุดที่ใช้ "ไล่เฉด/ภาพประดับ" (ไม่มี token ตรงตัว)
ค่าโทเคนหลักยังมาจาก :root[data-theme="dark"] ด้านบน
============================================================ */
:root[data-theme="dark"] .mu-hero {
background: linear-gradient(180deg, #1b1430 0%, #241726 55%, #2a2318 100%);
}
:root[data-theme="dark"] .mu-page {
background: linear-gradient(180deg, var(--c-surface) 0%, var(--c-bg) 100%);
}
:root[data-theme="dark"] .mu-blob { opacity: .28; }
:root[data-theme="dark"] .mu-menu-panel a:hover,
:root[data-theme="dark"] .mu-menu-panel a:active { background: var(--c-brand-soft); }
:root[data-theme="dark"] .mu-select-box,
:root[data-theme="dark"] .mu-lang-btn { background: var(--c-surface-2); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-meta-pill.sky { background: var(--c-tint-cyan); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-meta-pill.mint { background: var(--c-tint-green); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-meta-pill.pink { background: var(--c-tint-pink); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-cover { background: linear-gradient(135deg, var(--c-surface-2) 0%, var(--c-tint-purple) 100%); }
/* ============================================================
dark patch — คลาสที่ยังใช้สี literal ใน partial/index (mock)
ทุกค่าใช้โทเคนเดียวกับ Next → GUI สองฝั่งตรงกัน
============================================================ */
:root[data-theme="dark"] .mu-nav a { color: var(--c-danger); }
:root[data-theme="dark"] .mu-nav a.active { color: var(--c-danger); border-bottom-color: var(--c-danger); }
:root[data-theme="dark"] .mu-stop-card.is-stub {
background: var(--c-surface-2); border-color: var(--c-border);
}
:root[data-theme="dark"] .mu-chip.route,
:root[data-theme="dark"] .mu-type-pill.local { background: var(--c-tint-purple); border-color: var(--c-border); }
:root[data-theme="dark"] a.mu-chip.route:hover { background: var(--c-brand-soft); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-time-chip {
background: var(--c-surface-2); color: var(--c-ink); border-color: var(--c-border);
}
:root[data-theme="dark"] .mu-hero-metric:nth-child(1) { background: linear-gradient(135deg, var(--c-tint-purple), var(--c-tint-pink)); }
:root[data-theme="dark"] .mu-hero-metric:nth-child(2) { background: linear-gradient(135deg, var(--c-tint-cyan), var(--c-surface-2)); }
:root[data-theme="dark"] .mu-hero-metric:nth-child(3) { background: linear-gradient(135deg, var(--c-tint-pink), var(--c-tint-amber)); }
:root[data-theme="dark"] .mu-hero-metric-label { color: var(--c-ink-2); }
:root[data-theme="dark"] .mu-hero-metric-value { color: var(--c-ink); }
:root[data-theme="dark"] .mu-hero-lead { color: var(--c-ink-2); }
:root[data-theme="dark"] .mu-blog-excerpt { color: var(--c-ink-2); }
:root[data-theme="dark"] .mu-card .mu-badge { background: var(--c-tint-green); color: var(--c-ok); }
:root[data-theme="dark"] .mu-cover-tag { background: var(--c-glass); color: var(--c-ink); }
:root[data-theme="dark"] .mu-meta-pill { background: var(--c-surface-2); border-color: var(--c-border); color: var(--c-ink-2); }
:root[data-theme="dark"] .mu-credit-section,
:root[data-theme="dark"] .st-card,
:root[data-theme="dark"] .st-kpi { background: var(--c-surface); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-license { background: var(--c-surface-2); }
:root[data-theme="dark"] .mu-credit-section a,
:root[data-theme="dark"] .st-table a { color: var(--c-brand-ink); }
:root[data-theme="dark"] .st-table th { color: var(--c-ink-3); border-bottom-color: var(--c-border); }
:root[data-theme="dark"] .st-table td { border-bottom-color: var(--c-border-2); }
:root[data-theme="dark"] .mu-toolbar,
:root[data-theme="dark"] .mu-search-field,
:root[data-theme="dark"] .mu-select-box { background: var(--c-surface); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-suggest { background: var(--c-surface); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-footer,
:root[data-theme="dark"] .mu-site-footer { background: var(--c-surface); }
:root[data-theme="dark"] .st-toggle { background: var(--c-surface-2); }
:root[data-theme="dark"] .st-btn { border-color: var(--c-border); }
/* stop detail / check — ชิปเวลาและ label ที่ยังอ้างตัวแปรท้องถิ่น */
:root[data-theme="dark"] .mu-time-chip,
:root[data-theme="dark"] .mu-time-chip.is-est { color: var(--c-ink); background: var(--c-surface-2); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-time-grid .mu-time-chip { background: var(--c-surface-2); }
:root[data-theme="dark"] .mu-stop-hero,
:root[data-theme="dark"] .mu-card-panel,
:root[data-theme="dark"] .mu-route-tools,
:root[data-theme="dark"] .mu-nearby { background: var(--c-surface); border-color: var(--c-border); }
:root[data-theme="dark"] .mu-live-clock-time,
:root[data-theme="dark"] .mu-stop-hero-title { color: var(--c-ink); }
/* ============================================================
dropdown / <select> — ต้องอ่านออกทั้ง light และ dark
ปัญหาเดิม: select ใช้ color ของธีม แต่ option ใช้สีระบบ (ขาว-ขาว)
แก้: บังคับ color-scheme ตามธีม + กำหนดสี option ให้ตรงโทเคน
============================================================ */
select,
input,
textarea {
color-scheme: inherit;
}
:root[data-theme="dark"] select,
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea {
color-scheme: dark;
}
:root[data-theme="light"] select,
:root[data-theme="light"] input,
:root[data-theme="light"] textarea {
color-scheme: light;
}
option,
optgroup {
background-color: var(--c-surface);
color: var(--c-ink);
}
/* Firefox: สีของ popup ตามสี option ที่ประกาศไว้ */
@supports (-moz-appearance: none) {
option:checked {
background-color: var(--c-tint-purple);
color: var(--c-brand-ink);
}
}
+147
View File
@@ -0,0 +1,147 @@
/* ============================================================
theme.js — ธีม 3 โหมด (สว่าง / มืด / ตามอุปกรณ์)
------------------------------------------------------------
พอร์ตจาก web-at-transit/frontend/src/components/ThemeSwitch.tsx
ให้พฤติกรรมเหมือนกันเป๊ะ:
light = สว่าง · dark = มืด · auto = ตามธีมอุปกรณ์ (prefers-color-scheme)
- เก็บที่ localStorage 'at_theme' · ตั้ง <html data-theme> + data-theme-mode
- auto ฟัง event ของ matchMedia → เปลี่ยนทันทีที่ระบบสลับโหมด (ไม่ reload)
- มีสคริปต์ inline ใน index.html ตั้งธีมก่อน paint (กันจอขาววูบ)
- ปุ่มใน header = dropdown (aria-haspopup/menu, ปิดด้วย Esc/คลิกนอก)
============================================================ */
(function () {
'use strict';
var KEY = 'at_theme';
var DARK_QUERY = '(prefers-color-scheme: dark)';
var MODES = ['light', 'dark', 'auto'];
var LABEL = { light: 'สว่าง', dark: 'มืด', auto: 'ตามอุปกรณ์' };
var LABEL_EN = { light: 'Light', dark: 'Dark', auto: 'Device' };
function mq() { return window.matchMedia ? window.matchMedia(DARK_QUERY) : null; }
function deviceTheme() { var m = mq(); return (m && m.matches) ? 'dark' : 'light'; }
function resolve(mode) { return mode === 'auto' ? deviceTheme() : mode; }
function readMode() {
try {
var v = localStorage.getItem(KEY);
if (MODES.indexOf(v) !== -1) return v;
} catch (e) { /* localStorage ปิด */ }
return 'auto';
}
function isEn() { return window.I18N && I18N.getLang && I18N.getLang() === 'en'; }
function label(mode) { return (isEn() ? LABEL_EN : LABEL)[mode]; }
/* ไอคอน 3 แบบ (inline — sprite ของ mock ไม่มีชุดนี้) */
var ICON = {
light: '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M6.3 17.7l-1.4 1.4M19.1 4.9l-1.4 1.4"/></svg>',
dark: '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>',
auto: '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="4" width="20" height="14" rx="2"/><path d="M8 21h8M12 18v3"/></svg>'
};
var currentMode = readMode();
function paintUi() {
var btn = document.getElementById('theme-btn');
var icon = document.getElementById('theme-icon');
if (icon) icon.innerHTML = ICON[currentMode] || ICON.auto;
if (btn) {
btn.setAttribute('aria-label', 'ธีม: ' + label(currentMode) + ' / Theme');
btn.title = 'ธีม: ' + label(currentMode);
}
var items = document.querySelectorAll('#theme-menu [data-theme-mode]');
Array.prototype.forEach.call(items, function (b) {
var on = b.getAttribute('data-theme-mode') === currentMode;
b.setAttribute('aria-checked', on ? 'true' : 'false');
if (on) b.setAttribute('data-active', '1'); else b.removeAttribute('data-active');
var lbl = b.querySelector('.mu-theme-label');
if (lbl) lbl.textContent = label(b.getAttribute('data-theme-mode'));
});
}
function apply(mode) {
if (MODES.indexOf(mode) === -1) mode = 'auto';
currentMode = mode;
var resolved = resolve(mode);
var html = document.documentElement;
html.dataset.theme = resolved;
html.dataset.themeMode = mode;
html.style.colorScheme = resolved;
paintUi();
}
function choose(mode) {
try { localStorage.setItem(KEY, mode); } catch (e) { /* เพิกเฉย */ }
apply(mode);
}
/* auto: ตามอุปกรณ์แบบสด ๆ */
function watchDevice() {
var m = mq();
if (!m) return;
var onChange = function () { if (currentMode === 'auto') apply('auto'); };
if (typeof m.addEventListener === 'function') m.addEventListener('change', onChange);
else if (typeof m.addListener === 'function') m.addListener(onChange);
}
function wireMenu() {
var wrap = document.getElementById('theme-switch');
var btn = document.getElementById('theme-btn');
var menu = document.getElementById('theme-menu');
if (!wrap || !btn || !menu) return;
function setOpen(on) {
menu.hidden = !on;
btn.setAttribute('aria-expanded', on ? 'true' : 'false');
}
btn.addEventListener('click', function (e) {
e.stopPropagation();
setOpen(menu.hidden);
});
menu.addEventListener('click', function (e) {
var item = e.target.closest('[data-theme-mode]');
if (!item) return;
choose(item.getAttribute('data-theme-mode'));
setOpen(false);
btn.focus();
});
document.addEventListener('click', function (e) {
if (!wrap.contains(e.target)) setOpen(false);
});
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && !menu.hidden) {
setOpen(false);
btn.focus();
}
});
}
window.AtTheme = {
mode: function () { return currentMode; },
resolved: function () { return resolve(currentMode); },
set: choose,
apply: apply,
label: label,
refresh: paintUi
};
/* ตั้งธีมทันที (สคริปต์ใน head ตั้ง data-theme ไปแล้ว — ที่นี่แค่ซิงก์ state) */
apply(currentMode);
watchDevice();
wireMenu();
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', paintUi);
} else {
paintUi();
}
/* เปลี่ยนภาษา → ป้ายในเมนูธีมต้องเปลี่ยนตาม */
window.addEventListener('langchange', paintUi);
})();
+1
View File
@@ -0,0 +1 @@
{"version": "2026.09.27.129"}
-230
View File
@@ -1,230 +0,0 @@
/* visitors.js — นับผู้เข้าชมจริง (ฝั่งเบราว์เซอร์ ไม่มี backend) + รีเซ็ตด้วยรหัส
แนวคิด
แสดงผล = ฐาน + จำนวนผู้เข้าชมจริง (unique)
ฐานเริ่มต้น = 12,834 (แสดงเมื่อยังไม่เคยรีเซ็ต)
รีเซ็ต (รหัส) = ล้างฐานทิ้งด้วย → เริ่มนับใหม่จาก 0
กันจำนวนเฟ้อ 3 ชั้น
1. sessionStorage → 1 รอบการเข้าชม (เปิดแท็บใหม่) นับ 1 · กด F5 ไม่นับ
2. localStorage → 1 ครั้ง/วัน/เครื่อง (วันเดียวกันนับครั้งเดียว)
3. dayKey กำกับ → ล้าง session/incognito เปิดซ้ำวันเดิม = ไม่นับ (เพดาน/วัน)
ประหยัดพื้นที่
เก็บแค่ {"v": <จำนวนจริง>, "d": <วัน YYYY-MM-DD>} ≈ 35 ไบต์ · ไม่เก็บ log/IP/UA
รีเซ็ต
กดที่ตัวเลขผู้เข้าชม 5 ครั้งติด → เปิดช่องกรอกรหัส (ซ่อน ไม่มีปุ่มให้คนอื่นกด)
รหัสตรวจแบบ SHA-256 (ไม่เก็บรหัสจริงในโค้ด — เปิด view-source ไม่เจอ)
*/
(function () {
'use strict';
var KEY = 'at_visitors'; /* { v: จำนวนจริง, d: 'YYYY-MM-DD' } */
var SESSION_KEY = 'at_visitors_seen';
var BASE = 12834; /* ฐานตั้งต้น — รีเซ็ตแล้วกลับมาที่นี่ */
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';
function today() {
var d = new Date();
var m = String(d.getMonth() + 1);
var day = String(d.getDate());
if (m.length < 2) m = '0' + m;
if (day.length < 2) day = '0' + day;
return d.getFullYear() + '-' + m + '-' + day;
}
function read() {
try {
var raw = localStorage.getItem(KEY);
var d = raw ? JSON.parse(raw) : null;
if (!d || typeof d !== 'object') return { b: null, v: 0, d: '' };
return {
b: (d.b === undefined || d.b === null) ? null : Math.max(0, Number(d.b) || 0),
v: Math.max(0, Number(d.v) || 0),
d: String(d.d || '')
};
} catch (e) { return { b: null, v: 0, d: '' }; }
}
function write(d) {
try { localStorage.setItem(KEY, JSON.stringify(d)); } catch (e) { /* เงียบ */ }
}
/* ตรวจว่ารอบการเข้าชมนี้ "ควรนับ" — ผ่านครบ 3 ชั้น */
function shouldCount(store) {
/* ชั้น 1: sessionStorage — รอบนี้เคยนับแล้ว? (F5 ไม่นับ) */
var seen = null;
try { seen = sessionStorage.getItem(SESSION_KEY); } catch (e) { /* เงียบ */ }
if (seen) return false;
/* ชั้น 2+3: วันเดียวกันห้ามเพิ่ม (แม้ sessionStorage ถูกล้าง) */
if (store.d === today()) return false;
return true;
}
function fmt(n) { return Number(n).toLocaleString('en-US'); }
/* ── รหัส: SHA-256 ผ่าน SubtleCrypto (มีในทุกเบราว์เซอร์สมัยใหม่) ── */
function hash(text, cb) {
if (window.crypto && crypto.subtle && crypto.subtle.digest) {
crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))
.then(function (buf) {
var b = new Uint8Array(buf), s = '';
for (var i = 0; i < b.length; i++) s += ('0' + b[i].toString(16)).slice(-2);
cb(s);
})
.catch(function () { cb(null); });
} else {
cb(null); /* เบราว์เซอร์เก่า/ไม่มี https → กรุณาใช้ http://localhost */
}
}
/* เทียบแบบ constant-time (กัน timing attack) */
function safeEqual(a, b) {
if (typeof a !== 'string' || typeof b !== 'string' || a.length !== b.length) return false;
var diff = 0;
for (var i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
return diff === 0;
}
var Visitors = {
BASE: BASE, /* ฐานตั้งต้น (ค่าคงที่) — ดู Visitors._base สำหรับฐานที่ใช้จริง */
_base: BASE,
/* เรียกครั้งเดียวตอนโหลดหน้า — นับ (ถ้าควรนับ) แล้วคืนค่าที่จะแสดง */
init: function () {
var store = read();
if (shouldCount(store)) {
store.v = (Number(store.v) || 0) + 1;
store.d = today();
write(store);
try { sessionStorage.setItem(SESSION_KEY, '1'); } catch (e) { /* เงียบ */ }
}
/* ฐาน: ยังไม่เคยรีเซ็ต → BASE · เคยรีเซ็ต → ค่าที่บันทึกไว้ (0) */
var base = (store.b === null) ? BASE : store.b;
var el = document.getElementById('visitor-count');
if (el) el.textContent = fmt(base + store.v);
Visitors._base = base;
Visitors._store = store;
return base + store.v;
},
/* จำนวนจริง (ไม่รวม BASE) */
actual: function () { return read().v; },
/* รีเซ็ต: ล้างฐานทิ้งด้วย → เริ่มนับใหม่จาก 0 (ตามที่เลือก) */
reset: function () {
write({ b: 0, v: 0, d: today() });
/* ไม่ล้าง sessionStorage — กันการนับซ้ำทันทีหลังรีเซ็ตในรอบเดียวกัน */
Visitors._base = 0;
var el = document.getElementById('visitor-count');
if (el) el.textContent = fmt(0);
return 0;
},
/* ตรวจรหัสแล้วรีเซ็ต (async — SHA-256) */
resetWith: function (pass, done) {
hash(String(pass == null ? '' : pass), function (h) {
if (!h) { done(false, 'unsupported'); return; }
if (!safeEqual(h, PASS_HASH)) { done(false, 'wrong'); return; }
Visitors.reset();
done(true, 'ok');
});
},
_hash: hash,
_key: KEY
};
window.Visitors = Visitors;
/* ── ช่องทางลับ: กดที่ตัวเลข 5 ครั้งติด → เปิดช่องกรอกรหัส ── */
function mountTap() {
var el = document.getElementById('visitor-count');
if (!el) return;
var taps = 0, timer = null;
el.style.cursor = 'pointer';
el.addEventListener('click', function () {
taps++;
if (timer) clearTimeout(timer);
timer = setTimeout(function () { taps = 0; }, TAP_WINDOW);
if (taps >= TAPS) {
taps = 0;
clearTimeout(timer);
openDialog();
}
});
}
function openDialog() {
if (document.querySelector('.mu-vreset')) return;
var wrap = document.createElement('div');
wrap.className = 'mu-vreset';
wrap.innerHTML =
'<div class="mu-vreset-card" role="dialog" aria-modal="true" aria-labelledby="vreset-title">' +
'<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">' + vt('visitors.cancel', 'ยกเลิก') + '</button>' +
'<button type="button" class="mu-vreset-ok">' + vt('visitors.confirm', 'รีเซ็ต') + '</button>' +
'</div>' +
'</div>';
var input = wrap.querySelector('#vreset-pass');
var msg = wrap.querySelector('.mu-vreset-msg');
function close() { wrap.remove(); }
function submit() {
msg.textContent = '';
Visitors.resetWith(input.value, function (ok, why) {
if (ok) {
msg.className = 'mu-vreset-msg is-ok';
msg.textContent = vt('visitors.done', 'รีเซ็ตแล้ว — เริ่มนับใหม่จาก 0');
input.value = '';
setTimeout(close, 1200);
} else if (why === 'unsupported') {
msg.textContent = vt('visitors.unsupported', 'เบราว์เซอร์ไม่รองรับ');
} else {
msg.className = 'mu-vreset-msg is-bad';
msg.textContent = vt('visitors.badPass', 'รหัสไม่ถูกต้อง');
input.value = '';
input.focus();
}
});
}
wrap.querySelector('.mu-vreset-ok').addEventListener('click', submit);
wrap.querySelector('.mu-vreset-cancel').addEventListener('click', close);
wrap.addEventListener('click', function (e) { if (e.target === wrap) close(); });
input.addEventListener('keydown', function (e) {
if (e.key === 'Enter') submit();
if (e.key === 'Escape') close();
});
document.body.appendChild(wrap);
input.focus();
}
/* ── nับตอนโหลด + ติดช่องทางลับ ── */
function boot() {
Visitors.init();
mountTap();
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot);
else boot();
})();