Last active
September 19, 2025 21:52
-
-
Save wwmoraes/5b7045eb7db708adbfc07dd490d7bd1b to your computer and use it in GitHub Desktop.
Facebook activity log remover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var skip = 0; | |
| var menuTexts = [ | |
| "Remove Reaction", | |
| "Unlike", | |
| "Delete", | |
| "Remove Tag", | |
| "Delete your activity", | |
| "Remove Me From Guest List" | |
| ]; | |
| var optionsRemovalIntervalHandler = setInterval(() => { | |
| try { | |
| let alerts = Array.from(document.querySelectorAll("[role=alert]")); | |
| if (alerts.length > 0) { | |
| console.log("alert found, adding skip"); | |
| let alert = alerts.filter(element => element.textContent = "Something went wrong. Please try again."); | |
| if (alert.length > 0) { | |
| alert[0].parentNode.parentNode.parentNode.querySelector("[aria-label=Close]").click(); | |
| skip += 1; | |
| return; | |
| } | |
| } | |
| var options = Array.from(document.querySelectorAll("[aria-label='More options']")).slice(skip); | |
| console.log("trying option removal... count:", options.length, "skip:", skip); | |
| const element = options.shift(); | |
| if (element === undefined) { | |
| console.log("no more elements to remove, stopping"); | |
| clearInterval(optionsRemovalIntervalHandler); | |
| return; | |
| } | |
| element.click(); | |
| scrollTo(0, document.querySelector("[role=main]").scrollHeight); | |
| setTimeout(() => { | |
| console.log("removing..."); | |
| const removeButton = Array.from(document.querySelectorAll('[role=menuitem]')).filter((element) => { | |
| return menuTexts.includes(element.textContent); | |
| }); | |
| if (removeButton.length == 0) { | |
| console.log("remove button not found, skipping"); | |
| skip += 1; | |
| return; | |
| } | |
| removeButton[0].click(); | |
| Array.from(document.querySelectorAll("[role=dialog] [role=button]")).filter(element => { | |
| return element.textContent == "Remove" || element.textContent == "Delete" || element.textContent == "OK"; | |
| }).forEach(element => element.click()); | |
| }, 600); | |
| } catch (err) { | |
| console.error("caught unhandled error, stopping", err); | |
| clearInterval(optionsRemovalIntervalHandler); | |
| } | |
| }, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment