mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 14:07:13 +03:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3da6c8643 | ||
|
|
136f5e7d61 | ||
|
|
16f24978ff | ||
|
|
091d67e6b3 | ||
|
|
fcf9bdc68e | ||
|
|
af73aabbae | ||
|
|
778b433ad4 | ||
|
|
dc9c08f1fa | ||
|
|
4efa8b464e | ||
|
|
e7d0180e15 | ||
|
|
0fa24dbae4 | ||
|
|
975b876a74 | ||
|
|
557e2ea2df |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "__MSG_fullName__",
|
||||
"short_name": "SponsorBlock",
|
||||
"version": "5.10.2",
|
||||
"version": "5.10.5",
|
||||
"default_locale": "en",
|
||||
"description": "__MSG_Description__",
|
||||
"homepage_url": "https://sponsor.ajay.app",
|
||||
|
||||
Submodule public/_locales updated: 1b7ef51703...5ad4918d9d
@@ -88,7 +88,7 @@ div:hover > #previewbar.sbNotInvidious {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.ytp-tooltip.sponsorCategoryTooltipVisible {
|
||||
.ytp-tooltip.sponsorCategoryTooltipVisible:not(.sponsorTooltipHasYTChapters) {
|
||||
transform: translateY(-1em) !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,20 +154,6 @@
|
||||
<div class="small-description">__MSG_whatForceChannelCheck__</div>
|
||||
</div>
|
||||
|
||||
<div data-type="toggle" data-sync="refetchWhenNotFound">
|
||||
<div class="switch-container">
|
||||
<label class="switch">
|
||||
<input id="refetchWhenNotFound" type="checkbox" checked>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<label class="switch-label" for="refetchWhenNotFound">
|
||||
__MSG_enableRefetchWhenNotFound__
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="small-description">__MSG_whatRefetchWhenNotFound__</div>
|
||||
</div>
|
||||
|
||||
<div data-type="toggle" data-sync="showCategoryWithoutPermission">
|
||||
<div class="switch-container">
|
||||
<label class="switch">
|
||||
|
||||
@@ -669,7 +669,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
const skipButtonStates = this.state.skipButtonStates;
|
||||
const skipButtonCallbacks = this.state.skipButtonCallbacks;
|
||||
if (buttonIndex === null) {
|
||||
for (let i = 0; i < this.segments.length; i++) {
|
||||
for (let i = 0; i < skipButtonStates.length; i++) {
|
||||
skipButtonStates[i] = skipButtonState;
|
||||
skipButtonCallbacks[i] = this.reskip.bind(this);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ interface SBConfig {
|
||||
audioNotificationOnSkip: boolean;
|
||||
checkForUnlistedVideos: boolean;
|
||||
testingServer: boolean;
|
||||
refetchWhenNotFound: boolean;
|
||||
ytInfoPermissionGranted: boolean;
|
||||
allowExpirements: boolean;
|
||||
showDonationLink: boolean;
|
||||
@@ -312,7 +311,6 @@ const syncDefaults = {
|
||||
audioNotificationOnSkip: false,
|
||||
checkForUnlistedVideos: false,
|
||||
testingServer: false,
|
||||
refetchWhenNotFound: true,
|
||||
ytInfoPermissionGranted: false,
|
||||
allowExpirements: true,
|
||||
showDonationLink: true,
|
||||
|
||||
@@ -80,7 +80,6 @@ let importingChaptersWaiting = false;
|
||||
const skipNotices: SkipNotice[] = [];
|
||||
let upcomingNotice: UpcomingNotice | null = null;
|
||||
let activeSkipKeybindElement: ToggleSkippable = null;
|
||||
let retryFetchTimeout: NodeJS.Timeout = null;
|
||||
let shownSegmentFailedToFetchWarning = false;
|
||||
let selectedSegment: SegmentUUID | null = null;
|
||||
let previewedSegment = false;
|
||||
@@ -173,7 +172,6 @@ let popupInitialised = false;
|
||||
let submissionNotice: SubmissionNotice = null;
|
||||
|
||||
let lastResponseStatus: number;
|
||||
let retryCount = 0;
|
||||
|
||||
// Contains all of the functions and variables needed by the skip notice
|
||||
const skipNoticeContentContainer: ContentContainer = () => ({
|
||||
@@ -391,7 +389,6 @@ if (!Config.configSyncListeners.includes(contentConfigUpdateListener)) {
|
||||
function resetValues() {
|
||||
lastCheckTime = 0;
|
||||
lastCheckVideoTime = -1;
|
||||
retryCount = 0;
|
||||
previewedSegment = false;
|
||||
firstPlay = true;
|
||||
|
||||
@@ -519,7 +516,7 @@ function handleMobileControlsMutations(): void {
|
||||
function getPreviewBarAttachElement(): HTMLElement | null {
|
||||
const progressElementOptions = [{
|
||||
// For newer mobile YouTube (Sept 2024)
|
||||
selector: ".YtProgressBarLineHost, .YtChapteredProgressBarHost",
|
||||
selector: ".ytChapteredProgressBarHost, .ytProgressBarLineHost, .YtProgressBarLineHost, .YtChapteredProgressBarHost",
|
||||
isVisibleCheck: true
|
||||
}, {
|
||||
// For newer mobile YouTube (May 2024)
|
||||
@@ -1241,11 +1238,7 @@ async function sponsorsLookup(keepOldSubmissions = true, ignoreCache = false) {
|
||||
if (!isNaN(getVideoDuration())) {
|
||||
updatePreviewBar();
|
||||
}
|
||||
} else {
|
||||
retryFetch(404);
|
||||
}
|
||||
} else {
|
||||
retryFetch(lastResponseStatus);
|
||||
}
|
||||
|
||||
importExistingChapters(true);
|
||||
@@ -1312,27 +1305,6 @@ async function lockedCategoriesLookup(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function retryFetch(errorCode: number): void {
|
||||
sponsorDataFound = false;
|
||||
if (!Config.config.refetchWhenNotFound) return;
|
||||
|
||||
if (retryFetchTimeout) clearTimeout(retryFetchTimeout);
|
||||
if ((errorCode !== 404 && retryCount > 1) || (errorCode !== 404 && retryCount > 10)) {
|
||||
// Too many errors (50x), give up
|
||||
return;
|
||||
}
|
||||
|
||||
retryCount++;
|
||||
|
||||
const delay = errorCode === 404 ? (30000 + Math.random() * 30000) : (2000 + Math.random() * 10000);
|
||||
retryFetchTimeout = setTimeout(() => {
|
||||
if (getVideoID() && sponsorTimes?.length === 0
|
||||
|| sponsorTimes.every((segment) => segment.source !== SponsorSourceType.Server)) {
|
||||
// sponsorsLookup();
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only should be used when it is okay to skip a sponsor when in the middle of it
|
||||
*
|
||||
@@ -2694,7 +2666,7 @@ function showTimeWithoutSkips(skippedDuration: number): void {
|
||||
// YouTube player time display
|
||||
const selector =
|
||||
isOnInvidious() ? ".vjs-duration" :
|
||||
isOnMobileYouTube() ? ".YtwPlayerTimeDisplayContent" :
|
||||
isOnMobileYouTube() ? ".ytwPlayerTimeDisplayContent" :
|
||||
".ytp-time-display.notranslate .ytp-time-wrapper";
|
||||
const display = document.querySelector(selector);
|
||||
if (!display) return;
|
||||
|
||||
@@ -52,6 +52,7 @@ class PreviewBar {
|
||||
progressBar: HTMLElement;
|
||||
|
||||
segments: PreviewBarSegment[] = [];
|
||||
hasYouTubeChapters = false;
|
||||
existingChapters: PreviewBarSegment[] = [];
|
||||
videoDuration = 0;
|
||||
updateExistingChapters: () => void;
|
||||
@@ -136,7 +137,7 @@ class PreviewBar {
|
||||
|
||||
// Find the segment at that location, using the shortest if multiple found
|
||||
const [normalSegments, chapterSegments] =
|
||||
partition(this.segments.filter((s) => s.source !== SponsorSourceType.YouTube),
|
||||
partition(this.segments,
|
||||
(segment) => segment.actionType !== ActionType.Chapter);
|
||||
let mainSegment = this.getSmallestSegment(timeInSeconds, normalSegments, "normal");
|
||||
let secondarySegment = this.getSmallestSegment(timeInSeconds, chapterSegments, "chapter");
|
||||
@@ -145,13 +146,28 @@ class PreviewBar {
|
||||
secondarySegment = this.getSmallestSegment(timeInSeconds, chapterSegments.filter((s) => s !== secondarySegment));
|
||||
}
|
||||
|
||||
const hasAYouTubeChapterRemoved = this.hasYouTubeChapters
|
||||
|| (!Config.config.showAutogeneratedChapters && hasAutogeneratedChapters());
|
||||
if (hasAYouTubeChapterRemoved) {
|
||||
// Hide original tooltip if some chapter has been filtered out
|
||||
originalTooltip.style.display = "none";
|
||||
noYoutubeChapters = true;
|
||||
|
||||
originalTooltip.classList.add("sponsorTooltipHasYTChapters");
|
||||
} else {
|
||||
originalTooltip.classList.remove("sponsorTooltipHasYTChapters");
|
||||
}
|
||||
|
||||
if (mainSegment === null && secondarySegment === null) {
|
||||
this.categoryTooltipContainer.classList.remove(TOOLTIP_VISIBLE_CLASS);
|
||||
originalTooltip.style.removeProperty("display");
|
||||
if (!hasAYouTubeChapterRemoved) {
|
||||
this.categoryTooltipContainer.classList.remove(TOOLTIP_VISIBLE_CLASS);
|
||||
originalTooltip.style.removeProperty("display");
|
||||
}
|
||||
} else {
|
||||
this.categoryTooltipContainer.classList.add(TOOLTIP_VISIBLE_CLASS);
|
||||
if (mainSegment !== null && secondarySegment !== null) {
|
||||
this.categoryTooltipContainer.classList.add("sponsorTwoTooltips");
|
||||
originalTooltip.classList.remove("sponsorTooltipHasYTChapters");
|
||||
} else {
|
||||
this.categoryTooltipContainer.classList.remove("sponsorTwoTooltips");
|
||||
}
|
||||
@@ -172,16 +188,16 @@ class PreviewBar {
|
||||
originalTooltip.style.removeProperty("display");
|
||||
}
|
||||
|
||||
// Used to prevent overlapping
|
||||
this.categoryTooltip.classList.toggle("ytp-tooltip-text-no-title", noYoutubeChapters);
|
||||
this.chapterTooltip.classList.toggle("ytp-tooltip-text-no-title", noYoutubeChapters);
|
||||
|
||||
// To prevent offset issue
|
||||
this.categoryTooltip.style.right = titleTooltip.style.right;
|
||||
this.chapterTooltip.style.right = titleTooltip.style.right;
|
||||
this.categoryTooltip.style.textAlign = titleTooltip.style.textAlign;
|
||||
this.chapterTooltip.style.textAlign = titleTooltip.style.textAlign;
|
||||
}
|
||||
|
||||
// Used to prevent overlapping
|
||||
this.categoryTooltip.classList.toggle("ytp-tooltip-text-no-title", noYoutubeChapters);
|
||||
this.chapterTooltip.classList.toggle("ytp-tooltip-text-no-title", noYoutubeChapters);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -232,6 +248,7 @@ class PreviewBar {
|
||||
set(segments: PreviewBarSegment[], videoDuration: number): void {
|
||||
this.segments = segments ?? [];
|
||||
this.videoDuration = videoDuration ?? 0;
|
||||
this.hasYouTubeChapters = segments.some((segment) => segment.source === SponsorSourceType.YouTube);
|
||||
|
||||
// Remove unnecessary original chapters if submitted replacements exist
|
||||
for (const chapter of this.segments.filter((s) => s.actionType === ActionType.Chapter && s.source === SponsorSourceType.Server)) {
|
||||
|
||||
Reference in New Issue
Block a user