From 73645b029c25150628d19c4c2ac4b7b0a46a7b65 Mon Sep 17 00:00:00 2001 From: Omar Najjar Date: Wed, 30 Apr 2025 19:57:56 +1000 Subject: [PATCH] x --- index.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/index.html b/index.html index a5994a7..b657bda 100644 --- a/index.html +++ b/index.html @@ -772,6 +772,30 @@ async function safeFetch(url, options = {}) { showErrorMessage('Failed to load petitions. Please check the console for details.', true); } } +// Function to initialize share buttons +function initializeShareButtons() { + console.log("Initializing share buttons"); + + // Find any elements with a share function and add event listeners + const shareButtons = document.querySelectorAll('.custom-copy-button'); + if (shareButtons.length > 0) { + shareButtons.forEach(button => { + const proposalId = button.getAttribute('data-id'); + button.addEventListener('click', (e) => { + e.preventDefault(); + e.stopPropagation(); + // If you have a smartCopyShare function, use it + if (typeof smartCopyShare === 'function') { + smartCopyShare(proposalId); + } else { + // Fallback to basic copy + const link = getShareableLink(proposalId); + copyToClipboard(link); + } + }); + }); + } +} // Function to render all proposals function renderProposals(response) {