fixed copylink

This commit is contained in:
Omar Najjar 2025-03-10 19:31:55 +11:00
parent 116ad1ef88
commit c8a98f0ac5

View file

@ -93,6 +93,23 @@
</div>
<script>
function onlyCopyLink(proposalId) {
// Get the link to share
const link = getShareableLink(proposalId);
// Copy to clipboard
navigator.clipboard.writeText(link)
.then(() => {
// Success message
showToastMessage('Link copied to clipboard!', '#11cc77');
console.log('Link copied:', link);
})
.catch(err => {
// Error message
console.error('Failed to copy link:', err);
showToastMessage('Failed to copy link', '#ff0099');
});
}
// Configuration
const API_BASE_URL = 'https://radical.omar-c29.workers.dev/api'; // Replace with your actual worker URL
@ -707,11 +724,10 @@ async function submitVote(proposalId, voteType, isPetition = false, petitionDeta
<span class="vote-icon"></span>
<span>${proposal.downvotes || 0}</span>
</button>
<span class="net-votes ${voteClass}">${netVotes > 0 ? '+' : ''}${netVotes}</span>
<button class="share-button" data-proposal-id="${proposal.id}" style="background-color: #000000; border: 0px solid #333333; color: #aaaaaa; padding: 4px 8px; font-size: 20px;" onclick="event.stopPropagation(); event.preventDefault();" >
<img src="https://radical.omar-c29.workers.dev/memes/share-arrow-icon-md.png" alt="Share" class="share-icon" style="width: 20px; height: 14px; filter: brightness(0) invert(1);">
</button>
<span class="net-votes ${voteClass}">${netVotes > 0 ? '+' : ''}${netVotes}</span>
<div class="custom-copy-button" data-id="${proposal.id}" style="display: inline-block; background-color: #000000; border: 0px solid #333333; color: #aaaaaa; padding: 4px 8px; font-size: 20px; position: relative; z-index: 10; cursor: pointer; vertical-align: middle;" onclick="event.stopPropagation(); event.preventDefault(); onlyCopyLink('${proposal.id}');">
<img src="https://radical.omar-c29.workers.dev/memes/share-arrow-icon-md.png" alt="Copy Link" style="width: 20px; height: 14px; filter: brightness(0) invert(1); pointer-events: none;">
</div>
</div>
<div class="proposal-time">${formatDate(proposal.timestamp)}</div>
</div>
@ -1974,6 +1990,7 @@ function submitComment(proposalId, commentText) {
showToastMessage('Failed to post comment', '#ff0099');
});
}
</script>
<div class="music-prompt" id="music-prompt">hit me</div>