Skip to content

Instantly share code, notes, and snippets.

@creotiv
Created July 4, 2012 16:58
Show Gist options
  • Save creotiv/3048328 to your computer and use it in GitHub Desktop.
Save creotiv/3048328 to your computer and use it in GitHub Desktop.
Facebook friend adder
HTMLElement.prototype.click = function() {
var evt = this.ownerDocument.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
this.dispatchEvent(evt);
}
var addFriendSuggest = function() {
var link = document.getElementsByClassName('uiIconText')[0];
if(link.getAttribute('ajaxify')) {
link.click();
setTimeout(addFriendSuggest,2000);
} else {
link.className = "";
}
}
var addFriendSearch = function() {
var block = document.getElementsByClassName('FriendRequestAdd')[0];
block.className = "";
var link = block.getElementsByTagName('input')[0];
link.click();
setTimeout(addFriendSearch ,10000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment