diff --git a/package.json b/package.json index a627f21..56087c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aquavox", - "version": "1.12.15", + "version": "1.13.0", "private": false, "scripts": { "dev": "vite dev", diff --git a/src/lib/components/lyrics.svelte b/src/lib/components/lyrics.svelte index 59135ca..34779a3 100644 --- a/src/lib/components/lyrics.svelte +++ b/src/lib/components/lyrics.svelte @@ -2,7 +2,7 @@ import userAdjustingProgress from '$lib/state/userAdjustingProgress'; import createLyricsSearcher from '$lib/lyrics/lyricSearcher'; import progressBarRaw from '$lib/state/progressBarRaw'; - import type { LrcJsonData } from 'lrc-parser-ts'; + import type { LrcJsonData } from '$lib/lyrics/parser'; import progressBarSlideValue from '$lib/state/progressBarSlideValue'; import nextUpdate from '$lib/state/nextUpdate'; import truncate from '$lib/truncate'; @@ -15,12 +15,19 @@ // Local state and variables let getLyricIndex: Function; let debugMode = false; + let showTranslation = false; if (localStorage.getItem('debugMode') == null) { localStorage.setItem('debugMode', 'false'); } else { debugMode = localStorage.getItem('debugMode')!.toLowerCase() === "true"; } + if (localStorage.getItem('showTranslation') == null) { + localStorage.setItem('showTranslation', 'false'); + } + else { + showTranslation = localStorage.getItem('showTranslation')!.toLowerCase() === "true"; + } let currentLyricIndex = -1; let currentPositionIndex = -1; let currentAnimationIndex = -1; @@ -31,7 +38,7 @@ let scrolling = false; let scriptScrolling = false; - let currentLyricTopMargin = 288; + let currentLyricTopMargin = 208; // References to lyric elements let refs: HTMLParagraphElement[] = []; @@ -46,6 +53,13 @@ debugMode = !debugMode; localStorage.setItem('debugMode', debugMode ? 'true' : 'false'); } + else if (e.key === 't') { + showTranslation = !showTranslation; + localStorage.setItem('showTranslation', showTranslation ? 'true' : 'false'); + setTimeout(() => { + scrollToLyric(refs[currentPositionIndex]) + }, 50); + } } // using for debug mode @@ -281,7 +295,8 @@ {#if debugMode && lyricsContainer}
LyricIndex: {currentLyricIndex} PositionIndex: {currentPositionIndex} AnimationIndex:{currentAnimationIndex} @@ -302,16 +317,21 @@ on:scroll={scrollHandler} > {#each lyrics as lyric, i} -
+
+ {lyric} +
+ {#if originalLyrics.scripts[i].translation && showTranslation} +