공유 덱 카드 복원 기준을 imgSrc로 전환
동일 번호 카드가 많은 시리즈에서도 선택한 카드가 정확히 복원되도록 저장·검증·복원 흐름을 imgSrc 중심으로 정리하고, 이미지 누락 시 공통 뒷면 폴백을 적용한다. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
21
result.html
21
result.html
@@ -526,6 +526,7 @@
|
||||
let currentStyle = 'type1';
|
||||
let selectedCards = [];
|
||||
let seriesKey = '';
|
||||
const CARD_IMAGE_FALLBACK_SRC = '/images/uapr/comingsoon.png';
|
||||
|
||||
// 전역 함수로 등록 (onclick 이벤트 대응)
|
||||
window.changeStyle = changeStyle;
|
||||
@@ -537,6 +538,20 @@
|
||||
|
||||
let translations = {};
|
||||
|
||||
/**
|
||||
* 카드 이미지 URL 생성 (누락 시 공통 뒷면 사용)
|
||||
* @param {string} currentSeriesKey
|
||||
* @param {string} cardImgSrc
|
||||
* @returns {string}
|
||||
*/
|
||||
function resolveCardImageSrc(currentSeriesKey, cardImgSrc) {
|
||||
const fileName = (cardImgSrc || '').split('/').pop();
|
||||
if (!currentSeriesKey || !fileName) {
|
||||
return CARD_IMAGE_FALLBACK_SRC;
|
||||
}
|
||||
return `/images/${currentSeriesKey}/${fileName}`;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const currentLang = urlParams.get('lang') || localStorage.getItem('lang') || 'ko';
|
||||
@@ -653,15 +668,14 @@
|
||||
const div = document.createElement('div');
|
||||
div.className = `${widthClass} card-wrapper`;
|
||||
|
||||
const fileName = card.imgSrc.split('/').pop();
|
||||
const imgSrc = `/images/${seriesKey}/${fileName}`;
|
||||
const imgSrc = resolveCardImageSrc(seriesKey, card.imgSrc);
|
||||
|
||||
const keyLabelText = translations.keyCardLabel || "KEY CARD";
|
||||
|
||||
div.innerHTML = `
|
||||
<div class="card-badge">${card.count}</div>
|
||||
<div class="card-image-box ${isKey ? 'key-card-highlight' : ''}">
|
||||
<img src="${imgSrc}" class="w-full h-full object-contain" crossorigin="anonymous">
|
||||
<img src="${imgSrc}" class="w-full h-full object-contain" crossorigin="anonymous" onerror="this.src='${CARD_IMAGE_FALLBACK_SRC}'; this.onerror=null;">
|
||||
${isKey ? `<div class="absolute bottom-0 left-0 right-0 key-label text-[10px] text-center py-1 font-bold">${keyLabelText}</div>` : ''}
|
||||
</div>
|
||||
<div class="mt-2 text-[10px] font-mono text-slate-400">${card.Number}</div>
|
||||
@@ -726,6 +740,7 @@
|
||||
return selectedCards
|
||||
.filter((c) => c.count > 0)
|
||||
.map((c) => ({
|
||||
imgSrc: c.imgSrc,
|
||||
number: c.Number,
|
||||
count: c.count,
|
||||
key: Boolean(c.key),
|
||||
|
||||
Reference in New Issue
Block a user