Add tooltips to vote buttons in popup

This commit is contained in:
Ajay
2022-04-22 22:17:25 -04:00
parent b075116502
commit 1a908b5038
2 changed files with 22 additions and 6 deletions

View File

@@ -164,6 +164,9 @@
"copyPublicID": { "copyPublicID": {
"message": "Copy Public UserID" "message": "Copy Public UserID"
}, },
"copySegmentID": {
"message": "Copy Segment ID"
},
"discordAdvert": { "discordAdvert": {
"message": "Come join the official discord server to give suggestions and feedback!" "message": "Come join the official discord server to give suggestions and feedback!"
}, },
@@ -879,6 +882,15 @@
"ChangeCategoryTooltip": { "ChangeCategoryTooltip": {
"message": "This will instantly apply to your segments" "message": "This will instantly apply to your segments"
}, },
"downvote": {
"message": "Downvote"
},
"upvote": {
"message": "Upvote"
},
"hideSegment": {
"message": "Hide segment"
},
"SponsorTimeEditScrollNewFeature": { "SponsorTimeEditScrollNewFeature": {
"message": "Use your mousewheel while hovering over the edit box to quickly adjust the time. Combinations of the ctrl or shift key can be used to fine tune the changes." "message": "Use your mousewheel while hovering over the edit box to quickly adjust the time. Combinations of the ctrl or shift key can be used to fine tune the changes."
}, },

View File

@@ -451,12 +451,14 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
const upvoteButton = document.createElement("img"); const upvoteButton = document.createElement("img");
upvoteButton.id = "sponsorTimesUpvoteButtonsContainer" + UUID; upvoteButton.id = "sponsorTimesUpvoteButtonsContainer" + UUID;
upvoteButton.className = "voteButton"; upvoteButton.className = "voteButton";
upvoteButton.title = chrome.i18n.getMessage("upvote");
upvoteButton.src = chrome.runtime.getURL("icons/thumbs_up.svg"); upvoteButton.src = chrome.runtime.getURL("icons/thumbs_up.svg");
upvoteButton.addEventListener("click", () => vote(1, UUID)); upvoteButton.addEventListener("click", () => vote(1, UUID));
const downvoteButton = document.createElement("img"); const downvoteButton = document.createElement("img");
downvoteButton.id = "sponsorTimesDownvoteButtonsContainer" + UUID; downvoteButton.id = "sponsorTimesDownvoteButtonsContainer" + UUID;
downvoteButton.className = "voteButton"; downvoteButton.className = "voteButton";
downvoteButton.title = chrome.i18n.getMessage("downvote");
downvoteButton.src = locked && isVip ? chrome.runtime.getURL("icons/thumbs_down_locked.svg") : chrome.runtime.getURL("icons/thumbs_down.svg"); downvoteButton.src = locked && isVip ? chrome.runtime.getURL("icons/thumbs_down_locked.svg") : chrome.runtime.getURL("icons/thumbs_down.svg");
downvoteButton.addEventListener("click", () => vote(0, UUID)); downvoteButton.addEventListener("click", () => vote(0, UUID));
@@ -464,6 +466,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
uuidButton.id = "sponsorTimesCopyUUIDButtonContainer" + UUID; uuidButton.id = "sponsorTimesCopyUUIDButtonContainer" + UUID;
uuidButton.className = "voteButton"; uuidButton.className = "voteButton";
uuidButton.src = chrome.runtime.getURL("icons/clipboard.svg"); uuidButton.src = chrome.runtime.getURL("icons/clipboard.svg");
uuidButton.title = chrome.i18n.getMessage("copySegmentID");
uuidButton.addEventListener("click", () => { uuidButton.addEventListener("click", () => {
navigator.clipboard.writeText(UUID); navigator.clipboard.writeText(UUID);
const stopAnimation = AnimationUtils.applyLoadingAnimation(uuidButton, 0.3); const stopAnimation = AnimationUtils.applyLoadingAnimation(uuidButton, 0.3);
@@ -473,6 +476,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
const hideButton = document.createElement("img"); const hideButton = document.createElement("img");
hideButton.id = "sponsorTimesCopyUUIDButtonContainer" + UUID; hideButton.id = "sponsorTimesCopyUUIDButtonContainer" + UUID;
hideButton.className = "voteButton"; hideButton.className = "voteButton";
hideButton.title = chrome.i18n.getMessage("hideSegment");
if (segmentTimes[i].hidden === SponsorHideType.Hidden) { if (segmentTimes[i].hidden === SponsorHideType.Hidden) {
hideButton.src = chrome.runtime.getURL("icons/not_visible.svg"); hideButton.src = chrome.runtime.getURL("icons/not_visible.svg");
} else { } else {