Files
web-at-transit-mock/ui/partials/stopDetail.html
T
Bkk1234 74d605f1c4 ระบบ affiliate พาร์ทเนอร์ + นับผู้เข้าชม + สายที่เปิดดูบ่อย + ความปลอดภัยรูป
== ระบบพาร์ทเนอร์ (affiliate) ==
- resource/data/affiliates.json — ข้อมูล 11 โปรแกรม (8 ใน footer) + ที่วางลิงก์แนะนำ
- home.init.js: initSponsors() สร้างไทล์ marquee จาก JSON (ไม่ฮาร์ดโค้ดใน HTML)
    · มี affiliate_link → <a target=_blank rel="noopener sponsored">
    · ยังไม่มีลิงก์   → <span> แสดงรูปเฉย ๆ (กดไม่ได้ ไม่พาไปหน้าเปล่า)
    · โหลด JSON ไม่ได้ → คงไทล์ fallback ที่ฝังใน HTML (8 ไทล์)
- เติมลิงก์ affiliate แล้ว 6 แบรนด์: 7-Eleven · Shopee · Lazada · airasia MOVE ·
  busonlineticket · Trip.com

== ระบบสถิติ (ฝั่งเบราว์เซอร์ ไม่มี backend) ==
- ui/popular.js — "สายที่เปิดดูบ่อย" ใน footer
    · score = hits × 0.5^(อายุวัน/30) — กันคะแนนเฟ้อ (ครึ่งชีวิต 30 วัน)
    · ทิ้งข้อมูลที่ตายเกิน 180 วันอัตโนมัติ · เก็บ 2 ตัวเลข/สาย (~24 ไบต์)
    · ไม่มีข้อมูล → ใช้ค่าเริ่มต้น 101/902/15/464
- ui/visitors.js — นับผู้เข้าชมจริง (ฐาน 12,834)
    · กันเฟ้อ 3 ชั้น: sessionStorage (F5 ไม่นับ) → 1 ครั้ง/วัน → dayKey กันล้าง session
    · กดตัวเลข 5 ครั้ง → ช่องกรอกรหัส (SHA-256 ไม่เก็บรหัสจริงในโค้ด) → รีเซ็ตเป็น 0
- หัวข้อ footer เปลี่ยนเป็น "สายที่เปิดดูบ่อย" / "Most Viewed Routes"

== ความปลอดภัยของรูป ==
- images.zip: ลบ EXIF/GPS ทั้งหมด 12 ไฟล์ (piexif — ไม่แตะ pixel data, คง ICC profile)
    · ตัด .image/partners/_original/ ออก (ไฟล์สำรองที่ไม่ควรแจก)
    · ตรวจแล้ว: GPS=0 · EXIF=0 · รูปเสีย=0 · 39.4 MB → 37 MB
- tcl999-angthong.jpg ย่อ 4032×3024 (2.5 MB) → 700×525 (86 KB) สำหรับใช้บนเว็บ

== UI ==
- nav (mu-topbar) z-index 50 → 1100 + isolation:isolate ที่กรอบแผนที่
  (Leaflet ใช้ z-index ถึง 1000 — เดิมปุ่มซูม/ป๊อปอัปทะลุขึ้นทับ nav)
- รูปสำรองสถานี: ไม่มีรูป → แสดง minibus-512x512 (.is-fallback ใช้ object-fit:contain)
- affiliate.json เป็น CRLF ตาม pattern เดิมของโปรเจกต์
2026-10-07 23:29:36 +07:00

470 lines
19 KiB
HTML

