From 54a105acc861b3fce2973a61ce335aedbb0caf93 Mon Sep 17 00:00:00 2001 From: "Parsa Yazdani (Quix)" Date: Sun, 9 Mar 2025 21:30:26 +1100 Subject: [PATCH] JS share API --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index d5c9cb2..2c8dae1 100644 --- a/index.html +++ b/index.html @@ -731,9 +731,9 @@ async function submitVote(proposalId, voteType, isPetition = false, petitionDeta } if (shareButton) { - shareButton.addEventListener('click', () => { - // Copy the shareable link to clipboard - copyToClipboard(getShareableLink(proposal.id)); + shareButton.addEventListener('click', async () => { + if ('share' in navigator) await navigator.share({ title: 'What do you think?', text: proposal.text, url: getShareableLink(proposal.id) }); + else copyToClipboard(getShareableLink(proposal.id)); }); } });