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;
|
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);
|
const commentComposerAnchor = findCommentComposerAnchorInPost(postElement);
|
||||||
if (commentComposerAnchor && insertMarkerBeforeAnchor(postElement, marker, commentComposerAnchor)) {
|
if (commentComposerAnchor && insertMarkerBeforeAnchor(postElement, marker, commentComposerAnchor)) {
|
||||||
setTrackerInsertionMarkerLocked(marker, true);
|
setTrackerInsertionMarkerLocked(marker, true);
|
||||||
@@ -673,26 +689,12 @@ function positionTrackerInsertionMarker(postElement, marker, buttonBar, postNum
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedButtonBar = resolveActionButtonBar(postElement, buttonBar);
|
|
||||||
const actionAnchor = getDirectActionAnchorInPost(postElement, resolvedButtonBar);
|
|
||||||
const commentBoundary = findCommentBoundaryAnchorInPost(postElement, actionAnchor);
|
|
||||||
|
|
||||||
if (commentBoundary && insertMarkerBeforeAnchor(postElement, marker, commentBoundary)) {
|
if (commentBoundary && insertMarkerBeforeAnchor(postElement, marker, commentBoundary)) {
|
||||||
setTrackerInsertionMarkerLocked(marker, true);
|
setTrackerInsertionMarkerLocked(marker, true);
|
||||||
console.log('[FB Tracker] Post #' + postNum + ' - Marker inserted before comment boundary');
|
console.log('[FB Tracker] Post #' + postNum + ' - Marker inserted before comment boundary');
|
||||||
return true;
|
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)) {
|
if (buttonBar && buttonBar.parentElement && buttonBar.parentElement.parentElement && !postElement.contains(buttonBar.parentElement.parentElement)) {
|
||||||
buttonBar.parentElement.parentElement.insertBefore(marker, buttonBar.parentElement.nextSibling);
|
buttonBar.parentElement.parentElement.insertBefore(marker, buttonBar.parentElement.nextSibling);
|
||||||
setTrackerInsertionMarkerLocked(marker, false);
|
setTrackerInsertionMarkerLocked(marker, false);
|
||||||
@@ -714,6 +716,11 @@ function isTrackerInsertionMarkerPlacementValid(postElement, marker, buttonBar)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const actionAnchor = getDirectActionAnchorInPost(postElement, buttonBar);
|
||||||
|
if (actionAnchor && isNodeAfter(marker, actionAnchor)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const commentBoundary = findCommentBoundaryAnchorInPost(postElement);
|
const commentBoundary = findCommentBoundaryAnchorInPost(postElement);
|
||||||
|
|
||||||
if (commentBoundary && isNodeAfter(marker, commentBoundary)) {
|
if (commentBoundary && isNodeAfter(marker, commentBoundary)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user