mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 13:37:04 +03:00
Default to blank category when submitting
This commit is contained in:
@@ -571,6 +571,12 @@
|
||||
"moreCategories": {
|
||||
"message": "More Categories"
|
||||
},
|
||||
"chooseACategory": {
|
||||
"message": "Choose a Category"
|
||||
},
|
||||
"youMustSelectACategory": {
|
||||
"message": "You must select a category for all segments you are submitting!"
|
||||
},
|
||||
"bracketEnd": {
|
||||
"message": "(End)"
|
||||
},
|
||||
|
||||
@@ -230,7 +230,12 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
||||
}
|
||||
|
||||
getCategoryOptions() {
|
||||
let elements = [];
|
||||
let elements = [(
|
||||
<option value={"chooseACategory"}
|
||||
key={"chooseACategory"}>
|
||||
{chrome.i18n.getMessage("chooseACategory")}
|
||||
</option>
|
||||
)];
|
||||
|
||||
for (const category of Config.config.categorySelections) {
|
||||
elements.push(
|
||||
|
||||
@@ -167,9 +167,16 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
|
||||
ref.current.saveEditTimes();
|
||||
}
|
||||
|
||||
let sponsorTimesSubmitting = this.props.contentContainer().sponsorTimesSubmitting;
|
||||
for (const sponsorTime of sponsorTimesSubmitting) {
|
||||
if (sponsorTime.category === "chooseACategory") {
|
||||
alert(chrome.i18n.getMessage("youMustSelectACategory"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if any non music categories are being used on a music video
|
||||
if (this.contentContainer().videoInfo?.microformat?.playerMicroformatRenderer?.category === "Music") {
|
||||
let sponsorTimesSubmitting = this.props.contentContainer().sponsorTimesSubmitting;
|
||||
for (const sponsorTime of sponsorTimesSubmitting) {
|
||||
if (!sponsorTime.category.startsWith("music_")) {
|
||||
if (!confirm(chrome.i18n.getMessage("nonMusicCategoryOnMusic"))) return;
|
||||
|
||||
@@ -8,6 +8,7 @@ interface SBConfig {
|
||||
userID: string,
|
||||
// sponsorTimes: SBMap<string, SponsorTime[]>,
|
||||
segmentTimes: SBMap<string, SponsorTime[]>,
|
||||
defaultCategory: string,
|
||||
whitelistedChannels: string[],
|
||||
forceChannelCheck: boolean,
|
||||
startSponsorKeybind: string,
|
||||
@@ -40,6 +41,7 @@ interface SBConfig {
|
||||
|
||||
// Preview bar
|
||||
barTypes: {
|
||||
"preview-chooseACategory": PreviewBarOption,
|
||||
"sponsor": PreviewBarOption,
|
||||
"preview-sponsor": PreviewBarOption,
|
||||
"intro": PreviewBarOption,
|
||||
@@ -137,6 +139,7 @@ var Config: SBObject = {
|
||||
defaults: {
|
||||
userID: null,
|
||||
segmentTimes: new SBMap("segmentTimes"),
|
||||
defaultCategory: "chooseACategory",
|
||||
whitelistedChannels: [],
|
||||
forceChannelCheck: false,
|
||||
startSponsorKeybind: ";",
|
||||
@@ -171,6 +174,10 @@ var Config: SBObject = {
|
||||
|
||||
// Preview bar
|
||||
barTypes: {
|
||||
"preview-chooseACategory": {
|
||||
color: "#ffffff",
|
||||
opacity: "0.7"
|
||||
},
|
||||
"sponsor": {
|
||||
color: "#00d400",
|
||||
opacity: "0.7"
|
||||
|
||||
@@ -1150,8 +1150,7 @@ function startSponsorClicked() {
|
||||
sponsorTimesSubmitting.push({
|
||||
segment: [getRealCurrentTime()],
|
||||
UUID: null,
|
||||
// Default to sponsor
|
||||
category: "sponsor"
|
||||
category: Config.config.defaultCategory
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ async function runThePopup(messageListener?: MessageListener) {
|
||||
if (sponsorTimes[sponsorTimesIndex] == undefined) {
|
||||
sponsorTimes[sponsorTimesIndex] = {
|
||||
segment: [],
|
||||
category: "sponsor",
|
||||
category: Config.config.defaultCategory,
|
||||
UUID: null
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user