Created
October 9, 2009 12:07
-
-
Save kawahara/205959 to your computer and use it in GitHub Desktop.
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
<?xml version="1.0" encoding="UTF-8" ?> | |
<Module> | |
<ModulePrefs title="Test Application"> | |
<Require feature="opensocial-0.8" /> | |
</ModulePrefs> | |
<Content type="html"> | |
<![CDATA[ | |
<div id="console"></div> | |
<script type="text/javascript"> | |
function request() { | |
var req = opensocial.newDataRequest(); | |
var params = {}; | |
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.DATE_OF_BIRTH, opensocial.Person.Field.AGE]; | |
req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER, params), "get_viewer"); | |
req.send(response); | |
} | |
function response(data) { | |
var viewer = data.get("get_viewer").getData(); | |
var html = viewer.getDisplayName() + "さん(あなた)は" | |
+ viewer.getField(opensocial.Person.Field.DATE_OF_BIRTH) | |
+ "生まれで、" | |
+ viewer.getField(opensocial.Person.Field.AGE) | |
+ "歳です。"; | |
document.getElementById("console").innerHTML = html; | |
} | |
gadgets.util.registerOnLoadHandler(request); | |
</script> | |
]]> | |
</Content> | |
</Module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment