From 07fa86a04f2dd04fab7f034cadd032867849099c Mon Sep 17 00:00:00 2001 From: KaiKimera Date: Mon, 29 Apr 2024 21:42:25 +0300 Subject: [PATCH] 2024-04-29 18:42:25 --- assets/js/system/modules/clipboard.code.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/assets/js/system/modules/clipboard.code.js b/assets/js/system/modules/clipboard.code.js index 27f432d..8ab01fb 100644 --- a/assets/js/system/modules/clipboard.code.js +++ b/assets/js/system/modules/clipboard.code.js @@ -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); } ); }