mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-05-12 19:06:17 +02:00
Merge pull request #2235 from FlorianZahn/auto-skip-only-on-youtube-music
feat: Option to auto-skip non-music on youtube music only
This commit is contained in:
commit
ddd0b4ea05
5 changed files with 12 additions and 3 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit b22477a8640b407910b24d5bec13d0d6d4d3cf01
|
Subproject commit 9cef8e27cdc61acbb7b00db5a782106637ddcdbc
|
|
@ -1 +1 @@
|
||||||
Subproject commit d2cf3595c782b712d104f5893a0a744478c1a872
|
Subproject commit 314fe2ff783797068eb291993662f3e117b07dad
|
|
@ -243,6 +243,9 @@ class CategorySkipOptionsComponent extends React.Component<CategorySkipOptionsPr
|
||||||
return [{
|
return [{
|
||||||
configKey: "autoSkipOnMusicVideos",
|
configKey: "autoSkipOnMusicVideos",
|
||||||
label: chrome.i18n.getMessage("autoSkipOnMusicVideos"),
|
label: chrome.i18n.getMessage("autoSkipOnMusicVideos"),
|
||||||
|
}, {
|
||||||
|
configKey: "skipNonMusicOnlyOnYoutubeMusic",
|
||||||
|
label: chrome.i18n.getMessage("skipNonMusicOnlyOnYoutubeMusic"),
|
||||||
}];
|
}];
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -57,6 +57,7 @@ interface SBConfig {
|
||||||
donateClicked: number;
|
donateClicked: number;
|
||||||
autoHideInfoButton: boolean;
|
autoHideInfoButton: boolean;
|
||||||
autoSkipOnMusicVideos: boolean;
|
autoSkipOnMusicVideos: boolean;
|
||||||
|
skipNonMusicOnlyOnYoutubeMusic: boolean;
|
||||||
colorPalette: {
|
colorPalette: {
|
||||||
red: string;
|
red: string;
|
||||||
white: string;
|
white: string;
|
||||||
|
@ -322,6 +323,7 @@ const syncDefaults = {
|
||||||
donateClicked: 0,
|
donateClicked: 0,
|
||||||
autoHideInfoButton: true,
|
autoHideInfoButton: true,
|
||||||
autoSkipOnMusicVideos: false,
|
autoSkipOnMusicVideos: false,
|
||||||
|
skipNonMusicOnlyOnYoutubeMusic: false,
|
||||||
scrollToEditTimeUpdate: false, // false means the tooltip will be shown
|
scrollToEditTimeUpdate: false, // false means the tooltip will be shown
|
||||||
categoryPillUpdate: false,
|
categoryPillUpdate: false,
|
||||||
showChapterInfoMessage: true,
|
showChapterInfoMessage: true,
|
||||||
|
|
|
@ -35,7 +35,7 @@ import { ChapterVote } from "./render/ChapterVote";
|
||||||
import { openWarningDialog } from "./utils/warnings";
|
import { openWarningDialog } from "./utils/warnings";
|
||||||
import { isFirefoxOrSafari, waitFor } from "../maze-utils/src";
|
import { isFirefoxOrSafari, waitFor } from "../maze-utils/src";
|
||||||
import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating";
|
import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating";
|
||||||
import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube, isOnYTTV, getLastNonInlineVideoID, triggerVideoIDChange, triggerVideoElementChange, getIsInline, getCurrentTime, setCurrentTime, getVideoDuration, verifyCurrentTime, waitForVideo } from "../maze-utils/src/video";
|
import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube, isOnYouTubeMusic, isOnYTTV, getLastNonInlineVideoID, triggerVideoIDChange, triggerVideoElementChange, getIsInline, getCurrentTime, setCurrentTime, getVideoDuration, verifyCurrentTime, waitForVideo } from "../maze-utils/src/video";
|
||||||
import { Keybind, StorageChangesObject, isSafari, keybindEquals, keybindToString } from "../maze-utils/src/config";
|
import { Keybind, StorageChangesObject, isSafari, keybindEquals, keybindToString } from "../maze-utils/src/config";
|
||||||
import { findValidElement } from "../maze-utils/src/dom"
|
import { findValidElement } from "../maze-utils/src/dom"
|
||||||
import { getHash, HashedValue } from "../maze-utils/src/hash";
|
import { getHash, HashedValue } from "../maze-utils/src/hash";
|
||||||
|
@ -1926,6 +1926,10 @@ function createButton(baseID: string, title: string, callback: () => void, image
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldAutoSkip(segment: SponsorTime): boolean {
|
function shouldAutoSkip(segment: SponsorTime): boolean {
|
||||||
|
if (segment.category === "music_offtopic" && Config.config.skipNonMusicOnlyOnYoutubeMusic && !isOnYouTubeMusic()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return (!Config.config.manualSkipOnFullVideo || !sponsorTimes?.some((s) => s.category === segment.category && s.actionType === ActionType.Full))
|
return (!Config.config.manualSkipOnFullVideo || !sponsorTimes?.some((s) => s.category === segment.category && s.actionType === ActionType.Full))
|
||||||
&& (utils.getCategorySelection(segment.category)?.option === CategorySkipOption.AutoSkip ||
|
&& (utils.getCategorySelection(segment.category)?.option === CategorySkipOption.AutoSkip ||
|
||||||
(Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic")
|
(Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue