Skip to content

Instantly share code, notes, and snippets.

@sethwebster
Created November 30, 2013 13:22
Show Gist options
  • Save sethwebster/7719032 to your computer and use it in GitHub Desktop.
Save sethwebster/7719032 to your computer and use it in GitHub Desktop.
*** NOTE: This is the non-minified version for reading. A minified, bookmarklet-ready version of this is here: https://gist.github.com/sethwebster/7719079 For Facebook Pages only, invite all friends to like page. At the time of this writing, this works. Facebook changes things up pretty frequently so YMMV. First, add this code as bookmarklet, th…
var popup = null;
var total = 0;
function inviteNext(currentIndex,list){
if (currentIndex<list.length) {
total++;
list[currentIndex].click();
currentIndex++;
setTimeout(function() { inviteNext(currentIndex,list); },100);
updateCount();
}
else
{
destroyPopup();
}
}
function updateCount() {
var el = document.getElementById("invite-all-count-sw");
el.innerText = total+"/"+els.length;
}
function createPopup() {
var head = document.getElementsByTagName("head")[0];
var body = document.getElementsByTagName("body")[0];
var div = document.createElement("div");
div.setAttribute("id","add-all-div-sw");
div.setAttribute("style","text-align:center;font-family:\"lucida grande\",tahoma,verdana,arial,sans-serif;padding:20px;width:25%;height;20%;border:2px solid #ccc;background-color:#fff;position:relative;margin:0 auto 0 auto");
div.innerHTML = "Inviting Everyone in the List...<span id=\"invite-all-count-sw\">0</span> invited so far...";
body.appendChild(div);
popup = div;
}
function destroyPopup(){
popup.parentElement.removeChild(popup);
}
var els = document.getElementsByClassName("uiButton _1sm");
createPopup();
inviteNext(0,els);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment