Compare commits

..

11 Commits
3.0.1 ... 3.0.3

Author SHA1 Message Date
Ajay Ramachandran
6de1a58d88 bump version 2021-08-24 02:28:18 -04:00
Ajay Ramachandran
43a9ba0f9e Fix keybind being flaky 2021-08-23 19:51:58 -04:00
Ajay Ramachandran
c3489e54a6 Fix highlight category when minimum duration set 2021-08-23 18:23:03 -04:00
Ajay Ramachandran
75c003b204 Merge branch 'master' of https://github.com/ajayyy/SponsorBlock 2021-08-23 15:46:36 -04:00
Ajay Ramachandran
da5de43121 Fix skipping with highlight on invidious 2021-08-23 15:46:35 -04:00
Ajay Ramachandran
d20a44751c bump version 2021-08-23 03:08:01 -04:00
Ajay Ramachandran
15706fd3c4 Fix issue with early highlight breaking skipping 2021-08-22 20:47:46 -04:00
Ajay Ramachandran
a9e43f95f5 Fix highlight auto skipping on music videos 2021-08-22 19:03:24 -04:00
Ajay Ramachandran
11fe87a09e Fix highlight category info appearing to new users 2021-08-22 19:03:05 -04:00
Ajay Ramachandran
52741b2c0a Merge branch 'master' of https://github.com/ajayyy/SponsorBlock 2021-08-22 14:13:03 -04:00
Ajay Ramachandran
09b18a4f6d Fix auto skip on music videos for show overlay 2021-08-22 14:13:02 -04:00
5 changed files with 19 additions and 12 deletions

View File

@@ -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",

View File

@@ -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);
});

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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);
}
}