Skip to content

Instantly share code, notes, and snippets.

@ibaaj ibaaj/unfollow.js
Created Jun 14, 2015

Embed
What would you like to do?
Unfollow all pages i've liked on facebook - Go to https://www.facebook.com/[YOURUSERNAME]/likes & Scroll down to show all pages & execute this script in the console
counter=0; var ids = [];
for(var i=0; i < document.getElementsByClassName('_42ft _4jy0 _5lzj _3spg _4jy3 _517h _51sy').length; i++){
var d = document.getElementsByClassName('_42ft _4jy0 _5lzj _3spg _4jy3 _517h _51sy')[i];
if(!/hidden_elem/g.test(d.className)){
counter++;
ids.push(i);
}
}
console.log(counter);
var t = setInterval( function() {
if(ids.length==0)
clearInterval(t);
var s = ids.pop();
document.getElementsByClassName('_42ft _4jy0 _5lzj _3spg _4jy3 _517h _51sy')[s].click();
}, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.