Files
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

188 lines
8.9 KiB
HTML
Raw Permalink 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>
/* ============================================================
checkSchedule (#/check) — redesign ให้ใช้ภาษาดีไซน์เดียวกับหน้าแรก
------------------------------------------------------------
hero / selector / summary / zone ใช้ class จาก index.html shell
(ประกาศใน <head> แล้ว) → ไม่ต้องนิยามใหม่
เฉพาะส่วนเฉพาะหน้า (lead + schedule cards) ค่อยเติมตรงนี้
============================================================ */
.mu-hero-lead {
margin: 14px auto 0;
max-width: 640px;
color: var(--c-ink-2);
font-size: .95rem;
}
.mu-summary-grid { gap: 14px; }
/* --- ตารางเวลา: การ์ดสไตล์ index (gradient header + เนื้อขาว) --- */
.mu-schedule-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 14px;
}
.mu-stop-card {
background: var(--c-surface);
border-radius: 16px;
overflow: hidden;
box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
transition: transform .15s ease, box-shadow .15s ease;
}
.mu-stop-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 24px rgba(20, 40, 90, .1);
}
.mu-stop-card summary { list-style: none; cursor: pointer; }
.mu-stop-card summary::-webkit-details-marker { display: none; }
/* header การ์ด = gradient block ตามโทนสีเดียวกับ index zone tints */
.mu-stop-head {
display: flex;
align-items: center;
gap: 12px;
padding: 14px 16px;
color: #fff;
}
.mu-stop-head.tone-purple { background: linear-gradient(135deg, #7a4cc0 0%, #b07ce0 100%); }
.mu-stop-head.tone-sky { background: linear-gradient(135deg, #3071b8 0%, #6ea7e8 100%); }
.mu-stop-head.tone-mint { background: linear-gradient(135deg, #1f8765 0%, #51c39c 100%); }
.mu-stop-head.tone-pink { background: linear-gradient(135deg, #bb3a78 0%, #f08bb9 100%); }
.mu-stop-kind {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 5px 12px;
border-radius: 999px;
background: var(--c-glass-24);
font-size: .74rem;
font-weight: 700;
white-space: nowrap;
}
.mu-stop-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mu-stop-title strong { font-size: 1rem; font-weight: 800; }
.mu-stop-title small { font-size: .78rem; opacity: .85; }
.mu-stop-chevron { font-size: 1.2rem; opacity: .9; transition: transform .2s ease; }
.mu-stop-card[open] > summary .mu-stop-chevron { transform: rotate(180deg); }
.mu-stop-body { padding: 16px; }
.mu-stop-sub { font-weight: 700; color: var(--c-ink); margin: 0 0 10px; font-size: .9rem; }
.mu-direction-tag {
background: var(--c-brand);
color: #fff;
border-radius: 999px;
padding: 3px 10px;
font-size: .72rem;
margin-left: 8px;
}
.mu-time-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mu-time-chip {
padding: 6px 12px;
border-radius: 10px;
background: #f1f4fb;
color: var(--c-ink);
font-weight: 700;
font-size: .85rem;
border: 1px solid #e6eaf3;
font-variant-numeric: tabular-nums;
}
.mu-time-chip.next {
background: linear-gradient(135deg, #a855f7, #7c3aed);
color: #fff;
border-color: transparent;
box-shadow: 0 4px 10px rgba(124, 58, 237, .25);
}
.mu-schedule-note {
color: var(--c-danger);
font-size: .82rem;
margin: 12px 0 0;
padding: 8px 12px;
background: var(--c-tint-pink);
border-left: 3px solid #bb3a78;
border-radius: 8px;
display: flex;
align-items: center;
gap: 6px;
}
.mu-inline-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.mu-schedule { padding: 4px 0 48px; }
@media (max-width: 768px) {
.mu-summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
</style>
<!-- ============ HERO (ภาษาเดียวกับหน้าแรก) ============ -->
<section class="mu-hero">
<img class="mu-hero-map" src="../.image/network/overview-map.png" alt="" aria-hidden="true" fetchpriority="high" 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-clock"/></svg> <span data-i18n="cta.check">เช็กเวลาเดินรถ</span></span>
<h1><span data-i18n="check.title">ตารางเวลาเดินรถ</span><br><span class="mu-gradient-text" id="check-hero-route"></span></h1>
<p class="mu-hero-lead" data-i18n="check.lead">เลือกสายรถ แล้วดูรอบรถทุกจุดจอดในหน้าเดียว</p>
<div class="mu-route-selector single">
<div class="mu-select-field">
<label for="check-route-select">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 6v6"/><path d="M15 6v6"/><path d="M2 12h19.6"/><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3"/><circle cx="7" cy="18" r="2"/><path d="M9 18h5"/><circle cx="16" cy="18" r="2"/></svg>
<span data-i18n="route.selectRoute">เลือกสายรถ</span>
</label>
<div class="mu-select-box">
<svg class="mu-select-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 6v6"/><path d="M15 6v6"/><path d="M2 12h19.6"/><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3"/><circle cx="7" cy="18" r="2"/><path d="M9 18h5"/><circle cx="16" cy="18" r="2"/></svg>
<select id="check-route-select" data-i18n-attr="aria-label:route.selectRoute"></select>
<svg class="mu-select-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
</div>
</div>
</div>
</div>
</section>
<!-- ============ สรุปเส้นทาง (สถิติแบบ index) ============ -->
<section class="mu-summary" aria-label="สรุปเส้นทาง" data-i18n-attr="aria-label:aria.routeSummary">
<div class="mu-container">
<div class="mu-summary-grid">
<div class="mu-stat tag-purple"><h3 id="check-stat-stops">–</h3><p data-i18n="check.kpiStops">จุดจอดหลัก</p></div>
<div class="mu-stat tag-sky"><h3 id="check-stat-provinces">–</h3><p data-i18n="check.kpiProvince">จังหวัดที่ผ่าน</p></div>
<div class="mu-stat tag-mint"><h3 id="check-stat-trips">–</h3><p data-i18n="check.kpiTrips">รอบต่อวัน</p></div>
<div class="mu-stat tag-pink"><h3 id="check-stat-next">–</h3><p data-i18n="check.kpiNext">รอบถัดไป</p></div>
</div>
</div>
</section>
<!-- ============ ตารางเวลาเดินรถ ============ -->
<section class="mu-schedule" aria-label="ตารางเวลาเดินรถ" data-i18n-attr="aria-label:check.title">
<div class="mu-container">
<div class="mu-zone">
<div class="mu-zone-head">
<span class="mu-zone-tag tag-purple" data-i18n="check.scheduleAll">ตารางเวลาเดินรถทุกจุดจอด</span>
<p class="mu-zone-desc mu-zone-meta" id="check-zone-desc"></p>
<p class="mu-zone-desc mu-zone-meta mu-zone-now" id="check-now-line"></p>
<p class="mu-zone-desc mu-zone-updated" id="check-updated-line"></p>
</div>
<!-- การ์ดจุดจอด + ชิปเวลา: สร้างจาก resource/data/schedules.json (checkSchedule.init.js) -->
<ul class="mu-schedule-list" id="check-schedule-list"></ul>
</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>
</section>
<script src="./partials/checkSchedule.init.js"></script>