feat(라이브): 카드가 합친 칸 높이를 채우고, 이미지 링크를 누르면 가운데 보기 창

- 카드 높이 = 방송이 걸친 칸(합친 칸) 높이
- 보기 창: 화면 가운데, 원본 크기(크면 창 안 스크롤), 회전(보기만), 다운로드(원본·올린 파일 이름), 여러 장이면 앞뒤
- Ctrl·가운데 클릭은 예전처럼 새 탭

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 11:31:19 +09:00
parent 21659bca35
commit f5ddfd366b
9 changed files with 115 additions and 7 deletions
+15 -1
View File
@@ -63,6 +63,16 @@
box-shadow: 0 8px 24px rgba(15, 23, 42, .14); }
.lv-preview[hidden] { display: none; }
.lv-preview img { flex: 1 1 auto; min-height: 0; width: 100%; object-fit: contain; object-position: top; }
/* 이미지 보기 창 — 화면 가운데(모달 기본), 원본 크기, 크면 창 안에서 스크롤. 회전은 무대(stage) 크기를 돌린 크기로 바꿔 스크롤이 맞게 */
.lv-viewer { max-width: 94vw; max-height: 94vh; padding: 0; border: 1px solid #cfd4dc; border-radius: 12px; background: #fff; overflow: hidden; }
.lv-viewer[open] { display: flex; flex-direction: column; }
.lv-viewer::backdrop { background: rgba(0, 0, 0, .6); }
.lv-viewer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid #e3e6eb; }
.lv-viewer-cap { font-size: 12.5px; font-weight: 600; color: #374151; }
.lv-viewer-count { font-size: 12px; font-variant-numeric: tabular-nums; color: #4b5563; }
.lv-viewer-body { display: flex; min-height: 0; overflow: auto; background: #f3f4f6; }
.lv-viewer-stage { position: relative; flex: none; margin: auto; } /* margin:auto = 작으면 가운데, 크면 스크롤 시작이 잘리지 않음 */
.lv-viewer-stage img { position: absolute; left: 50%; top: 50%; max-width: none; transform: translate(-50%, -50%); }
.lv-preview figcaption { flex: none; font-size: 10.5px; font-weight: 600; color: #4b5563; text-align: center; }
/* 오른쪽 달력 = 공용 달력의 80% */
.lv-side-cal { flex: none; box-sizing: border-box; padding: 10px; border: 1px solid #cfd4dc; border-radius: 10px; background: #fff; font-size: 10.4px; }
@@ -98,7 +108,11 @@
.lv-cell.is-drop { background: #e8f1ff; box-shadow: inset 0 0 0 2px #3b82f6; }
.lv-cell-add { display: block; width: 100%; height: 100%; min-height: 22px; border: 1px dashed #d8dce3; border-radius: 6px; background: transparent; color: #b0b6c0; font-size: 14px; cursor: pointer; }
.lv-cell-add:hover, .lv-cell-add:focus-visible { border-color: #6b7280; color: #374151; }
.lv-card + .lv-card { margin-top: 2px; }
/* 카드 = 합친 칸 높이 전체(2시간 방송 = 두 칸). 표 칸의 height:1px 은 최소값일 뿐 — 안의 height:100% 가 칸 높이를 따르게 하는 방법 */
.lv-cell { height: 1px; }
.lv-cards { display: flex; flex-direction: column; gap: 2px; height: 100%; }
.lv-cards .lv-card { flex: 1 1 auto; display: flex; flex-direction: column; }
.lv-cards .lv-card-nums { flex: 1 1 auto; align-items: center; }
.lv-card { border: 1px solid #1f2937; border-radius: 6px; background: #fff; overflow: hidden; }
.lv-card-head { display: flex; align-items: center; gap: 3px; padding: 1px 4px; border-bottom: 1px solid #1f2937; cursor: grab; }
.lv-card-head:active { cursor: grabbing; }
+42
View File
@@ -232,6 +232,48 @@
calWrap.addEventListener("focusout", function (e) { if (linkOf(e.target)) preview.hidden = true; });
}
// ── 달력: 이미지 링크를 누르면 화면 가운데 보기 창 — 원본 크기, 회전(보기만, 90°씩), 다운로드(원본), 여러 장이면 앞뒤 ──
const viewer = document.getElementById("lv-viewer");
if (viewer) {
const vImg = viewer.querySelector("img"), stage = viewer.querySelector(".lv-viewer-stage");
const vCap = viewer.querySelector(".lv-viewer-cap"), vCount = viewer.querySelector(".lv-viewer-count");
const dl = viewer.querySelector("[data-download]"), steps = viewer.querySelectorAll("[data-step]");
let ids = [], names = [], at = 0, turn = 0;
const place = function () {
const w = vImg.naturalWidth, h = vImg.naturalHeight, side = turn % 2 === 1;
stage.style.width = (side ? h : w) + "px";
stage.style.height = (side ? w : h) + "px";
vImg.style.transform = "translate(-50%, -50%) rotate(" + turn * 90 + "deg)";
};
const load = function () {
turn = 0;
vImg.src = dl.href = "/live/images/" + ids[at];
dl.download = names[at] || "image-" + ids[at];
vCount.textContent = ids.length > 1 ? at + 1 + " / " + ids.length : "";
steps.forEach(function (b) { b.hidden = ids.length < 2; });
};
vImg.addEventListener("load", place);
calWrap.addEventListener("click", function (e) {
const a = e.target.closest("a[data-images]");
if (!a || e.ctrlKey || e.metaKey || e.shiftKey || e.button) return; // Ctrl·가운데 클릭 = 예전처럼 새 탭
e.preventDefault();
ids = JSON.parse(a.dataset.images);
names = JSON.parse(a.dataset.names || "[]");
at = 0;
vCap.textContent = a.dataset.preview.replace(/ · \d+\/\d+$/, "");
vImg.alt = a.title;
load();
if (preview) preview.hidden = true;
viewer.showModal();
});
viewer.addEventListener("click", function (e) {
if (e.target === viewer || e.target.closest("[data-viewer-close]")) { viewer.close(); return; } // 바깥(배경) = 닫기
const step = e.target.closest("[data-step]");
if (step) { at = (at + Number(step.dataset.step) + ids.length) % ids.length; load(); return; }
if (e.target.closest("[data-rotate]")) { turn = (turn + 1) % 4; place(); }
});
}
// ── 달력: 날짜별 광고비 ──
document.addEventListener("click", async function (e) {
const b = e.target.closest("button[data-spend]");