Skip to content

Instantly share code, notes, and snippets.

@koudelka
Created December 17, 2012 21:59
Show Gist options
  • Save koudelka/4322700 to your computer and use it in GitHub Desktop.
Save koudelka/4322700 to your computer and use it in GitHub Desktop.
Deletes all Facebook friend requests, execute on https://www.facebook.com/friends/requests
var x = document.evaluate('//input[@value="Delete Request"]', document.documentElement, null, XPathResult.ANY_TYPE, null);
// gotta build an array of the elements, iterators throw exceptions if you modify the DOM from under them
var elements = [];
var thisNode = x.iterateNext();
while (thisNode) {
elements.push(thisNode);
thisNode = x.iterateNext();
}
elements.forEach(function(e) {
e.click();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment