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