diff options
author | Ajay Ramachandran <[email protected]> | 2021-09-01 13:15:15 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2021-09-01 13:15:15 -0400 |
commit | 681eb61763ce28889a92e5a3db7af528996f38be (patch) | |
tree | 6183d9a6a37b0f545b2fa9583d486b17e1f8f181 | |
parent | 71cf9888e8891e215d3f03a3963afb4f9ceb34f4 (diff) | |
download | SponsorBlock-681eb61763ce28889a92e5a3db7af528996f38be.tar.gz SponsorBlock-681eb61763ce28889a92e5a3db7af528996f38be.zip |
Fix highlight appearing as two timestamps in popup
-rw-r--r-- | src/popup.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/popup.ts b/src/popup.ts index 95ca2896..280d07c2 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -1,9 +1,10 @@ import Config from "./config"; import Utils from "./utils"; -import { SponsorTime, SponsorHideType } from "./types"; +import { SponsorTime, SponsorHideType, CategoryActionType } from "./types"; import { Message, MessageResponse } from "./messageTypes"; import { showDonationLink } from "./utils/configUtils"; +import { getCategoryActionType } from "./utils/categoryUtils"; const utils = new Utils(); interface MessageListener { @@ -403,7 +404,10 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { const textNode = document.createTextNode(utils.shortCategoryName(segmentTimes[i].category) + extraInfo); const segmentTimeFromToNode = document.createElement("div"); - segmentTimeFromToNode.innerText = utils.getFormattedTime(segmentTimes[i].segment[0], true) + " " + chrome.i18n.getMessage("to") + " " + utils.getFormattedTime(segmentTimes[i].segment[1], true); + segmentTimeFromToNode.innerText = utils.getFormattedTime(segmentTimes[i].segment[0], true) + + (getCategoryActionType(segmentTimes[i].category) !== CategoryActionType.POI + ? " " + chrome.i18n.getMessage("to") + " " + utils.getFormattedTime(segmentTimes[i].segment[1], true) + : ""); segmentTimeFromToNode.style.margin = "5px"; sponsorTimeButton.appendChild(categoryColorCircle); |