mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 02:51:46 +00:00
fix: apply fix from eslint
This commit is contained in:
@ -31,8 +31,12 @@ export const menu = async ({
|
||||
type: 'submenu',
|
||||
submenu: [
|
||||
{
|
||||
label: t('plugins.synced-lyrics.menu.line-effect.submenu.scale.label'),
|
||||
toolTip: t('plugins.synced-lyrics.menu.line-effect.submenu.scale.tooltip'),
|
||||
label: t(
|
||||
'plugins.synced-lyrics.menu.line-effect.submenu.scale.label',
|
||||
),
|
||||
toolTip: t(
|
||||
'plugins.synced-lyrics.menu.line-effect.submenu.scale.tooltip',
|
||||
),
|
||||
type: 'radio',
|
||||
checked: config.lineEffect === 'scale',
|
||||
click() {
|
||||
@ -42,8 +46,12 @@ export const menu = async ({
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('plugins.synced-lyrics.menu.line-effect.submenu.offset.label'),
|
||||
toolTip: t('plugins.synced-lyrics.menu.line-effect.submenu.offset.tooltip'),
|
||||
label: t(
|
||||
'plugins.synced-lyrics.menu.line-effect.submenu.offset.label',
|
||||
),
|
||||
toolTip: t(
|
||||
'plugins.synced-lyrics.menu.line-effect.submenu.offset.tooltip',
|
||||
),
|
||||
type: 'radio',
|
||||
checked: config.lineEffect === 'offset',
|
||||
click() {
|
||||
@ -53,8 +61,12 @@ export const menu = async ({
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('plugins.synced-lyrics.menu.line-effect.submenu.focus.label'),
|
||||
toolTip: t('plugins.synced-lyrics.menu.line-effect.submenu.focus.tooltip'),
|
||||
label: t(
|
||||
'plugins.synced-lyrics.menu.line-effect.submenu.focus.label',
|
||||
),
|
||||
toolTip: t(
|
||||
'plugins.synced-lyrics.menu.line-effect.submenu.focus.tooltip',
|
||||
),
|
||||
type: 'radio',
|
||||
checked: config.lineEffect === 'focus',
|
||||
click() {
|
||||
@ -125,7 +137,9 @@ export const menu = async ({
|
||||
},
|
||||
{
|
||||
label: t('plugins.synced-lyrics.menu.show-lyrics-even-if-inexact.label'),
|
||||
toolTip: t('plugins.synced-lyrics.menu.show-lyrics-even-if-inexact.tooltip'),
|
||||
toolTip: t(
|
||||
'plugins.synced-lyrics.menu.show-lyrics-even-if-inexact.tooltip',
|
||||
),
|
||||
type: 'checkbox',
|
||||
checked: config.showLyricsEvenIfInexact,
|
||||
click(item) {
|
||||
|
||||
@ -28,7 +28,7 @@ export const LyricsContainer = () => {
|
||||
|
||||
const info = getSongInfo();
|
||||
await makeLyricsRequest(info).catch((err) => {
|
||||
setError(`${err}`);
|
||||
setError(String(err));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -14,12 +14,15 @@ import type { SyncedLyricsPluginConfig } from '../types';
|
||||
|
||||
export let _ytAPI: YoutubePlayer | null = null;
|
||||
|
||||
export const renderer = createRenderer<{
|
||||
observerCallback: MutationCallback;
|
||||
observer?: MutationObserver;
|
||||
videoDataChange: () => Promise<void>;
|
||||
updateTimestampInterval?: NodeJS.Timeout | string | number;
|
||||
}, SyncedLyricsPluginConfig>({
|
||||
export const renderer = createRenderer<
|
||||
{
|
||||
observerCallback: MutationCallback;
|
||||
observer?: MutationObserver;
|
||||
videoDataChange: () => Promise<void>;
|
||||
updateTimestampInterval?: NodeJS.Timeout | string | number;
|
||||
},
|
||||
SyncedLyricsPluginConfig
|
||||
>({
|
||||
onConfigChange(newConfig) {
|
||||
setConfig(newConfig);
|
||||
},
|
||||
@ -57,9 +60,7 @@ export const renderer = createRenderer<{
|
||||
);
|
||||
}
|
||||
|
||||
this.observer ??= new MutationObserver(
|
||||
this.observerCallback,
|
||||
);
|
||||
this.observer ??= new MutationObserver(this.observerCallback);
|
||||
|
||||
// Force the lyrics tab to be enabled at all times.
|
||||
this.observer.disconnect();
|
||||
|
||||
@ -27,7 +27,7 @@ export const extractTimeAndText = (
|
||||
parseInt(rMillis),
|
||||
];
|
||||
|
||||
const timeInMs = (minutes * 60 * 1000) + (seconds * 1000) + millis;
|
||||
const timeInMs = minutes * 60 * 1000 + seconds * 1000 + millis;
|
||||
|
||||
return {
|
||||
index,
|
||||
@ -75,7 +75,6 @@ export const getLyricsList = async (
|
||||
track_name: songData.title,
|
||||
});
|
||||
|
||||
|
||||
if (songData.album) {
|
||||
query.set('album_name', songData.album);
|
||||
}
|
||||
@ -88,7 +87,7 @@ export const getLyricsList = async (
|
||||
return null;
|
||||
}
|
||||
|
||||
let data = await response.json() as LRCLIBSearchResponse;
|
||||
let data = (await response.json()) as LRCLIBSearchResponse;
|
||||
if (!data || !Array.isArray(data)) {
|
||||
setDebugInfo('Unexpected server response.');
|
||||
return null;
|
||||
@ -127,7 +126,10 @@ export const getLyricsList = async (
|
||||
const itemArtists = artistName.split(/[&,]/g).map((i) => i.trim());
|
||||
|
||||
const permutations = artists.flatMap((artistA) =>
|
||||
itemArtists.map((artistB) => [artistA.toLowerCase(), artistB.toLowerCase()])
|
||||
itemArtists.map((artistB) => [
|
||||
artistA.toLowerCase(),
|
||||
artistB.toLowerCase(),
|
||||
]),
|
||||
);
|
||||
|
||||
const ratio = Math.max(...permutations.map(([x, y]) => jaroWinkler(x, y)));
|
||||
@ -148,7 +150,7 @@ export const getLyricsList = async (
|
||||
return null;
|
||||
}
|
||||
|
||||
setDebugInfo(JSON.stringify(closestResult, null, 4));
|
||||
setDebugInfo(JSON.stringify(closestResult, null, 4));
|
||||
|
||||
if (Math.abs(closestResult.duration - duration) > 15) {
|
||||
return null;
|
||||
|
||||
@ -7,8 +7,11 @@ import type { SyncedLyricsPluginConfig } from '../types';
|
||||
|
||||
export const [isVisible, setIsVisible] = createSignal<boolean>(false);
|
||||
|
||||
export const [config, setConfig] = createSignal<SyncedLyricsPluginConfig | null>(null);
|
||||
export const [playerState, setPlayerState] = createSignal<VideoDetails | null>(null);
|
||||
export const [config, setConfig] =
|
||||
createSignal<SyncedLyricsPluginConfig | null>(null);
|
||||
export const [playerState, setPlayerState] = createSignal<VideoDetails | null>(
|
||||
null,
|
||||
);
|
||||
|
||||
export const LyricsRenderer = () => {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user