Skip to content

Commit

Permalink
2024-04-29 18:42:25
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiKimera committed Apr 29, 2024
1 parent d372d21 commit 07fa86a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions assets/js/system/modules/clipboard.code.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ const $clipboard = async ($selector) => {
return Array.from($line.childNodes).map($node => $node.textContent).join('');
});
const $text = $code.join('').replace(/\n{3,}/g, '\n\n');
const $icon = $button.firstElementChild.classList.value;

$button.addEventListener('click', ($e) => {
$e.preventDefault();
navigator.clipboard.writeText($text);
$button.firstElementChild.className = 'fas fa-check fa-fw';
setTimeout(() => {
$button.firstElementChild.className = $icon;
}, 1000);
}
);
}
Expand Down

0 comments on commit 07fa86a

Please sign in to comment.