-
-
Save nbriz/11838808fbe21695adfd to your computer and use it in GitHub Desktop.
// 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(); | |
} |
@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)
@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...
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 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.
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.