Skip to content

Commit 048bc9d

Browse files
authored
fix(lyrics-plus): fix lyrics transition effect issue (#3305)
1 parent c3485db commit 048bc9d

File tree

1 file changed

+50
-91
lines changed

1 file changed

+50
-91
lines changed

CustomApps/lyrics-plus/Pages.js

Lines changed: 50 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -177,56 +177,37 @@ const SyncedLyricsPage = react.memo(({ lyrics = [], provider, copyright, isKara
177177
return react.createElement(
178178
"div",
179179
{
180-
className: "lyrics-lyricsContainer-LyricsLineContainer",
181-
key: i,
182-
},
183-
react.createElement(
184-
"p",
185-
{
186-
className,
187-
style: {
188-
cursor: "pointer",
189-
"--position-index": animationIndex,
190-
"--animation-index": (animationIndex < 0 ? 0 : animationIndex) + 1,
191-
"--blur-index": Math.abs(animationIndex),
192-
},
193-
key: lineNumber,
194-
dir: "auto",
195-
ref,
196-
onClick: (event) => {
197-
if (startTime) {
198-
Spicetify.Player.seek(startTime);
199-
}
200-
},
201-
onContextMenu: (event) => {
202-
event.preventDefault();
203-
Spicetify.Platform.ClipboardAPI.copy(rawLyrics)
204-
.then(() => Spicetify.showNotification("Lyrics copied to clipboard"))
205-
.catch(() => Spicetify.showNotification("Failed to copy lyrics to clipboard"));
206-
},
180+
className,
181+
style: {
182+
cursor: "pointer",
183+
"--position-index": animationIndex,
184+
"--animation-index": (animationIndex < 0 ? 0 : animationIndex) + 1,
185+
"--blur-index": Math.abs(animationIndex),
186+
},
187+
dir: "auto",
188+
ref,
189+
key: lineNumber,
190+
onClick: (event) => {
191+
if (startTime) {
192+
Spicetify.Player.seek(startTime);
193+
}
194+
},
195+
onContextMenu: (event) => {
196+
event.preventDefault();
197+
Spicetify.Platform.ClipboardAPI.copy(rawLyrics)
198+
.then(() => Spicetify.showNotification("Lyrics copied to clipboard"))
199+
.catch(() => Spicetify.showNotification("Failed to copy lyrics to clipboard"));
207200
},
208-
!isKara ? lineText : react.createElement(KaraokeLine, { text, startTime, position, isActive })
209-
),
201+
},
202+
react.createElement("p", {}, !isKara ? lineText : react.createElement(KaraokeLine, { text, startTime, position, isActive })),
210203
showTranslatedBelow &&
211204
originalText &&
212205
originalText !== text &&
213206
react.createElement(
214207
"p",
215208
{
216-
className,
217209
style: {
218210
opacity: 0.5,
219-
cursor: "pointer",
220-
"--position-index": animationIndex,
221-
"--animation-index": (animationIndex < 0 ? 0 : animationIndex) + 1,
222-
"--blur-index": Math.abs(animationIndex),
223-
},
224-
dir: "auto",
225-
ref,
226-
onClick: (event) => {
227-
if (startTime) {
228-
Spicetify.Player.seek(startTime);
229-
}
230211
},
231212
},
232213
text
@@ -464,47 +445,33 @@ const SyncedExpandedLyricsPage = react.memo(({ lyrics, provider, copyright, isKa
464445
return react.createElement(
465446
"div",
466447
{
467-
className: "lyrics-lyricsContainer-LyricsLineContainer",
448+
className: `lyrics-lyricsContainer-LyricsLine${i <= activeLineIndex ? " lyrics-lyricsContainer-LyricsLine-active" : ""}`,
468449
key: i,
469-
},
470-
react.createElement(
471-
"p",
472-
{
473-
className: `lyrics-lyricsContainer-LyricsLine${i <= activeLineIndex ? " lyrics-lyricsContainer-LyricsLine-active" : ""}`,
474-
style: {
475-
cursor: "pointer",
476-
},
477-
dir: "auto",
478-
ref: isActive ? activeLineRef : null,
479-
onClick: (event) => {
480-
if (startTime) {
481-
Spicetify.Player.seek(startTime);
482-
}
483-
},
484-
onContextMenu: (event) => {
485-
event.preventDefault();
486-
Spicetify.Platform.ClipboardAPI.copy(rawLyrics)
487-
.then(() => Spicetify.showNotification("Lyrics copied to clipboard"))
488-
.catch(() => Spicetify.showNotification("Failed to copy lyrics to clipboard"));
489-
},
450+
style: {
451+
cursor: "pointer",
490452
},
491-
!isKara ? lineText : react.createElement(KaraokeLine, { text, startTime, position, isActive })
492-
),
453+
dir: "auto",
454+
ref: isActive ? activeLineRef : null,
455+
onClick: (event) => {
456+
if (startTime) {
457+
Spicetify.Player.seek(startTime);
458+
}
459+
},
460+
onContextMenu: (event) => {
461+
event.preventDefault();
462+
Spicetify.Platform.ClipboardAPI.copy(rawLyrics)
463+
.then(() => Spicetify.showNotification("Lyrics copied to clipboard"))
464+
.catch(() => Spicetify.showNotification("Failed to copy lyrics to clipboard"));
465+
},
466+
},
467+
react.createElement("p", {}, !isKara ? lineText : react.createElement(KaraokeLine, { text, startTime, position, isActive })),
493468
showTranslatedBelow &&
494469
originalText &&
495470
originalText !== text &&
496471
react.createElement(
497472
"p",
498473
{
499-
className: `lyrics-lyricsContainer-LyricsLine${i <= activeLineIndex ? " lyrics-lyricsContainer-LyricsLine-active" : ""}`,
500-
style: { opacity: 0.5, cursor: "pointer" },
501-
dir: "auto",
502-
ref: isActive ? activeLineRef : null,
503-
onClick: (event) => {
504-
if (startTime) {
505-
Spicetify.Player.seek(startTime);
506-
}
507-
},
474+
style: { opacity: 0.5 },
508475
},
509476
text
510477
)
@@ -541,32 +508,24 @@ const UnsyncedLyricsPage = react.memo(({ lyrics, provider, copyright }) => {
541508
return react.createElement(
542509
"div",
543510
{
544-
className: "lyrics-lyricsContainer-LyricsLineContainer",
511+
className: "lyrics-lyricsContainer-LyricsLine lyrics-lyricsContainer-LyricsLine-active",
545512
key: index,
546-
},
547-
react.createElement(
548-
"p",
549-
{
550-
className: "lyrics-lyricsContainer-LyricsLine lyrics-lyricsContainer-LyricsLine-active",
551-
dir: "auto",
552-
onContextMenu: (event) => {
553-
event.preventDefault();
554-
Spicetify.Platform.ClipboardAPI.copy(rawLyrics)
555-
.then(() => Spicetify.showNotification("Lyrics copied to clipboard"))
556-
.catch(() => Spicetify.showNotification("Failed to copy lyrics to clipboard"));
557-
},
513+
dir: "auto",
514+
onContextMenu: (event) => {
515+
event.preventDefault();
516+
Spicetify.Platform.ClipboardAPI.copy(rawLyrics)
517+
.then(() => Spicetify.showNotification("Lyrics copied to clipboard"))
518+
.catch(() => Spicetify.showNotification("Failed to copy lyrics to clipboard"));
558519
},
559-
lineText
560-
),
520+
},
521+
react.createElement("p", {}, lineText),
561522
showTranslatedBelow &&
562523
originalText &&
563524
originalText !== text &&
564525
react.createElement(
565526
"p",
566527
{
567-
className: "lyrics-lyricsContainer-LyricsLine lyrics-lyricsContainer-LyricsLine-active",
568528
style: { opacity: 0.5 },
569-
dir: "auto",
570529
},
571530
text
572531
)

0 commit comments

Comments
 (0)