From 3879cc6de33536123b81c22ff6f6d726b2910a88 Mon Sep 17 00:00:00 2001 From: opl- Date: Sun, 15 Nov 2020 02:36:16 +0100 Subject: Clean up segment creation code Noteworthy changes: - Adds ability to cancel creating a segment - Makes segment creation fully the responsibility of the content script, with the popup script buttons simply doing RPC - Adds types to the Utils.wait function - Fixes segment timestamps backwards if user marks segment end earlier than the start - Makes the info menu (in-page popup) workaround clearer and easier to remove in the future. --- public/_locales/en/messages.json | 3 + public/_locales/pl/messages.json | 3 + public/popup.html | 2 +- src/components/SponsorTimeEditComponent.tsx | 4 +- src/config.ts | 1 + src/content.ts | 331 ++++++++++++++-------------- src/messageTypes.ts | 11 +- src/popup.ts | 120 ++++------ src/types.ts | 8 +- src/utils.ts | 4 +- 10 files changed, 223 insertions(+), 264 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 16f9e266..7d782223 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -79,6 +79,9 @@ "sponsorEnd": { "message": "Segment Ends Now" }, + "sponsorCancel": { + "message": "Cancel Creating Segment" + }, "noVideoID": { "message": "No YouTube video found.\nIf this is incorrect, refresh the tab." }, diff --git a/public/_locales/pl/messages.json b/public/_locales/pl/messages.json index 23f87442..223c1ef2 100644 --- a/public/_locales/pl/messages.json +++ b/public/_locales/pl/messages.json @@ -79,6 +79,9 @@ "sponsorEnd": { "message": "Koniec segmentu" }, + "sponsorCancel": { + "message": "Anuluj tworzenie segmentu" + }, "noVideoID": { "message": "Nie znaleziono filmu YouTube.\nJeżeli to błąd, odśwież stronę." }, diff --git a/public/popup.html b/public/popup.html index 435007f7..4f3669eb 100644 --- a/public/popup.html +++ b/public/popup.html @@ -71,7 +71,7 @@