Created
January 4, 2013 10:08
-
-
Save Hydrotoast/4451443 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GroupInvitations() { | |
this.event_id = 517949684905901; | |
this.member_ids = []; | |
this.semaphore = 0; | |
} | |
GroupInvitations.prototype = { | |
unlock: function() { | |
if (++(this.semaphore) === 3) { | |
resultStr = this.member_ids.join(','); | |
invitationURL = '/' + this.event_id + '/invited?users=' + resultStr; | |
console.log(this.member_ids.length); | |
console.log(invitationURL); | |
FB.api(invitationURL, 'post', function(response) { | |
console.log(response); | |
}); | |
} | |
return this.semaphore; | |
} | |
}; | |
FB.getLoginStatus(function(response) { | |
gi = new GroupInvitations(); | |
if (response.status != 'connected') | |
return; | |
// DATspace | |
FB.api('/141673622569388/members', function(result) { | |
for (var i = 0; i < result.data.length; i++) | |
gi.member_ids.push(result.data[i].id); | |
gi.unlock(); | |
}); | |
// WICS | |
FB.api('/2200392077/members', function(result) { | |
for (var i = 0; i < result.data.length; i++) | |
gi.member_ids.push(result.data[i].id); | |
gi.unlock(); | |
}); | |
// ACM | |
FB.api('/228954137162541/members', function(result) { | |
for (var i = 0; i < result.data.length; i++) | |
gi.member_ids.push(result.data[i].id); | |
gi.unlock(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment