Merge pull request #650 from ajayyy/improvements

Improvements
This commit is contained in:
Ajay Ramachandran
2021-03-07 14:23:28 -05:00
committed by GitHub
5 changed files with 7 additions and 22 deletions

View File

@@ -517,7 +517,7 @@
"message": "Music: Non-Music Section" "message": "Music: Non-Music Section"
}, },
"category_music_offtopic_description": { "category_music_offtopic_description": {
"message": "Only for use in music videos. This includes introductions or outros in music videos." "message": "Only for use in music videos. This only should be used for sections of music videos that aren't already covered by another category."
}, },
"category_music_offtopic_short": { "category_music_offtopic_short": {
"message": "Non-Music" "message": "Non-Music"

View File

@@ -127,7 +127,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
render(): React.ReactElement { render(): React.ReactElement {
const noticeStyle: React.CSSProperties = { const noticeStyle: React.CSSProperties = {
zIndex: 50 + this.amountOfPreviousNotices zIndex: 1000 + this.amountOfPreviousNotices
} }
if (this.contentContainer().onMobileYouTube) { if (this.contentContainer().onMobileYouTube) {
noticeStyle.bottom = "4em"; noticeStyle.bottom = "4em";

View File

@@ -647,12 +647,12 @@ async function sponsorsLookup(id: string) {
sponsorLookupRetries = 0; sponsorLookupRetries = 0;
} else if (response?.status === 404) { } else if (response?.status === 404) {
retryFetch(id); retryFetch(id);
} else if (sponsorLookupRetries < 90 && !recheckStarted) { } else if (sponsorLookupRetries < 15 && !recheckStarted) {
recheckStarted = true; recheckStarted = true;
//TODO lower when server becomes better (back to 1 second) //TODO lower when server becomes better (back to 1 second)
//some error occurred, try again in a second //some error occurred, try again in a second
setTimeout(() => sponsorsLookup(id), 5000 + Math.random() * 15000); setTimeout(() => sponsorsLookup(id), 5000 + Math.random() * 15000 + 5000 * sponsorLookupRetries);
sponsorLookupRetries++; sponsorLookupRetries++;
} }
@@ -1281,7 +1281,7 @@ function openInfoMenu() {
const settings = <HTMLImageElement> popup.querySelector("#sbPopupIconSettings"); const settings = <HTMLImageElement> popup.querySelector("#sbPopupIconSettings");
const edit = <HTMLImageElement> popup.querySelector("#sbPopupIconEdit"); const edit = <HTMLImageElement> popup.querySelector("#sbPopupIconEdit");
const check = <HTMLImageElement> popup.querySelector("#sbPopupIconCheck"); const check = <HTMLImageElement> popup.querySelector("#sbPopupIconCheck");
logo.src = chrome.extension.getURL("icons/LogoSponsorBlocker256px.png"); logo.src = chrome.extension.getURL("icons/IconSponsorBlocker256px.png");
settings.src = chrome.extension.getURL("icons/settings.svg"); settings.src = chrome.extension.getURL("icons/settings.svg");
edit.src = chrome.extension.getURL("icons/pencil.svg"); edit.src = chrome.extension.getURL("icons/pencil.svg");
check.src = chrome.extension.getURL("icons/check.svg"); check.src = chrome.extension.getURL("icons/check.svg");

View File

@@ -396,7 +396,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
extraInfo = " (" + chrome.i18n.getMessage("hiddenDueToDuration") + ")"; extraInfo = " (" + chrome.i18n.getMessage("hiddenDueToDuration") + ")";
} }
sponsorTimeButton.innerText = prefix + getFormattedTime(segmentTimes[i].segment[0]) + " " + chrome.i18n.getMessage("to") + " " + getFormattedTime(segmentTimes[i].segment[1]) + extraInfo; sponsorTimeButton.innerText = prefix + utils.getFormattedTime(segmentTimes[i].segment[0], true) + " " + chrome.i18n.getMessage("to") + " " + utils.getFormattedTime(segmentTimes[i].segment[1], true) + extraInfo;
const categoryColorCircle = document.createElement("span"); const categoryColorCircle = document.createElement("span");
categoryColorCircle.id = "sponsorTimesCategoryColorCircle" + UUID; categoryColorCircle.id = "sponsorTimesCategoryColorCircle" + UUID;
@@ -595,21 +595,6 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
}); });
} }
//converts time in seconds to minutes:seconds
function getFormattedTime(seconds) {
const minutes = Math.floor(seconds / 60);
const secondsDisplayNumber = Math.round(seconds - minutes * 60);
let secondsDisplay = String(secondsDisplayNumber);
if (secondsDisplayNumber < 10) {
//add a zero
secondsDisplay = "0" + secondsDisplay;
}
const formatted = minutes + ":" + secondsDisplay;
return formatted;
}
function whitelistChannel() { function whitelistChannel() {
//get the channel url //get the channel url
messageHandler.query({ messageHandler.query({

View File

@@ -290,7 +290,7 @@ class Utils {
let errorMessage = ""; let errorMessage = "";
const postFix = (responseText ? "\n\n" + responseText : ""); const postFix = (responseText ? "\n\n" + responseText : "");
if([400, 429, 409, 502, 0].includes(statusCode)) { if([400, 429, 409, 502, 503, 0].includes(statusCode)) {
//treat them the same //treat them the same
if (statusCode == 503) statusCode = 502; if (statusCode == 503) statusCode = 502;