Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 86 additions & 44 deletions CustomApps/lyrics-plus/Pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,37 @@ const IdlingIndicator = ({ isActive, progress, delay }) => {
return react.createElement(
"div",
{
className: `lyrics-idling-indicator ${
!isActive ? "lyrics-idling-indicator-hidden" : ""
} lyrics-lyricsContainer-LyricsLine lyrics-lyricsContainer-LyricsLine-active`,
className: `lyrics-idling-indicator ${!isActive ? "lyrics-idling-indicator-hidden" : ""
} lyrics-lyricsContainer-LyricsLine lyrics-lyricsContainer-LyricsLine-active`,
style: {
"--position-index": 0,
"--animation-index": 1,
"--indicator-delay": `${delay}ms`,
},
},
react.createElement("div", { className: `lyrics-idling-indicator__circle ${progress >= 0.05 ? "active" : ""}` }),
react.createElement("div", { className: `lyrics-idling-indicator__circle ${progress >= 0.33 ? "active" : ""}` }),
react.createElement("div", { className: `lyrics-idling-indicator__circle ${progress >= 0.66 ? "active" : ""}` })
[0.05, 0.33, 0.66].map((threshold) =>
react.createElement(
"div", { className: `lyrics-idling-indicator__circle ${progress >= threshold ? "active" : ""}` }
)
)
);
};

const InlineIdlingIndicator = ({ progress, isActive }) => {
return react.createElement(
"span",
{
className: `lyrics-inline-idling-indicator${isActive ? " active" : ""}`,
},
[0.05, 0.33, 0.66].map((threshold, idx) =>
react.createElement(
"span",
{
key: idx,
className: `lyrics-inline-idling-dot${progress >= threshold ? " active" : ""}`,
}
)
)
);
};

Expand Down Expand Up @@ -145,6 +164,29 @@ const SyncedLyricsPage = react.memo(({ lyrics = [], provider, copyright, isKara
delay: activeLines[2].startTime / 3,
});
}
if (text === "♪") {
let className = "lyrics-lyricsContainer-LyricsLine";
let ref;
if (Math.min(activeLineIndex, CONFIG.visual["lines-before"] + 1) === i) {
className += " lyrics-lyricsContainer-LyricsLine-active";
ref = activeLineEle;
}
const animationIndex = activeLineIndex <= CONFIG.visual["lines-before"]
? i - activeLineIndex
: i - CONFIG.visual["lines-before"] - 1;
const nextLine = activeLines[i + 1];
const timeToNext = nextLine ? nextLine.startTime - startTime : 1000;
const progress = Math.min(1, (position - startTime) / (timeToNext || 1));
return react.createElement(
"div",
{ className, style: { cursor: "pointer", "--position-index": animationIndex, "--animation-index": (animationIndex < 0 ? 0 : animationIndex) + 1, "--blur-index": Math.abs(animationIndex) }, key: lineNumber, dir: "auto", ref, onClick: () => { if (startTime) Spicetify.Player.seek(startTime); } },
react.createElement(
"p",
{},
react.createElement(InlineIdlingIndicator, { progress, isActive: progress >= 1 })
)
);
}

let className = "lyrics-lyricsContainer-LyricsLine";
const activeElementIndex = Math.min(activeLineIndex, CONFIG.visual["lines-before"] + 1);
Expand Down Expand Up @@ -210,21 +252,21 @@ const SyncedLyricsPage = react.memo(({ lyrics = [], provider, copyright, isKara
!isKara ? lineText : react.createElement(KaraokeLine, { text, startTime, position, isActive })
),
belowMode &&
react.createElement(
"p",
{
style: {
opacity: 0.5,
},
onContextMenu: (event) => {
event.preventDefault();
Spicetify.Platform.ClipboardAPI.copy(Utils.convertParsedToLRC(lyrics, belowMode).conver)
.then(() => Spicetify.showNotification("Translated lyrics copied to clipboard"))
.catch(() => Spicetify.showNotification("Failed to copy translated lyrics to clipboard"));
},
react.createElement(
"p",
{
style: {
opacity: 0.5,
},
text
)
onContextMenu: (event) => {
event.preventDefault();
Spicetify.Platform.ClipboardAPI.copy(Utils.convertParsedToLRC(lyrics, belowMode).conver)
.then(() => Spicetify.showNotification("Translated lyrics copied to clipboard"))
.catch(() => Spicetify.showNotification("Failed to copy translated lyrics to clipboard"));
},
},
text
)
);
})
),
Expand Down Expand Up @@ -489,19 +531,19 @@ const SyncedExpandedLyricsPage = react.memo(({ lyrics, provider, copyright, isKa
!isKara ? lineText : react.createElement(KaraokeLine, { text, startTime, position, isActive })
),
belowMode &&
react.createElement(
"p",
{
style: { opacity: 0.5 },
onContextMenu: (event) => {
event.preventDefault();
Spicetify.Platform.ClipboardAPI.copy(Utils.convertParsedToLRC(lyrics, belowMode).conver)
.then(() => Spicetify.showNotification("Translated lyrics copied to clipboard"))
.catch(() => Spicetify.showNotification("Failed to copy translated lyrics to clipboard"));
},
react.createElement(
"p",
{
style: { opacity: 0.5 },
onContextMenu: (event) => {
event.preventDefault();
Spicetify.Platform.ClipboardAPI.copy(Utils.convertParsedToLRC(lyrics, belowMode).conver)
.then(() => Spicetify.showNotification("Translated lyrics copied to clipboard"))
.catch(() => Spicetify.showNotification("Failed to copy translated lyrics to clipboard"));
},
text
)
},
text
)
);
}),
react.createElement("p", {
Expand Down Expand Up @@ -556,19 +598,19 @@ const UnsyncedLyricsPage = react.memo(({ lyrics, provider, copyright }) => {
lineText
),
belowMode &&
react.createElement(
"p",
{
style: { opacity: 0.5 },
onContextMenu: (event) => {
event.preventDefault();
Spicetify.Platform.ClipboardAPI.copy(Utils.convertParsedToUnsynced(lyrics, belowMode).conver)
.then(() => Spicetify.showNotification("Translated lyrics copied to clipboard"))
.catch(() => Spicetify.showNotification("Failed to copy translated lyrics to clipboard"));
},
react.createElement(
"p",
{
style: { opacity: 0.5 },
onContextMenu: (event) => {
event.preventDefault();
Spicetify.Platform.ClipboardAPI.copy(Utils.convertParsedToUnsynced(lyrics, belowMode).conver)
.then(() => Spicetify.showNotification("Translated lyrics copied to clipboard"))
.catch(() => Spicetify.showNotification("Failed to copy translated lyrics to clipboard"));
},
text
)
},
text
)
);
}),
react.createElement("p", {
Expand Down
56 changes: 56 additions & 0 deletions CustomApps/lyrics-plus/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -728,3 +728,59 @@ div.lyrics-tabBar-headerItemLink {
margin-left: 100px;
}
}

.lyrics-inline-idling-indicator {
display: inline-flex;
align-items: center;
gap: 0.25em;
margin-left: 0.2em;
opacity: 0.5;
transition: opacity 0.2s;
vertical-align: middle;
}
.lyrics-inline-idling-indicator.active {
opacity: 1;
}
.lyrics-inline-idling-dot {
width: 0.5em;
height: 0.5em;
border-radius: 50%;
background: var(--lyrics-idling-dot-color, #888);
opacity: 0.3;
transform: scale(0.7);
transition: background 0.2s, opacity 0.2s, transform 0.2s;
display: inline-block;
}
.lyrics-inline-idling-dot.active {
background: var(--lyrics-idling-dot-active-color, #fff);
opacity: 1;
transform: scale(1.1);
}

.lyrics-idling-indicator {
display: flex;
align-items: center;
gap: 0.4em;
justify-content: center;
margin: 0.5em 0;
opacity: 0.7;
transition: opacity 0.2s;
}
.lyrics-idling-indicator.active {
opacity: 1;
}
.lyrics-idling-dot {
width: 0.7em;
height: 0.7em;
border-radius: 50%;
background: var(--lyrics-idling-dot-color, #888);
opacity: 0.3;
transform: scale(0.7);
transition: background 0.2s, opacity 0.2s, transform 0.2s;
display: inline-block;
}
.lyrics-idling-dot.active {
background: var(--lyrics-idling-dot-active-color, #fff);
opacity: 1;
transform: scale(1.1);
}
Loading