diff --git a/src/main/resources/templates/shortform.html b/src/main/resources/templates/shortform.html index 7c2bee4..58acfea 100644 --- a/src/main/resources/templates/shortform.html +++ b/src/main/resources/templates/shortform.html @@ -78,6 +78,7 @@ let currentCategory = new URLSearchParams(location.search).get('category') === 'POLITICS' ? 'POLITICS' : 'ENTERTAINMENT'; let subtitlePollTimer = null; + const openJobIds = new Set(); async function api(path, opts) { const res = await fetch(path, Object.assign({ headers: { 'Content-Type': 'application/json' } }, opts)); @@ -132,6 +133,7 @@ e.stopPropagation(); if (!confirm('이 작업을 삭제할까요?')) return; await api('/api/shortform/jobs/' + id, { method: 'DELETE' }); + openJobIds.delete(id); loadJobs(); } @@ -146,8 +148,14 @@ } catch (err) { alert('되돌리기 실패: ' + err.message); } } - async function toggleJob(id, el) { - if (el.classList.contains('open')) { el.classList.remove('open'); return; } + async function toggleJob(id, el, restoreOpen = false) { + if (el.classList.contains('open')) { + if (!restoreOpen) { + el.classList.remove('open'); + openJobIds.delete(id); + } + return; + } const detail = await api('/api/shortform/jobs/' + id); const toolbar = `