From 2bd3359b5b70c04bb72b74c732e2fde8802c4970 Mon Sep 17 00:00:00 2001 From: wangyantong <51265903115@stu.ecnu.edu.cn> Date: Tue, 19 Nov 2024 00:01:08 +0800 Subject: [PATCH] fix: fix openrank display (#929) --- .../features/developer-hovercard-info/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/ContentScripts/features/developer-hovercard-info/index.tsx b/src/pages/ContentScripts/features/developer-hovercard-info/index.tsx index 128d452d..bb97ddb3 100644 --- a/src/pages/ContentScripts/features/developer-hovercard-info/index.tsx +++ b/src/pages/ContentScripts/features/developer-hovercard-info/index.tsx @@ -37,6 +37,11 @@ const getDeveloperName = (target: HTMLElement): string | null => { }; const renderTo = (container: HTMLElement, developerName: string, openrank: string) => { + const parentElement = container.parentNode?.parentElement?.parentElement; + const hovercardUrl = parentElement?.getAttribute('data-hovercard-target-url'); + if (!hovercardUrl || !hovercardUrl.startsWith('/users')) { + return; + } const openRankContainer = document.createElement('div'); container.appendChild(openRankContainer); createRoot(openRankContainer).render();