feat: update copy link functionality to include full URL
This commit is contained in:
@@ -149,13 +149,15 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
// 复制链接按钮点击事件
|
// 复制链接按钮点击事件
|
||||||
copyLinkButton.addEventListener('click', function() {
|
copyLinkButton.addEventListener('click', function() {
|
||||||
if (lastAudioUrl) {
|
if (lastAudioUrl) {
|
||||||
navigator.clipboard.writeText(lastAudioUrl).then(() => {
|
// 获取完整的URL,包括域名部分
|
||||||
|
const fullUrl = new URL(lastAudioUrl, window.location.origin).href;
|
||||||
|
navigator.clipboard.writeText(fullUrl).then(() => {
|
||||||
alert('链接已复制到剪贴板');
|
alert('链接已复制到剪贴板');
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('复制失败:', err);
|
console.error('复制失败:', err);
|
||||||
// 兼容处理
|
// 兼容处理
|
||||||
const textArea = document.createElement('textarea');
|
const textArea = document.createElement('textarea');
|
||||||
textArea.value = lastAudioUrl;
|
textArea.value = fullUrl;
|
||||||
document.body.appendChild(textArea);
|
document.body.appendChild(textArea);
|
||||||
textArea.focus();
|
textArea.focus();
|
||||||
textArea.select();
|
textArea.select();
|
||||||
|
|||||||
Reference in New Issue
Block a user