From a8a022ec544c34c6fa55a6de36cfde0eae143de8 Mon Sep 17 00:00:00 2001 From: Bkk1234 Date: Tue, 24 Nov 2026 15:29:04 +0700 Subject: [PATCH] =?UTF-8?q?fix(cards):=20=E0=B8=88=E0=B8=B3=E0=B8=81?= =?UTF-8?q?=E0=B8=B1=E0=B8=94=E0=B8=9E=E0=B8=B7=E0=B9=89=E0=B8=99=E0=B8=97?= =?UTF-8?q?=E0=B8=B5=E0=B9=88=E0=B8=84=E0=B8=A5=E0=B8=B4=E0=B8=81=E0=B8=97?= =?UTF-8?q?=E0=B8=B5=E0=B9=88=20"=E0=B8=81=E0=B8=A5=E0=B9=88=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=84=E0=B8=A7=E0=B8=B2?= =?UTF-8?q?=E0=B8=A1"=20=E0=B9=80=E0=B8=97=E0=B9=88=E0=B8=B2=E0=B8=99?= =?UTF-8?q?=E0=B8=B1=E0=B9=89=E0=B8=99=20=E2=80=94=20=E0=B8=A3=E0=B8=B9?= =?UTF-8?q?=E0=B8=9B=E0=B9=84=E0=B8=A1=E0=B9=88=20navigate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - card-click v2: ตรวจว่าคลิกอยู่ใน parent ของลิงก์ "ดูรายละเอียด" (= กล่อง bg-[#1B1B1B]) · คลิกรูป/พื้นที่ด้านบนการ์ด → ไม่ทำอะไร · คลิกกล่องข้อความ (km./ชื่อ/ที่ตั้ง/tag/ช่องว่าง) → เปิดหน้าโรงหนัง · ปุ่มแชร์ยังทำงานเอง - cursor: pointer เฉพาะกล่องข้อความ (article = auto) - ลบ card-click.v1.js · อัปเดตแท็กใน 64 หน้า · sw VERSION v2.1.4 + precache v2 - docs/card-clickable.md: อธิบายขอบเขตการคลิกด้วยโครงสร้าง DOM จริง --- 404.html | 2 +- about/index.html | 2 +- assets/card-click.v1.js | 56 -------------- assets/card-click.v2.js | 74 +++++++++++++++++++ c/alliance-francaise-de-bangkok/index.html | 2 +- .../index.html | 2 +- c/century-the-movie-plaza/index.html | 2 +- c/chumphae-cineplex/index.html | 2 +- c/cinema-oasis/index.html | 2 +- c/ck-multiplex/index.html | 2 +- c/coliseum-paradise/index.html | 2 +- c/dech-udom-theatre/index.html | 2 +- c/doc-club-and-friends/index.html | 2 +- c/homeflick/index.html | 2 +- c/house-cinema-samyan/index.html | 2 +- c/kku-cinema/index.html | 2 +- c/lido-connect/index.html | 2 +- c/loprama/index.html | 2 +- c/major-hollywood/index.html | 2 +- c/mecani/index.html | 2 +- c/muangthong-rama/index.html | 2 +- c/mvp-cinema/index.html | 2 +- .../index.html | 2 +- c/nevada-multiplex/index.html | 2 +- c/phahol-theatre/index.html | 2 +- c/phok-bookshop-cinema/index.html | 2 +- c/sala-saneha/index.html | 2 +- c/srisakon-cineplex/index.html | 2 +- c/suen-heng-multiplex-sisaket/index.html | 2 +- c/thai-film-archive/index.html | 2 +- c/thana-cineplex/index.html | 2 +- c/the-friese-greene-club/index.html | 2 +- c/wednesday-shine/index.html | 2 +- .../alliance-francaise-de-bangkok/index.html | 2 +- .../index.html | 2 +- cinema/century-the-movie-plaza/index.html | 2 +- cinema/chumphae-cineplex/index.html | 2 +- cinema/cinema-oasis/index.html | 2 +- cinema/ck-multiplex/index.html | 2 +- cinema/coliseum-paradise/index.html | 2 +- cinema/dech-udom-theatre/index.html | 2 +- cinema/doc-club-and-friends/index.html | 2 +- cinema/homeflick/index.html | 2 +- cinema/house-cinema-samyan/index.html | 2 +- cinema/kku-cinema/index.html | 2 +- cinema/lido-connect/index.html | 2 +- cinema/loprama/index.html | 2 +- cinema/major-hollywood/index.html | 2 +- cinema/mecani/index.html | 2 +- cinema/muangthong-rama/index.html | 2 +- cinema/mvp-cinema/index.html | 2 +- .../index.html | 2 +- cinema/nevada-multiplex/index.html | 2 +- cinema/phahol-theatre/index.html | 2 +- cinema/phok-bookshop-cinema/index.html | 2 +- cinema/sala-saneha/index.html | 2 +- cinema/srisakon-cineplex/index.html | 2 +- cinema/suen-heng-multiplex-sisaket/index.html | 2 +- cinema/thai-film-archive/index.html | 2 +- cinema/thana-cineplex/index.html | 2 +- cinema/the-friese-greene-club/index.html | 2 +- cinema/wednesday-shine/index.html | 2 +- docs/card-clickable.md | 48 +++++++----- for-cinemas/index.html | 2 +- for-film-lovers/index.html | 2 +- index.html | 2 +- offline.html | 2 +- scripts/apply-card-click.mjs | 6 +- sw.js | 4 +- 69 files changed, 173 insertions(+), 143 deletions(-) delete mode 100644 assets/card-click.v1.js create mode 100644 assets/card-click.v2.js diff --git a/404.html b/404.html index 904125c..9c33a71 100644 --- a/404.html +++ b/404.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/about/index.html b/about/index.html index 12a99bf..4df2e83 100644 --- a/about/index.html +++ b/about/index.html @@ -67,4 +67,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/assets/card-click.v1.js b/assets/card-click.v1.js deleted file mode 100644 index 3622c26..0000000 --- a/assets/card-click.v1.js +++ /dev/null @@ -1,56 +0,0 @@ -/*! - * card-click v1 — ทำให้การ์ดโรงหนัง "ทั้งใบ" กดเปิดหน้าโรงหนังได้ - * - * บริบท: เว็บนี้เป็น static export (HTML + JS ที่ build มาแล้ว ไม่มี React source ในรีโป) - * จึงเสริมพฤติกรรมด้วย event delegation แทนการแก้ component - * - * กติกา - * - คลิกที่ว่างของการ์ด = ไปหน้า /cinema/ ของการ์ดนั้น - * - คลิกที่ปุ่ม/ลิงก์/ช่องกรอกในใบ (เช่น ปุ่มแชร์, "ดูรายละเอียด") = ปล่อยให้ของเดิมทำงาน - * - ไม่ทำงานเมื่อ: กดปุ่มกลาง/ขวา, มี modifier (ctrl/cmd/shift/alt), หรือกำลังลากเลือกข้อความ - * - คีย์บอร์ดยังใช้ลิงก์ "ดูรายละเอียด" (Tab + Enter) ได้ตามเดิม - */ -(() => { - const CARD = "article"; - const CARD_LINK = 'a[href^="/cinema/"]'; - const INTERACTIVE = - 'a,button,input,select,textarea,label,summary,[role="button"],[contenteditable="true"]'; - - function cardClick(event) { - if (event.defaultPrevented || event.button !== 0) return; - if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return; - - const target = event.target instanceof Element ? event.target : null; - if (!target) return; - - const card = target.closest(CARD); - if (!card) return; - - // ปล่อยให้ปุ่ม/ลิงก์ภายในใบทำงานของตัวเอง (เช่น ปุ่มแชร์) - const own = target.closest(INTERACTIVE); - if (own && card.contains(own)) return; - - // อย่าแย่งคลิกตอนผู้ใช้ลากเลือกข้อความ - const selection = window.getSelection(); - if (selection && selection.toString().trim() !== "") return; - - const link = card.querySelector(CARD_LINK); - if (!link) return; - - event.preventDefault(); - location.assign(link.getAttribute("href")); - } - - document.addEventListener("click", cardClick); - - // ลูกศรชี้ + วงโฟกัทให้เห็นว่าใบนี้กดได้ (ใช้ selector เดียวกับการ์ดจริง) - const style = document.createElement("style"); - style.textContent = - 'article:has(' + - CARD_LINK + - "){cursor:pointer}" + - "article " + - CARD_LINK + - ":focus-visible{outline:2px solid #A92626;outline-offset:4px;border-radius:16px}"; - document.head.appendChild(style); -})(); diff --git a/assets/card-click.v2.js b/assets/card-click.v2.js new file mode 100644 index 0000000..17afb8e --- /dev/null +++ b/assets/card-click.v2.js @@ -0,0 +1,74 @@ +/*! + * card-click v2 — เปิดหน้าโรงหนังเมื่อคลิก "กล่องข้อความสีดำ" ในการ์ดเท่านั้น + * + * บริบท: เว็บนี้เป็น static export (HTML + JS ที่ build แล้ว ไม่มี React source ในรีโป) + * จึงเสริมพฤติกรรมด้วย event delegation แทนการแก้ component + * + * โครงการ์ด (จาก DOM จริง) + *
← รูปโรงหนัง + เอฟเฟกต์ hover (ห้ามคลิกแล้ว navigate) + *
← ปุ่มแชร์ + *
← กล่องข้อความ (คลิกได้ทั้งกล่อง) + * … km. / ชื่อโรง / ที่ตั้ง / tag … + * ดูรายละเอียด + *
+ *
+ * + * กติกา + * - คลิกในกล่องข้อความ (รวมพื้นที่ว่างรอบ ๆ ข้อความ) → ไปหน้า /cinema/ + * - คลิกที่รูป/พื้นที่นอกกล่อง → ไม่ทำอะไร (ปล่อยให้ hover/เอฟเฟกต์เดิมทำงาน) + * - คลิกปุ่ม/ลิงก์/ช่องกรอกในกล่อง (เช่น ปุ่มแชร์, "ดูรายละเอียด") → ของเดิมทำงานเอง + * - ไม่ทำงานเมื่อ: ปุ่มกลาง/ขวา, มี modifier (ctrl/cmd/shift/alt), หรือกำลังลากเลือกข้อความ + */ +(() => { + const CARD = "article"; + const CARD_LINK = 'a[href^="/cinema/"]'; + const INTERACTIVE = + 'a,button,input,select,textarea,label,summary,[role="button"],[contenteditable="true"]'; + + /** กล่องข้อความ = div ที่มีลิงก์ "ดูรายละเอียด" เป็นลูกโดยตรง */ + function textBoxOf(link) { + return link.parentElement; + } + + function cardClick(event) { + if (event.defaultPrevented || event.button !== 0) return; + if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return; + + const target = event.target instanceof Element ? event.target : null; + if (!target) return; + + const card = target.closest(CARD); + if (!card) return; + + const link = card.querySelector(CARD_LINK); + if (!link) return; + + const box = textBoxOf(link); + // คลิกนอกรวมถึงรูปโรงหนัง → ไม่ต้องทำอะไร + if (!box || !box.contains(target)) return; + + // ปล่อยให้ปุ่ม/ลิงก์ภายในกล่องทำงานของตัวเอง (เช่น ปุ่มแชร์) + const own = target.closest(INTERACTIVE); + if (own && box.contains(own)) return; + + // อย่าแย่งคลิกตอนผู้ใช้ลากเลือกข้อความ + const selection = window.getSelection(); + if (selection && selection.toString().trim() !== "") return; + + event.preventDefault(); + location.assign(link.getAttribute("href")); + } + + document.addEventListener("click", cardClick); + + // ลูกศรชี้เฉพาะกล่องข้อความ + วงโฟกัสที่ลิงก์ (รูปไม่เปลี่ยน cursor) + const style = document.createElement("style"); + style.textContent = + "div:has(> " + + CARD_LINK + + "){cursor:pointer}" + + "div > " + + CARD_LINK + + ":focus-visible{outline:2px solid #A92626;outline-offset:4px;border-radius:16px}"; + document.head.appendChild(style); +})(); diff --git a/c/alliance-francaise-de-bangkok/index.html b/c/alliance-francaise-de-bangkok/index.html index ba92950..70c077a 100644 --- a/c/alliance-francaise-de-bangkok/index.html +++ b/c/alliance-francaise-de-bangkok/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/century-the-movie-plaza-sukhumvit/index.html b/c/century-the-movie-plaza-sukhumvit/index.html index 5cad865..957e059 100644 --- a/c/century-the-movie-plaza-sukhumvit/index.html +++ b/c/century-the-movie-plaza-sukhumvit/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/century-the-movie-plaza/index.html b/c/century-the-movie-plaza/index.html index 47f127f..dc9d933 100644 --- a/c/century-the-movie-plaza/index.html +++ b/c/century-the-movie-plaza/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/chumphae-cineplex/index.html b/c/chumphae-cineplex/index.html index e19deb9..e3ebcb9 100644 --- a/c/chumphae-cineplex/index.html +++ b/c/chumphae-cineplex/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/cinema-oasis/index.html b/c/cinema-oasis/index.html index 471a8b0..e252e5c 100644 --- a/c/cinema-oasis/index.html +++ b/c/cinema-oasis/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/ck-multiplex/index.html b/c/ck-multiplex/index.html index de78e3a..a6d1a2f 100644 --- a/c/ck-multiplex/index.html +++ b/c/ck-multiplex/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/coliseum-paradise/index.html b/c/coliseum-paradise/index.html index 31aec86..aca2ea4 100644 --- a/c/coliseum-paradise/index.html +++ b/c/coliseum-paradise/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/dech-udom-theatre/index.html b/c/dech-udom-theatre/index.html index e7fd77c..8bf089e 100644 --- a/c/dech-udom-theatre/index.html +++ b/c/dech-udom-theatre/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/doc-club-and-friends/index.html b/c/doc-club-and-friends/index.html index 70e3b7e..5a96ee8 100644 --- a/c/doc-club-and-friends/index.html +++ b/c/doc-club-and-friends/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/homeflick/index.html b/c/homeflick/index.html index e0f7871..a84e89c 100644 --- a/c/homeflick/index.html +++ b/c/homeflick/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/house-cinema-samyan/index.html b/c/house-cinema-samyan/index.html index 1e37041..a7d07de 100644 --- a/c/house-cinema-samyan/index.html +++ b/c/house-cinema-samyan/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/kku-cinema/index.html b/c/kku-cinema/index.html index d11d1d2..78faf93 100644 --- a/c/kku-cinema/index.html +++ b/c/kku-cinema/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/lido-connect/index.html b/c/lido-connect/index.html index 855a16c..32e3ddf 100644 --- a/c/lido-connect/index.html +++ b/c/lido-connect/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/loprama/index.html b/c/loprama/index.html index 4ee3e16..caad568 100644 --- a/c/loprama/index.html +++ b/c/loprama/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/major-hollywood/index.html b/c/major-hollywood/index.html index 1f316cb..469a56c 100644 --- a/c/major-hollywood/index.html +++ b/c/major-hollywood/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/mecani/index.html b/c/mecani/index.html index 73c0467..f2b49c4 100644 --- a/c/mecani/index.html +++ b/c/mecani/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/muangthong-rama/index.html b/c/muangthong-rama/index.html index f1c18c7..28d3d91 100644 --- a/c/muangthong-rama/index.html +++ b/c/muangthong-rama/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/mvp-cinema/index.html b/c/mvp-cinema/index.html index 99c1c26..3f71944 100644 --- a/c/mvp-cinema/index.html +++ b/c/mvp-cinema/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/nang-loeng-cinema-sala-chalerm-thani/index.html b/c/nang-loeng-cinema-sala-chalerm-thani/index.html index 909ec63..314ac2b 100644 --- a/c/nang-loeng-cinema-sala-chalerm-thani/index.html +++ b/c/nang-loeng-cinema-sala-chalerm-thani/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/nevada-multiplex/index.html b/c/nevada-multiplex/index.html index ea50e79..a694aa4 100644 --- a/c/nevada-multiplex/index.html +++ b/c/nevada-multiplex/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/phahol-theatre/index.html b/c/phahol-theatre/index.html index 37b993f..d1e9660 100644 --- a/c/phahol-theatre/index.html +++ b/c/phahol-theatre/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/phok-bookshop-cinema/index.html b/c/phok-bookshop-cinema/index.html index c0312b1..3380859 100644 --- a/c/phok-bookshop-cinema/index.html +++ b/c/phok-bookshop-cinema/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/sala-saneha/index.html b/c/sala-saneha/index.html index f494c0e..dd49050 100644 --- a/c/sala-saneha/index.html +++ b/c/sala-saneha/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/srisakon-cineplex/index.html b/c/srisakon-cineplex/index.html index 3dc643d..ed3bf67 100644 --- a/c/srisakon-cineplex/index.html +++ b/c/srisakon-cineplex/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/suen-heng-multiplex-sisaket/index.html b/c/suen-heng-multiplex-sisaket/index.html index 7e88aea..4d7a27d 100644 --- a/c/suen-heng-multiplex-sisaket/index.html +++ b/c/suen-heng-multiplex-sisaket/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/thai-film-archive/index.html b/c/thai-film-archive/index.html index a8db2f7..aa2d25d 100644 --- a/c/thai-film-archive/index.html +++ b/c/thai-film-archive/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/thana-cineplex/index.html b/c/thana-cineplex/index.html index 8db5aac..95a22e2 100644 --- a/c/thana-cineplex/index.html +++ b/c/thana-cineplex/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/the-friese-greene-club/index.html b/c/the-friese-greene-club/index.html index 0284784..ea48985 100644 --- a/c/the-friese-greene-club/index.html +++ b/c/the-friese-greene-club/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/c/wednesday-shine/index.html b/c/wednesday-shine/index.html index 09b3001..784064c 100644 --- a/c/wednesday-shine/index.html +++ b/c/wednesday-shine/index.html @@ -12,4 +12,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/alliance-francaise-de-bangkok/index.html b/cinema/alliance-francaise-de-bangkok/index.html index 1113bc9..7067cf3 100644 --- a/cinema/alliance-francaise-de-bangkok/index.html +++ b/cinema/alliance-francaise-de-bangkok/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/century-the-movie-plaza-sukhumvit/index.html b/cinema/century-the-movie-plaza-sukhumvit/index.html index 01272c9..41d5cbe 100644 --- a/cinema/century-the-movie-plaza-sukhumvit/index.html +++ b/cinema/century-the-movie-plaza-sukhumvit/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/century-the-movie-plaza/index.html b/cinema/century-the-movie-plaza/index.html index c139de0..4196468 100644 --- a/cinema/century-the-movie-plaza/index.html +++ b/cinema/century-the-movie-plaza/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/chumphae-cineplex/index.html b/cinema/chumphae-cineplex/index.html index cd40341..1cb4fd3 100644 --- a/cinema/chumphae-cineplex/index.html +++ b/cinema/chumphae-cineplex/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/cinema-oasis/index.html b/cinema/cinema-oasis/index.html index 3901568..3f4bc16 100644 --- a/cinema/cinema-oasis/index.html +++ b/cinema/cinema-oasis/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/ck-multiplex/index.html b/cinema/ck-multiplex/index.html index eb631d9..a6fe235 100644 --- a/cinema/ck-multiplex/index.html +++ b/cinema/ck-multiplex/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/coliseum-paradise/index.html b/cinema/coliseum-paradise/index.html index 05c226c..9cd2bd2 100644 --- a/cinema/coliseum-paradise/index.html +++ b/cinema/coliseum-paradise/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/dech-udom-theatre/index.html b/cinema/dech-udom-theatre/index.html index 1dc889b..16be2e5 100644 --- a/cinema/dech-udom-theatre/index.html +++ b/cinema/dech-udom-theatre/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/doc-club-and-friends/index.html b/cinema/doc-club-and-friends/index.html index 505c8ed..5587b13 100644 --- a/cinema/doc-club-and-friends/index.html +++ b/cinema/doc-club-and-friends/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/homeflick/index.html b/cinema/homeflick/index.html index b3b13c6..7707008 100644 --- a/cinema/homeflick/index.html +++ b/cinema/homeflick/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/house-cinema-samyan/index.html b/cinema/house-cinema-samyan/index.html index 129badd..2db120b 100644 --- a/cinema/house-cinema-samyan/index.html +++ b/cinema/house-cinema-samyan/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/kku-cinema/index.html b/cinema/kku-cinema/index.html index 83545a9..0c52b63 100644 --- a/cinema/kku-cinema/index.html +++ b/cinema/kku-cinema/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/lido-connect/index.html b/cinema/lido-connect/index.html index 92ed048..77b5a0d 100644 --- a/cinema/lido-connect/index.html +++ b/cinema/lido-connect/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/loprama/index.html b/cinema/loprama/index.html index 4fce9e6..9c2f698 100644 --- a/cinema/loprama/index.html +++ b/cinema/loprama/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/major-hollywood/index.html b/cinema/major-hollywood/index.html index bf29918..3987915 100644 --- a/cinema/major-hollywood/index.html +++ b/cinema/major-hollywood/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/mecani/index.html b/cinema/mecani/index.html index cca6752..f77818b 100644 --- a/cinema/mecani/index.html +++ b/cinema/mecani/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/muangthong-rama/index.html b/cinema/muangthong-rama/index.html index b431174..290620f 100644 --- a/cinema/muangthong-rama/index.html +++ b/cinema/muangthong-rama/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/mvp-cinema/index.html b/cinema/mvp-cinema/index.html index 7ccd48d..7b2b4ac 100644 --- a/cinema/mvp-cinema/index.html +++ b/cinema/mvp-cinema/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/nang-loeng-cinema-sala-chalerm-thani/index.html b/cinema/nang-loeng-cinema-sala-chalerm-thani/index.html index 01a7916..f8e9177 100644 --- a/cinema/nang-loeng-cinema-sala-chalerm-thani/index.html +++ b/cinema/nang-loeng-cinema-sala-chalerm-thani/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/nevada-multiplex/index.html b/cinema/nevada-multiplex/index.html index fb9faac..3efff4b 100644 --- a/cinema/nevada-multiplex/index.html +++ b/cinema/nevada-multiplex/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/phahol-theatre/index.html b/cinema/phahol-theatre/index.html index 91a6250..cb6e125 100644 --- a/cinema/phahol-theatre/index.html +++ b/cinema/phahol-theatre/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/phok-bookshop-cinema/index.html b/cinema/phok-bookshop-cinema/index.html index 34cbbf7..111596a 100644 --- a/cinema/phok-bookshop-cinema/index.html +++ b/cinema/phok-bookshop-cinema/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/sala-saneha/index.html b/cinema/sala-saneha/index.html index 0d57795..90933fd 100644 --- a/cinema/sala-saneha/index.html +++ b/cinema/sala-saneha/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/srisakon-cineplex/index.html b/cinema/srisakon-cineplex/index.html index b06ff88..5d5b05a 100644 --- a/cinema/srisakon-cineplex/index.html +++ b/cinema/srisakon-cineplex/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/suen-heng-multiplex-sisaket/index.html b/cinema/suen-heng-multiplex-sisaket/index.html index ee3ffeb..0d72287 100644 --- a/cinema/suen-heng-multiplex-sisaket/index.html +++ b/cinema/suen-heng-multiplex-sisaket/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/thai-film-archive/index.html b/cinema/thai-film-archive/index.html index 0eb5f3c..c98588c 100644 --- a/cinema/thai-film-archive/index.html +++ b/cinema/thai-film-archive/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/thana-cineplex/index.html b/cinema/thana-cineplex/index.html index c435f4d..d96627a 100644 --- a/cinema/thana-cineplex/index.html +++ b/cinema/thana-cineplex/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/the-friese-greene-club/index.html b/cinema/the-friese-greene-club/index.html index 0fec942..705df83 100644 --- a/cinema/the-friese-greene-club/index.html +++ b/cinema/the-friese-greene-club/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/cinema/wednesday-shine/index.html b/cinema/wednesday-shine/index.html index 701a7fa..428c54a 100644 --- a/cinema/wednesday-shine/index.html +++ b/cinema/wednesday-shine/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/docs/card-clickable.md b/docs/card-clickable.md index 0c99235..68115ac 100644 --- a/docs/card-clickable.md +++ b/docs/card-clickable.md @@ -1,24 +1,35 @@ -# การ์ดโรงหนัง — คลิกได้ทั้งใบ (static export) +# การ์ดโรงหนัง — คลิก "กล่องข้อความ" ได้ทั้งกล่อง (static export) รีโปนี้เก็บ **static export** (HTML + JS ที่ build แล้ว) ไม่มี source component ให้แก้ -จึงเสริมพฤติกรรม "คลิกทั้งใบการ์ด = เปิดหน้าโรงหนัง" ด้วยสคริปต์เล็ก ๆ ที่โหลดทุกหน้า +จึงเสริมพฤติกรรมด้วยสคริปต์เล็ก ๆ ที่โหลดทุกหน้า + +## ขอบเขตการคลิก (สำคัญ) + +โครงสร้างการ์ดจริง + +``` +
← รูปโรงหนัง + เอฟเฟกต์ hover · คลิกแล้วไม่ไปไหน +
← ปุ่มแชร์ +
← กล่องข้อความ · คลิกได้ทั้งกล่อง + — km. / ชื่อโรง / ที่ตั้ง / tag + ดูรายละเอียด +
+
+``` + +- **คลิกในกล่องข้อความ** (รวมพื้นที่ว่างรอบข้อความ, บรรทัด km., ชื่อโรง, ที่ตั้ง, tag) → เปิดหน้าโรงหนัง +- **คลิกที่รูป / พื้นที่ด้านบน** → ไม่ทำอะไร (ไม่ navigate) +- **คลิกปุ่มแชร์ / ลิงก์ "ดูรายละเอียด"** → ทำงานของตัวเองตามเดิม (ไม่ถูกดักซ้ำ) +- ไม่ทำงานเมื่อ: ปุ่มกลาง/ขวา, กด Ctrl/Cmd/Shift/Alt, หรือกำลังลากเลือกข้อความ ## ไฟล์ที่เกี่ยวข้อง | ไฟล์ | หน้าที่ | |---|---| -| `assets/card-click.v1.js` | event delegation: คลิกพื้นที่ว่างของ `
` → ไป `a[href^="/cinema/"]` ในใบนั้น | -| `scripts/apply-card-click.mjs` | เติม ` \ No newline at end of file +})(); \ No newline at end of file diff --git a/for-film-lovers/index.html b/for-film-lovers/index.html index b278c32..1713b91 100644 --- a/for-film-lovers/index.html +++ b/for-film-lovers/index.html @@ -70,4 +70,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/index.html b/index.html index 904125c..9c33a71 100644 --- a/index.html +++ b/index.html @@ -66,4 +66,4 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/offline.html b/offline.html index 6e8f3da..cc6f652 100644 --- a/offline.html +++ b/offline.html @@ -85,5 +85,5 @@ document.addEventListener("click",(event)=>{ event.stopImmediatePropagation(); location.assign(anchor.getAttribute("href")); },true); -})(); +})(); diff --git a/scripts/apply-card-click.mjs b/scripts/apply-card-click.mjs index f58a8d3..5837607 100644 --- a/scripts/apply-card-click.mjs +++ b/scripts/apply-card-click.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env node /** - * ใส่ '; +const TAG = ''; const CHECK = process.argv.includes("--check"); const SKIP = new Set(["node_modules", ".git"]); @@ -31,7 +31,7 @@ const missing = []; for (const file of files) { const html = fs.readFileSync(file, "utf8"); - if (html.includes("card-click.v1.js")) continue; + if (html.includes("card-click.v2.js")) continue; missing.push(file); if (CHECK) continue; diff --git a/sw.js b/sw.js index 40f0f36..e5b00b4 100644 --- a/sw.js +++ b/sw.js @@ -18,7 +18,7 @@ * | โดเมนอื่น (รูป hotlink) | ไม่จัดการ | * | /app/* · /node_modules/* · /@* | ไม่จัดการ (โมดูลของ dev server) | */ -const VERSION = "v2.1.3"; +const VERSION = "v2.1.4"; const PAGES_CACHE = `alterflixhub-pages-${VERSION}`; const ASSETS_CACHE = `alterflixhub-assets-${VERSION}`; @@ -29,7 +29,7 @@ const PRECACHE = [ "/icon-192.png", "/icon-512.png", "/favicon.svg", - "/assets/card-click.v1.js", + "/assets/card-click.v2.js", ]; self.addEventListener("install", (event) => {