From 7e3228517de34e0a19fab21153dfda0c922ab095 Mon Sep 17 00:00:00 2001 From: XYShaoKang <38753204+XYShaoKang@users.noreply.github.com> Date: Sun, 22 Sep 2024 11:19:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A2=84=E6=B5=8B=E5=88=97=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/content/pages/ranking/utils.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/content/pages/ranking/utils.ts b/src/content/pages/ranking/utils.ts index 5dc0486..72e1c25 100644 --- a/src/content/pages/ranking/utils.ts +++ b/src/content/pages/ranking/utils.ts @@ -46,7 +46,7 @@ export function getUsername( } else { region = 'CN' } - username = a.pathname.split('/').filter(Boolean)[1] + username = a.pathname?.split('/').filter(Boolean)[1] } else { const a = row.children[1].children[0] as HTMLAnchorElement if (a.host === 'leetcode.com') { @@ -74,10 +74,7 @@ export const useRowChange = ( }, 100) handleChange() const observer = new MutationObserver(handleChange) - const a = beta - ? row.children[0].children[0].children[0].children[0] - : row.children[1].children[0] - observer.observe(a, { attributes: true, childList: true }) + observer.observe(row, { attributes: true, childList: true }) return () => { handleChange.cancel() observer.disconnect()