<script>
var linkIcon = document.getElementById('copy-post-link');
// Set cursor to hand shape on hover
linkIcon.addEventListener('mouseenter', function() {
linkIcon.style.cursor = 'pointer';
});
linkIcon.addEventListener('mouseleave', function() {
linkIcon.style.cursor = 'default'; // Reset cursor on mouse leave
});
linkIcon.addEventListener('click', function() {
// Create a temporary input element
var tempInput = document.createElement('input');
// Set its value to the post link
tempInput.value = window.location.href;
// Append it to the body
document.body.appendChild(tempInput);
// Select the input's text
tempInput.select();
// Copy the selected text
document.execCommand('copy');
// Remove the temporary input element
document.body.removeChild(tempInput);
// Provide some feedback to the user
alert('Post link copied to clipboard');
});
</script>