- 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
154 lines
12 KiB
HTML
154 lines
12 KiB
HTML
<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>
|