Mixi アプリ マイミクのリスト表示
2020年2月15日 (土) 07:34時点におけるPiroto (トーク | 投稿記録)による版 (ページの作成:「==mixi アプリ マイミクのリスト表示== [mixi アプリ] ===マイミクのリストを表示するサンプル=== File:0799_mixi_app_mymx.jpg ===ソー…」)
mixi アプリ マイミクのリスト表示
[mixi アプリ]
マイミクのリストを表示するサンプル
ソース
重要API
| API | 概要 |
|---|---|
| http://code.google.com/intl/ja/apis/opensocial/docs/0.8/reference/#opensocial.newIdSpec] | [IdSpce] オブジェクトを作成 |
| http://code.google.com/intl/ja/apis/opensocial/docs/0.8/reference/#opensocial.DataRequest.newFetchPeopleRequest] | サーバーから友だちを要求するアイテムを作成。[Collection] <Person> オブジェクトを返す |
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="list_friends">
<Require feature="opensocial-0.8"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="text/javascript">
// 閲覧者の友人コレクション取得要求
function request() {
var idspec = opensocial.newIdSpec({ "userId" : "VIEWER", "groupId" : "FRIENDS" });
var req = opensocial.newDataRequest();
req.add(req.newFetchPeopleRequest(idspec), "friends");
req.send(response);
}
// 閲覧者の友人コレクション取得応答
function response(dataResponse) {
var friends = dataResponse.get("friends").getData();
document.getElementById("friend_list").innerHTML = printFriendsList(friends);
}
// 閲覧者の友人リスト表示
function printFriendsList(friends) {
var html = "
"; html += ""; friends.each( function(friend) {
html += "";
html += "";
html += "";
html += "";
});
html += "| Image | NickName |
|---|---|
| <img src='" + friend.getField("thumbnailUrl") + "'> | <a href='" + friend.getField("profileUrl") + "' target='_blank'>" + friend.getDisplayName() + "</a> |
";
return html;
}
gadgets.util.registerOnLoadHandler(request);
</script>
]]> </Content> </Module>
© 2006 矢木浩人
