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
This commit is contained in:
1 parent
1adc2a6cd0
commit
b6ccb66ce2
8 files changed
+189
-39
No files matched your search
@@ -172,6 +172,15 @@
|
||||
<!-- การ์ดจุดจอด + ชิปเวลา: สร้างจาก 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>
|
||||
|
||||
|
||||
+1
-14
@@ -1,23 +1,10 @@
|
||||
<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;
|
||||
padding: 10px 16px; border: 1px solid #7a4cc0; border-radius: 8px;
|
||||
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 var(--c-border); 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) {
|
||||
.mu-share-row { align-items: stretch; }
|
||||
.mu-share-btn { justify-content: center; }
|
||||
.mu-share-status { text-align: left; }
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -419,6 +419,7 @@
|
||||
var btn = document.getElementById('share-btn');
|
||||
var status = document.getElementById('share-status');
|
||||
if (!btn) return;
|
||||
btn.dataset.bound = '1'; /* หน้าแรกมี logic ลิงก์สั้นของตัวเอง */
|
||||
var tr = window.I18N ? window.I18N.t : function (k) { return k; };
|
||||
|
||||
function paint(msg) {
|
||||
|
||||
Reference in new issue
Block a user