mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 14:07:13 +03:00
Added category names to notice
This commit is contained in:
@@ -35,9 +35,6 @@
|
|||||||
"Segments": {
|
"Segments": {
|
||||||
"message": "sponsor segments"
|
"message": "sponsor segments"
|
||||||
},
|
},
|
||||||
"noticeTitle": {
|
|
||||||
"message": "Sponsor Skipped"
|
|
||||||
},
|
|
||||||
"reportButtonTitle": {
|
"reportButtonTitle": {
|
||||||
"message": "Report"
|
"message": "Report"
|
||||||
},
|
},
|
||||||
@@ -272,12 +269,12 @@
|
|||||||
"errorCode": {
|
"errorCode": {
|
||||||
"message": "Error Code: "
|
"message": "Error Code: "
|
||||||
},
|
},
|
||||||
"noticeTitleNotSkipped": {
|
|
||||||
"message": "Skip Sponsor?"
|
|
||||||
},
|
|
||||||
"skip": {
|
"skip": {
|
||||||
"message": "Skip"
|
"message": "Skip"
|
||||||
},
|
},
|
||||||
|
"skipped": {
|
||||||
|
"message": "Skipped"
|
||||||
|
},
|
||||||
"disableAutoSkip": {
|
"disableAutoSkip": {
|
||||||
"message": "Disable Auto Skip"
|
"message": "Disable Auto Skip"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
this.contentContainer = props.contentContainer;
|
this.contentContainer = props.contentContainer;
|
||||||
this.audio = null;
|
this.audio = null;
|
||||||
|
|
||||||
let noticeTitle = chrome.i18n.getMessage("noticeTitle");
|
let noticeTitle = chrome.i18n.getMessage("category_" + this.getSponsorTime().category) + " " + chrome.i18n.getMessage("skipped");
|
||||||
|
|
||||||
if (!this.autoSkip) {
|
if (!this.autoSkip) {
|
||||||
noticeTitle = chrome.i18n.getMessage("noticeTitleNotSkipped");
|
noticeTitle = chrome.i18n.getMessage("skip") + " " + chrome.i18n.getMessage("category_" + this.getSponsorTime().category) + "?";
|
||||||
}
|
}
|
||||||
|
|
||||||
//add notice
|
//add notice
|
||||||
@@ -103,6 +103,11 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper method
|
||||||
|
getSponsorTime() {
|
||||||
|
return utils.getSponsorTimeFromUUID(this.contentContainer().sponsorTimes, this.UUID);
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (Config.config.audioNotificationOnSkip && this.audio) {
|
if (Config.config.audioNotificationOnSkip && this.audio) {
|
||||||
this.audio.volume = this.contentContainer().v.volume * 0.1;
|
this.audio.volume = this.contentContainer().v.volume * 0.1;
|
||||||
@@ -215,7 +220,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
{/* Category Selector */}
|
{/* Category Selector */}
|
||||||
<select id={"sponsorTimeCategories" + this.idSuffix}
|
<select id={"sponsorTimeCategories" + this.idSuffix}
|
||||||
className="sponsorTimeCategories"
|
className="sponsorTimeCategories"
|
||||||
defaultValue={utils.getSponsorTimeFromUUID(this.props.contentContainer().sponsorTimes, this.props.UUID).category}
|
defaultValue={this.getSponsorTime().category}
|
||||||
ref={this.categoryOptionRef}
|
ref={this.categoryOptionRef}
|
||||||
onChange={this.categorySelectionChange.bind(this)}>
|
onChange={this.categorySelectionChange.bind(this)}>
|
||||||
|
|
||||||
@@ -319,7 +324,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
chrome.runtime.sendMessage({"message": "openConfig"});
|
chrome.runtime.sendMessage({"message": "openConfig"});
|
||||||
|
|
||||||
// Reset option to original
|
// Reset option to original
|
||||||
event.target.value = utils.getSponsorTimeFromUUID(this.props.contentContainer().sponsorTimes, this.props.UUID).category;
|
event.target.value = this.getSponsorTime().category;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,7 +345,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
|
|
||||||
getUnskippedModeInfo(buttonText: string) {
|
getUnskippedModeInfo(buttonText: string) {
|
||||||
let maxCountdownTime = function() {
|
let maxCountdownTime = function() {
|
||||||
let sponsorTime = utils.getSponsorTimeFromUUID(this.contentContainer().sponsorTimes, this.UUID);
|
let sponsorTime = this.getSponsorTime();
|
||||||
let duration = Math.round((sponsorTime.segment[1] - this.contentContainer().v.currentTime) * (1 / this.contentContainer().v.playbackRate));
|
let duration = Math.round((sponsorTime.segment[1] - this.contentContainer().v.currentTime) * (1 / this.contentContainer().v.playbackRate));
|
||||||
|
|
||||||
return Math.max(duration, 4);
|
return Math.max(duration, 4);
|
||||||
@@ -387,7 +392,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
this.adjustDownvotingState(false);
|
this.adjustDownvotingState(false);
|
||||||
|
|
||||||
// Change the sponsor locally
|
// Change the sponsor locally
|
||||||
let sponsorTime = utils.getSponsorTimeFromUUID(this.contentContainer().sponsorTimes, this.UUID);
|
let sponsorTime = this.getSponsorTime();
|
||||||
if (sponsorTime) {
|
if (sponsorTime) {
|
||||||
if (type === 0) {
|
if (type === 0) {
|
||||||
sponsorTime.hidden = SponsorHideType.Downvoted;
|
sponsorTime.hidden = SponsorHideType.Downvoted;
|
||||||
|
|||||||
Reference in New Issue
Block a user