diff --git a/404.html b/404.html index 872bf1b..904125c 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 4b49fab..12a99bf 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 new file mode 100644 index 0000000..3622c26 --- /dev/null +++ b/assets/card-click.v1.js @@ -0,0 +1,56 @@ +/*! + * 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/c/alliance-francaise-de-bangkok/index.html b/c/alliance-francaise-de-bangkok/index.html index c3044e0..ba92950 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 5119133..5cad865 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 bbcbe2d..47f127f 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 30008a5..e19deb9 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 c20e95f..471a8b0 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 f233274..de78e3a 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 e77480b..31aec86 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 55a98bf..e7fd77c 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 9993b44..70e3b7e 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 e539dbd..e0f7871 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 ddac749..1e37041 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 2958096..d11d1d2 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 bf8b7e6..855a16c 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 38d97c7..4ee3e16 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 503109a..1f316cb 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 96cd704..73c0467 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 0e1fbef..f1c18c7 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 6c17921..99c1c26 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 85046e1..909ec63 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 6cb570b..ea50e79 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 faaabb1..37b993f 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 eecc6f0..c0312b1 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 96ded5f..f494c0e 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 0512ef0..3dc643d 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 6aa3724..7e88aea 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 5453053..a8db2f7 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 2906005..8db5aac 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 5cf0c97..0284784 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 193d723..09b3001 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 54f7f52..1113bc9 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 e717406..01272c9 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 80bc82a..c139de0 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 d6c7ddc..cd40341 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 1831b9a..3901568 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 d604579..eb631d9 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 f624dbc..05c226c 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 2cfaf0f..1dc889b 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 8fcfc46..505c8ed 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 d5e2489..b3b13c6 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 1d37b61..129badd 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 769a26f..83545a9 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 11311de..92ed048 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 446da0e..4fce9e6 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 b5865c4..bf29918 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 4d8c7c4..cca6752 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 a6d6fdf..b431174 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 f6a86ef..7ccd48d 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 3c044bd..01a7916 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 31a50ea..fb9faac 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 a47f48e..91a6250 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 f663e9e..34cbbf7 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 ae59b7e..0d57795 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 e9cb635..b06ff88 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 df4d14d..ee3ffeb 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 cf32e61..0eb5f3c 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 3cba17c..c435f4d 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 6532679..0fec942 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 f8acd55..701a7fa 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 new file mode 100644 index 0000000..0c99235 --- /dev/null +++ b/docs/card-clickable.md @@ -0,0 +1,37 @@ +# การ์ดโรงหนัง — คลิกได้ทั้งใบ (static export) + +รีโปนี้เก็บ **static export** (HTML + JS ที่ build แล้ว) ไม่มี source component ให้แก้ +จึงเสริมพฤติกรรม "คลิกทั้งใบการ์ด = เปิดหน้าโรงหนัง" ด้วยสคริปต์เล็ก ๆ ที่โหลดทุกหน้า + +## ไฟล์ที่เกี่ยวข้อง + +| ไฟล์ | หน้าที่ | +|---|---| +| `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 1d152b8..b278c32 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 872bf1b..904125c 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 9f2cbca..6e8f3da 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 new file mode 100644 index 0000000..f58a8d3 --- /dev/null +++ b/scripts/apply-card-click.mjs @@ -0,0 +1,53 @@ +#!/usr/bin/env node +/** + * ใส่ '; +const CHECK = process.argv.includes("--check"); +const SKIP = new Set(["node_modules", ".git"]); + +function walk(dir, out = []) { + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + if (SKIP.has(entry.name)) continue; + const full = path.join(dir, entry.name); + if (entry.isDirectory()) walk(full, out); + else if (entry.name.endsWith(".html")) out.push(full); + } + return out; +} + +const files = walk("."); +let patched = 0; +const missing = []; + +for (const file of files) { + const html = fs.readFileSync(file, "utf8"); + if (html.includes("card-click.v1.js")) continue; + missing.push(file); + if (CHECK) continue; + + const next = html.includes("") + ? html.replace("", `${TAG}`) + : html + TAG; + fs.writeFileSync(file, next); + patched++; +} + +if (CHECK) { + console.log( + missing.length === 0 + ? `ครบแล้ว: ${files.length} ไฟล์` + : `ยังขาด ${missing.length}/${files.length} ไฟล์:\n${missing.join("\n")}`, + ); +} else { + console.log(`เติมสคริปต์แล้ว ${patched} ไฟล์ (จากทั้งหมด ${files.length})`); +} diff --git a/sw.js b/sw.js index 45d9ebe..40f0f36 100644 --- a/sw.js +++ b/sw.js @@ -18,7 +18,7 @@ * | โดเมนอื่น (รูป hotlink) | ไม่จัดการ | * | /app/* · /node_modules/* · /@* | ไม่จัดการ (โมดูลของ dev server) | */ -const VERSION = "v2.1.2"; +const VERSION = "v2.1.3"; const PAGES_CACHE = `alterflixhub-pages-${VERSION}`; const ASSETS_CACHE = `alterflixhub-assets-${VERSION}`; @@ -29,6 +29,7 @@ const PRECACHE = [ "/icon-192.png", "/icon-512.png", "/favicon.svg", + "/assets/card-click.v1.js", ]; self.addEventListener("install", (event) => {