Prioritize tracker placement above comment composer
This commit is contained in:
@@ -615,13 +615,22 @@ function positionTrackerInsertionMarker(postElement, marker, buttonBar, postNum
|
||||
return false;
|
||||
}
|
||||
|
||||
const commentComposerAnchor = findCommentComposerAnchorInPost(postElement);
|
||||
if (commentComposerAnchor && commentComposerAnchor.parentElement) {
|
||||
commentComposerAnchor.parentElement.insertBefore(marker, commentComposerAnchor);
|
||||
setTrackerInsertionMarkerLocked(marker, true);
|
||||
console.log('[FB Tracker] Post #' + postNum + ' - Marker inserted before comment composer');
|
||||
return true;
|
||||
}
|
||||
|
||||
const resolvedButtonBar = resolveActionButtonBar(postElement, buttonBar);
|
||||
const actionAnchor = getDirectActionAnchorInPost(postElement, resolvedButtonBar);
|
||||
const commentBoundary = findCommentBoundaryAnchorInPost(postElement, actionAnchor);
|
||||
|
||||
if (actionAnchor && commentBoundary && commentBoundary.parentElement && isNodeAfter(commentBoundary, actionAnchor)) {
|
||||
if (commentBoundary && commentBoundary.parentElement) {
|
||||
commentBoundary.parentElement.insertBefore(marker, commentBoundary);
|
||||
setTrackerInsertionMarkerLocked(marker, true);
|
||||
console.log('[FB Tracker] Post #' + postNum + ' - Marker inserted before comment boundary');
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -643,13 +652,6 @@ function positionTrackerInsertionMarker(postElement, marker, buttonBar, postNum
|
||||
return true;
|
||||
}
|
||||
|
||||
if (commentBoundary && commentBoundary.parentElement) {
|
||||
commentBoundary.parentElement.insertBefore(marker, commentBoundary);
|
||||
setTrackerInsertionMarkerLocked(marker, true);
|
||||
console.log('[FB Tracker] Post #' + postNum + ' - Marker fallback inserted before comment boundary');
|
||||
return true;
|
||||
}
|
||||
|
||||
postElement.appendChild(marker);
|
||||
setTrackerInsertionMarkerLocked(marker, false);
|
||||
console.log('[FB Tracker] Post #' + postNum + ' - Marker fallback appended to post');
|
||||
@@ -661,12 +663,7 @@ function isTrackerInsertionMarkerPlacementValid(postElement, marker, buttonBar)
|
||||
return false;
|
||||
}
|
||||
|
||||
const actionAnchor = getDirectActionAnchorInPost(postElement, buttonBar);
|
||||
const commentBoundary = findCommentBoundaryAnchorInPost(postElement, actionAnchor);
|
||||
|
||||
if (actionAnchor && isNodeAfter(actionAnchor, marker)) {
|
||||
return false;
|
||||
}
|
||||
const commentBoundary = findCommentBoundaryAnchorInPost(postElement);
|
||||
|
||||
if (commentBoundary && isNodeAfter(marker, commentBoundary)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user