Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
all-in-one script ( with parameters ) >> big thnx to @subimage && xtra updates by Luigi DiGangi
// forked from subimage's modifications of my much messier prior scripts
// ( https://gist.github.com/subimage/d952e49c9184d6a7a74f )
// after entering jquery into ur console, enter the code below in ur console
// then load a few months of activity && enter leaveFacebook(); into ur console
// u can specify parameters like so: leaveFacebook('Unlike'); if u only want to unlike
// or leaveFacebook('Unfriend'); if u only want to unfriend
// etc...
// visit nickbriz.com/facebook for vidz && details
var waitSeconds = 1; // adjust for slow internet connections
var menuChoices = null;
var currTimeout = null;
// Loads menus we're interested in clicking at a later time...
function loadMenus(params) {
console.log("Loading menus to click!");
var editMenus = $('.uiPopover > a');
for (var i = 0; i < editMenus.length; i++) { editMenus[i].click(); };
if(params){
var menuStringsToMatch = [];
if(params.indexOf('Report/Mark as Spam') != -1){ menuStringsToMatch.push('Report/Mark as Spam'); }
if(params.indexOf('Report/Remove Tag') != -1){ menuStringsToMatch.push('Report/Remove Tag'); }
if(params.indexOf('Delete...') != -1){ menuStringsToMatch.push('Delete...'); }
if(params.indexOf('Remove Tag...') != -1){ menuStringsToMatch.push('Remove Tag...'); }
if(params.indexOf('Remove Post') != -1){ menuStringsToMatch.push('Remove Post'); }
if(params.indexOf('Delete This Photo') != -1){ menuStringsToMatch.push('Delete This Photo'); }
if(params.indexOf('Delete') != -1){ menuStringsToMatch.push('Delete'); }
if(params.indexOf('Unlike') != -1){ menuStringsToMatch.push('Unlike'); }
if(params.indexOf('Unfriend') != -1){ menuStringsToMatch.push('Unfriend'); }
} else {
var menuStringsToMatch = [ 'Report/Remove Tag','Remove Tag...','Report/Mark as Spam','Remove Post','Delete This Photo','Delete','Delete...','Unlike','Unfriend' ];
}
menuChoices = [];
$('.uiLayer span').each(function() {
var ele = $(this);
var menuContent = ele.html();
for(var i=0;i<menuStringsToMatch.length;i++) {
var matchStr = menuStringsToMatch[i];
if(menuContent.indexOf(matchStr) == 0) menuChoices.push(ele);
}
});
console.log("Found "+menuChoices.length+" menus to click...please hold!");
}
// Clicks confirmation buttons
function clickButtons() {
console.log("Clearing confirmation buttons");
var buttonLabelsToClick = [
'Continue', 'Confirm', 'Delete', 'Remove','Remove Post','Okay', 'Close'
];
$('button, a').each(function( i ) {
var ele = $(this);
var btnContent = ele.html();
for(var i=0;i<buttonLabelsToClick.length;i++) {
var matchStr = buttonLabelsToClick[i];
if(btnContent.indexOf(matchStr) == 0) ele.click();
}
});
// Get rid of any "this content is no longer available" warnings
window.setTimeout(function(){
$('a.layerCancel span').click();
}, 100);
$( "input[value|='Delete']" ).click();
}
// Clicks menus, one by one...waits for it to load (hopefully),
// then clicks the delete / continue / whatever buttons
function clickNextMenu() {
var currentEle = menuChoices.shift();
console.log(currentEle);
$(currentEle).click();
// Clear timeouts so they don't stack up on each other
window.clearTimeout(currTimeout);
currTimeout = window.setTimeout(function() {
clickButtons();
if(menuChoices.length > 0) clickNextMenu();
}, waitSeconds*1000);
}
function leaveFacebook(params) {
loadMenus(params);
clickNextMenu();
}

hi nick, thanks for the update. really bizarre but i've executed this code and facebook sort of registers some of it in the Activity Log but doesn't reflect it on my profile. did you run into this at all? thx

Owner
nbriz commented Jul 23, 2014

what do u mean when u say they register some of it in the activity log? when i ran it ( removing all my activity from 2008 - 2014 ) in the end there were a few posts ( very few ) that for some reason wouldn't delete ( even if i did it manually ) is this what u mean?

so when i click on activity log and click on likes or posts i'm tagged in etc on the left hand side is says there are no posts from 2013...etc. but if i actually go to my profile page and scroll down my page everything is still there and loads up. i've had problems especially with removing tags from my photos though and defriending people and deleting the events i was associated with.
anyhow, i've gone and ballsed it up in my impatience and unfriended everyone thinking i'll go back and remove tags/photos later...school girl error! sorry for wasting your time!

Owner
nbriz commented Jul 26, 2014

no worries vhcgreen, like i mentioned... even after removing all of my activity, there are a few lingering posts that won't seem to go away... tbh, this is probably just a facebook bug, don't think it was designed to account for this kind of mass-deleting ;)

MAJOR PROBLEM, the script opens the chat menu instead of the activity ones

Yo... all I'm getting is 'undefined' on the console... jquery is loaded = true, do i need to be on a particular page in Fb? thanks again

me too same thing as s0rfila

Owner
nbriz commented Aug 1, 2014

yes, u need to be in ur activity log showing "All" or filtering by the particular category u wanna wipe.

The problem is that the script is unable to open the menus, it opens the chat settings instead
http://imgur.com/FIiGIam

Exactly what ferraucchio is saying...

Owner
nbriz commented Aug 4, 2014

ok, couple things to check [1] are u in the activity log? && [2] have u scrolled down ur activity log enough to be sure you've loaded things to 'Unlike'???

also, if u are specifically trying to "unlike" but want to keep other data ( which i'm assuming b/c u added the 'Unlike' parameter ) u could instead filter through the activity log [a] go to ur activity log [b] filter by 'Likes' ( http://imgur.com/J30nR0b ) [c] copy+paste jquery, then the script above, then simply type: leaveFacebook(); ...without parameters.

seandogg commented Aug 4, 2014

nbriz & subimage:

Kudos again. it's working now... like magic!!! don't forget to drop the:
leaveFacebook();

into your console after pasting the script... and yes, the activity feed was the ticket. Thanks for helping everyone...

nbriz:

I'm having some trouble. The script worked for a while and allowed me to unfriend all/remove likes. However, it doesn't work for the photos. The boxes come up but it says "oops this doesn't seem possible just now." The boxes remain open and I have to manually remove them all.

Is there a way to fix this?

Matt

Owner
nbriz commented Aug 10, 2014

hi Matt, could u share a screen shot of that message && ur console?

therub commented Aug 13, 2014

Great work, from what I can tell, but I'm getting an error. I'm using Web Console in Firefox, but code from other sections have worked fine.

I paste in the "leave_facebook.js" code and get "undefined" response. I then drop in the "leaveFacebook();" code (no quotes) and get this returned:

Error: <![EX[["Tried to get element with id of "%s" but it is not present on the page.",".uiPopover > a"]]]>
"Loading menus to click!"

Attached is a screenshot. The only difference in this screenshot is that after the leave_facebook.js, I saw you ask above if the user had scrolled down. Scrolling down is not in the original instructions, so in this screenshot I have used the scroll script then stopped the scroll, then applied the leaveFacebook();.

The error is the same, though, with and without the scroll script.

I'm hyped up to get the F off FB, and I've been stuck on this for about 2 hrs now. Wanted to try to figure it out w/o bugging you.

http://imgur.com/Ubg0ln6

Thanks for the help!

Owner
nbriz commented Aug 13, 2014

hi therub, question: did u copy+paste jquery b4 pasting the leave_facebook.js code?
as per the instructions just under the video here: http://nickbriz.com/facebook/unfriend.html

therub commented Aug 13, 2014

A ha! I read it, but I guess I ignored it.

Thanks. Trying it now.

edit: Perfect. Working perfectly now.

Not sure if I am leaving something out but what should the console look life after each step?

I pasted the jquery and saw "true"
then I pasted the all in one script and saw "undefined"
what should I see after the "leaveFacebook();"

(sorry not techy at all but desperate to get off of facebook)

I started this process yesterday and the script worked perfectly, but it appears FB has updated the activity feed so the script can't locate the menus to run on any more.

Owner
nbriz commented Aug 31, 2014

@ZiggyMoonBlues u should see the menu's popping up && ur activity getting deleted. Make sure before u paste jquery that you are looking at ur activity log

@danielpearson i just tested it w/a face account && it still worked for me?

Can you tell me what I'm doing wrong?
I have pasted everything (jquery and script ) and after that nothing has been deleted.
You can see that at screenshot
http://imgur.com/t1FnPmk
I would be grateful for help

@nbriz first off, can't thank you enough for all you help and the continued support.

I'm getting "The content you requested cannot be displayed right now. It may be temporarily unavailable, the link you clicked on may have expired, or you may not have permission to view this page."
http://i.imgur.com/BQPnNdL.png

Untagging also seems to get hungup and not clicking through the windows.
http://i.imgur.com/Mvxm2zh.png

Thanks again.

@nbriz I'm having the same issues as BergerFohr (above)

Owner
nbriz commented Nov 8, 2014

@BergerFohr after pasting jquery && the updated code above, do u type in leaveFacebook() by itself or with the parameters? i just did a test with the leaveFacebook() function ( without any parameters ) && it worked fine...

@ghost
ghost commented Nov 28, 2014

Guys, when i try to delete something, i always receive this error message:

Uncaught Error: <![EX[["Tried to get element with id of "%s" but it is not present on the page.",".uiPopover > a"]]]>

what's wrong? I open my activity log, expand it and then copy and paste on my console the code on top and then paste "leaveFacebook('Unlike'); or leaveFacebook('Delete');"

@ahnabelle try to turn the language of your Facebook account to "English (UK)"

I was able to delete all my likes and comments, but I'm unable to delete the photos i've been tagged.
I entered the jquery, then the script, and at the end i entered leaveFacebook();
does anybody know if this is still working? Thank you
screen shot 2015-10-17 at 5 20 42 pm
The continue button is grayed out.

I also get the same problem as fl4tfour, It seems that the only active continue bottom is on the bottom of the stack so you can't get to it. Would be nice is there was a part of the script that let you access them from the top down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment