Fix comment anchor detection for tracker placement
This commit is contained in:
@@ -272,8 +272,6 @@ function findCommentSectionAnchorInPost(postElement, actionAnchor = null) {
|
||||
'[aria-label*="most relevant" i]',
|
||||
'[aria-label*="neueste" i]',
|
||||
'[aria-label*="newest" i]',
|
||||
'[aria-label*="kommentare" i]',
|
||||
'[aria-label*="comments" i]',
|
||||
'[aria-roledescription*="kommentar" i]',
|
||||
'[aria-roledescription*="comment" i]',
|
||||
'[data-testid*="comment" i]',
|
||||
@@ -287,7 +285,7 @@ function findCommentSectionAnchorInPost(postElement, actionAnchor = null) {
|
||||
const anchors = new Set();
|
||||
|
||||
postElement.querySelectorAll(selectors.join(', ')).forEach((candidate) => {
|
||||
if (!candidate || candidate.closest('.fb-tracker-ui')) {
|
||||
if (!candidate || candidate.closest('.fb-tracker-ui') || !isElementVisible(candidate)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -299,11 +297,17 @@ function findCommentSectionAnchorInPost(postElement, actionAnchor = null) {
|
||||
|| candidate;
|
||||
}
|
||||
|
||||
const anchor = getTopLevelAnchorWithinPost(postElement, anchorSeed);
|
||||
if (!anchor || anchor === actionAnchor) {
|
||||
let anchor = getTopLevelAnchorWithinPost(postElement, anchorSeed);
|
||||
if (anchor === actionAnchor) {
|
||||
anchor = anchorSeed;
|
||||
}
|
||||
|
||||
if (!anchor || anchor === actionAnchor || !anchor.parentElement) {
|
||||
return;
|
||||
}
|
||||
if (actionAnchor && !isNodeAfter(anchor, actionAnchor)) {
|
||||
|
||||
const anchorIsInsideAction = Boolean(actionAnchor && actionAnchor.contains(anchor));
|
||||
if (actionAnchor && !anchorIsInsideAction && !isNodeAfter(anchor, actionAnchor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user