From c007ac3d8653b06aa5b2efd304e40098cd39273e Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sun, 21 Nov 2021 19:40:25 -0500 Subject: [PATCH] Add tooltip about filler category --- public/_locales/en/messages.json | 6 +++--- src/config.ts | 2 ++ src/content.ts | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index a2da981b..f4285495 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -814,9 +814,6 @@ "Credits": { "message": "Credits" }, - "highlightNewFeature": { - "message": "New! Get to the point of the video with one click with the new highlight category" - }, "LearnMore": { "message": "Learn More" }, @@ -837,5 +834,8 @@ }, "SponsorTimeEditScrollNewFeature": { "message": "Use your mousewheel while hovering over the edit box to quickly adjust the time. Combinations of the ctrl or shift key can be used to fine tune the changes." + }, + "fillerNewFeature": { + "message": "New! Skip tangents and jokes with the filler category. Enable in options" } } diff --git a/src/config.ts b/src/config.ts index 3c4bb30a..344a7b62 100644 --- a/src/config.ts +++ b/src/config.ts @@ -51,6 +51,7 @@ interface SBConfig { locked: string }, scrollToEditTimeUpdate: boolean, + fillerUpdate: boolean, // What categories should be skipped categorySelections: CategorySelection[], @@ -202,6 +203,7 @@ const Config: SBObject = { autoHideInfoButton: true, autoSkipOnMusicVideos: false, scrollToEditTimeUpdate: false, // false means the tooltip will be shown + fillerUpdate: false, categorySelections: [{ name: "sponsor" as Category, diff --git a/src/content.ts b/src/content.ts index 776505ec..f87a477b 100644 --- a/src/content.ts +++ b/src/content.ts @@ -333,6 +333,25 @@ async function videoIDChange(id) { // Clear unsubmitted segments from the previous video sponsorTimesSubmitting = []; updateSponsorTimesSubmitting(); + + // Filler update + if (!Config.config.fillerUpdate) { + Config.config.fillerUpdate = true; + + utils.wait(getControls).then(() => { + const playButton = document.querySelector(".ytp-play-button") as HTMLElement; + const allCategories = ["sponsor", "intro", "outro", "selfpromo", "interaction"]; + if (playButton && allCategories.every((name) => Config.config.categorySelections.some((selection) => selection.name === name))) { + new Tooltip({ + text: chrome.i18n.getMessage("fillerNewFeature"), + link: "https://wiki.sponsor.ajay.app/w/Filler_Tangent", + referenceNode: playButton.parentElement, + prependElement: playButton, + timeout: 10 + }); + } + }); + } } function handleMobileControlsMutations(): void {