From a5202a0b5e8111db5ea39e99fadb5762e6645f18 Mon Sep 17 00:00:00 2001 From: binmax <501711499@qq.com> Date: Sat, 11 May 2024 15:06:22 +0800 Subject: [PATCH] fix: nig-798 --- src/content/addToTwitterHome.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/content/addToTwitterHome.tsx b/src/content/addToTwitterHome.tsx index a2198f8..4280a2a 100644 --- a/src/content/addToTwitterHome.tsx +++ b/src/content/addToTwitterHome.tsx @@ -26,6 +26,13 @@ export const addPriceComponent = (element: Element, tweetId: string, twitterUser export const addVoteComponent = (element: Element, tweetId: string, userName: string) => { const voteContainer = document.createElement('div'); + const repostContainer = element.querySelector( + 'article > div >div > div:nth-child(1)' + ); + // 如果是转发的话,目前 innerText 会是 You reposted,判断如果有内容不管是什么文案我们就认为是转发的 + const isRepost = repostContainer && repostContainer.innerText !== ''; + // 如果是转发不要附加 vote 组件 + if (isRepost) return; const specificElement = element.querySelector( 'article > div > div > div:nth-child(2) > div:nth-child(2) > div:nth-child(4) > div > div' );