diff --git a/public/_locales b/public/_locales index baf39106..b1cbf592 160000 --- a/public/_locales +++ b/public/_locales @@ -1 +1 @@ -Subproject commit baf39106e0471e89dd85c17871017dc38b991343 +Subproject commit b1cbf592a9781ba0f17ad12bf7be47e108c578df diff --git a/src/content.ts b/src/content.ts index bf4b252c..58a48f05 100644 --- a/src/content.ts +++ b/src/content.ts @@ -35,7 +35,7 @@ import { openWarningDialog } from "./utils/warnings"; import { isFirefoxOrSafari, waitFor } from "../maze-utils/src"; import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating"; import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube } from "../maze-utils/src/video"; -import { Keybind, StorageChangesObject, isSafari, keybindEquals } from "../maze-utils/src/config"; +import { Keybind, StorageChangesObject, isSafari, keybindEquals, keybindToString } from "../maze-utils/src/config"; import { findValidElement } from "../maze-utils/src/dom" import { getHash, HashedValue } from "../maze-utils/src/hash"; import { generateUserID } from "../maze-utils/src/setup"; @@ -78,6 +78,7 @@ let activeSkipKeybindElement: ToggleSkippable = null; let retryFetchTimeout: NodeJS.Timeout = null; let shownSegmentFailedToFetchWarning = false; let selectedSegment: SegmentUUID | null = null; +let previewedSegment = false; // JSON video info let videoInfo: VideoInfo = null; @@ -372,6 +373,7 @@ function resetValues() { lastCheckTime = 0; lastCheckVideoTime = -1; retryCount = 0; + previewedSegment = false; sponsorTimes = []; existingChaptersImported = false; @@ -1579,6 +1581,7 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments: * @param time */ function previewTime(time: number, unpause = true) { + previewedSegment = true; getVideo().currentTime = time; // Unpause the video if needed @@ -2263,6 +2266,11 @@ async function sendSubmitMessage() { return; } + if (!previewedSegment) { + alert(`${chrome.i18n.getMessage("previewSegmentRequired")} ${keybindToString(Config.config.previewKeybind)}`); + return; + } + // Add loading animation playerButtons.submit.image.src = chrome.extension.getURL("icons/PlayerUploadIconSponsorBlocker.svg"); const stopAnimation = AnimationUtils.applyLoadingAnimation(playerButtons.submit.button, 1, () => updateEditButtonsOnPlayer());