zoom card update

This commit is contained in:
2026-06-12 04:09:34 +00:00
parent 06d0cacc95
commit b14469f7d7
4 changed files with 48 additions and 3 deletions
+31 -1
View File
@@ -367,6 +367,34 @@
};
var EVIDENCE_RARITY_LABEL = { common: 'การ์ดธรรมดา', rare: 'การ์ด Rare', legendary: 'การ์ดชี้คนร้าย' };
/** กล่องดูการ์ดหลักฐานแบบขยาย (zoom) — ปิดด้วยปุ่ม ×, คลิกพื้นหลัง, หรือ Esc */
function openEvidenceCardLightboxPlay(imageUrl, label, rarity) {
if (!imageUrl) return;
var rar = String(rarity || 'common').toLowerCase();
var glow = EVIDENCE_RARITY_GLOW[rar] || EVIDENCE_RARITY_GLOW.common;
var ov = document.getElementById('evidence-card-lightbox');
if (!ov) {
ov = document.createElement('div');
ov.id = 'evidence-card-lightbox';
ov.style.cssText = 'position:fixed;inset:0;z-index:100001;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(5,8,18,.88);backdrop-filter:blur(4px)';
ov.innerHTML =
'<button type="button" class="ecl-close" aria-label="ปิด" style="position:absolute;top:22px;right:26px;width:46px;height:46px;border:none;border-radius:50%;cursor:pointer;font:900 26px/1 system-ui,sans-serif;color:#0a0e1a;background:linear-gradient(180deg,#ffd666,#f0b429);box-shadow:0 8px 22px rgba(0,0,0,.45)">&times;</button>' +
'<div class="ecl-stage" style="display:flex;flex-direction:column;align-items:center;gap:14px;max-width:92vw">' +
'<img class="ecl-img" alt="" style="display:block;width:auto;height:auto;max-width:min(86vw,520px);max-height:78vh;border-radius:16px" />' +
'<div class="ecl-cap" style="font:800 16px/1.3 Kanit,system-ui,sans-serif;color:#e7ecff;text-align:center;max-width:90vw"></div>' +
'</div>';
document.body.appendChild(ov);
var closeFn = function () { ov.style.display = 'none'; };
ov.addEventListener('click', function (e) { if (e.target === ov || (e.target.classList && e.target.classList.contains('ecl-close'))) closeFn(); });
document.addEventListener('keydown', function (e) { if (e.key === 'Escape' && ov.style.display !== 'none') closeFn(); });
}
var img = ov.querySelector('.ecl-img');
var cap = ov.querySelector('.ecl-cap');
if (img) { img.style.boxShadow = '0 0 44px ' + glow + ',0 22px 60px rgba(0,0,0,.6)'; img.src = imageUrl; }
if (cap) cap.textContent = label || '';
ov.style.display = 'flex';
}
function showInSceneEvidenceReveal(res, onDone) {
var done = false;
var finish = function () { if (done) return; done = true; onDone(); };
@@ -414,7 +442,9 @@
var img = document.createElement('img');
img.src = c.imageUrl;
img.alt = EVIDENCE_RARITY_LABEL[rar] || 'หลักฐาน';
img.style.cssText = 'display:block;width:min(34vw,260px);height:auto;border-radius:14px;box-shadow:0 0 36px ' + glow + ',0 18px 50px rgba(0,0,0,.6)';
img.style.cssText = 'display:block;width:min(34vw,260px);height:auto;border-radius:14px;box-shadow:0 0 36px ' + glow + ',0 18px 50px rgba(0,0,0,.6);cursor:zoom-in';
img.title = 'แตะเพื่อดูใหญ่';
img.addEventListener('click', function () { openEvidenceCardLightboxPlay(c.imageUrl, EVIDENCE_RARITY_LABEL[rar] || '', rar); });
img.onerror = function () { this.onerror = null; this.style.width = '200px'; this.style.height = '300px'; this.style.background = '#1b2240'; this.removeAttribute('src'); };
var tag = document.createElement('div');
tag.style.cssText = 'font:800 14px/1 Kanit,system-ui,sans-serif;color:#fff;opacity:.92';
+15
View File
@@ -5042,6 +5042,21 @@
img.onerror = function () { this.onerror = null; buildEs3HtmlCard(card, c, linkName, cardIndex); };
img.src = c.imageUrl;
card.appendChild(img);
/* ปุ่มแว่นขยายมุมการ์ด — ดูใหญ่ได้โดยไม่ชนกับการเลือกการ์ด (stopPropagation) */
var zb = document.createElement('button');
zb.type = 'button';
zb.className = 'es3-card-zoom';
zb.setAttribute('aria-label', 'ดูใหญ่');
zb.textContent = '🔍';
zb.style.cssText = 'position:absolute;top:6px;right:6px;z-index:3;width:30px;height:30px;border:none;border-radius:50%;cursor:zoom-in;font-size:15px;line-height:1;background:rgba(8,12,28,.78);color:#ffd666;box-shadow:0 2px 8px rgba(0,0,0,.5)';
zb.addEventListener('click', function (e) {
e.stopPropagation();
var label = (c.titleTh || '') + (c.titleEn ? ' · ' + c.titleEn : '');
if (!label && linkName) label = linkName;
openEvidenceCardLightbox(c.imageUrl, label, c.rarity);
});
card.style.position = 'relative';
card.appendChild(zb);
return card;
}
buildEs3HtmlCard(card, c, linkName, cardIndex);
+1 -1
View File
@@ -5152,7 +5152,7 @@
<script src="/app-base.js?v=2"></script>
<script src="/Game/socket.io/socket.io.js"></script>
<script src="js/version.js?v=0.0306"></script>
<script src="js/play.js?v=0.00610200036"></script>
<script src="js/play.js?v=0.00610200037"></script>
<div class="version-tag">v —</div>
</body>
</html>
+1 -1
View File
@@ -1613,7 +1613,7 @@
<script src="js/display-name.js?v=2"></script>
<script src="js/version.js?v=0.0122"></script>
<script src="js/customize-popup.js?v=31" data-customize-triggers="" data-customize-asset-base="img/03-5-Customize"></script>
<script src="js/room-lobby.js?v=0.0268"></script>
<script src="js/room-lobby.js?v=0.0269"></script>
<div class="version-tag">v —</div>
</body>
</html>