Last active
June 17, 2017 19:38
-
-
Save rileyjshaw/953b3aba4c48e34b0069152f5fc21e4c to your computer and use it in GitHub Desktop.
Might get you part-way to deleting your Facebook wall?
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
// In Chrome, go to your profile page. Open the Developer Tools Console | |
// (cmd + alt + j) and click the mobile phone button in the top left ("Toggle | |
// device toolbar"). I did this because it's easier to get around whatever | |
// guards are in place without worrying about hover states, etc. | |
// | |
// I chose "iPhone 5" in the device menu at the top of the browser window. That | |
// might be important, but probably not. I only ran this once ¯\_(ツ)_/¯ | |
// | |
// Refresh the page, scroll down so you can see your posts, paste this into the | |
// console, hit enter, and enjoy the show for 20 seconds until it comes to a | |
// grinding halt. | |
// | |
// ^ Hopefully not. If it does stop, try manually deleting whatever caused the | |
// issue, refreshing, crossing fingers, then going again. Repeat 4 delete. | |
// Here we go! | |
const steps = [ | |
// Click the chevron to open the menu. | |
() => document.querySelector( | |
'[data-sigil="story-popup-context-init"]' | |
).click(), | |
// Remove the post, or hide it if it's someone else's content. | |
() => { | |
const remover = document.querySelector( | |
'[data-sigil*="removeStoryButton"][data-sigil*="enabled_action"]'); | |
if (remover) { | |
console.log('R E M O V I N G P O S T !'); | |
return remover.click(); | |
} | |
const buttons = Array.from(document.querySelectorAll( | |
'[data-sigil*="afroDirectAction"][data-sigil*="enabled_action"]')); | |
const hider = buttons.filter(button => button.querySelector( | |
'[data-sigil="action-title"]' | |
).textContent === 'Hide from Timeline')[0]; | |
if (hider) { | |
console.log('H I D I N G P O S T !'); | |
hider.click(); | |
} | |
// I think there's a third type of thing, where you want to click | |
// "Untag something-or-other" rather than removing or hiding the post. | |
// If that's the case, you might be able to do something like: | |
// | |
// const untagger = buttons.filter(button => button.querySelector( | |
// '[data-sigil="action-title"]' | |
// ).textContent === 'WHATEVER THE BUTTON TEXT IS')[0]; | |
// if (untagger) { | |
// console.log('U N T A G G I N G P O S T !'); | |
// untagger.click(); | |
// } | |
}, | |
// If you add something to the above step, you may need to go into your | |
// Developer Tools inspector to see what the new confirm button's | |
// `aria-label` is and add it to this list. | |
() => document.querySelector( | |
'[aria-label="Delete"], [aria-label="Hide"]' | |
).click(), | |
]; | |
// That's it. It just runs through ^those three steps over and over again, with | |
// a ~1s delay between each step. You can probably decrease the delay time, I | |
// just figure it's rate-limited. Also, I wanted it to look really cool for my | |
// Instagram story. | |
(function nextClick (i) { | |
console.log('R U N N I N G S T E P ' + i); | |
steps[i](); | |
console.log('R A N S T E P ' + i); | |
setTimeout(() => nextClick((i + 1) % steps.length), | |
700 + Math.random() * 500); // <-- this is the delay. | |
})(0); | |
// Good luck deleting yourself! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment