This commit is contained in:
parent
23f6ee7c86
commit
e3950b61fd
34
src/index.ts
34
src/index.ts
|
@ -212,25 +212,21 @@ export default function killTheNewsletter(
|
||||||
for (const copyable of document.querySelectorAll(".copyable"))
|
for (const copyable of document.querySelectorAll(".copyable"))
|
||||||
copyable.insertAdjacentHTML(
|
copyable.insertAdjacentHTML(
|
||||||
"afterend",
|
"afterend",
|
||||||
$${"`"}
|
$${"`"}$${html`<br />
|
||||||
$${html`
|
<button
|
||||||
<br />
|
type="button"
|
||||||
<button
|
onclick="${javascript`
|
||||||
type="button"
|
(async () => {
|
||||||
onclick="${javascript`
|
await navigator.clipboard.writeText("\${copyable.textContent}");
|
||||||
(async () => {
|
const originalTextContent = this.textContent;
|
||||||
await navigator.clipboard.writeText("\${copyable.textContent}");
|
this.textContent = "Copied";
|
||||||
const originalTextContent = this.textContent;
|
await new Promise(resolve => window.setTimeout(resolve, 500));
|
||||||
this.textContent = "Copied";
|
this.textContent = originalTextContent;
|
||||||
await new Promise(resolve => window.setTimeout(resolve, 500));
|
})();
|
||||||
this.textContent = originalTextContent;
|
`}"
|
||||||
})();
|
>
|
||||||
`}"
|
Copy
|
||||||
>
|
</button>`}$${"`"}
|
||||||
Copy
|
|
||||||
</button>
|
|
||||||
`}
|
|
||||||
$${"`"}
|
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue