Formatting

This commit is contained in:
Ajay
2022-03-10 10:23:35 -05:00
parent 54013681ef
commit c76f241b63

View File

@@ -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) => { utils.sendRequestToServer("GET", "/api/userInfo?value=userName&value=viewCount&value=minutesSaved&userID=" + Config.config.userID, (res) => {
if (res.status === 200) { if (res.status === 200) {
const userInfo = JSON.parse(res.responseText) const userInfo = JSON.parse(res.responseText);
PageElements.usernameValue.innerText = userInfo.userName PageElements.usernameValue.innerText = userInfo.userName;
const viewCount = userInfo.viewCount
const viewCount = userInfo.viewCount;
if (viewCount != 0) { if (viewCount != 0) {
if (viewCount > 1) { if (viewCount > 1) {
PageElements.sponsorTimesViewsDisplayEndWord.innerText = chrome.i18n.getMessage("Segments") PageElements.sponsorTimesViewsDisplayEndWord.innerText = chrome.i18n.getMessage("Segments");
} else { } else {
PageElements.sponsorTimesViewsDisplayEndWord.innerText = chrome.i18n.getMessage("Segment") PageElements.sponsorTimesViewsDisplayEndWord.innerText = chrome.i18n.getMessage("Segment");
} }
PageElements.sponsorTimesViewsDisplay.innerText = viewCount.toLocaleString() PageElements.sponsorTimesViewsDisplay.innerText = viewCount.toLocaleString();
PageElements.sponsorTimesViewsContainer.style.display = "unset" PageElements.sponsorTimesViewsContainer.style.display = "unset";
} }
showDonateWidget(viewCount)
const minutesSaved = userInfo.minutesSaved showDonateWidget(viewCount);
const minutesSaved = userInfo.minutesSaved;
if (minutesSaved != 0) { if (minutesSaved != 0) {
if (minutesSaved != 1) { if (minutesSaved != 1) {
PageElements.sponsorTimesOthersTimeSavedEndWord.innerText = chrome.i18n.getMessage("minsLower") PageElements.sponsorTimesOthersTimeSavedEndWord.innerText = chrome.i18n.getMessage("minsLower");
} else { } 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 //get the amount of times this user has contributed and display it to thank them
if (Config.config.sponsorTimesContributed != undefined) { if (Config.config.sponsorTimesContributed != undefined) {