mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 12:07:11 +03:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6de1a58d88 | ||
|
|
43a9ba0f9e | ||
|
|
c3489e54a6 | ||
|
|
75c003b204 | ||
|
|
da5de43121 | ||
|
|
d20a44751c | ||
|
|
15706fd3c4 | ||
|
|
a9e43f95f5 | ||
|
|
11fe87a09e | ||
|
|
52741b2c0a | ||
|
|
09b18a4f6d |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "__MSG_fullName__",
|
||||
"short_name": "SponsorBlock",
|
||||
"version": "3.0.1",
|
||||
"version": "3.0.3",
|
||||
"default_locale": "en",
|
||||
"description": "__MSG_Description__",
|
||||
"homepage_url": "https://sponsor.ajay.app",
|
||||
|
||||
@@ -81,7 +81,7 @@ chrome.runtime.onInstalled.addListener(function () {
|
||||
//save this UUID
|
||||
Config.config.userID = newUserID;
|
||||
|
||||
Config.config.highlightCategoryUpdate = false;
|
||||
Config.config.highlightCategoryUpdate = true;
|
||||
}
|
||||
}, 1500);
|
||||
});
|
||||
|
||||
@@ -444,8 +444,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
|
||||
}
|
||||
|
||||
// Don't skip if this category should not be skipped
|
||||
if (utils.getCategorySelection(currentSkip.category)?.option === CategorySkipOption.ShowOverlay
|
||||
&& skipInfo.array !== sponsorTimesSubmitting) return;
|
||||
if (!shouldSkip(currentSkip) && skipInfo.array !== sponsorTimesSubmitting) return;
|
||||
|
||||
const skippingFunction = () => {
|
||||
let forcedSkipTime: number = null;
|
||||
@@ -676,7 +675,8 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) {
|
||||
// Hide all submissions smaller than the minimum duration
|
||||
if (Config.config.minDuration !== 0) {
|
||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||
if (sponsorTimes[i].segment[1] - sponsorTimes[i].segment[0] < Config.config.minDuration) {
|
||||
if (sponsorTimes[i].segment[1] - sponsorTimes[i].segment[0] < Config.config.minDuration
|
||||
&& getCategoryActionType(sponsorTimes[i].category) !== CategoryActionType.POI) {
|
||||
sponsorTimes[i].hidden = SponsorHideType.MinimumDuration;
|
||||
}
|
||||
}
|
||||
@@ -962,14 +962,14 @@ function getNextSkipIndex(currentTime: number, includeIntersectingSegments: bool
|
||||
if ((minUnsubmittedSponsorTimeIndex === -1 && minSponsorTimeIndex !== -1) ||
|
||||
sponsorStartTimes[minSponsorTimeIndex] < unsubmittedSponsorStartTimes[minUnsubmittedSponsorTimeIndex]) {
|
||||
return {
|
||||
array: sponsorTimes,
|
||||
array: sponsorTimes.filter((segment) => getCategoryActionType(segment.category) === CategoryActionType.Skippable),
|
||||
index: minSponsorTimeIndex,
|
||||
endIndex: endTimeIndex,
|
||||
openNotice: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
array: sponsorTimesSubmitting,
|
||||
array: sponsorTimesSubmitting.filter((segment) => getCategoryActionType(segment.category) === CategoryActionType.Skippable),
|
||||
index: minUnsubmittedSponsorTimeIndex,
|
||||
endIndex: previewEndTimeIndex,
|
||||
openNotice: false
|
||||
@@ -1038,7 +1038,7 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments:
|
||||
if ((minimum === undefined
|
||||
|| ((includeNonIntersectingSegments && sponsorTimes[i].segment[0] >= minimum)
|
||||
|| (includeIntersectingSegments && sponsorTimes[i].segment[0] < minimum && sponsorTimes[i].segment[1] > minimum)))
|
||||
&& (!onlySkippableSponsors || utils.getCategorySelection(sponsorTimes[i].category).option !== CategorySkipOption.ShowOverlay)
|
||||
&& (!onlySkippableSponsors || shouldSkip(sponsorTimes[i]))
|
||||
&& (!hideHiddenSponsors || sponsorTimes[i].hidden === SponsorHideType.Visible)
|
||||
&& getCategoryActionType(sponsorTimes[i].category) === CategoryActionType.Skippable) {
|
||||
|
||||
@@ -1190,6 +1190,12 @@ function createButton(baseID: string, title: string, callback: () => void, image
|
||||
|
||||
function shouldAutoSkip(segment: SponsorTime): boolean {
|
||||
return utils.getCategorySelection(segment.category)?.option === CategorySkipOption.AutoSkip ||
|
||||
(Config.config.autoSkipOnMusicVideos && sponsorTimes.some((s) => s.category === "music_offtopic")
|
||||
&& getCategoryActionType(segment.category) === CategoryActionType.Skippable);
|
||||
}
|
||||
|
||||
function shouldSkip(segment: SponsorTime): boolean {
|
||||
return utils.getCategorySelection(segment.category)?.option !== CategorySkipOption.ShowOverlay ||
|
||||
(Config.config.autoSkipOnMusicVideos && sponsorTimes.some((s) => s.category === "music_offtopic"));
|
||||
}
|
||||
|
||||
@@ -1620,7 +1626,8 @@ async function sendSubmitMessage() {
|
||||
// Check to see if any of the submissions are below the minimum duration set
|
||||
if (Config.config.minDuration > 0) {
|
||||
for (let i = 0; i < sponsorTimesSubmitting.length; i++) {
|
||||
if (sponsorTimesSubmitting[i].segment[1] - sponsorTimesSubmitting[i].segment[0] < Config.config.minDuration) {
|
||||
if (sponsorTimesSubmitting[i].segment[1] - sponsorTimesSubmitting[i].segment[0] < Config.config.minDuration
|
||||
&& getCategoryActionType(sponsorTimesSubmitting[i].category) !== CategoryActionType.POI) {
|
||||
const confirmShort = chrome.i18n.getMessage("shortCheck") + "\n\n" +
|
||||
getSegmentsMessage(sponsorTimesSubmitting);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ export class SkipButtonControlBar {
|
||||
const leftControlsContainer = document.querySelector(".ytp-left-controls");
|
||||
this.chapterText = document.querySelector(".ytp-chapter-container");
|
||||
|
||||
if (!leftControlsContainer.contains(this.container)) {
|
||||
if (leftControlsContainer && !leftControlsContainer.contains(this.container)) {
|
||||
leftControlsContainer.insertBefore(this.container, this.chapterText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class SkipNotice {
|
||||
}
|
||||
|
||||
setShowKeybindHint(value: boolean): void {
|
||||
this.skipNoticeRef.current.setState({
|
||||
this.skipNoticeRef?.current?.setState({
|
||||
showKeybindHint: value
|
||||
});
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class SkipNotice {
|
||||
}
|
||||
|
||||
toggleSkip(): void {
|
||||
this.skipNoticeRef.current.prepAction(SkipNoticeAction.Unskip);
|
||||
this.skipNoticeRef?.current?.prepAction(SkipNoticeAction.Unskip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user