// Function to copy the URL to the clipboard function copyUrlToClipboard() { const url = window.location.href; navigator.clipboard.writeText(url).then(() => { console.log("URL copied to clipboard:", url); shareMessageElement.style.display = "block"; setTimeout(() => shareMessageElement.style.display = "none", 5000); }).catch(error => console.error("Error copying URL to clipboard:", error)); } // Find elements with the attribute ap-social-share and attach event listener document.querySelector('[ap-social-share="url"]').addEventListener("click", copyUrlToClipboard); const shareMessageElement = document.querySelector('[ap-social-share="message"]');