From 60b0dbb2370181dec8902772a3952cb4b44bbf25 Mon Sep 17 00:00:00 2001 From: hanyd Date: Sat, 14 Sep 2024 15:40:59 +0800 Subject: [PATCH] Remove live or premiere video support --- public/_locales/en/messages.json | 3 --- public/_locales/zh_CN/messages.json | 3 --- public/_locales/zh_TW/messages.json | 3 --- src/content.ts | 13 +++---------- src/utils/video.ts | 11 ----------- 5 files changed, 3 insertions(+), 30 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index c4991061..3cbcc050 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -477,9 +477,6 @@ "shortCheck": { "message": "以下的提交短于您的最小持续时间选项。这代表它们可能已经被提交,只是由于该选项被忽略了。您确定要提交吗?" }, - "liveOrPremiere": { - "message": "无法在进行中的直播或首播提交片段。请等待直播结束后刷新页面并确认片段仍然有效,再次提交。" - }, "customServerAddress": { "message": "空降助手服务器地址" }, diff --git a/public/_locales/zh_CN/messages.json b/public/_locales/zh_CN/messages.json index c4991061..3cbcc050 100644 --- a/public/_locales/zh_CN/messages.json +++ b/public/_locales/zh_CN/messages.json @@ -477,9 +477,6 @@ "shortCheck": { "message": "以下的提交短于您的最小持续时间选项。这代表它们可能已经被提交,只是由于该选项被忽略了。您确定要提交吗?" }, - "liveOrPremiere": { - "message": "无法在进行中的直播或首播提交片段。请等待直播结束后刷新页面并确认片段仍然有效,再次提交。" - }, "customServerAddress": { "message": "空降助手服务器地址" }, diff --git a/public/_locales/zh_TW/messages.json b/public/_locales/zh_TW/messages.json index 9a9e01e6..4a403ef7 100644 --- a/public/_locales/zh_TW/messages.json +++ b/public/_locales/zh_TW/messages.json @@ -477,9 +477,6 @@ "shortCheck": { "message": "以下的提交短於您的最小持續時間選項。這代表它們可能已經被提交,只是由於該選項被忽略了。您確定要提交嗎?" }, - "liveOrPremiere": { - "message": "無法在進行中的直播或首播提交片段。請等待直播結束後刷新頁面並確認片段仍然有效,再次提交。" - }, "customServerAddress": { "message": "Bilibili Sponsor Block伺服器地址" }, diff --git a/src/content.ts b/src/content.ts index 4e1a6545..89c184cf 100644 --- a/src/content.ts +++ b/src/content.ts @@ -45,7 +45,7 @@ import { getErrorMessage, getFormattedTime } from "./utils/formating"; import { GenericUtils } from "./utils/genericUtils"; import { getHash, HashedValue } from "./utils/hash"; import { logDebug } from "./utils/logger"; -import { getControls, getHashParams, getProgressBar, isPlayingPlaylist, isVisible } from "./utils/pageUtils"; +import { getControls, getHashParams, getProgressBar, isPlayingPlaylist } from "./utils/pageUtils"; import { getBilibiliVideoID } from "./utils/parseVideoID"; import { generateUserID } from "./utils/setup"; import { getStartTimeFromUrl } from "./utils/urlParser"; @@ -54,12 +54,11 @@ import { checkVideoIDChange, detectPageType, getChannelIDInfo, - updateFrameRate, - getIsLivePremiere, getPageType, getVideo, getVideoID, setupVideoModule, + updateFrameRate } from "./utils/video"; import { openWarningDialog } from "./utils/warnings"; @@ -2277,13 +2276,7 @@ function submitSegments() { //send the message to the background js //called after all the checks have been made that it's okay to do so async function sendSubmitMessage(): Promise { - // check if all segments are full video - const onlyFullVideo = sponsorTimesSubmitting.every((segment) => segment.actionType === ActionType.Full); - // Block if submitting on a running livestream or premiere - if (!onlyFullVideo && (getIsLivePremiere() || isVisible(document.querySelector(".ytp-live-badge")))) { - showMessage(chrome.i18n.getMessage("liveOrPremiere"), "warning"); - return false; - } + // TODO: add checks for premiere videos if ( !previewedSegment && diff --git a/src/utils/video.ts b/src/utils/video.ts index 65976b6a..a5214ade 100644 --- a/src/utils/video.ts +++ b/src/utils/video.ts @@ -1,6 +1,5 @@ import * as documentScript from "../../dist/js/document.js"; import Config from "../config"; -import { isSafari } from "../config/config"; import { newThumbnails } from "../thumbnail-utils/thumbnailManagement"; import { PageType } from "../types"; import { waitFor } from "./"; @@ -31,9 +30,6 @@ let videoMutationListenerElement: HTMLElement | null = null; const videosSetup: HTMLVideoElement[] = []; let waitingForNewVideo = false; -// if video is live or premiere -let isLivePremiere: boolean; - let videoID: VideoID | null = null; let pageType: PageType = PageType.Unknown; let channelIDInfo: ChannelIDInfo; @@ -159,7 +155,6 @@ function resetValues() { status: ChannelIDStatus.Fetching, id: null, }; - isLivePremiere = false; // Reset the last media session link window.postMessage( @@ -357,8 +352,6 @@ function windowListenerHandler(event: MessageEvent): void { void videoIDChange(data.videoID); } else if (dataType === "data" && data.videoID) { void videoIDChange(data.videoID); - - isLivePremiere = data.isLive || data.isPremiere; } else if (dataType === "newElement") { newThumbnails(); } @@ -415,10 +408,6 @@ export function getChannelIDInfo(): ChannelIDInfo { return channelIDInfo; } -export function getIsLivePremiere(): boolean { - return isLivePremiere; -} - export function getPageType(): PageType { return pageType; }