diff options
author | Ajay <[email protected]> | 2022-03-10 10:23:35 -0500 |
---|---|---|
committer | Ajay <[email protected]> | 2022-03-10 10:23:35 -0500 |
commit | c76f241b636e894a66d926fa582ca52f9c225aea (patch) | |
tree | 1fe539d010492ae0c959508b22159c77b7b15403 | |
parent | 54013681ef5365669fcabc8c95ff0de76419c441 (diff) | |
download | SponsorBlock-c76f241b636e894a66d926fa582ca52f9c225aea.tar.gz SponsorBlock-c76f241b636e894a66d926fa582ca52f9c225aea.zip |
Formatting
-rw-r--r-- | src/popup.ts | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/popup.ts b/src/popup.ts index bd743605..a6b1ff44 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -169,30 +169,33 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { utils.sendRequestToServer("GET", "/api/userInfo?value=userName&value=viewCount&value=minutesSaved&userID=" + Config.config.userID, (res) => { if (res.status === 200) { - const userInfo = JSON.parse(res.responseText) - PageElements.usernameValue.innerText = userInfo.userName - const viewCount = userInfo.viewCount + const userInfo = JSON.parse(res.responseText); + PageElements.usernameValue.innerText = userInfo.userName; + + const viewCount = userInfo.viewCount; if (viewCount != 0) { if (viewCount > 1) { - PageElements.sponsorTimesViewsDisplayEndWord.innerText = chrome.i18n.getMessage("Segments") + PageElements.sponsorTimesViewsDisplayEndWord.innerText = chrome.i18n.getMessage("Segments"); } else { - PageElements.sponsorTimesViewsDisplayEndWord.innerText = chrome.i18n.getMessage("Segment") + PageElements.sponsorTimesViewsDisplayEndWord.innerText = chrome.i18n.getMessage("Segment"); } - PageElements.sponsorTimesViewsDisplay.innerText = viewCount.toLocaleString() - PageElements.sponsorTimesViewsContainer.style.display = "unset" + PageElements.sponsorTimesViewsDisplay.innerText = viewCount.toLocaleString(); + PageElements.sponsorTimesViewsContainer.style.display = "unset"; } - showDonateWidget(viewCount) - const minutesSaved = userInfo.minutesSaved + + showDonateWidget(viewCount); + + const minutesSaved = userInfo.minutesSaved; if (minutesSaved != 0) { if (minutesSaved != 1) { - PageElements.sponsorTimesOthersTimeSavedEndWord.innerText = chrome.i18n.getMessage("minsLower") + PageElements.sponsorTimesOthersTimeSavedEndWord.innerText = chrome.i18n.getMessage("minsLower"); } else { - PageElements.sponsorTimesOthersTimeSavedEndWord.innerText = chrome.i18n.getMessage("minLower") + PageElements.sponsorTimesOthersTimeSavedEndWord.innerText = chrome.i18n.getMessage("minLower"); } - PageElements.sponsorTimesOthersTimeSavedDisplay.innerText = getFormattedHours(minutesSaved) + PageElements.sponsorTimesOthersTimeSavedDisplay.innerText = getFormattedHours(minutesSaved); } } - }) + }); //get the amount of times this user has contributed and display it to thank them if (Config.config.sponsorTimesContributed != undefined) { |