Files

17 lines
723 B
JavaScript
Raw Permalink Normal View History

/* Subscription URLs are credentials: no logging, analytics or network calls. */
document.querySelectorAll('[data-copy-target]').forEach(function (button) {
button.addEventListener('click', async function () {
const input = document.getElementById(button.dataset.copyTarget);
const feedback = document.getElementById('copy-feedback');
if (!input) return;
try {
await navigator.clipboard.writeText(input.value);
if (feedback) feedback.textContent = '已复制订阅地址,请勿转发给他人。';
} catch (_) {
input.focus();
input.select();
if (feedback) feedback.textContent = '浏览器未允许自动复制,已选中地址,请手动复制。';
}
});
});