types.ts 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. import { NanoEmitter } from "@sv443-network/userutils";
  2. import type * as consts from "./constants.js";
  3. import type { scriptInfo } from "./constants.js";
  4. import type { addSelectorListener } from "./observers.js";
  5. import type resources from "../assets/resources.json";
  6. import type locales from "../assets/locales.json";
  7. import type { getResourceUrl, getSessionId, getVideoTime, TrLocale, t, tp, fetchVideoVotes, onInteraction, getThumbnailUrl, getBestThumbnailUrl, getLocale, hasKey, hasKeyFor, getDomain, waitVideoElementReady, setInnerHtml, getCurrentMediaType } from "./utils/index.js";
  8. import type { SiteEventsMap } from "./siteEvents.js";
  9. import type { InterfaceEventsMap, getAutoLikeDataInterface, getFeaturesInterface, getPluginInfo, registerPlugin, saveAutoLikeDataInterface, saveFeaturesInterface, setLocaleInterface } from "./interface.js";
  10. import type { BytmDialog, ExImDialog, createCircularBtn, createHotkeyInput, createRipple, createToggleInput, showIconToast, showToast } from "./components/index.js";
  11. import type { fetchLyricsUrlTop, sanitizeArtists, sanitizeSong } from "./features/lyrics.js";
  12. import type { getLyricsCacheEntry } from "./features/lyricsCache.js";
  13. //#region other
  14. /** Custom CLI args passed to rollup */
  15. export type RollupArgs = Partial<{
  16. "config-mode": "development" | "production";
  17. "config-branch": "main" | "develop";
  18. "config-host": "greasyfork" | "github" | "openuserjs";
  19. "config-assetSource": "local" | "github";
  20. "config-suffix": string;
  21. }>;
  22. // I know TS enums are impure but it doesn't really matter here, plus imo they are cooler than pure enums anyway
  23. export enum LogLevel {
  24. Debug,
  25. Info,
  26. }
  27. /** Which domain this script is currently running on */
  28. export type Domain = "yt" | "ytm";
  29. /** A selection option between one of the supported domains, or all of them */
  30. export type SiteSelection = Domain | "all";
  31. /** A selection option between one of the supported domains, or none of them */
  32. export type SiteSelectionOrNone = SiteSelection | "none";
  33. /** Key of a resource in `assets/resources.json` and extra keys defined by `tools/post-build.ts` */
  34. export type ResourceKey = keyof typeof resources | `trans-${keyof typeof locales}` | "changelog" | "css-bundle";
  35. /** Describes a single hotkey */
  36. export type HotkeyObj = {
  37. code: string,
  38. shift: boolean,
  39. ctrl: boolean,
  40. alt: boolean,
  41. };
  42. export type LyricsCacheEntry = {
  43. artist: string;
  44. song: string;
  45. url: string;
  46. viewed: number;
  47. added: number;
  48. };
  49. export type AutoLikeData = {
  50. channels: {
  51. /** 24-character channel ID or user ID including the @ prefix */
  52. id: string;
  53. /** Channel name (for display purposes only) */
  54. name: string;
  55. /** Whether the channel should be auto-liked */
  56. enabled: boolean;
  57. }[];
  58. };
  59. export type RYDVotesObj = {
  60. /** The watch ID of the video */
  61. id: string;
  62. /** ISO timestamp of when the video was uploaded */
  63. dateCreated: string;
  64. /** Amount of likes */
  65. likes: number;
  66. /** Amount of dislikes */
  67. dislikes: number;
  68. /** Like to dislike ratio from 0.0 to 5.0 */
  69. rating: number;
  70. /** Amount of views */
  71. viewCount: number;
  72. /** Whether the video was deleted */
  73. deleted: boolean;
  74. };
  75. export type VideoVotesObj = {
  76. /** The watch ID of the video */
  77. id: string;
  78. /** Amount of likes */
  79. likes: number;
  80. /** Amount of dislikes */
  81. dislikes: number;
  82. /** Like to dislike ratio from 0.0 to 5.0 */
  83. rating: number;
  84. /** Timestamp of when the data was fetched */
  85. timestamp: number;
  86. };
  87. export type NumberNotation = "short" | "long";
  88. export type ColorLightness = "darker" | "normal" | "lighter";
  89. //#region global
  90. /** All properties of the `unsafeWindow.BYTM` object (also called "plugin interface") */
  91. export type BytmObject =
  92. {
  93. [key: string]: unknown;
  94. locale: TrLocale;
  95. logLevel: LogLevel;
  96. }
  97. // information from the userscript header
  98. & typeof scriptInfo
  99. // certain variables from `src/constants.ts`
  100. & Pick<typeof consts, "mode" | "branch" | "host" | "buildNumber" | "compressionFormat">
  101. // global functions exposed through the interface in `src/interface.ts`
  102. & InterfaceFunctions
  103. // others
  104. & {
  105. NanoEmitter: typeof NanoEmitter;
  106. BytmDialog: typeof BytmDialog;
  107. ExImDialog: typeof ExImDialog;
  108. // the entire UserUtils library
  109. UserUtils: typeof import("@sv443-network/userutils");
  110. // the entire compare-versions library
  111. compareVersions: typeof import("compare-versions");
  112. };
  113. export type TTPolicy = {
  114. createHTML: (dirty: string) => string;
  115. };
  116. declare global {
  117. interface Window {
  118. // to see the expanded type, install the VS Code extension "MylesMurphy.prettify-ts" and hover over the property below
  119. // alternatively navigate with ctrl+click to find the types
  120. BYTM: BytmObject;
  121. // polyfill for the new Trusted Types API
  122. trustedTypes: {
  123. createPolicy(name: string, policy: TTPolicy): TTPolicy;
  124. };
  125. }
  126. }
  127. //#region plugins
  128. /**
  129. * Intents (permissions) BYTM has to grant your plugin for it to be able to access certain features.
  130. * TODO: this feature is unfinished, but you should still specify the intents your plugin needs.
  131. * Never request more permissions than you need, as this is a bad practice and can lead to your plugin being rejected.
  132. */
  133. export enum PluginIntent {
  134. /** Plugin has access to hidden config values */
  135. HiddenConfigValues = 1,
  136. /** Plugin can write to the feature configuration */
  137. WriteFeatureConfig = 2,
  138. /** Plugin can write to the lyrics cache */
  139. WriteLyricsCache = 4,
  140. /** Plugin can add new translations and overwrite existing ones */
  141. WriteTranslations = 8,
  142. /** Plugin can create modal dialogs */
  143. CreateModalDialogs = 16,
  144. /** Plugin can read and write auto-like data */
  145. ReadAndWriteAutoLikeData = 32,
  146. }
  147. /** Result of a plugin registration */
  148. export type PluginRegisterResult = {
  149. /** Public info about the registered plugin */
  150. info: PluginInfo;
  151. /** NanoEmitter instance for plugin events - see {@linkcode PluginEventMap} for a list of events */
  152. events: NanoEmitter<PluginEventMap>;
  153. /** Authentication token for the plugin to use in certain restricted function calls */
  154. token: string;
  155. }
  156. /** Minimal object that describes a plugin - this is all info the other installed plugins can see */
  157. export type PluginInfo = {
  158. /** Name of the plugin */
  159. name: string;
  160. /**
  161. * Adding the namespace and the name property makes the unique identifier for a plugin.
  162. * If one exists with the same name and namespace as this plugin, it may be overwritten at registration.
  163. * I recommend to set this value to a URL pointing to your homepage, or the author's username.
  164. */
  165. namespace: string;
  166. /** Version of the plugin as a semver-compliant string */
  167. version: string;
  168. };
  169. /** Minimum part of the PluginDef object needed to make up the resolvable plugin identifier */
  170. export type PluginDefResolvable = PluginDef | { plugin: Pick<PluginDef["plugin"], "name" | "namespace"> };
  171. /** An object that describes a BYTM plugin */
  172. export type PluginDef = {
  173. plugin: PluginInfo & {
  174. /**
  175. * Descriptions of at least en_US and optionally any other locale supported by BYTM.
  176. * When an untranslated locale is set, the description will default to the value of en_US
  177. */
  178. description: Partial<Record<keyof typeof locales, string>> & {
  179. en_US: string;
  180. };
  181. /** URL to the plugin's icon - recommended size: 48x48 to 128x128 */
  182. iconUrl?: string;
  183. license?: {
  184. /** License name */
  185. name: string;
  186. /** URL to the license text */
  187. url: string;
  188. };
  189. /** Homepage URLs for the plugin */
  190. homepage: {
  191. /** URL to the plugin's source code (i.e. Git repo) - closed source plugins are not officially accepted at the moment. */
  192. source: string;
  193. /** Any other homepage URL */
  194. other?: string;
  195. /** URL to the plugin's bug tracker page, like GitHub issues */
  196. bug?: string;
  197. /** URL to the plugin's GreasyFork page */
  198. greasyfork?: string;
  199. /** URL to the plugin's OpenUserJS page */
  200. openuserjs?: string;
  201. };
  202. };
  203. /** Intents (permissions) BYTM has to grant the plugin for it to work */
  204. intents?: number;
  205. /** Info about the plugin contributors */
  206. contributors?: Array<{
  207. /** Name of this contributor */
  208. name: string;
  209. /** (optional) Email address of this contributor */
  210. email?: string;
  211. /** (optional) URL to this plugin contributor's homepage / GitHub profile */
  212. url?: string;
  213. }>;
  214. };
  215. /** All events that are dispatched to plugins individually, including everything in {@linkcode SiteEventsMap} and {@linkcode InterfaceEventsMap} - these don't have a prefix since they can't conflict with other events */
  216. export type PluginEventMap =
  217. // These are emitted on each plugin individually, with individual data:
  218. & {
  219. /** Emitted when the plugin is fully registered on BYTM's side and can use authenticated API calls */
  220. pluginRegistered: (info: PluginInfo) => void;
  221. }
  222. // These are emitted on every plugin simultaneously, with the same or similar data:
  223. & SiteEventsMap
  224. & InterfaceEventsMap;
  225. /** A plugin in either the queue or registered map */
  226. export type PluginItem =
  227. & {
  228. def: PluginDef;
  229. }
  230. & Pick<PluginRegisterResult, "events">;
  231. /** All functions exposed by the interface on the global `BYTM` object */
  232. export type InterfaceFunctions = {
  233. // meta:
  234. /** Registers a plugin with BYTM. Needed to receive the token for making authenticated function calls. */
  235. registerPlugin: typeof registerPlugin;
  236. /** 🔒 Checks if the plugin with the given name and namespace is registered and returns an info object about it */
  237. getPluginInfo: typeof getPluginInfo;
  238. // bytm-specific:
  239. /** Returns the current domain as a constant string representation */
  240. getDomain: typeof getDomain;
  241. /**
  242. * Returns the URL of a resource as defined in `assets/resources.json`
  243. * There are also some resources like translation files that get added by `tools/post-build.ts`
  244. *
  245. * The returned URL is a `blob:` URL served up by the userscript extension
  246. * This makes the resource fast to fetch and also prevents CORS issues
  247. */
  248. getResourceUrl: typeof getResourceUrl;
  249. /** Returns the unique session ID for the current tab */
  250. getSessionId: typeof getSessionId;
  251. // dom:
  252. /** Sets the innerHTML property of the provided element to a sanitized version of the provided HTML string */
  253. setInnerHtml: typeof setInnerHtml;
  254. /** Adds a listener to one of the already present SelectorObserver instances */
  255. addSelectorListener: typeof addSelectorListener;
  256. /** Registers accessible interaction listeners (click, enter, space) on the provided element */
  257. onInteraction: typeof onInteraction;
  258. /**
  259. * Returns the current video time (on both YT and YTM)
  260. * In case it can't be determined on YT, mouse movement is simulated to bring up the video time
  261. * In order for that edge case not to error out, the function would need to be called in response to a user interaction event (e.g. click) due to the strict autoplay policy in browsers
  262. */
  263. getVideoTime: typeof getVideoTime;
  264. /** Returns the thumbnail URL for the provided video ID and thumbnail quality */
  265. getThumbnailUrl: typeof getThumbnailUrl;
  266. /** Returns the thumbnail URL with the best quality for the provided video ID */
  267. getBestThumbnailUrl: typeof getBestThumbnailUrl;
  268. /** Resolves the returned promise when the video element is queryable in the DOM */
  269. waitVideoElementReady: typeof waitVideoElementReady;
  270. /** (On YTM only) returns the current media type (video or song) */
  271. getCurrentMediaType: typeof getCurrentMediaType;
  272. // translations:
  273. /** 🔒 Sets the locale for all new translations */
  274. setLocale: typeof setLocaleInterface;
  275. /** Returns the current locale */
  276. getLocale: typeof getLocale;
  277. /** Returns whether a translation key exists for the set locale */
  278. hasKey: typeof hasKey;
  279. /** Returns whether a translation key exists for the provided locale */
  280. hasKeyFor: typeof hasKeyFor;
  281. /** Returns the translation for the provided translation key and set locale (check the files in the folder `assets/translations`) */
  282. t: typeof t;
  283. /** Returns the translation for the provided translation key, including pluralization identifier and set locale (check the files in the folder `assets/translations`) */
  284. tp: typeof tp;
  285. // feature config:
  286. /** 🔒 Returns the current feature configuration */
  287. getFeatures: typeof getFeaturesInterface;
  288. /** 🔒 Overwrites the feature configuration with the provided one */
  289. saveFeatures: typeof saveFeaturesInterface;
  290. // lyrics:
  291. /** Sanitizes the provided artist string - this needs to be done before calling other lyrics related functions! */
  292. sanitizeArtists: typeof sanitizeArtists;
  293. /** Sanitizes the provided song title string - this needs to be done before calling other lyrics related functions! */
  294. sanitizeSong: typeof sanitizeSong;
  295. /** Fetches the lyrics URL of the top search result for the provided song and artist. Before a request is sent, the cache is checked for a match. */
  296. fetchLyricsUrlTop: typeof fetchLyricsUrlTop;
  297. /** Returns the lyrics cache entry for the provided song and artist, if there is one. Never sends a request on its own. */
  298. getLyricsCacheEntry: typeof getLyricsCacheEntry;
  299. // auto-like:
  300. /** 🔒 Returns the current auto-like data */
  301. getAutoLikeData: typeof getAutoLikeDataInterface;
  302. /** 🔒 Overwrites the auto-like data */
  303. saveAutoLikeData: typeof saveAutoLikeDataInterface;
  304. /** Returns the votes for the provided video ID from the ReturnYoutubeDislike API */
  305. fetchVideoVotes: typeof fetchVideoVotes;
  306. // components:
  307. /** Creates a new hotkey input component */
  308. createHotkeyInput: typeof createHotkeyInput;
  309. /** Creates a new toggle input component */
  310. createToggleInput: typeof createToggleInput;
  311. /** Creates a new circular button component */
  312. createCircularBtn: typeof createCircularBtn;
  313. /** Creates a new ripple effect on the provided element or creates an empty element that has the effect */
  314. createRipple: typeof createRipple;
  315. /** Shows a toast with the provided text */
  316. showToast: typeof showToast;
  317. /** Shows a toast with the provided text and an icon */
  318. showIconToast: typeof showIconToast;
  319. };
  320. //#region feature defs
  321. export type FeatureKey = keyof FeatureConfig;
  322. export type FeatureCategory =
  323. | "layout"
  324. | "volume"
  325. | "songLists"
  326. | "behavior"
  327. | "input"
  328. | "lyrics"
  329. | "integrations"
  330. | "general";
  331. type SelectOption = {
  332. value: string | number;
  333. label: string;
  334. };
  335. type FeatureTypeProps = ({
  336. type: "toggle";
  337. default: boolean;
  338. } & FeatureFuncProps)
  339. | ({
  340. type: "number";
  341. default: number;
  342. min: number;
  343. max?: number;
  344. step?: number;
  345. unit?: string | ((val: number) => string);
  346. } & FeatureFuncProps)
  347. | ({
  348. type: "select";
  349. default: string | number;
  350. options: SelectOption[] | (() => SelectOption[]);
  351. } & FeatureFuncProps)
  352. | ({
  353. type: "slider";
  354. default: number;
  355. min: number;
  356. max: number;
  357. step?: number;
  358. unit?: string | ((val: number) => string);
  359. } & FeatureFuncProps)
  360. | ({
  361. type: "hotkey";
  362. default: HotkeyObj;
  363. } & FeatureFuncProps)
  364. | ({
  365. type: "text";
  366. default: string;
  367. normalize?: (val: string) => string;
  368. } & FeatureFuncProps)
  369. | {
  370. type: "button";
  371. default?: undefined;
  372. click: () => Promise<void | unknown> | void | unknown;
  373. }
  374. type FeatureFuncProps = (
  375. {
  376. /** Whether the feature requires a page reload to take effect */
  377. reloadRequired: false;
  378. /** Called to instantiate the feature on the page */
  379. enable: (featCfg: FeatureConfig) => void,
  380. }
  381. | {
  382. /** Whether the feature requires a page reload to take effect */
  383. reloadRequired?: true;
  384. /** Called to instantiate the feature on the page */
  385. enable?: undefined;
  386. }
  387. ) & (
  388. {
  389. /** Called to remove all traces of the feature from the page and memory (includes event listeners) */
  390. disable?: (feats: FeatureConfig) => void,
  391. }
  392. | {
  393. /** Called to update the feature's behavior when the config changes */
  394. change?: (key: FeatureKey, initialVal: number | boolean | Record<string, unknown>, newVal: number | boolean | Record<string, unknown>) => void,
  395. }
  396. );
  397. /**
  398. * The feature info object that contains all properties necessary to construct the config menu and the feature config object.
  399. * All values are loosely typed so try to only use this with the `satisfies` keyword.
  400. * Use `typeof featInfo` (from `src/features/index.ts`) instead for full type safety.
  401. */
  402. export type FeatureInfo = Record<
  403. keyof FeatureConfig,
  404. {
  405. category: FeatureCategory;
  406. /**
  407. * HTML string that will be the help text for this feature
  408. * Specifying a function is useful for pluralizing or inserting values into the translation at runtime
  409. */
  410. helpText?: string | (() => string);
  411. /** Whether the value should be hidden in the config menu and from plugins */
  412. valueHidden?: boolean;
  413. /** Transformation function called before the value is rendered in the config menu */
  414. renderValue?: (value: string) => string | Promise<string>;
  415. /** HTML string that is appended to the end of a feature's text description */
  416. textAdornment?: () => (Promise<string | undefined> | string | undefined);
  417. /** Whether to only show this feature when advanced mode is activated (default false) */
  418. advanced?: boolean;
  419. }
  420. & FeatureTypeProps
  421. >;
  422. //#region feature config
  423. /** Feature configuration */
  424. export interface FeatureConfig {
  425. //#region layout
  426. /** Show a BetterYTM watermark under the YTM logo */
  427. watermarkEnabled: boolean;
  428. /** Remove the "si" tracking parameter from links in the share menu? */
  429. removeShareTrackingParam: boolean;
  430. /** On which sites to remove the "si" tracking parameter from links in the share menu */
  431. removeShareTrackingParamSites: SiteSelection;
  432. /** Enable skipping to a specific time in the video by pressing a number key (0-9) */
  433. numKeysSkipToTime: boolean;
  434. /** Fix spacing issues in the layout */
  435. fixSpacing: boolean;
  436. /** Where to show a thumbnail overlay over the video element and whether to show it at all */
  437. thumbnailOverlayBehavior: "never" | "videosOnly" | "songsOnly" | "always";
  438. /** Whether to show a button to toggle the thumbnail overlay in the media controls */
  439. thumbnailOverlayToggleBtnShown: boolean;
  440. /** Whether to show an indicator on the thumbnail overlay when it is active */
  441. thumbnailOverlayShowIndicator: boolean;
  442. /** The opacity of the thumbnail overlay indicator element */
  443. thumbnailOverlayIndicatorOpacity: number;
  444. /** How to fit the thumbnail overlay image */
  445. thumbnailOverlayImageFit: "cover" | "contain" | "fill";
  446. /** Hide the cursor when it's idling on the video element for a while */
  447. hideCursorOnIdle: boolean;
  448. /** Delay in seconds after which the cursor should be hidden */
  449. hideCursorOnIdleDelay: number;
  450. /** Whether to fix various issues in the layout when HDR is supported and active */
  451. fixHdrIssues: boolean;
  452. /** Whether to show the like/dislike ratio on the currently playing song */
  453. showVotes: boolean;
  454. /** Which format to use for the like/dislike ratio on the currently playing song */
  455. showVotesFormat: NumberNotation;
  456. //#region volume
  457. /** Add a percentage label to the volume slider */
  458. volumeSliderLabel: boolean;
  459. /** The width of the volume slider in pixels */
  460. volumeSliderSize: number;
  461. /** Volume slider sensitivity - the smaller this number, the finer the volume control */
  462. volumeSliderStep: number;
  463. /** Volume slider scroll wheel sensitivity */
  464. volumeSliderScrollStep: number;
  465. /** Whether the volume should be locked to the same level across all tabs (changing in one changes in all others too) */
  466. volumeSharedBetweenTabs: boolean;
  467. /** Whether to set an initial volume level for each new session */
  468. setInitialTabVolume: boolean;
  469. /** The initial volume level to set for each new session */
  470. initialTabVolumeLevel: number;
  471. //#region song lists
  472. /** Add a button to each song in the queue to quickly open its lyrics page */
  473. lyricsQueueButton: boolean;
  474. /** Add a button to each song in the queue to quickly remove it */
  475. deleteFromQueueButton: boolean;
  476. /** Where to place the buttons in the queue */
  477. listButtonsPlacement: "queueOnly" | "everywhere";
  478. /** Add a button above the queue to scroll to the currently playing song */
  479. scrollToActiveSongBtn: boolean;
  480. /** Add a button above the queue to clear it */
  481. clearQueueBtn: boolean;
  482. //#region behavior
  483. /** Whether to completely disable the popup that sometimes appears before leaving the site */
  484. disableBeforeUnloadPopup: boolean;
  485. /** After how many milliseconds to close permanent toasts */
  486. closeToastsTimeout: number;
  487. /** Remember the last song's time when reloading or restoring the tab */
  488. rememberSongTime: boolean;
  489. /** Where to remember the song time */
  490. rememberSongTimeSites: SiteSelection;
  491. /** Time in seconds to remember the song time for */
  492. rememberSongTimeDuration: number;
  493. /** Time in seconds to subtract from the remembered song time */
  494. rememberSongTimeReduction: number;
  495. /** Minimum time in seconds the song needs to be played before it is remembered */
  496. rememberSongTimeMinPlayTime: number;
  497. //#region input
  498. /** Arrow keys skip forwards and backwards */
  499. arrowKeySupport: boolean;
  500. /** By how many seconds to skip when pressing the arrow keys */
  501. arrowKeySkipBy: number;
  502. /** Add a hotkey to switch between the YT and YTM sites on a video / song */
  503. switchBetweenSites: boolean;
  504. /** The hotkey that needs to be pressed to initiate the site switch */
  505. switchSitesHotkey: HotkeyObj;
  506. /** Make it so middle clicking a song to open it in a new tab (through thumbnail and song title) is easier */
  507. anchorImprovements: boolean;
  508. /** Whether to auto-like all played videos of configured channels */
  509. autoLikeChannels: boolean;
  510. /** Whether to show toggle buttons on the channel page to enable/disable auto-liking for that channel */
  511. autoLikeChannelToggleBtn: boolean;
  512. // TODO(v2.2):
  513. // /** Whether to show a toggle button in the media controls to enable/disable auto-liking for those channel(s) */
  514. // autoLikePlayerBarToggleBtn: boolean;
  515. /** How long to wait after a video has started playing to auto-like it */
  516. autoLikeTimeout: number;
  517. /** Whether to show a toast when a video is auto-liked */
  518. autoLikeShowToast: boolean;
  519. /** Opens the auto-like channels management dialog */
  520. autoLikeOpenMgmtDialog: undefined;
  521. //#region lyrics
  522. /** Add a button to the media controls to open the current song's lyrics on genius.com in a new tab */
  523. geniusLyrics: boolean;
  524. /** Base URL to use for GeniURL */
  525. geniUrlBase: string;
  526. /** Token to use for GeniURL */
  527. geniUrlToken: string;
  528. /** Max size of lyrics cache */
  529. lyricsCacheMaxSize: number;
  530. /** Max TTL of lyrics cache entries, in ms */
  531. lyricsCacheTTL: number;
  532. /** Button to clear lyrics cache */
  533. clearLyricsCache: undefined;
  534. // /** Whether to use advanced filtering when searching for lyrics (exact, exact-ish) */
  535. // advancedLyricsFilter: boolean;
  536. //#region integrations
  537. /** On which sites to disable Dark Reader - does nothing if the extension is not installed */
  538. disableDarkReaderSites: SiteSelectionOrNone;
  539. /** Whether to fix the styling of some elements from the SponsorBlock extension - does nothing if the extension is not installed */
  540. sponsorBlockIntegration: boolean;
  541. /** Whether to adjust styles so they look better when using the ThemeSong extension */
  542. themeSongIntegration: boolean;
  543. /** Lightness of the color used when ThemeSong is enabled */
  544. themeSongLightness: ColorLightness;
  545. //#region misc
  546. /** The locale to use for translations */
  547. locale: TrLocale;
  548. /** Whether to default to US-English if the translation for the set locale is missing */
  549. localeFallback: boolean;
  550. /** Whether to check for updates to the script */
  551. versionCheck: boolean;
  552. /** Button to check for updates */
  553. checkVersionNow: undefined;
  554. /** The console log level - 0 = Debug, 1 = Info */
  555. logLevel: LogLevel;
  556. /** Amount of seconds until the feature initialization times out */
  557. initTimeout: number;
  558. /** Amount of seconds to show BYTM's toasts for */
  559. toastDuration: number;
  560. /** Whether to show a toast on generic errors */
  561. showToastOnGenericError: boolean;
  562. /** Button that resets the config to the default state */
  563. resetConfig: undefined;
  564. /** Whether to show advanced settings in the config menu */
  565. advancedMode: boolean;
  566. }