diff --git a/CustomApps/lyrics-plus/Pages.js b/CustomApps/lyrics-plus/Pages.js index e82a9c9c78..ccbf74cf88 100755 --- a/CustomApps/lyrics-plus/Pages.js +++ b/CustomApps/lyrics-plus/Pages.js @@ -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; @@ -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; @@ -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; diff --git a/CustomApps/lyrics-plus/Utils.js b/CustomApps/lyrics-plus/Utils.js index d66128c540..1d43a7bcfd 100644 --- a/CustomApps/lyrics-plus/Utils.js +++ b/CustomApps/lyrics-plus/Utils.js @@ -175,7 +175,7 @@ const Utils = { const rubyElems = s.split(""); 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("")[0]; const furigana = rubyElems[i].split("")[1].split("")[0];