diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index c862ba00..7066e5f7 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -741,6 +741,9 @@ "message": "Got it", "description": "Used as the button to dismiss a tooltip" }, + "fullVideoTooltipWarning": { + "message": "This segment is large. If the whole video is about one topic, then change from \"Skip\" to \"Full Video\". See the guidelines for more information." + }, "experiementOptOut": { "message": "Opt-out of all future experiments", "description": "This is used in a popup about a new experiment to get a list of unlisted videos to back up since all unlisted videos uploaded before 2017 will be set to private." diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx index 1a734cb5..eaf83a91 100644 --- a/src/components/SponsorTimeEditComponent.tsx +++ b/src/components/SponsorTimeEditComponent.tsx @@ -40,6 +40,7 @@ class SponsorTimeEditComponent extends React.Component this.configUpdate(); Config.configListeners.push(this.configUpdate.bind(this)); } + + this.checkToShowFullVideoWarning(); } componentWillUnmount(): void { @@ -82,6 +85,8 @@ class SponsorTimeEditComponent extends React.Component { Config.config.scrollToEditTimeUpdate = true }); + } + } + + showToolTip(text: string, buttonFunction?: () => void): boolean { + const element = document.getElementById("sponsorTimesContainer" + this.idSuffix); + if (element) { new RectangleTooltip({ - text: chrome.i18n.getMessage("SponsorTimeEditScrollNewFeature"), + text, referenceNode: element.parentElement, prependElement: element, timeout: 15, @@ -300,10 +312,27 @@ class SponsorTimeEditComponent extends React.Component { Config.config.scrollToEditTimeUpdate = true }, + buttonFunction, fontSize: "14px", maxHeight: "200px" }); + + return true; + } else { + return false; + } + } + + checkToShowFullVideoWarning(): void { + const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index]; + const segmentDuration = sponsorTime.segment[1] - sponsorTime.segment[0]; + const videoPercentage = segmentDuration / this.props.contentContainer().v.duration; + + if (videoPercentage > 0.6 && !this.fullVideoWarningShown + && (sponsorTime.category === "sponsor" || sponsorTime.category === "selfpromo" || sponsorTime.category === "chooseACategory")) { + if (this.showToolTip(chrome.i18n.getMessage("fullVideoTooltipWarning"))) { + this.fullVideoWarningShown = true; + } } }