diff --git a/src/main/resources/templates/shortform.html b/src/main/resources/templates/shortform.html index 07698cb..79d5b73 100644 --- a/src/main/resources/templates/shortform.html +++ b/src/main/resources/templates/shortform.html @@ -158,16 +158,10 @@ } const detail = await api('/api/shortform/jobs/' + id); const toolbar = `
- - + data-complete-on-copy>영상 URL 복사 + data-complete-on-copy ${detail.subtitleVtt ? '' : 'disabled'}>타임스탬프 자막 복사 ${detail.subtitleStatus === 'READY' || detail.subtitleStatus === 'COLLECTING' ? '' : ` `}
`; @@ -184,20 +178,25 @@ openJobIds.add(id); el.querySelectorAll('[data-copy]').forEach(btn => { const label = btn.dataset.label || 'capcut2 JSON 복사'; - btn.onclick = (e) => { + btn.onclick = async (e) => { e.stopPropagation(); - navigator.clipboard.writeText(decodeURIComponent(btn.dataset.copy)); - btn.textContent = '복사됨!'; - setTimeout(() => btn.textContent = label, 1200); + await navigator.clipboard.writeText(decodeURIComponent(btn.dataset.copy)); + if (btn.hasAttribute('data-complete-on-copy')) { + btn.textContent = '완료'; + btn.disabled = true; + } else { + btn.textContent = '복사됨!'; + setTimeout(() => btn.textContent = label, 1200); + } }; }); const subtitleButton = el.querySelector('[data-subtitle-copy]'); if (subtitleButton && detail.subtitleVtt) { - subtitleButton.onclick = (e) => { + subtitleButton.onclick = async (e) => { e.stopPropagation(); - navigator.clipboard.writeText(detail.subtitleVtt); - subtitleButton.textContent = '복사됨!'; - setTimeout(() => subtitleButton.textContent = '타임스탬프 자막 복사', 1200); + await navigator.clipboard.writeText(detail.subtitleVtt); + subtitleButton.textContent = '완료'; + subtitleButton.disabled = true; }; } } @@ -299,11 +298,11 @@ const button = card.querySelector('[data-subtitle-copy]'); if (!button || !detail.subtitleVtt) return; button.disabled = false; - button.onclick = (e) => { + button.onclick = async (e) => { e.stopPropagation(); - navigator.clipboard.writeText(detail.subtitleVtt); - button.textContent = '복사됨!'; - setTimeout(() => button.textContent = '타임스탬프 자막 복사', 1200); + await navigator.clipboard.writeText(detail.subtitleVtt); + button.textContent = '완료'; + button.disabled = true; }; }