mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-14 15:37:12 +03:00
Add channel id and name attribute for advanced skip options
This commit is contained in:
@@ -222,7 +222,7 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
|
||||
sendResponse({
|
||||
found: sponsorDataFound,
|
||||
status: lastResponseStatus,
|
||||
sponsorTimes: sponsorTimes,
|
||||
sponsorTimes: sponsorTimes.filter((segment) => getCategorySelection(segment).option !== CategorySkipOption.Disabled),
|
||||
time: getCurrentTime() ?? 0,
|
||||
onMobileYouTube: isOnMobileYouTube(),
|
||||
videoID: getVideoID(),
|
||||
@@ -1252,24 +1252,27 @@ async function sponsorsLookup(keepOldSubmissions = true, ignoreCache = false) {
|
||||
}
|
||||
}
|
||||
|
||||
notifyPopupOfSegments();
|
||||
importExistingChapters(true);
|
||||
|
||||
if (Config.config.isVip) {
|
||||
lockedCategoriesLookup();
|
||||
}
|
||||
}
|
||||
|
||||
function notifyPopupOfSegments(): void {
|
||||
// notify popup of segment changes
|
||||
chrome.runtime.sendMessage({
|
||||
message: "infoUpdated",
|
||||
found: sponsorDataFound,
|
||||
status: lastResponseStatus,
|
||||
sponsorTimes: sponsorTimes,
|
||||
sponsorTimes: sponsorTimes.filter((segment) => getCategorySelection(segment).option !== CategorySkipOption.Disabled),
|
||||
time: getCurrentTime() ?? 0,
|
||||
onMobileYouTube: isOnMobileYouTube(),
|
||||
videoID: getVideoID(),
|
||||
loopedChapter: loopedChapter?.UUID,
|
||||
channelWhitelisted
|
||||
});
|
||||
|
||||
if (Config.config.isVip) {
|
||||
lockedCategoriesLookup();
|
||||
}
|
||||
}
|
||||
|
||||
function importExistingChapters(wait: boolean) {
|
||||
@@ -1403,7 +1406,7 @@ function updatePreviewBar(): void {
|
||||
const previewBarSegments: PreviewBarSegment[] = [];
|
||||
if (sponsorTimes) {
|
||||
sponsorTimes.forEach((segment) => {
|
||||
if (segment.hidden !== SponsorHideType.Visible) return;
|
||||
if (segment.hidden !== SponsorHideType.Visible || getCategorySelection(segment).option === CategorySkipOption.Disabled) return;
|
||||
|
||||
previewBarSegments.push({
|
||||
segment: segment.segment as [number, number],
|
||||
@@ -1457,6 +1460,9 @@ async function channelIDChange(channelIDInfo: ChannelIDInfo) {
|
||||
|
||||
// check if the start of segments were missed
|
||||
if (Config.config.forceChannelCheck && sponsorTimes?.length > 0) startSkipScheduleCheckingForStartSponsors();
|
||||
|
||||
updatePreviewBar();
|
||||
notifyPopupOfSegments();
|
||||
}
|
||||
|
||||
function videoElementChange(newVideo: boolean, video: HTMLVideoElement): void {
|
||||
|
||||
Reference in New Issue
Block a user