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