Files
web-at-transit-mock/ui/partials/blog.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

256 lines
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<style>
/* ===== หน้าบทความ — ข้อมูลจาก partials/blog-data/ (ระบบเดียวกับ about) ===== */
.mu-hero-lead {
margin: 14px auto 0;
max-width: 640px;
color: #5b3b71;
font-size: .95rem;
}
.mu-blog-wrap { padding: 26px 0 52px; }
/* --- แถบสลับมุมมอง (ตาราง / รายการ) --- */
.mu-blog-bar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
margin-bottom: 18px;
}
.mu-blog-count { margin: 0; color: #6f7b95; font-size: .88rem; }
.mu-view-switch {
margin-left: auto;
display: inline-flex;
gap: 2px;
background: #f0edf7;
border: 1px solid #e4dcf2;
border-radius: 999px;
padding: 3px;
}
.mu-view-btn {
display: inline-flex;
align-items: center;
gap: 6px;
border: 0;
background: transparent;
color: #6d28d9;
font-family: inherit;
font-weight: 700;
font-size: .8rem;
min-height: 36px;
padding: 6px 14px;
border-radius: 999px;
cursor: pointer;
transition: background .15s ease, color .15s ease;
}
.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:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 2px; }
/* --- โหมดตาราง (grid) --- */
#blog-list.mode-grid {
display: grid;
grid-template-columns: 1fr;
gap: 18px;
}
.mu-blog-card {
display: flex;
flex-direction: column;
background: #fff;
border: 1px solid #ebe8f4;
border-radius: 18px;
overflow: hidden;
box-shadow: 0 10px 26px rgba(63, 43, 94, .07);
text-decoration: none;
color: inherit;
transition: transform .18s ease, box-shadow .18s ease;
}
.mu-blog-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(63, 43, 94, .14); }
.mu-blog-card .mu-cover { aspect-ratio: 16 / 9; }
.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-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 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-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-more { margin-top: auto; padding-top: 6px; color: #7a4cc0; font-weight: 700; font-size: .85rem; }
/* --- โหมดรายการ (list) --- */
#blog-list.mode-list { display: flex; flex-direction: column; gap: 14px; }
.mu-blog-row {
display: grid;
grid-template-columns: 108px 1fr;
gap: 14px;
align-items: center;
background: #fff;
border: 1px solid #ebe8f4;
border-radius: 16px;
padding: 12px;
box-shadow: 0 8px 20px rgba(63, 43, 94, .06);
text-decoration: none;
color: inherit;
transition: border-color .15s ease, box-shadow .15s ease;
}
.mu-blog-row:hover { border-color: #d8c9f2; box-shadow: 0 12px 26px rgba(63, 43, 94, .12); }
.mu-blog-row .thumb {
width: 108px; height: 84px;
border-radius: 12px;
object-fit: cover;
display: block;
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 .mu-blog-excerpt { -webkit-line-clamp: 2; }
.mu-blog-empty { color: #6f7b95; 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; }
@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 .mu-cover { aspect-ratio: 16 / 8; }
/* --- แผนที่เส้นทางแทนรูปปก (textN.json → "map") --- */
.mu-post .mu-cover.is-map { aspect-ratio: auto; height: 280px; position: relative; }
.mu-post .mu-cover.is-map .at-map { height: 100%; border: 0; border-radius: 0; }
.mu-cover.is-map .at-map.is-static { pointer-events: none; } /* ปิดซูม/ลาก */
.mu-cover-cap {
position: absolute; left: 0; right: 0; bottom: 0; z-index: 500;
padding: 8px 12px; color: #fff; font-size: .8rem; line-height: 1.4;
background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, .62));
}
/* --- แผนที่ "เส้นทางที่เสนอ" (ความฝัน) + รายการคลิกได้ + แผงรายละเอียด --- */
/* isolation:isolate — กัก z-index ของ Leaflet (400–1000) ไว้ในกรอบแผนที่
ไม่ให้ปุ่มซูม/ป๊อปอัปทะลุขึ้นไปทับ nav (z-index 1100) */
.blog-mapx { margin: 0 0 16px; position: relative; isolation: isolate; }
/* ป้ายหมวดบนแผนที่ (มุมขวาบน — หลบปุ่มซูมของ Leaflet ที่มุมซ้ายบน) */
.blog-mapx-tag {
position: absolute; top: 12px; right: 12px; z-index: 500;
display: inline-flex; align-items: center; gap: 6px;
padding: 5px 10px; border-radius: 999px;
font-size: .72rem; font-weight: 800; letter-spacing: .02em;
background: rgba(255, 255, 255, .92); color: #1f2a44;
backdrop-filter: blur(8px);
box-shadow: 0 4px 10px rgba(15, 23, 42, .15);
pointer-events: none;
}
.blog-mapx-map { height: 280px; border-radius: 16px; }
.blog-mapx-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.blog-mapx-group {
margin: 10px 0 2px; font-size: .78rem; font-weight: 700; letter-spacing: .01em;
color: #7a4cc0; list-style: none;
}
.blog-mapx-group:first-child { margin-top: 0; }
.blog-mapx-group::before { content: ''; display: inline-block; width: 14px; height: 2px;
background: #cbb8e8; vertical-align: middle; margin-right: 8px; border-radius: 2px; }
.blog-mapx-row {
display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
padding: 9px 11px; border: 1px solid #e8e4f2; border-radius: 12px;
background: #fff; cursor: pointer; font-size: .88rem; color: #3d4a63;
}
.blog-mapx-row:hover { border-color: #cbb8e8; background: #faf8ff; }
.blog-mapx-row.is-on { border-color: #7a4cc0; background: #f6f2ff; }
.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-nm { font-weight: 700; color: #1f2a44; }
.blog-mapx-ds { color: #6b7a94; }
.blog-mapx-ds::before { content: '\00b7'; margin-right: 6px; color: #c9c2dc; }
.blog-mapx-badge {
margin-left: auto; font-size: .72rem; padding: 2px 8px; border-radius: 999px;
background: #fdf4e3; color: #8a6100; 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[hidden] { display: none; }
.blog-mapx-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.blog-mapx-head strong { color: #1f2a44; font-size: .95rem; }
.blog-mapx-line { margin: 4px 0; font-size: .85rem; color: #6b7a94; }
.blog-mapx-line span::after { content: ':'; margin-right: 6px; }
.blog-mapx-line b { color: #1f2a44; font-weight: 600; }
.blog-mapx-facts { margin: 8px 0 0; font-size: .82rem; color: #7a4cc0; font-weight: 700; }
.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; }
.at-tip-org { background: #1f2a44; color: #fff; border: 0; font-weight: 700; }
@media (min-width: 768px) { .blog-mapx-map { height: 380px; } }
.mu-cover-note {
position: absolute; left: 12px; bottom: 12px; z-index: 500;
padding: 4px 10px; border-radius: 999px; font-size: .78rem;
background: rgba(255, 255, 255, .9); color: #8a6100; border: 1px solid #f0d9a8;
}
.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; }
/* ย่อหน้า: เว้นระยะ 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:last-child { margin-bottom: 0; }
/* ย่อหน้าที่เป็นรูป/บรรทัดข้อมูลไม่ต้องย่อหน้า */
.mu-post-body p.mu-post-figure, .mu-post-figure, .mu-post-body p:empty { text-indent: 0; }
/* มาร์กดาวน์เบา ๆ ในเนื้อหา (จาก textN.json) */
.mu-post-body strong { color: #1f2a44; font-weight: 800; }
.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:hover { border-bottom-color: #7a4cc0; }
.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; }
.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-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 figcaption { margin-top: 6px; color: #6f7b95; font-size: .82rem; text-align: center; }
.mu-post-back {
display: inline-flex; align-items: center; gap: 6px;
margin-bottom: 16px; color: #7a4cc0; font-weight: 700;
text-decoration: none; font-size: .9rem;
}
.mu-post-back:hover { text-decoration: underline; }
/* แท็บเล็ตขึ้นไป: การ์ด 2 คอลัมน์ → 3 คอลัมน์ */
@media (min-width: 768px) {
.mu-post .mu-cover.is-map { height: 380px; }
}
@media (min-width: 640px) {
#blog-list.mode-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
#blog-list.mode-grid { grid-template-columns: repeat(3, 1fr); }
.mu-post-body { padding: 26px 30px 34px; }
}
</style>
<!-- ============ HERO ============ -->
<section class="mu-hero">
<img class="mu-hero-map" src="../.image/network/overview-map.png" alt="" aria-hidden="true" decoding="async">
<div class="mu-blob one"></div>
<div class="mu-blob two"></div>
<div class="mu-blob three"></div>
<div class="mu-container mu-hero-content">
<span class="mu-badge"><svg class="ic" aria-hidden="true"><use href="#ic-message-circle"/></svg> <span data-i18n="nav.blog">บ่นไปเรื่อย</span></span>
<h1><span data-i18n="blog.title">บ่นไปเรื่อย</span><br><span class="mu-gradient-text" data-i18n="blog.subtitle">หน้านี้ก็เหมือนไดอารี่ของเรา อยากบ่นอะไรก็บ่น</span></h1>
<p class="mu-hero-lead" data-i18n="blog.lead">ขอบคุณที่เข้ามาอ่านบางบทความก็มีสาระบางบทความก็ไม่มีสาระ </p>
</div>
</section>
<!-- ============ รายการบทความ (โหลดจาก blog-data: text1.json + pic1, ...) ============ -->
<section class="mu-blog-wrap">
<div class="mu-container">
<div class="mu-blog-bar" id="blog-bar" hidden>
<p class="mu-blog-count" id="blog-count"></p>
<div class="mu-view-switch" role="group" aria-label="มุมมอง">
<button type="button" class="mu-view-btn" data-view="grid">
<svg class="ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg>
<span data-i18n="blog.viewGrid">ตาราง</span>
</button>
<button type="button" class="mu-view-btn" data-view="list">
<svg class="ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" x2="21" y1="6" y2="6"/><line x1="8" x2="21" y1="12" y2="12"/><line x1="8" x2="21" y1="18" y2="18"/><line x1="3" x2="3.01" y1="6" y2="6"/><line x1="3" x2="3.01" y1="12" y2="12"/><line x1="3" x2="3.01" y1="18" y2="18"/></svg>
<span data-i18n="blog.viewList">รายการ</span>
</button>
</div>
</div>
<div id="blog-list" aria-live="polite">
<div class="mu-blog-skel"></div>
</div>
</div>
</section>
<script src="./partials/blog.init.js"></script>