2020-03-12 00:35:20 +01:00
|
|
|
import SubmissionNotice from "./render/SubmissionNotice";
|
|
|
|
import SkipNoticeComponent from "./components/SkipNoticeComponent";
|
2021-01-17 20:25:45 +01:00
|
|
|
import SkipNotice from "./render/SkipNotice";
|
2020-03-12 00:35:20 +01:00
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export interface ContentContainer {
|
2020-03-12 00:35:20 +01:00
|
|
|
(): {
|
2021-04-06 05:35:05 +02:00
|
|
|
vote: (type: number, UUID: SegmentUUID, category?: Category, skipNotice?: SkipNoticeComponent) => void,
|
2020-03-12 00:35:20 +01:00
|
|
|
dontShowNoticeAgain: () => void,
|
2022-04-22 08:33:07 +02:00
|
|
|
unskipSponsorTime: (segment: SponsorTime, unskipTime: number, forceSeek?: boolean) => void,
|
2020-04-05 03:04:17 +02:00
|
|
|
sponsorTimes: SponsorTime[],
|
|
|
|
sponsorTimesSubmitting: SponsorTime[],
|
2021-01-17 20:25:45 +01:00
|
|
|
skipNotices: SkipNotice[],
|
2020-03-12 00:35:20 +01:00
|
|
|
v: HTMLVideoElement,
|
|
|
|
sponsorVideoID,
|
2022-04-22 08:33:07 +02:00
|
|
|
reskipSponsorTime: (segment: SponsorTime, forceSeek?: boolean) => void,
|
2020-03-12 00:35:20 +01:00
|
|
|
updatePreviewBar: () => void,
|
|
|
|
onMobileYouTube: boolean,
|
|
|
|
sponsorSubmissionNotice: SubmissionNotice,
|
2022-06-09 20:02:23 +02:00
|
|
|
resetSponsorSubmissionNotice: (callRef?: boolean) => void,
|
2020-11-15 02:36:16 +01:00
|
|
|
updateEditButtonsOnPlayer: () => void,
|
2020-09-15 16:26:46 +02:00
|
|
|
previewTime: (time: number, unpause?: boolean) => void,
|
2020-12-15 19:54:33 +01:00
|
|
|
videoInfo: VideoInfo,
|
2021-10-10 10:47:47 +02:00
|
|
|
getRealCurrentTime: () => number,
|
2021-11-07 06:05:32 +01:00
|
|
|
lockedCategories: string[],
|
|
|
|
channelIDInfo: ChannelIDInfo
|
2020-03-12 00:35:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export interface FetchResponse {
|
2020-05-25 04:42:55 +02:00
|
|
|
responseText: string,
|
|
|
|
status: number,
|
|
|
|
ok: boolean
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:01:19 +01:00
|
|
|
export type HashedValue = string & { __hashBrand: unknown };
|
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export interface VideoDurationResponse {
|
2020-01-29 05:52:15 +01:00
|
|
|
duration: number;
|
|
|
|
}
|
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export enum CategorySkipOption {
|
2020-04-04 18:58:02 +02:00
|
|
|
ShowOverlay,
|
|
|
|
ManualSkip,
|
|
|
|
AutoSkip
|
|
|
|
}
|
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export interface CategorySelection {
|
2021-04-06 05:35:05 +02:00
|
|
|
name: Category;
|
2020-04-04 18:58:02 +02:00
|
|
|
option: CategorySkipOption
|
2020-04-03 04:13:36 +02:00
|
|
|
}
|
2020-03-12 00:35:20 +01:00
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export enum SponsorHideType {
|
2020-04-26 05:41:08 +02:00
|
|
|
Visible = undefined,
|
|
|
|
Downvoted = 1,
|
2022-02-07 03:03:39 +01:00
|
|
|
MinimumDuration,
|
|
|
|
Hidden,
|
2020-04-26 05:41:08 +02:00
|
|
|
}
|
|
|
|
|
2021-09-01 22:30:17 +02:00
|
|
|
export enum ActionType {
|
|
|
|
Skip = "skip",
|
2021-10-13 05:33:41 +02:00
|
|
|
Mute = "mute",
|
|
|
|
Chapter = "chapter",
|
2022-01-22 02:18:42 +01:00
|
|
|
Full = "full",
|
|
|
|
Poi = "poi"
|
2021-09-01 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export const ActionTypes = [ActionType.Skip, ActionType.Mute];
|
|
|
|
|
2021-04-06 05:35:05 +02:00
|
|
|
export type SegmentUUID = string & { __segmentUUIDBrand: unknown };
|
|
|
|
export type Category = string & { __categoryBrand: unknown };
|
|
|
|
|
2021-07-04 05:42:08 +02:00
|
|
|
export enum SponsorSourceType {
|
|
|
|
Server = undefined,
|
2022-02-23 03:22:30 +01:00
|
|
|
Local = 1,
|
|
|
|
YouTube = 2
|
2021-07-04 05:42:08 +02:00
|
|
|
}
|
|
|
|
|
2021-11-07 21:26:00 +01:00
|
|
|
export interface SegmentContainer {
|
2021-05-21 21:51:58 +02:00
|
|
|
segment: [number] | [number, number];
|
2021-11-07 21:26:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface SponsorTime extends SegmentContainer {
|
2021-04-06 05:35:05 +02:00
|
|
|
UUID: SegmentUUID;
|
2021-10-15 06:31:07 +02:00
|
|
|
locked?: number;
|
2020-04-05 03:04:17 +02:00
|
|
|
|
2021-04-06 05:35:05 +02:00
|
|
|
category: Category;
|
2021-09-01 22:30:17 +02:00
|
|
|
actionType: ActionType;
|
2021-10-13 05:33:41 +02:00
|
|
|
description?: string;
|
2020-04-26 05:41:08 +02:00
|
|
|
|
|
|
|
hidden?: SponsorHideType;
|
2021-12-26 06:17:49 +01:00
|
|
|
source: SponsorSourceType;
|
2021-10-02 00:07:15 +02:00
|
|
|
videoDuration?: number;
|
2020-04-05 03:04:17 +02:00
|
|
|
}
|
|
|
|
|
2021-09-02 01:51:42 +02:00
|
|
|
export interface ScheduledTime extends SponsorTime {
|
|
|
|
scheduledTime: number;
|
|
|
|
}
|
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export interface PreviewBarOption {
|
2020-06-04 02:20:02 +02:00
|
|
|
color: string,
|
|
|
|
opacity: string
|
|
|
|
}
|
|
|
|
|
2020-12-13 20:48:09 +01:00
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export interface Registration {
|
2020-12-13 20:48:09 +01:00
|
|
|
message: string,
|
|
|
|
id: string,
|
|
|
|
allFrames: boolean,
|
|
|
|
js: browser.extensionTypes.ExtensionFileOrCode[],
|
|
|
|
css: browser.extensionTypes.ExtensionFileOrCode[],
|
|
|
|
matches: string[]
|
|
|
|
}
|
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export interface BackgroundScriptContainer {
|
2020-12-13 20:48:09 +01:00
|
|
|
registerFirefoxContentScript: (opts: Registration) => void,
|
|
|
|
unregisterFirefoxContentScript: (id: string) => void
|
|
|
|
}
|
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export interface VideoInfo {
|
2020-12-15 13:33:38 +01:00
|
|
|
responseContext: {
|
|
|
|
serviceTrackingParams: Array<{service: string, params: Array<{key: string, value: string}>}>,
|
|
|
|
webResponseContextExtensionData: {
|
|
|
|
hasDecorated: boolean
|
|
|
|
}
|
|
|
|
},
|
|
|
|
playabilityStatus: {
|
|
|
|
status: string,
|
|
|
|
playableInEmbed: boolean,
|
|
|
|
miniplayer: {
|
|
|
|
miniplayerRenderer: {
|
|
|
|
playbackMode: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
streamingData: unknown;
|
|
|
|
playbackTracking: unknown;
|
|
|
|
videoDetails: {
|
|
|
|
videoId: string,
|
|
|
|
title: string,
|
|
|
|
lengthSeconds: string,
|
|
|
|
keywords: string[],
|
|
|
|
channelId: string,
|
|
|
|
isOwnerViewing: boolean,
|
|
|
|
shortDescription: string,
|
|
|
|
isCrawlable: boolean,
|
|
|
|
thumbnail: {
|
|
|
|
thumbnails: Array<{url: string, width: number, height: number}>
|
|
|
|
},
|
|
|
|
averageRating: number,
|
|
|
|
allowRatings: boolean,
|
|
|
|
viewCount: string,
|
|
|
|
author: string,
|
|
|
|
isPrivate: boolean,
|
|
|
|
isUnpluggedCorpus: boolean,
|
|
|
|
isLiveContent: boolean,
|
|
|
|
};
|
|
|
|
playerConfig: unknown;
|
|
|
|
storyboards: unknown;
|
|
|
|
microformat: {
|
|
|
|
playerMicroformatRenderer: {
|
|
|
|
thumbnail: {
|
|
|
|
thumbnails: Array<{url: string, width: number, height: number}>
|
|
|
|
},
|
|
|
|
embed: {
|
|
|
|
iframeUrl: string,
|
|
|
|
flashUrl: string,
|
|
|
|
width: number,
|
|
|
|
height: number,
|
|
|
|
flashSecureUrl: string,
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
simpleText: string,
|
|
|
|
},
|
|
|
|
description: {
|
|
|
|
simpleText: string,
|
|
|
|
},
|
|
|
|
lengthSeconds: string,
|
|
|
|
ownerProfileUrl: string,
|
|
|
|
externalChannelId: string,
|
|
|
|
availableCountries: string[],
|
|
|
|
isUnlisted: boolean,
|
|
|
|
hasYpcMetadata: boolean,
|
|
|
|
viewCount: string,
|
2021-04-06 05:35:05 +02:00
|
|
|
category: Category,
|
2020-12-15 13:33:38 +01:00
|
|
|
publishDate: string,
|
|
|
|
ownerChannelName: string,
|
|
|
|
uploadDate: string,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
trackingParams: string;
|
|
|
|
attestation: unknown;
|
|
|
|
messages: unknown;
|
|
|
|
}
|
|
|
|
|
2021-01-17 18:56:37 +01:00
|
|
|
export type VideoID = string;
|
|
|
|
|
|
|
|
export type StorageChangesObject = { [key: string]: chrome.storage.StorageChange };
|
|
|
|
|
2020-11-15 02:36:16 +01:00
|
|
|
export type UnEncodedSegmentTimes = [string, SponsorTime[]][];
|
2021-05-21 23:33:48 +02:00
|
|
|
|
|
|
|
export enum ChannelIDStatus {
|
|
|
|
Fetching,
|
|
|
|
Found,
|
|
|
|
Failed
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ChannelIDInfo {
|
|
|
|
id: string,
|
|
|
|
status: ChannelIDStatus
|
2021-08-18 02:47:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface SkipToTimeParams {
|
|
|
|
v: HTMLVideoElement,
|
|
|
|
skipTime: number[],
|
|
|
|
skippingSegments: SponsorTime[],
|
|
|
|
openNotice: boolean,
|
|
|
|
forceAutoSkip?: boolean,
|
|
|
|
unskipTime?: number
|
2021-08-19 07:17:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ToggleSkippable {
|
|
|
|
toggleSkip: () => void;
|
|
|
|
setShowKeybindHint: (show: boolean) => void;
|
2021-08-20 04:32:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export enum NoticeVisbilityMode {
|
|
|
|
FullSize = 0,
|
|
|
|
MiniForAutoSkip = 1,
|
|
|
|
MiniForAll = 2,
|
|
|
|
FadedForAutoSkip = 3,
|
|
|
|
FadedForAll = 4
|
2022-01-08 17:07:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export type Keybind = {
|
|
|
|
key: string,
|
|
|
|
code?: string,
|
|
|
|
ctrl?: boolean,
|
|
|
|
alt?: boolean,
|
|
|
|
shift?: boolean
|
2022-08-29 05:38:40 +02:00
|
|
|
}
|
|
|
|
|
2022-07-29 07:34:53 +02:00
|
|
|
export enum PageType {
|
|
|
|
Shorts = "shorts",
|
|
|
|
Watch = "watch",
|
|
|
|
Search = "search",
|
|
|
|
Browse = "browse",
|
2022-10-05 04:08:19 +02:00
|
|
|
Channel = "channel",
|
|
|
|
Embed = "embed"
|
2022-07-29 07:34:53 +02:00
|
|
|
}
|
|
|
|
|
2022-08-29 05:38:40 +02:00
|
|
|
export interface ButtonListener {
|
|
|
|
name: string,
|
|
|
|
listener: (e?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void
|
2021-05-21 23:33:48 +02:00
|
|
|
}
|