Skip to content

Instantly share code, notes, and snippets.

@kawahara
Created October 9, 2009 12:07
Show Gist options
  • Save kawahara/205959 to your computer and use it in GitHub Desktop.
Save kawahara/205959 to your computer and use it in GitHub Desktop.
<?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