Place tracker bar above Facebook action bar by default
This commit is contained in:
@@ -666,6 +666,22 @@ function positionTrackerInsertionMarker(postElement, marker, buttonBar, postNum
|
||||
return false;
|
||||
}
|
||||
|
||||
const resolvedButtonBar = resolveActionButtonBar(postElement, buttonBar);
|
||||
const actionAnchor = getDirectActionAnchorInPost(postElement, resolvedButtonBar);
|
||||
const commentBoundary = findCommentBoundaryAnchorInPost(postElement, actionAnchor);
|
||||
|
||||
if (actionAnchor && insertMarkerBeforeAnchor(postElement, marker, actionAnchor)) {
|
||||
setTrackerInsertionMarkerLocked(marker, true);
|
||||
console.log('[FB Tracker] Post #' + postNum + ' - Marker inserted above action bar');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (resolvedButtonBar && insertMarkerBeforeAnchor(postElement, marker, resolvedButtonBar)) {
|
||||
setTrackerInsertionMarkerLocked(marker, true);
|
||||
console.log('[FB Tracker] Post #' + postNum + ' - Marker inserted above resolved button bar');
|
||||
return true;
|
||||
}
|
||||
|
||||
const commentComposerAnchor = findCommentComposerAnchorInPost(postElement);
|
||||
if (commentComposerAnchor && insertMarkerBeforeAnchor(postElement, marker, commentComposerAnchor)) {
|
||||
setTrackerInsertionMarkerLocked(marker, true);
|
||||
@@ -673,26 +689,12 @@ function positionTrackerInsertionMarker(postElement, marker, buttonBar, postNum
|
||||
return true;
|
||||
}
|
||||
|
||||
const resolvedButtonBar = resolveActionButtonBar(postElement, buttonBar);
|
||||
const actionAnchor = getDirectActionAnchorInPost(postElement, resolvedButtonBar);
|
||||
const commentBoundary = findCommentBoundaryAnchorInPost(postElement, actionAnchor);
|
||||
|
||||
if (commentBoundary && insertMarkerBeforeAnchor(postElement, marker, commentBoundary)) {
|
||||
setTrackerInsertionMarkerLocked(marker, true);
|
||||
console.log('[FB Tracker] Post #' + postNum + ' - Marker inserted before comment boundary');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (actionAnchor && insertMarkerAfterAnchor(postElement, marker, actionAnchor)) {
|
||||
setTrackerInsertionMarkerLocked(marker, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (resolvedButtonBar && insertMarkerAfterAnchor(postElement, marker, resolvedButtonBar)) {
|
||||
setTrackerInsertionMarkerLocked(marker, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (buttonBar && buttonBar.parentElement && buttonBar.parentElement.parentElement && !postElement.contains(buttonBar.parentElement.parentElement)) {
|
||||
buttonBar.parentElement.parentElement.insertBefore(marker, buttonBar.parentElement.nextSibling);
|
||||
setTrackerInsertionMarkerLocked(marker, false);
|
||||
@@ -714,6 +716,11 @@ function isTrackerInsertionMarkerPlacementValid(postElement, marker, buttonBar)
|
||||
return false;
|
||||
}
|
||||
|
||||
const actionAnchor = getDirectActionAnchorInPost(postElement, buttonBar);
|
||||
if (actionAnchor && isNodeAfter(marker, actionAnchor)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const commentBoundary = findCommentBoundaryAnchorInPost(postElement);
|
||||
|
||||
if (commentBoundary && isNodeAfter(marker, commentBoundary)) {
|
||||
|
||||
Reference in New Issue
Block a user