Facebook Auto Confirm Friend Requests

By Julien C Last update Feb 28, 2008 — Installed 6,143 times. Daily Installs: 39, 36, 38, 18, 21, 28, 19, 23, 29, 39, 23, 24, 32, 19, 20, 18, 40, 20, 19, 21, 20, 20, 12, 27, 23, 17, 4, 17, 11, 28, 17, 23
// ==UserScript==
// @name           Facebook Auto Confirm Friend Requests
// @namespace      http://blog.mapmyglobe.com/
// @author         Julien C
// @description    Automatically accept all friend requests on Facebook. Please leave some time for all the Ajax calls to run if you've got a lot of requests
// @include        http://*.facebook.com/reqs.php*
// ==/UserScript==


(function() {
  //CSS Selector:
  function $$(xpath,root) { 
    xpath=xpath.replace(/((^|\|)\s*)([^/|\s]+)/g,'$2.//$3').
               replace(/\.([\w-]+)(?!([^\]]*]))/g,'[@class="$1" or @class$=" $1" or @class^="$1 " or @class~=" $1 "]').
                replace(/#([\w-]+)/g,'[@id="$1"]').
                replace(/\/\[/g,'/*[');
    str='(@\\w+|"[^"]*"|\'[^\']*\')'
    xpath=xpath.replace(new RegExp(str+'\\s*~=\\s*'+str,'g'),'contains($1,$2)').
                replace(new RegExp(str+'\\s*\\^=\\s*'+str,'g'),'starts-with($1,$2)').
                replace(new RegExp(str+'\\s*\\$=\\s*'+str,'g'),'substring($1,string-length($1)-string-length($2)+1)=$2');
    var got=document.evaluate(xpath,root||document,null,null,null), result=[];
    while(next=got.iterateNext()) result.push(next);
    return result;
  }
  
  
  var inputbuttons = $$('input.inputbutton');
  for (var i = 0; i < inputbuttons.length; i++){
    if (inputbuttons[i].value=="Confirm"){
      inputbuttons[i].click();
    }
  }
})();