Skip to content

Instantly share code, notes, and snippets.

@stubar
Created April 9, 2018 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stubar/1c98070dad9196b6d3971e09b0eb6e81 to your computer and use it in GitHub Desktop.
Save stubar/1c98070dad9196b6d3971e09b0eb6e81 to your computer and use it in GitHub Desktop.
Delete all you Facebook Photos (tested in Chrome 65)
/*
This script is for deleting your photos...
1. Go to your profile
2. Select Photos
3. Scroll down until you can see all the photos you wish to delete in this session (all of them if you like)
4. Paste this script in the console and press return
*/
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
(async () =>{
while(document.querySelector(".fbTimelineSelectorButton")){
var clickEvent = document.createEvent("MouseEvents");
clickEvent.initEvent("click",true,false);
document.querySelector(".fbTimelineSelectorButton").dispatchEvent(clickEvent);
await timeout(500);
document.querySelector("a.itemAnchor[data-action-type=delete_photo]").dispatchEvent(clickEvent);
await timeout(1000);
document.querySelector("button.layerConfirm").dispatchEvent(clickEvent);
await timeout(3000);
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment