Created
September 18, 2012 20:39
-
-
Save phwd/3745712 to your computer and use it in GitHub Desktop.
Pages you own on Facebook
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
<fb:login-button scope="manage_pages" | |
onlogin="getAccounts()"> | |
Grant Permissions to Allow access to Pages you admin | |
</fb:login-button> | |
<ul id="accounts"></ul> | |
<script> | |
window.getAccounts = pullAccounts(); | |
function pullAccounts(){ | |
FB.api('/me/accounts', function(response) { | |
Log.info('Accounts', response); | |
parseAccounts(response); | |
}); | |
} | |
function parseAccounts(response) { | |
var ul = document.getElementById('accounts'); | |
for (var i=0, l=response.data.length; i<l; i++) { | |
var account = response.data[i]; | |
var li = document.createElement('li'); | |
var a = document.createElement('a'); | |
if(account.category != "Application"){ | |
a.innerHTML = account.name; | |
a.href = "http://facebook.com/" + account.id; | |
li.appendChild(a); | |
ul.appendChild(li); | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment