Add category name and color to popup

This commit is contained in:
Ajay Ramachandran 2020-12-13 21:51:55 -05:00
parent 3f19506137
commit b6fd1f0804
2 changed files with 19 additions and 6 deletions

View file

@ -34,6 +34,13 @@
cursor: pointer;
}
.dot {
height: 10px;
width: 10px;
border-radius: 50%;
display: inline-block;
}
.sponsorTimesThanksForVotingText {
font-size: large;
}

View file

@ -340,9 +340,6 @@ async function runThePopup(messageListener?: MessageListener) {
PageElements.unwhitelistChannel.style.display = "unset";
PageElements.whitelistToggle.checked = true;
document.querySelectorAll('label > svg')[0].classList.add("rotated");
//PageElements.downloadedSponsorMessageTimes.innerText = chrome.i18n.getMessage("channelWhitelisted");
//PageElements.downloadedSponsorMessageTimes.style.fontWeight = "bold";
}
});
}
@ -412,9 +409,13 @@ async function runThePopup(messageListener?: MessageListener) {
//add them as buttons to the issue reporting container
let container = document.getElementById("issueReporterTimeButtons");
for (let i = 0; i < segmentTimes.length; i++) {
let UUID = segmentTimes[i].UUID;
let sponsorTimeButton = document.createElement("button");
sponsorTimeButton.className = "segmentTimeButton popupElement";
let prefix = chrome.i18n.getMessage("category_" + segmentTimes[i].category) + ": ";
let extraInfo = "";
if (segmentTimes[i].hidden === SponsorHideType.Downvoted) {
//this one is downvoted
@ -424,13 +425,17 @@ async function runThePopup(messageListener?: MessageListener) {
extraInfo = " (" + chrome.i18n.getMessage("hiddenDueToDuration") + ")";
}
sponsorTimeButton.innerText = getFormattedTime(segmentTimes[i].segment[0]) + " " + chrome.i18n.getMessage("to") + " " + getFormattedTime(segmentTimes[i].segment[1]) + extraInfo;
sponsorTimeButton.innerText = prefix + getFormattedTime(segmentTimes[i].segment[0]) + " " + chrome.i18n.getMessage("to") + " " + getFormattedTime(segmentTimes[i].segment[1]) + extraInfo;
let categoryColorCircle = document.createElement("span");
categoryColorCircle.id = "sponsorTimesCategoryColorCircle" + UUID;
categoryColorCircle.style.backgroundColor = Config.config.barTypes[segmentTimes[i].category].color;
categoryColorCircle.classList.add("dot");
categoryColorCircle.classList.add("sponsorTimesCategoryColorCircle");
let votingButtons = document.createElement("div");
votingButtons.classList.add("votingButtons");
let UUID = segmentTimes[i].UUID;
//thumbs up and down buttons
let voteButtonsContainer = document.createElement("div");
voteButtonsContainer.id = "sponsorTimesVoteButtonsContainer" + UUID;
@ -469,6 +474,7 @@ async function runThePopup(messageListener?: MessageListener) {
thanksForVotingText.classList.add("sponsorTimesThanksForVotingText");
voteStatusContainer.appendChild(thanksForVotingText);
votingButtons.append(categoryColorCircle);
votingButtons.append(sponsorTimeButton);
votingButtons.append(voteButtonsContainer);
votingButtons.append(voteStatusContainer);