diff --git a/assets/javascripts/copy.js b/assets/javascripts/copy.js index 801694d..0f4dfe5 100644 --- a/assets/javascripts/copy.js +++ b/assets/javascripts/copy.js @@ -18,7 +18,14 @@ async function handleCopy(event) { // 5. Reset after 2 seconds setTimeout(() => { - link.innerText = originalText; + // Check if the text is long enough to prevent errors + if (originalText.length >= 8) { + const firstPart = originalText.slice(0, -8); + const lastEight = originalText.slice(-8); + link.innerHTML = `${firstPart}${lastEight}`; + } else { + link.innerText = originalText; + } link.style.color = ""; }, 2000);