<style>
.mu-other-stops { margin: 16px 0 6px; }
.mu-other-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mu-other-item { display: block; padding: 10px 12px; background: #fff;
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-item .mu-time-grid { margin-top: 8px; }
.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;
color: #7a4cc0; 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 strong { display: block; color: #1f2a44; font-size: .94rem; }
.mu-other-txt span { display: block; color: #6f7b95; 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.warn { background: #fff5e6; color: #9a6b00; border-color: #f2d9a8; }
:root {
--mu-accent: #7a4cc0;
--mu-accent-soft: #f3eafe;
--mu-ink: #1f2a44;
--mu-muted: #6f7b95;
--mu-border: #ecd7e6;
--mu-surface: #ffffff;
--mu-rose: #ec4899;
--mu-sky: #3071b8;
--mu-mint: #1f8765;
}
.mu-page {
background:
radial-gradient(circle at 8% 10%, rgba(122, 76, 192, 0.09), transparent 30%),
radial-gradient(circle at 100% 0%, rgba(48, 113, 184, 0.10), transparent 28%),
linear-gradient(180deg, #fcfbff 0%, #f8f9ff 100%);
}
.mu-stop-hero {
position: relative;
overflow: hidden;
border: 1px solid rgba(231, 224, 246, 0.95);
border-radius: 22px;
background: linear-gradient(135deg, #f8f4ff 0%, #f2f6ff 45%, #eefaf5 100%);
box-shadow: 0 16px 34px rgba(122, 76, 192, 0.12);
padding: 18px;
margin-bottom: 14px;
display: grid;
grid-template-columns: 1.2fr .8fr;
gap: 16px;
align-items: stretch;
}
.mu-stop-hero::before,
.mu-stop-hero::after {
content: "";
position: absolute;
border-radius: 999px;
pointer-events: none;
opacity: .48;
}
.mu-stop-hero::before {
width: 220px;
height: 220px;
top: -120px;
right: -70px;
background: radial-gradient(circle, #f472b6 0%, rgba(244, 114, 182, 0) 72%);
}
.mu-stop-hero::after {
width: 200px;
height: 200px;
left: -70px;
bottom: -115px;
background: radial-gradient(circle, #60a5fa 0%, rgba(96, 165, 250, 0) 72%);
}
.mu-stop-hero > * {
position: relative;
z-index: 1;
min-width: 0; /* กัน grid track บวมตาม min-content (ไม่งั้นเนื้อหาถูก overflow:hidden ตัดที่จอแคบ) */
}
.mu-stop-hero-title {
overflow-wrap: anywhere;
margin: 0;
font-size: 1.72rem;
color: var(--mu-ink);
line-height: 1.2;
}
.mu-stop-hero-sub {
margin: 8px 0 0;
color: var(--mu-muted);
font-size: .9rem;
}
.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.purple { background:linear-gradient(135deg, #f5eeff, #fce7f3); color:#7a4cc0; border-color:#e8d9f0; }
.mu-meta-pill.sky { background:linear-gradient(135deg, #ebf5ff, #eff6ff); color:#3071b8; border-color:#d7e7fb; }
.mu-meta-pill.mint { background:linear-gradient(135deg, #eafaf4, #ecfeff); color:#1f8765; border-color:#d1efdf; }
.mu-direction-tag { background:#7a4cc0; 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-hero-metric-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
margin-top: 12px;
}
.mu-hero-metric {
border: 1px solid rgba(231, 224, 246, 0.9);
border-radius: 12px;
padding: 10px;
background: #fff;
box-shadow: 0 6px 14px rgba(122, 76, 192, 0.08);
min-width: 0;
overflow-wrap: anywhere;
}
.mu-hero-metric:nth-child(1) { background: linear-gradient(135deg, #f5efff, #fdf2f8); }
.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(4) { background: linear-gradient(135deg, #ecfdf5, #f0fdfa); }
.mu-hero-metric-label {
margin: 0;
color: var(--mu-muted);
font-size: .76rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: .03em;
}
.mu-hero-metric-value {
margin: 4px 0 0;
color: var(--mu-ink);
font-size: 1.06rem;
font-weight: 800;
line-height: 1.2;
}
.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 .mu-stop-summary-meta { color: #6f7b95; 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-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-stop-chevron { display: inline-block; color: #7a4cc0; font-size: .9rem; line-height: 1; transition: transform .2s ease; }
.mu-stop-expander[open] .mu-stop-chevron { transform: rotate(180deg); }
.mu-live-clock-card {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
margin: 6px 0 14px;
padding: 12px 14px;
border: 1px solid rgba(240, 191, 224, 0.9);
border-radius: 14px;
background: linear-gradient(135deg, #ffe8f4 0%, #f5f0ff 50%, #e8f7ff 100%);
box-shadow: 0 8px 20px rgba(122, 76, 192, 0.10);
}
.mu-live-clock-title {
margin: 0;
color: #6f7b95;
font-size: .78rem;
font-weight: 700;
letter-spacing: .04em;
text-transform: uppercase;
}
.mu-live-clock-time {
margin: 2px 0 0;
font-size: 1.65rem;
line-height: 1;
color: #1f2a44;
font-weight: 800;
font-family: "K2D", "Prompt", "Noto Sans Thai", sans-serif;
}
.mu-live-clock-note {
margin: 0;
padding: 6px 10px;
border-radius: 999px;
background: linear-gradient(135deg, #ffffff, #fff7fb);
border: 1px solid #eec7df;
color: #9333ea;
font-size: .78rem;
font-weight: 600;
white-space: nowrap;
}
.mu-live-dot {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 999px;
background: #ec4899;
margin-right: 6px;
animation: muPulse 1.6s infinite;
vertical-align: middle;
}
.mu-next-arrival {
display: inline-flex;
align-items: center;
gap: 6px;
background: #fff;
border: 1px solid #f0d6e6;
color: #9a3b6e;
border-radius: 999px;
padding: 3px 10px;
font-size: .76rem;
font-weight: 700;
line-height: 1;
}
.mu-next-arrival::before {
content: "⏱";
font-size: .85rem;
line-height: 1;
}
.mu-time-chip.next-live {
background: linear-gradient(135deg, #ec4899, #8b5cf6);
border-color: transparent;
color: #fff;
box-shadow: 0 6px 14px rgba(139, 92, 246, 0.28);
transform: translateY(-1px);
}
.mu-panel {
border: 1px solid rgba(231, 224, 246, 0.95);
border-radius: 18px;
background: linear-gradient(180deg, #ffffff, #fffbfe);
box-shadow: 0 10px 24px rgba(122, 76, 192, 0.09);
}
.mu-info-grid {
display: grid;
grid-template-columns: repeat(4, minmax(140px, 1fr));
gap: 10px;
margin: 16px 0 18px;
}
.mu-info-card {
border-radius: 14px;
padding: 12px 14px;
border: 1px solid #e9e2fb;
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 .value { margin:4px 0 0; font-size:1rem; font-weight:700; color:#2b2f42; }
.mu-layout-grid {
display: grid;
grid-template-columns: 1.35fr .9fr;
gap: 16px;
align-items: start;
}
.mu-card-panel {
background: #fff;
border: 1px solid #ebe8f4;
border-radius: 16px;
padding: 18px;
box-shadow: 0 8px 24px rgba(67, 56, 202, 0.08);
}
.mu-card-panel h2,
.mu-card-panel h3 { margin-top:0; }
.mu-chip {
display:inline-flex;
align-items:center;
gap:6px;
padding:6px 10px;
border-radius:999px;
font-size:.8rem;
font-weight:700;
}
@media (max-width: 980px) {
.mu-info-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
.mu-layout-grid { grid-template-columns: 1fr; }
}
.mu-panel h2 {
position: relative;
padding-left: 14px;
margin-bottom: 14px;
}
.mu-panel h2::before {
content: "";
position: absolute;
left: 0;
top: 4px;
width: 6px;
height: 24px;
border-radius: 999px;
background: linear-gradient(180deg, #ec4899, #8b5cf6);
}
.mu-route-tools {
display: flex;
align-items: center;
gap: 8px;
margin: 0 0 12px;
flex-wrap: wrap;
}
.mu-route-filter {
flex: 1;
min-width: 240px;
border: 1px solid rgba(214, 199, 226, 0.9);
border-radius: 12px;
padding: 10px 12px;
font-size: .9rem;
color: var(--mu-ink);
background: linear-gradient(180deg, #ffffff, #f8fbff);
outline: none;
box-shadow: 0 2px 4px rgba(0,0,0,.02);
}
.mu-route-filter:focus {
border-color: #c9a9eb;
box-shadow: 0 0 0 3px rgba(122, 76, 192, 0.12);
}
.mu-route-count {
border: 1px solid rgba(233, 200, 251, 0.9);
background: linear-gradient(135deg, #faf5ff, #fdf2f8);
color: #6b21a8;
border-radius: 999px;
padding: 8px 12px;
font-size: .8rem;
font-weight: 700;
}
.mu-stop-expander {
border: 1px solid rgba(243, 228, 238, 0.95);
border-radius: 14px;
margin-bottom: 8px;
overflow: hidden;
background: linear-gradient(180deg, #fff, #fffafe);
}
.mu-stop-expander[open] {
border-color: rgba(226, 201, 245, 0.95);
box-shadow: 0 8px 18px rgba(122, 76, 192, 0.10);
}
.mu-stop-expander > summary {
background: linear-gradient(180deg, #fff, #fff6fb);
padding: 14px;
/* flex + wrap: จอกว้างเรียงบรรทัดเดียว / จอแคบพับลงมา ไม่ทับกัน */
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
cursor: pointer;
list-style: none;
}
.mu-stop-expander > summary::-webkit-details-marker { display: none; }
.mu-stop-list > li:nth-child(4n + 1) .mu-stop-expander > summary { border-left: 4px solid #8b5cf6; }
.mu-stop-list > li:nth-child(4n + 2) .mu-stop-expander > summary { border-left: 4px solid #38bdf8; }
.mu-stop-list > li:nth-child(4n + 3) .mu-stop-expander > summary { border-left: 4px solid #f472b6; }
.mu-stop-list > li:nth-child(4n + 4) .mu-stop-expander > summary { border-left: 4px solid #34d399; }
.mu-stop-expander-body {
background: linear-gradient(180deg, #fffcff, #fffcfd);
padding-left: 58px;
border-top: 1px solid #f6eaf2;
}
.mu-toolbar {
margin-top: 10px;
margin-bottom: 12px;
background: rgba(255,255,255,.8);
backdrop-filter: blur(8px);
border: 1px solid rgba(231, 224, 246, 0.9);
border-radius: 14px;
padding: 10px;
}
@media (max-width: 980px) {
.mu-stop-hero {
grid-template-columns: 1fr;
}
.mu-hero-metric-grid {
grid-template-columns: 1fr 1fr;
}
}
@media (max-width: 640px) {
.mu-hero-metric-grid { grid-template-columns: 1fr; }
.mu-hero-metric { min-width: 0; overflow-wrap: anywhere; }
.mu-stop-summary-rail {
gap: 6px;
}
/* จอแคบ: จัด summary เป็น 3 แถวอ่านง่าย — chip+badge / ชื่อสาย / รอบ+ลูกศร */
.mu-stop-expander > summary {
row-gap: 9px;
align-items: flex-start;
}
.mu-stop-summary-main { flex: 1 1 100%; order: 5; }
.mu-stop-summary-rail {
flex: 1 1 100%;
order: 6;
margin-left: 0;
justify-content: space-between;
}
.mu-next-arrival {
font-size: .72rem;
}
.mu-stop-expander-body {
padding-left: 14px;
}
.mu-route-filter {
min-width: 100%;
}
}
@keyframes muPulse {
0% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.38); }
70% { box-shadow: 0 0 0 8px rgba(236, 72, 153, 0); }
100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0); }
}
/* === Modern image polish === */
.mu-logo-img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.mu-stop-hero-photo { width: 100%; height: 220px; object-fit: cover; border-radius: 16px; display: block; margin-bottom: 12px; box-shadow: 0 10px 24px rgba(63,43,94,.16); }
/* รูปสำรอง (สถานียังไม่มีรูป) — เป็นไอคอนโปร่งใส จึงใช้ contain + พื้นอ่อน ไม่ให้ยืด/ตัด */
.mu-stop-hero-photo.is-fallback {
object-fit: contain; padding: 22px; box-sizing: border-box;
background: #f7f4fd; box-shadow: none; border: 1px solid #e8e4f2;
}
.mu-nearby {
background: #fff; border: 1px solid var(--mu-border); border-radius: 20px;
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 p.sub { margin: 0 0 14px; color: var(--mu-muted); font-size: .85rem; }
.mu-nearby-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mu-nearby-card { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 4/3; box-shadow: 0 6px 14px rgba(63,43,94,.10); cursor: pointer; transition: transform .2s ease; }
.mu-nearby-card:hover { transform: translateY(-3px); }
.mu-nearby-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.mu-nearby-card:hover img { transform: scale(1.06); }
.mu-nearby-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,23,42,0) 50%, rgba(15,23,42,.65) 100%); }
.mu-nearby-card .cap { position: absolute; left: 12px; right: 12px; bottom: 10px; color: #fff; z-index: 1; font-weight: 700; font-size: .92rem; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.mu-nearby-card .cap small { display: block; font-weight: 500; opacity: .85; font-size: .76rem; }
</style>
<main class="mu-page">
<div class="mu-container">
<p class="mu-breadcrumb" id="stop-breadcrumb"></p>
<section class="mu-stop-hero">
<div>
<h1 class="mu-stop-hero-title"><svg class="ic" aria-hidden="true"><use href="#ic-map-pin"/></svg> <span id="stop-title"></span></h1>
<p class="mu-stop-hero-sub" id="stop-sub"></p>
<div class="mu-meta-row" id="stop-meta"></div>
<div class="mu-hero-metric-grid" id="stop-metrics"></div>
</div>
<div>
<img class="mu-stop-hero-photo" id="stop-photo" alt="" fetchpriority="high" decoding="async" hidden>
<div class="mu-live-clock-card" id="mu-live-clock-card">
<div>
<p class="mu-live-clock-title" data-i18n="stop.nowAtStop">เวลาปัจจุบัน ณ ป้ายนี้</p>
<p class="mu-live-clock-time" id="mu-current-time">--:--</p>
</div>
<p class="mu-live-clock-note"><span class="mu-live-dot"></span><span data-i18n="stop.autoNext">กำลังคำนวณเที่ยวถัดไปอัตโนมัติ</span></p>
</div>
</div>
</section>
<section class="mu-nearby" id="stop-nearby" aria-label="สถานที่ใกล้เคียง" hidden>
<h2><span data-i18n="stop.nearby">ใกล้เคียงป้าย</span></h2>
<p class="sub" id="stop-nearby-sub"></p>
<div class="mu-nearby-grid" id="stop-nearby-grid"></div>
</section>
<div class="mu-toolbar" id="stop-toolbar"></div>
<section class="mu-info-grid" id="stop-info" aria-label="stop highlights"></section>
<section class="mu-layout-grid">
<div class="mu-card-panel">
<h2><span data-i18n="stop.routes">สายรถที่ผ่านจุดนี้</span></h2>
<div class="mu-route-tools">
<input id="mu-route-filter" class="mu-route-filter" type="text" placeholder="ค้นหาสายรถหรือปลายทาง" data-i18n-attr="placeholder:stop.searchRoute,aria-label:stop.searchRoute">
<span class="mu-route-count" id="mu-route-count"></span>
</div>
<ul class="mu-list mu-stop-list" id="stop-routes"></ul>
</div>
<aside class="mu-card-panel">
<h2><span data-i18n="stop.mapInfo">แผนที่และข้อมูลป้าย</span></h2>
<div class="at-map" id="stop-map" role="region" aria-label="แผนที่เส้นทางที่ผ่านป้ายนี้"></div>
<p class="at-map-caption" id="stop-map-caption"></p>
<div id="stop-chips" style="display:flex; flex-wrap:wrap; gap:8px; margin-top:14px;"></div>
</aside>
</section>
</div>
</main>
<script src="./partials/stopDetail.init.js"></script>