Merge pull request #1518 from mchangrh/interface-delimiter

Interface delimiter
This commit is contained in:
Ajay Ramachandran
2022-10-08 10:07:58 -04:00
committed by GitHub
19 changed files with 280 additions and 279 deletions

View File

@@ -23,7 +23,8 @@
"@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-unused-vars": "error",
"no-self-assign": "off", "no-self-assign": "off",
"@typescript-eslint/no-empty-interface": "off", "@typescript-eslint/no-empty-interface": "off",
"react/prop-types": [2, { "ignore": ["children"] }] "react/prop-types": [2, { "ignore": ["children"] }],
"@typescript-eslint/member-delimiter-style": "warn"
}, },
"settings": { "settings": {
"react": { "react": {

View File

@@ -8,42 +8,42 @@ enum CountdownMode {
} }
export interface NoticeProps { export interface NoticeProps {
noticeTitle: string, noticeTitle: string;
maxCountdownTime?: () => number, maxCountdownTime?: () => number;
dontPauseCountdown?: boolean, dontPauseCountdown?: boolean;
amountOfPreviousNotices?: number, amountOfPreviousNotices?: number;
showInSecondSlot?: boolean, showInSecondSlot?: boolean;
timed?: boolean, timed?: boolean;
idSuffix?: string, idSuffix?: string;
fadeIn?: boolean, fadeIn?: boolean;
startFaded?: boolean, startFaded?: boolean;
firstColumn?: React.ReactElement[] | React.ReactElement, firstColumn?: React.ReactElement[] | React.ReactElement;
firstRow?: React.ReactElement, firstRow?: React.ReactElement;
bottomRow?: React.ReactElement[], bottomRow?: React.ReactElement[];
smaller?: boolean, smaller?: boolean;
limitWidth?: boolean, limitWidth?: boolean;
extraClass?: string, extraClass?: string;
hideLogo?: boolean, hideLogo?: boolean;
hideRightInfo?: boolean, hideRightInfo?: boolean;
// Callback for when this is closed // Callback for when this is closed
closeListener: () => void, closeListener: () => void;
onMouseEnter?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void, onMouseEnter?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
zIndex?: number, zIndex?: number;
style?: React.CSSProperties style?: React.CSSProperties;
biggerCloseButton?: boolean; biggerCloseButton?: boolean;
children?: React.ReactNode children?: React.ReactNode;
} }
export interface NoticeState { export interface NoticeState {
maxCountdownTime: () => number, maxCountdownTime: () => number;
countdownTime: number, countdownTime: number;
countdownMode: CountdownMode, countdownMode: CountdownMode;
mouseHovering: boolean; mouseHovering: boolean;

View File

@@ -1,11 +1,11 @@
import * as React from "react"; import * as React from "react";
export interface NoticeTextSelectionProps { export interface NoticeTextSelectionProps {
icon?: string, icon?: string;
text: string, text: string;
idSuffix: string, idSuffix: string;
onClick?: (event: React.MouseEvent) => unknown, onClick?: (event: React.MouseEvent) => unknown;
children?: React.ReactNode children?: React.ReactNode;
} }
export interface NoticeTextSelectionState { export interface NoticeTextSelectionState {

View File

@@ -14,11 +14,11 @@ import { DEFAULT_CATEGORY } from "../utils/categoryUtils";
const utils = new Utils(); const utils = new Utils();
export interface SponsorTimeEditProps { export interface SponsorTimeEditProps {
index: number, index: number;
idSuffix: string, idSuffix: string;
// Contains functions and variables from the content script needed by the skip notice // Contains functions and variables from the content script needed by the skip notice
contentContainer: ContentContainer, contentContainer: ContentContainer;
submissionNotice: SubmissionNoticeComponent; submissionNotice: SubmissionNoticeComponent;
categoryList?: Category[]; categoryList?: Category[];

View File

@@ -20,8 +20,8 @@ export interface SubmissionNoticeProps {
} }
export interface SubmissionNoticeState { export interface SubmissionNoticeState {
noticeTitle: string, noticeTitle: string;
messages: string[], messages: string[];
idSuffix: string; idSuffix: string;
} }

View File

@@ -7,7 +7,7 @@ export interface UnsubmittedVideosProps {
} }
export interface UnsubmittedVideosState { export interface UnsubmittedVideosState {
tableVisible: boolean, tableVisible: boolean;
} }
class UnsubmittedVideosComponent extends React.Component<UnsubmittedVideosProps, UnsubmittedVideosState> { class UnsubmittedVideosComponent extends React.Component<UnsubmittedVideosProps, UnsubmittedVideosState> {

View File

@@ -8,122 +8,122 @@ export interface Permission {
} }
interface SBConfig { interface SBConfig {
userID: string, userID: string;
isVip: boolean, isVip: boolean;
permissions: Record<Category, Permission>, permissions: Record<Category, Permission>;
/* Contains unsubmitted segments that the user has created. */ /* Contains unsubmitted segments that the user has created. */
unsubmittedSegments: Record<string, SponsorTime[]>, unsubmittedSegments: Record<string, SponsorTime[]>;
defaultCategory: Category, defaultCategory: Category;
renderSegmentsAsChapters: boolean, renderSegmentsAsChapters: boolean;
whitelistedChannels: string[], whitelistedChannels: string[];
forceChannelCheck: boolean, forceChannelCheck: boolean;
minutesSaved: number, minutesSaved: number;
skipCount: number, skipCount: number;
sponsorTimesContributed: number, sponsorTimesContributed: number;
submissionCountSinceCategories: number, // New count used to show the "Read The Guidelines!!" message submissionCountSinceCategories: number; // New count used to show the "Read The Guidelines!!" message
showTimeWithSkips: boolean, showTimeWithSkips: boolean;
disableSkipping: boolean, disableSkipping: boolean;
muteSegments: boolean, muteSegments: boolean;
fullVideoSegments: boolean, fullVideoSegments: boolean;
manualSkipOnFullVideo: boolean, manualSkipOnFullVideo: boolean;
trackViewCount: boolean, trackViewCount: boolean;
trackViewCountInPrivate: boolean, trackViewCountInPrivate: boolean;
trackDownvotes: boolean, trackDownvotes: boolean;
dontShowNotice: boolean, dontShowNotice: boolean;
noticeVisibilityMode: NoticeVisbilityMode, noticeVisibilityMode: NoticeVisbilityMode;
hideVideoPlayerControls: boolean, hideVideoPlayerControls: boolean;
hideInfoButtonPlayerControls: boolean, hideInfoButtonPlayerControls: boolean;
hideDeleteButtonPlayerControls: boolean, hideDeleteButtonPlayerControls: boolean;
hideUploadButtonPlayerControls: boolean, hideUploadButtonPlayerControls: boolean;
hideSkipButtonPlayerControls: boolean, hideSkipButtonPlayerControls: boolean;
hideDiscordLaunches: number, hideDiscordLaunches: number;
hideDiscordLink: boolean, hideDiscordLink: boolean;
invidiousInstances: string[], invidiousInstances: string[];
supportInvidious: boolean, supportInvidious: boolean;
serverAddress: string, serverAddress: string;
minDuration: number, minDuration: number;
skipNoticeDuration: number, skipNoticeDuration: number;
audioNotificationOnSkip: boolean, audioNotificationOnSkip: boolean;
checkForUnlistedVideos: boolean, checkForUnlistedVideos: boolean;
testingServer: boolean, testingServer: boolean;
refetchWhenNotFound: boolean, refetchWhenNotFound: boolean;
ytInfoPermissionGranted: boolean, ytInfoPermissionGranted: boolean;
allowExpirements: boolean, allowExpirements: boolean;
showDonationLink: boolean, showDonationLink: boolean;
showPopupDonationCount: number, showPopupDonationCount: number;
showUpsells: boolean, showUpsells: boolean;
donateClicked: number, donateClicked: number;
autoHideInfoButton: boolean, autoHideInfoButton: boolean;
autoSkipOnMusicVideos: boolean, autoSkipOnMusicVideos: boolean;
colorPalette: { colorPalette: {
red: string, red: string;
white: string, white: string;
locked: string locked: string;
}, };
scrollToEditTimeUpdate: boolean, scrollToEditTimeUpdate: boolean;
categoryPillUpdate: boolean, categoryPillUpdate: boolean;
showChapterInfoMessage: boolean, showChapterInfoMessage: boolean;
darkMode: boolean, darkMode: boolean;
showCategoryGuidelines: boolean, showCategoryGuidelines: boolean;
showCategoryWithoutPermission: boolean, showCategoryWithoutPermission: boolean;
showSegmentNameInChapterBar: boolean, showSegmentNameInChapterBar: boolean;
// Used to cache calculated text color info // Used to cache calculated text color info
categoryPillColors: { categoryPillColors: {
[key in Category]: { [key in Category]: {
lastColor: string, lastColor: string;
textColor: string textColor: string;
}
} }
};
skipKeybind: Keybind, skipKeybind: Keybind;
startSponsorKeybind: Keybind, startSponsorKeybind: Keybind;
submitKeybind: Keybind, submitKeybind: Keybind;
nextChapterKeybind: Keybind, nextChapterKeybind: Keybind;
previousChapterKeybind: Keybind, previousChapterKeybind: Keybind;
// What categories should be skipped // What categories should be skipped
categorySelections: CategorySelection[], categorySelections: CategorySelection[];
payments: { payments: {
licenseKey: string, licenseKey: string;
lastCheck: number, lastCheck: number;
lastFreeCheck: number, lastFreeCheck: number;
freeAccess: boolean, freeAccess: boolean;
chaptersAllowed: boolean chaptersAllowed: boolean;
} };
// Preview bar // Preview bar
barTypes: { barTypes: {
"preview-chooseACategory": PreviewBarOption, "preview-chooseACategory": PreviewBarOption;
"sponsor": PreviewBarOption, "sponsor": PreviewBarOption;
"preview-sponsor": PreviewBarOption, "preview-sponsor": PreviewBarOption;
"selfpromo": PreviewBarOption, "selfpromo": PreviewBarOption;
"preview-selfpromo": PreviewBarOption, "preview-selfpromo": PreviewBarOption;
"exclusive_access": PreviewBarOption, "exclusive_access": PreviewBarOption;
"interaction": PreviewBarOption, "interaction": PreviewBarOption;
"preview-interaction": PreviewBarOption, "preview-interaction": PreviewBarOption;
"intro": PreviewBarOption, "intro": PreviewBarOption;
"preview-intro": PreviewBarOption, "preview-intro": PreviewBarOption;
"outro": PreviewBarOption, "outro": PreviewBarOption;
"preview-outro": PreviewBarOption, "preview-outro": PreviewBarOption;
"preview": PreviewBarOption, "preview": PreviewBarOption;
"preview-preview": PreviewBarOption, "preview-preview": PreviewBarOption;
"music_offtopic": PreviewBarOption, "music_offtopic": PreviewBarOption;
"preview-music_offtopic": PreviewBarOption, "preview-music_offtopic": PreviewBarOption;
"poi_highlight": PreviewBarOption, "poi_highlight": PreviewBarOption;
"preview-poi_highlight": PreviewBarOption, "preview-poi_highlight": PreviewBarOption;
"filler": PreviewBarOption, "filler": PreviewBarOption;
"preview-filler": PreviewBarOption, "preview-filler": PreviewBarOption;
} };
} }
export type VideoDownvotes = { segments: { uuid: HashedValue, hidden: SponsorHideType }[] , lastAccess: number }; export type VideoDownvotes = { segments: { uuid: HashedValue; hidden: SponsorHideType }[] ; lastAccess: number };
interface SBStorage { interface SBStorage {
/* VideoID prefixes to UUID prefixes */ /* VideoID prefixes to UUID prefixes */
downvotedSegments: Record<VideoID & HashedValue, VideoDownvotes>, downvotedSegments: Record<VideoID & HashedValue, VideoDownvotes>;
navigationApiAvailable: boolean, navigationApiAvailable: boolean;
} }
export interface SBObject { export interface SBObject {
@@ -340,7 +340,7 @@ const Config: SBObject = {
// Function setup // Function setup
function configProxy(): { sync: SBConfig, local: SBStorage } { function configProxy(): { sync: SBConfig; local: SBStorage } {
chrome.storage.onChanged.addListener((changes: {[key: string]: chrome.storage.StorageChange}, areaName) => { chrome.storage.onChanged.addListener((changes: {[key: string]: chrome.storage.StorageChange}, areaName) => {
if (areaName === "sync") { if (areaName === "sync") {
for (const key in changes) { for (const key in changes) {

View File

@@ -68,7 +68,7 @@ let channelIDInfo: ChannelIDInfo;
// Locked Categories in this tab, like: ["sponsor","intro","outro"] // Locked Categories in this tab, like: ["sponsor","intro","outro"]
let lockedCategories: Category[] = []; let lockedCategories: Category[] = [];
// Used to calculate a more precise "virtual" video time // Used to calculate a more precise "virtual" video time
let lastKnownVideoTime: { videoTime: number, preciseTime: number } = { let lastKnownVideoTime: { videoTime: number; preciseTime: number } = {
videoTime: null, videoTime: null,
preciseTime: null preciseTime: null
}; };
@@ -125,7 +125,7 @@ let categoryPill: CategoryPill = null;
let controls: HTMLElement | null = null; let controls: HTMLElement | null = null;
/** Contains buttons created by `createButton()`. */ /** Contains buttons created by `createButton()`. */
const playerButtons: Record<string, {button: HTMLButtonElement, image: HTMLImageElement, setupListener: boolean}> = {}; const playerButtons: Record<string, {button: HTMLButtonElement; image: HTMLImageElement; setupListener: boolean}> = {};
// Direct Links after the config is loaded // Direct Links after the config is loaded
utils.wait(() => Config.config !== null, 1000, 1).then(() => videoIDChange(getYouTubeVideoID(document))); utils.wait(() => Config.config !== null, 1000, 1).then(() => videoIDChange(getYouTubeVideoID(document)));
@@ -1403,7 +1403,7 @@ async function whitelistCheck() {
* Returns info about the next upcoming sponsor skip * Returns info about the next upcoming sponsor skip
*/ */
function getNextSkipIndex(currentTime: number, includeIntersectingSegments: boolean, includeNonIntersectingSegments: boolean): function getNextSkipIndex(currentTime: number, includeIntersectingSegments: boolean, includeNonIntersectingSegments: boolean):
{array: ScheduledTime[], index: number, endIndex: number, extraIndexes: number[], openNotice: boolean} { {array: ScheduledTime[]; index: number; endIndex: number; extraIndexes: number[]; openNotice: boolean} {
const autoSkipSorter = (segment: ScheduledTime) => { const autoSkipSorter = (segment: ScheduledTime) => {
const skipOption = utils.getCategorySelection(segment.category)?.option; const skipOption = utils.getCategorySelection(segment.category)?.option;
@@ -1515,7 +1515,7 @@ function getLatestEndTimeIndex(sponsorTimes: SponsorTime[], index: number, hideH
* the current time, but end after * the current time, but end after
*/ */
function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments: boolean, includeNonIntersectingSegments: boolean, function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments: boolean, includeNonIntersectingSegments: boolean,
minimum?: number, hideHiddenSponsors = false): {includedTimes: ScheduledTime[], scheduledTimes: number[]} { minimum?: number, hideHiddenSponsors = false): {includedTimes: ScheduledTime[]; scheduledTimes: number[]} {
if (!sponsorTimes) return {includedTimes: [], scheduledTimes: []}; if (!sponsorTimes) return {includedTimes: [], scheduledTimes: []};
const includedTimes: ScheduledTime[] = []; const includedTimes: ScheduledTime[] = [];

View File

@@ -6,26 +6,26 @@
import { PageType } from "./types"; import { PageType } from "./types";
interface StartMessage { interface StartMessage {
type: "navigation", type: "navigation";
pageType: PageType pageType: PageType;
videoID: string | null, videoID: string | null;
} }
interface FinishMessage extends StartMessage { interface FinishMessage extends StartMessage {
channelID: string, channelID: string;
channelTitle: string channelTitle: string;
} }
interface AdMessage { interface AdMessage {
type: "ad", type: "ad";
playing: boolean playing: boolean;
} }
interface VideoData { interface VideoData {
type: "data", type: "data";
videoID: string, videoID: string;
isLive: boolean, isLive: boolean;
isPremiere: boolean isPremiere: boolean;
} }
type WindowMessage = StartMessage | FinishMessage | AdMessage | VideoData; type WindowMessage = StartMessage | FinishMessage | AdMessage | VideoData;

2
src/globals.d.ts vendored
View File

@@ -1,6 +1,6 @@
import { SBObject } from "./config"; import { SBObject } from "./config";
declare global { declare global {
interface Window { SB: SBObject; } interface Window { SB: SBObject }
// Remove this once the API becomes stable and types are shipped in @types/chrome // Remove this once the API becomes stable and types are shipped in @types/chrome
namespace chrome { namespace chrome {
namespace declarativeContent { namespace declarativeContent {

View File

@@ -651,7 +651,7 @@ class PreviewBar {
} }
private findLeftAndScale(selector: string, currentElement: HTMLElement, progressBar: HTMLElement): private findLeftAndScale(selector: string, currentElement: HTMLElement, progressBar: HTMLElement):
{ left: number, scale: number } { { left: number; scale: number } {
const sections = currentElement.parentElement.parentElement.parentElement.children; const sections = currentElement.parentElement.parentElement.parentElement.children;
let currentWidth = 0; let currentWidth = 0;
let lastWidth = 0; let lastWidth = 0;

View File

@@ -61,9 +61,9 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
localizeHtmlPage(); localizeHtmlPage();
type InputPageElements = { type InputPageElements = {
whitelistToggle?: HTMLInputElement, whitelistToggle?: HTMLInputElement;
toggleSwitch?: HTMLInputElement, toggleSwitch?: HTMLInputElement;
usernameInput?: HTMLInputElement, usernameInput?: HTMLInputElement;
}; };
type PageElements = { [key: string]: HTMLElement } & InputPageElements type PageElements = { [key: string]: HTMLElement } & InputPageElements

View File

@@ -9,17 +9,17 @@ import { ButtonListener, ContentContainer } from "../types";
import NoticeTextSelectionComponent from "../components/NoticeTextSectionComponent"; import NoticeTextSelectionComponent from "../components/NoticeTextSectionComponent";
export interface TextBox { export interface TextBox {
icon: string, icon: string;
text: string text: string;
} }
export interface NoticeOptions { export interface NoticeOptions {
title: string, title: string;
referenceNode?: HTMLElement, referenceNode?: HTMLElement;
textBoxes?: TextBox[], textBoxes?: TextBox[];
buttons?: ButtonListener[], buttons?: ButtonListener[];
fadeIn?: boolean, fadeIn?: boolean;
timed?: boolean timed?: boolean;
style?: React.CSSProperties; style?: React.CSSProperties;
extraClass?: string; extraClass?: string;
maxCountdownTime?: () => number; maxCountdownTime?: () => number;

View File

@@ -2,18 +2,18 @@ import * as React from "react";
import { createRoot, Root } from 'react-dom/client'; import { createRoot, Root } from 'react-dom/client';
export interface RectangleTooltipProps { export interface RectangleTooltipProps {
text: string, text: string;
link?: string, link?: string;
referenceNode: HTMLElement, referenceNode: HTMLElement;
prependElement?: HTMLElement, // Element to append before prependElement?: HTMLElement; // Element to append before
bottomOffset?: string, bottomOffset?: string;
leftOffset?: string, leftOffset?: string;
timeout?: number, timeout?: number;
htmlId?: string, htmlId?: string;
maxHeight?: string, maxHeight?: string;
maxWidth?: string, maxWidth?: string;
backgroundColor?: string, backgroundColor?: string;
fontSize?: string, fontSize?: string;
buttonFunction?: () => void; buttonFunction?: () => void;
} }

View File

@@ -4,32 +4,32 @@ import SkipNotice from "./render/SkipNotice";
export interface ContentContainer { export interface ContentContainer {
(): { (): {
vote: (type: number, UUID: SegmentUUID, category?: Category, skipNotice?: SkipNoticeComponent) => void, vote: (type: number, UUID: SegmentUUID, category?: Category, skipNotice?: SkipNoticeComponent) => void;
dontShowNoticeAgain: () => void, dontShowNoticeAgain: () => void;
unskipSponsorTime: (segment: SponsorTime, unskipTime: number, forceSeek?: boolean) => void, unskipSponsorTime: (segment: SponsorTime, unskipTime: number, forceSeek?: boolean) => void;
sponsorTimes: SponsorTime[], sponsorTimes: SponsorTime[];
sponsorTimesSubmitting: SponsorTime[], sponsorTimesSubmitting: SponsorTime[];
skipNotices: SkipNotice[], skipNotices: SkipNotice[];
v: HTMLVideoElement, v: HTMLVideoElement;
sponsorVideoID, sponsorVideoID;
reskipSponsorTime: (segment: SponsorTime, forceSeek?: boolean) => void, reskipSponsorTime: (segment: SponsorTime, forceSeek?: boolean) => void;
updatePreviewBar: () => void, updatePreviewBar: () => void;
onMobileYouTube: boolean, onMobileYouTube: boolean;
sponsorSubmissionNotice: SubmissionNotice, sponsorSubmissionNotice: SubmissionNotice;
resetSponsorSubmissionNotice: (callRef?: boolean) => void, resetSponsorSubmissionNotice: (callRef?: boolean) => void;
updateEditButtonsOnPlayer: () => void, updateEditButtonsOnPlayer: () => void;
previewTime: (time: number, unpause?: boolean) => void, previewTime: (time: number, unpause?: boolean) => void;
videoInfo: VideoInfo, videoInfo: VideoInfo;
getRealCurrentTime: () => number, getRealCurrentTime: () => number;
lockedCategories: string[], lockedCategories: string[];
channelIDInfo: ChannelIDInfo channelIDInfo: ChannelIDInfo;
} };
} }
export interface FetchResponse { export interface FetchResponse {
responseText: string, responseText: string;
status: number, status: number;
ok: boolean ok: boolean;
} }
export type HashedValue = string & { __hashBrand: unknown }; export type HashedValue = string & { __hashBrand: unknown };
@@ -46,7 +46,7 @@ export enum CategorySkipOption {
export interface CategorySelection { export interface CategorySelection {
name: Category; name: Category;
option: CategorySkipOption option: CategorySkipOption;
} }
export enum SponsorHideType { export enum SponsorHideType {
@@ -97,95 +97,95 @@ export interface ScheduledTime extends SponsorTime {
} }
export interface PreviewBarOption { export interface PreviewBarOption {
color: string, color: string;
opacity: string opacity: string;
} }
export interface Registration { export interface Registration {
message: string, message: string;
id: string, id: string;
allFrames: boolean, allFrames: boolean;
js: browser.extensionTypes.ExtensionFileOrCode[], js: browser.extensionTypes.ExtensionFileOrCode[];
css: browser.extensionTypes.ExtensionFileOrCode[], css: browser.extensionTypes.ExtensionFileOrCode[];
matches: string[] matches: string[];
} }
export interface BackgroundScriptContainer { export interface BackgroundScriptContainer {
registerFirefoxContentScript: (opts: Registration) => void, registerFirefoxContentScript: (opts: Registration) => void;
unregisterFirefoxContentScript: (id: string) => void unregisterFirefoxContentScript: (id: string) => void;
} }
export interface VideoInfo { export interface VideoInfo {
responseContext: { responseContext: {
serviceTrackingParams: Array<{service: string, params: Array<{key: string, value: string}>}>, serviceTrackingParams: Array<{service: string; params: Array<{key: string; value: string}>}>;
webResponseContextExtensionData: { webResponseContextExtensionData: {
hasDecorated: boolean hasDecorated: boolean;
} };
}, };
playabilityStatus: { playabilityStatus: {
status: string, status: string;
playableInEmbed: boolean, playableInEmbed: boolean;
miniplayer: { miniplayer: {
miniplayerRenderer: { miniplayerRenderer: {
playbackMode: string playbackMode: string;
} };
} };
}; };
streamingData: unknown; streamingData: unknown;
playbackTracking: unknown; playbackTracking: unknown;
videoDetails: { videoDetails: {
videoId: string, videoId: string;
title: string, title: string;
lengthSeconds: string, lengthSeconds: string;
keywords: string[], keywords: string[];
channelId: string, channelId: string;
isOwnerViewing: boolean, isOwnerViewing: boolean;
shortDescription: string, shortDescription: string;
isCrawlable: boolean, isCrawlable: boolean;
thumbnail: { thumbnail: {
thumbnails: Array<{url: string, width: number, height: number}> thumbnails: Array<{url: string; width: number; height: number}>;
}, };
averageRating: number, averageRating: number;
allowRatings: boolean, allowRatings: boolean;
viewCount: string, viewCount: string;
author: string, author: string;
isPrivate: boolean, isPrivate: boolean;
isUnpluggedCorpus: boolean, isUnpluggedCorpus: boolean;
isLiveContent: boolean, isLiveContent: boolean;
}; };
playerConfig: unknown; playerConfig: unknown;
storyboards: unknown; storyboards: unknown;
microformat: { microformat: {
playerMicroformatRenderer: { playerMicroformatRenderer: {
thumbnail: { thumbnail: {
thumbnails: Array<{url: string, width: number, height: number}> thumbnails: Array<{url: string; width: number; height: number}>;
}, };
embed: { embed: {
iframeUrl: string, iframeUrl: string;
flashUrl: string, flashUrl: string;
width: number, width: number;
height: number, height: number;
flashSecureUrl: string, flashSecureUrl: string;
}, };
title: { title: {
simpleText: string, simpleText: string;
}, };
description: { description: {
simpleText: string, simpleText: string;
}, };
lengthSeconds: string, lengthSeconds: string;
ownerProfileUrl: string, ownerProfileUrl: string;
externalChannelId: string, externalChannelId: string;
availableCountries: string[], availableCountries: string[];
isUnlisted: boolean, isUnlisted: boolean;
hasYpcMetadata: boolean, hasYpcMetadata: boolean;
viewCount: string, viewCount: string;
category: Category, category: Category;
publishDate: string, publishDate: string;
ownerChannelName: string, ownerChannelName: string;
uploadDate: string, uploadDate: string;
} };
}; };
trackingParams: string; trackingParams: string;
attestation: unknown; attestation: unknown;
@@ -205,17 +205,17 @@ export enum ChannelIDStatus {
} }
export interface ChannelIDInfo { export interface ChannelIDInfo {
id: string, id: string;
status: ChannelIDStatus status: ChannelIDStatus;
} }
export interface SkipToTimeParams { export interface SkipToTimeParams {
v: HTMLVideoElement, v: HTMLVideoElement;
skipTime: number[], skipTime: number[];
skippingSegments: SponsorTime[], skippingSegments: SponsorTime[];
openNotice: boolean, openNotice: boolean;
forceAutoSkip?: boolean, forceAutoSkip?: boolean;
unskipTime?: number unskipTime?: number;
} }
export interface ToggleSkippable { export interface ToggleSkippable {
@@ -232,11 +232,11 @@ export enum NoticeVisbilityMode {
} }
export type Keybind = { export type Keybind = {
key: string, key: string;
code?: string, code?: string;
ctrl?: boolean, ctrl?: boolean;
alt?: boolean, alt?: boolean;
shift?: boolean shift?: boolean;
} }
export enum PageType { export enum PageType {
@@ -249,6 +249,6 @@ export enum PageType {
} }
export interface ButtonListener { export interface ButtonListener {
name: string, name: string;
listener: (e?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void listener: (e?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
} }

View File

@@ -24,7 +24,7 @@ export default class Utils {
/* Used for waitForElement */ /* Used for waitForElement */
creatingWaitingMutationObserver = false; creatingWaitingMutationObserver = false;
waitingMutationObserver: MutationObserver = null; waitingMutationObserver: MutationObserver = null;
waitingElements: { selector: string, visibleCheck: boolean, callback: (element: Element) => void }[] = []; waitingElements: { selector: string; visibleCheck: boolean; callback: (element: Element) => void }[] = [];
constructor(backgroundScriptContainer: BackgroundScriptContainer = null) { constructor(backgroundScriptContainer: BackgroundScriptContainer = null) {
this.backgroundScriptContainer = backgroundScriptContainer; this.backgroundScriptContainer = backgroundScriptContainer;

View File

@@ -25,7 +25,7 @@ function applyLoadingAnimation(element: HTMLElement, time: number, callback?: ()
}); });
} }
function setupCustomHideAnimation(element: Element, container: Element, enabled = true, rightSlide = true): { hide: () => void, show: () => void } { function setupCustomHideAnimation(element: Element, container: Element, enabled = true, rightSlide = true): { hide: () => void; show: () => void } {
if (enabled) element.classList.add("autoHiding"); if (enabled) element.classList.add("autoHiding");
element.classList.add("hidden"); element.classList.add("hidden");
element.classList.add("animationDone"); element.classList.add("animationDone");

View File

@@ -93,7 +93,7 @@ function getLuminance(color: string): number {
} }
/* From https://stackoverflow.com/a/5624139 */ /* From https://stackoverflow.com/a/5624139 */
function hexToRgb(hex: string): {r: number, g: number, b: number} { function hexToRgb(hex: string): {r: number; g: number; b: number} {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, function(m, r, g, b) { hex = hex.replace(shorthandRegex, function(m, r, g, b) {

View File

@@ -6,9 +6,9 @@ import { GenericUtils } from "./genericUtils";
const utils = new Utils(); const utils = new Utils();
export interface ChatConfig { export interface ChatConfig {
displayName: string, displayName: string;
composerInitialValue?: string, composerInitialValue?: string;
customDescription?: string customDescription?: string;
} }
export async function openWarningDialog(contentContainer: ContentContainer): Promise<void> { export async function openWarningDialog(contentContainer: ContentContainer): Promise<void> {