Require previewing before submitting

This commit is contained in:
Ajay 2024-01-15 00:45:44 -05:00
parent 1bf67cc533
commit 5d77a08364
2 changed files with 10 additions and 2 deletions

@ -1 +1 @@
Subproject commit baf39106e0471e89dd85c17871017dc38b991343
Subproject commit b1cbf592a9781ba0f17ad12bf7be47e108c578df

View file

@ -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());