mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +03:00
Formatting
This commit is contained in:
29
src/popup.ts
29
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) => {
|
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user