diff --git a/frontend/javascript/code_snippets.js b/frontend/javascript/code_snippets.js index 0966f18..4ce8e5e 100644 --- a/frontend/javascript/code_snippets.js +++ b/frontend/javascript/code_snippets.js @@ -10,7 +10,7 @@ export function copyHeadingDirectLinks() { headings.forEach(function (heading) { const linkIcon = document.createElement('span'); - linkIcon.innerHTML = ''; + linkIcon.innerHTML = `` linkIcon.style.cursor = 'pointer'; linkIcon.style.position = 'relative'; linkIcon.style.left = '10px'; @@ -23,6 +23,15 @@ export function copyHeadingDirectLinks() { const id = heading.getAttribute('id'); const url = window.location.href.split('#')[0] + '#' + id; navigator.clipboard.writeText(url); + + // Replace the link icon with a checkmark icon + linkIcon.innerHTML = ` + ` + + // Automatically revert the checkmark to the link icon after 2 seconds + setTimeout(function () { + linkIcon.innerHTML = `` + }, 2000); }); heading.addEventListener('mouseover', function () {