Skip to content

Commit

Permalink
Make copy button in popup use full segment ID
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Jan 18, 2025
1 parent b81de96 commit 2cefb98
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,22 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
uuidButton.className = "voteButton";
uuidButton.src = chrome.runtime.getURL("icons/clipboard.svg");
uuidButton.title = chrome.i18n.getMessage("copySegmentID");
uuidButton.addEventListener("click", () => {
copyToClipboard(UUID);
uuidButton.addEventListener("click", async () => {
const stopAnimation = AnimationUtils.applyLoadingAnimation(uuidButton, 0.3);

if (UUID.length > 60) {
copyToClipboard(UUID);
} else {
const segmentIDData = await asyncRequestToServer("GET", "/api/segmentID", {
UUID: UUID,
videoID: currentVideoID
});

if (segmentIDData.ok && segmentIDData.responseText) {
copyToClipboard(segmentIDData.responseText);
}
}

stopAnimation();
});

Expand Down

0 comments on commit 2cefb98

Please sign in to comment.