mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 01:01:55 +01:00
Remove some redundant checks
This commit is contained in:
parent
b066945331
commit
d97d45ae14
1 changed files with 14 additions and 24 deletions
38
src/popup.ts
38
src/popup.ts
|
@ -146,17 +146,13 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
||||||
let currentVideoID = null;
|
let currentVideoID = null;
|
||||||
|
|
||||||
//show proper disable skipping button
|
//show proper disable skipping button
|
||||||
const disableSkipping = Config.config.disableSkipping;
|
if (Config.config.disableSkipping) {
|
||||||
if (disableSkipping != undefined && disableSkipping) {
|
|
||||||
PageElements.disableSkipping.style.display = "none";
|
PageElements.disableSkipping.style.display = "none";
|
||||||
PageElements.enableSkipping.style.display = "unset";
|
PageElements.enableSkipping.style.display = "unset";
|
||||||
PageElements.toggleSwitch.checked = false;
|
PageElements.toggleSwitch.checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the don't show notice again variable is true, an option to
|
if (Config.config.dontShowNotice) {
|
||||||
// disable should be available
|
|
||||||
const dontShowNotice = Config.config.dontShowNotice;
|
|
||||||
if (dontShowNotice != undefined && dontShowNotice) {
|
|
||||||
PageElements.showNoticeAgain.style.display = "unset";
|
PageElements.showNoticeAgain.style.display = "unset";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,29 +191,23 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the amount of times this user has skipped a sponsor
|
if (Config.config.skipCount != 1) {
|
||||||
if (Config.config.skipCount != undefined) {
|
PageElements.sponsorTimesSkipsDoneEndWord.innerText = chrome.i18n.getMessage("Segments");
|
||||||
if (Config.config.skipCount != 1) {
|
} else {
|
||||||
PageElements.sponsorTimesSkipsDoneEndWord.innerText = chrome.i18n.getMessage("Segments");
|
PageElements.sponsorTimesSkipsDoneEndWord.innerText = chrome.i18n.getMessage("Segment");
|
||||||
} else {
|
|
||||||
PageElements.sponsorTimesSkipsDoneEndWord.innerText = chrome.i18n.getMessage("Segment");
|
|
||||||
}
|
|
||||||
|
|
||||||
PageElements.sponsorTimesSkipsDoneDisplay.innerText = Config.config.skipCount.toLocaleString();
|
|
||||||
PageElements.sponsorTimesSkipsDoneContainer.style.display = "unset";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the amount of time this user has saved.
|
PageElements.sponsorTimesSkipsDoneDisplay.innerText = Config.config.skipCount.toLocaleString();
|
||||||
if (Config.config.minutesSaved != undefined) {
|
PageElements.sponsorTimesSkipsDoneContainer.style.display = "unset";
|
||||||
if (Config.config.minutesSaved != 1) {
|
|
||||||
PageElements.sponsorTimeSavedEndWord.innerText = chrome.i18n.getMessage("minsLower");
|
|
||||||
} else {
|
|
||||||
PageElements.sponsorTimeSavedEndWord.innerText = chrome.i18n.getMessage("minLower");
|
|
||||||
}
|
|
||||||
|
|
||||||
PageElements.sponsorTimeSavedDisplay.innerText = getFormattedHours(Config.config.minutesSaved);
|
if (Config.config.minutesSaved != 1) {
|
||||||
|
PageElements.sponsorTimeSavedEndWord.innerText = chrome.i18n.getMessage("minsLower");
|
||||||
|
} else {
|
||||||
|
PageElements.sponsorTimeSavedEndWord.innerText = chrome.i18n.getMessage("minLower");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PageElements.sponsorTimeSavedDisplay.innerText = getFormattedHours(Config.config.minutesSaved);
|
||||||
|
|
||||||
// Must be delayed so it only happens once loaded
|
// Must be delayed so it only happens once loaded
|
||||||
setTimeout(() => PageElements.sponsorblockPopup.classList.remove("preload"), 250);
|
setTimeout(() => PageElements.sponsorblockPopup.classList.remove("preload"), 250);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue