feat: 정치 피드 URL 복사 버튼 추가
This commit is contained in:
parent
f47e07a9e8
commit
74350afc38
@ -629,6 +629,11 @@
|
|||||||
aria-label="재가공 스튜디오에서 열기">
|
aria-label="재가공 스튜디오에서 열기">
|
||||||
<i data-lucide="wand-2" style="width:16px;"></i>
|
<i data-lucide="wand-2" style="width:16px;"></i>
|
||||||
</a>`}
|
</a>`}
|
||||||
|
${FEED_TOPIC === 'POLITICS' ? `
|
||||||
|
<button class="icon-btn" title="영상 URL 복사" aria-label="영상 URL 복사"
|
||||||
|
onclick="copyVideoUrl('${esc(it.videoId)}')">
|
||||||
|
<i data-lucide="copy" style="width:16px;"></i>
|
||||||
|
</button>` : ''}
|
||||||
<button class="icon-btn${it.bookmarked ? ' on' : ''}" title="북마크"
|
<button class="icon-btn${it.bookmarked ? ' on' : ''}" title="북마크"
|
||||||
aria-label="북마크" aria-pressed="${it.bookmarked}"
|
aria-label="북마크" aria-pressed="${it.bookmarked}"
|
||||||
onclick="toggleBookmark(${it.id}, ${!!it.bookmarked})">
|
onclick="toggleBookmark(${it.id}, ${!!it.bookmarked})">
|
||||||
@ -755,6 +760,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function copyVideoUrl(videoId){
|
||||||
|
const url = 'https://www.youtube.com/watch?v=' + videoId;
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(url);
|
||||||
|
toast('영상 URL을 복사했습니다');
|
||||||
|
} catch(e) {
|
||||||
|
const input = document.createElement('textarea');
|
||||||
|
input.value = url;
|
||||||
|
input.setAttribute('readonly', '');
|
||||||
|
input.style.position = 'fixed';
|
||||||
|
input.style.opacity = '0';
|
||||||
|
document.body.appendChild(input);
|
||||||
|
input.select();
|
||||||
|
const copied = document.execCommand('copy');
|
||||||
|
input.remove();
|
||||||
|
toast(copied ? '영상 URL을 복사했습니다' : 'URL 복사에 실패했습니다', !copied);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---------- 카드 액션 ----------
|
// ---------- 카드 액션 ----------
|
||||||
async function toggleBookmark(id, current){
|
async function toggleBookmark(id, current){
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user