Created
May 28, 2025 11:40
-
-
Save goranefbl/493ac57be483d0b5b518d8685a0a9d2d to your computer and use it in GitHub Desktop.
copy link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener('DOMContentLoaded', function () { | |
document.querySelectorAll('.wpgens-raf-simple-shortcode').forEach(function (el) { | |
el.addEventListener('click', function (e) { | |
e.preventDefault(); | |
const textToCopy = el.href; | |
navigator.clipboard.writeText(textToCopy).then(() => { | |
const originalText = el.textContent; | |
el.textContent = 'Copied!'; | |
setTimeout(() => { | |
el.textContent = originalText; | |
}, 2000); | |
}).catch(err => { | |
console.error('Failed to copy text: ', err); | |
}); | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment