Friday, March 18, 2011

Inviting all your friends to facebook events: update March 2011

Facebook just changed (on march 15th 2011) the way to invite friends to event, so a new script is needed.

The code I came up with is:

Version 1:

javascript:elms=document.getElementsByName("checkableitems[]");for (i=0;i<elms.length;i++){if (elms[i].type="checkbox" )elms[i].click()};

Version 2:

javascript:javascript:var elms=document.getElementsByName("checkableitems[]");for(var count=0;count<elms.length;count++){var t = setTimeout("elms["+count+"].click()",100)}

Since now the facebook system uses lazy loading, only the first 100 friends are selected.
You can prevent this by scrolling to the end of the friend list before applying the script!

As before, the script can take a long time (several minutes for thousands of friends) before actually selecting every friend, so just wait.

If your friends are not too many, you can also create different lists of 100 friends each, and apply the script on each list.

I tested version1 with Chrome, other tested firefox 4 and opera. let me know of problems or better solutions!
Some people reported browser crashes.
The script is probably intensive for a high number of user (i could not test more than 500 :D). In case, try version 2!

I posted 2 version: the first is the "normal" one. The second might be a bit slower, but should avoid browser chrashes (I hope!). I'm still working on a faster version, so check back ;)

How to use it:
Triple click on the script (version1 or version 2) to select it.
Copy (ctr+C) the above script.
Go to the event page and select "invite friends". When the menu opens, select your friend list (or just leave "all friends"). Scroll to the end of the panel, and then past into the url bar the script (ctr+v).
Wait a bit (maybe more than a bit!), and you should find all of your friend selected.
Submit the invite and you're done!
For a guide with screenshots check