Created
June 22, 2009 14:19
-
-
Save axemclion/133984 to your computer and use it in GitHub Desktop.
A HTML file that can be used to fetch the contacts from gmail to invite them
This file contains 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
<html> | |
<head></head> | |
<body> | |
<div id = "SelectContacts"></div> | |
<img src = "img/sample.jpg"></body> | |
<script type="text/javascript" src="http://www.google.com/jsapi"></script> | |
<script type="text/javascript"> | |
google.load("gdata", "1.x"); | |
google.setOnLoadCallback(function() { | |
var scope = 'http://www.google.com/m8/feeds'; | |
var token = google.accounts.user.login(scope); | |
var contactsFeedUri = 'http://www.google.com/m8/feeds/contacts/default/full'; | |
var query = new google.gdata.contacts.ContactQuery(contactsFeedUri); | |
query.setMaxResults(50); | |
var contactsService = new google.gdata.contacts.ContactsService('circuspop-1.0'); | |
var contactsHTML = ""; | |
var contactsDiv = document.getElementById("SelectContacts"); | |
var addContact = function(emailAddress) { | |
contactsHTML += emailAddress + "<br>"; | |
} | |
contactsService.getContactFeed(query, function(result) { | |
var entries = result.feed.entry; | |
for (var i = 0; i < entries.length; i++) { | |
var contactEntry = entries[i]; | |
var emailAddresses = contactEntry.getEmailAddresses(); | |
for (var j = 0; j < emailAddresses.length; j++) { | |
addContact(emailAddresses[j].getAddress()); | |
} | |
} | |
contactsDiv.innerHTML = contactsHTML; | |
}, function(e) { | |
google.accounts.user.logout(); | |
}); | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment