Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
21 changes: 18 additions & 3 deletions CustomApps/lyrics-plus/Pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,12 @@ const SyncedLyricsPage = react.memo(({ lyrics = [], provider, copyright, isKara

// Convert lyrics to text for comparison
const belowOrigin = (typeof originalText === "object" ? originalText?.props?.children?.[0] : originalText)?.replace(/\s+/g, "");
const belowTxt = (typeof text === "object" ? text?.props?.children?.[0] : text)?.replace(/\s+/g, "");
const belowTxt =
typeof text === "string"
? text.replace(/\s+/g, "")
: typeof text?.props?.children?.[0] === "string"
? text.props.children[0].replace(/\s+/g, "")
: "";

const belowMode = showTranslatedBelow && originalText && belowOrigin !== belowTxt;

Expand Down Expand Up @@ -634,7 +639,12 @@ const SyncedExpandedLyricsPage = react.memo(({ lyrics, provider, copyright, isKa

// Convert lyrics to text for comparison
const belowOrigin = (typeof originalText === "object" ? originalText?.props?.children?.[0] : originalText)?.replace(/\s+/g, "");
const belowTxt = (typeof text === "object" ? text?.props?.children?.[0] : text)?.replace(/\s+/g, "");
const belowTxt =
typeof text === "string"
? text.replace(/\s+/g, "")
: typeof text?.props?.children?.[0] === "string"
? text.props.children[0].replace(/\s+/g, "")
: "";

const belowMode = showTranslatedBelow && originalText && belowOrigin !== belowTxt;

Expand Down Expand Up @@ -713,7 +723,12 @@ const UnsyncedLyricsPage = react.memo(({ lyrics, provider, copyright }) => {

// Convert lyrics to text for comparison
const belowOrigin = (typeof originalText === "object" ? originalText?.props?.children?.[0] : originalText)?.replace(/\s+/g, "");
const belowTxt = (typeof text === "object" ? text?.props?.children?.[0] : text)?.replace(/\s+/g, "");
const belowTxt =
typeof text === "string"
? text.replace(/\s+/g, "")
: typeof text?.props?.children?.[0] === "string"
? text.props.children[0].replace(/\s+/g, "")
: "";

const belowMode = showTranslatedBelow && originalText && belowOrigin !== belowTxt;

Expand Down
2 changes: 1 addition & 1 deletion CustomApps/lyrics-plus/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const Utils = {
const rubyElems = s.split("<ruby>");
const reactChildren = [];

reactChildren.push(rubyElems[0]);
if (rubyElems[0] !== "") reactChildren.push(rubyElems[0]);
for (let i = 1; i < rubyElems.length; i++) {
const kanji = rubyElems[i].split("<rp>")[0];
const furigana = rubyElems[i].split("<rt>")[1].split("</rt>")[0];
Expand Down