feature: singer showing
fix: remove blank line in parsed result improve: remove unused variable
This commit is contained in:
parent
d562c1c9a5
commit
69a2384ad6
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aquavox",
|
"name": "aquavox",
|
||||||
"version": "1.14.1",
|
"version": "1.15.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
@ -112,7 +112,6 @@
|
|||||||
}}
|
}}
|
||||||
on:mousemove={(e) => {
|
on:mousemove={(e) => {
|
||||||
if ($userAdjustingProgress) {
|
if ($userAdjustingProgress) {
|
||||||
console.log(e.offsetX )
|
|
||||||
adjustDisplayProgress(e.offsetX / progressBar.getBoundingClientRect().width);
|
adjustDisplayProgress(e.offsetX / progressBar.getBoundingClientRect().width);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
let currentPositionIndex = -1;
|
let currentPositionIndex = -1;
|
||||||
let currentAnimationIndex = -1;
|
let currentAnimationIndex = -1;
|
||||||
let lyricsContainer: HTMLDivElement | null;
|
let lyricsContainer: HTMLDivElement | null;
|
||||||
let lastAdjustProgress = 0;
|
|
||||||
let localProgress = 0;
|
let localProgress = 0;
|
||||||
let lastScroll = 0;
|
let lastScroll = 0;
|
||||||
let scrolling = false;
|
let scrolling = false;
|
||||||
@ -217,7 +216,6 @@
|
|||||||
if (
|
if (
|
||||||
currentPositionIndex < 0 ||
|
currentPositionIndex < 0 ||
|
||||||
currentPositionIndex === currentAnimationIndex ||
|
currentPositionIndex === currentAnimationIndex ||
|
||||||
currentPositionIndex === lastAdjustProgress ||
|
|
||||||
$userAdjustingProgress === true ||
|
$userAdjustingProgress === true ||
|
||||||
scrolling
|
scrolling
|
||||||
) return;
|
) return;
|
||||||
@ -283,13 +281,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle progress bar sliding events
|
|
||||||
progressBarSlideValue.subscribe((_) => {
|
|
||||||
if ($userAdjustingProgress === false && getLyricIndex) {
|
|
||||||
lastAdjustProgress = currentPositionIndex;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function lyricClick(lyricIndex: number) {
|
function lyricClick(lyricIndex: number) {
|
||||||
if (player===null || originalLyrics.scripts === undefined) return;
|
if (player===null || originalLyrics.scripts === undefined) return;
|
||||||
player.currentTime = originalLyrics.scripts[lyricIndex].start;
|
player.currentTime = originalLyrics.scripts[lyricIndex].start;
|
||||||
@ -309,7 +300,6 @@
|
|||||||
AnimationIndex:{currentAnimationIndex}
|
AnimationIndex:{currentAnimationIndex}
|
||||||
NextUpdate: {$nextUpdate}
|
NextUpdate: {$nextUpdate}
|
||||||
Progress: {progress.toFixed(2)}
|
Progress: {progress.toFixed(2)}
|
||||||
lastAdjustProgress: {lastAdjustProgress}
|
|
||||||
scrollPosition: {lyricsContainer.scrollTop}
|
scrollPosition: {lyricsContainer.scrollTop}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -324,6 +314,8 @@
|
|||||||
on:scroll={scrollHandler}
|
on:scroll={scrollHandler}
|
||||||
>
|
>
|
||||||
{#each lyrics as lyric, i}
|
{#each lyrics as lyric, i}
|
||||||
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
<div bind:this={_refs[i]} class="relative h-fit text-shadow-lg" on:click={() => {lyricClick(i)}} >
|
<div bind:this={_refs[i]} class="relative h-fit text-shadow-lg" on:click={() => {lyricClick(i)}} >
|
||||||
{#if debugMode && refs[i] && refs[i].style !== undefined}
|
{#if debugMode && refs[i] && refs[i].style !== undefined}
|
||||||
<span class="previous-lyric !text-lg !absolute !-translate-y-12">{i}
|
<span class="previous-lyric !text-lg !absolute !-translate-y-12">{i}
|
||||||
@ -332,11 +324,15 @@
|
|||||||
top: {Math.round(refs[i].getBoundingClientRect().top)}px
|
top: {Math.round(refs[i].getBoundingClientRect().top)}px
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<p class={`${getClass(i, progress)} hover:bg-[rgba(200,200,200,0.2)] pl-2 rounded-lg duration-300 cursor-pointer `}>
|
<p class={`${getClass(i, progress)} hover:bg-[rgba(200,200,200,0.2)] pl-2 rounded-lg duration-300 cursor-pointer `}>
|
||||||
|
{#if originalLyrics.scripts[i].singer}
|
||||||
|
<span class="singer">{originalLyrics.scripts[i].singer}</span>
|
||||||
|
{/if}
|
||||||
{lyric}
|
{lyric}
|
||||||
</p>
|
</p>
|
||||||
{#if originalLyrics.scripts[i].translation && showTranslation}
|
{#if originalLyrics.scripts[i].translation && showTranslation}
|
||||||
<div class={`${getClass(i, progress)} relative !text-xl !md:text-2xl lg:!text-3xl !top-1`}>{originalLyrics.scripts[i].translation}</div>
|
<div class={`${getClass(i, progress)} pl-2 relative !text-xl !md:text-2xl lg:!text-3xl !top-1 duration-300 `}>{originalLyrics.scripts[i].translation}</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
@ -365,6 +361,18 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.singer {
|
||||||
|
position: absolute;
|
||||||
|
display: inline-block;
|
||||||
|
bottom: 50%;
|
||||||
|
transform: translateY(calc(50%)) translateX(-3rem);
|
||||||
|
padding: 0.1rem 0.4rem;
|
||||||
|
background: rgba(255,255,255,.15);
|
||||||
|
border-radius: 0.4rem;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
line-height: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
.no-scrollbar {
|
.no-scrollbar {
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
}
|
}
|
||||||
|
@ -298,8 +298,10 @@ export default function lrcParser(lrc: string): LrcJsonData {
|
|||||||
if (parsedLrc.scripts[i+1].text.trim() === "") {
|
if (parsedLrc.scripts[i+1].text.trim() === "") {
|
||||||
i+=2;
|
i+=2;
|
||||||
} else i++;
|
} else i++;
|
||||||
|
if (lyricLine.text.trim() !== "") {
|
||||||
lyrics.push(lyricLine);
|
lyrics.push(lyricLine);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
finalLrc.scripts = lyrics;
|
finalLrc.scripts = lyrics;
|
||||||
return finalLrc;
|
return finalLrc;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user