Skip to content

Commit c8a255d

Browse files
Add copy feedback for User ID copy buttons
1 parent 1639c49 commit c8a255d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

script.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,16 @@ function handleGenerateUserIds() {
10151015

10161016
const btn = document.createElement("button");
10171017
btn.textContent = "Copy";
1018-
btn.addEventListener("click", () => copyToClipboard(id));
1018+
btn.addEventListener("click", async () => {
1019+
const ok = await copyToClipboard(id);
1020+
const prev = btn.textContent;
1021+
btn.textContent = ok ? "Copied!" : "Copy failed";
1022+
btn.disabled = true;
1023+
setTimeout(() => {
1024+
btn.textContent = prev;
1025+
btn.disabled = false;
1026+
}, 1500);
1027+
});
10191028

10201029
row.appendChild(span);
10211030
row.appendChild(btn);

0 commit comments

Comments
 (0)