「Mixi アプリ マイミクのリスト表示」の版間の差分
ナビゲーションに移動
検索に移動
| (同じ利用者による、間の1版が非表示) | |||
| 1行目: | 1行目: | ||
| − | ==mixi アプリ マイミクのリスト表示== | + | ==[[mixi アプリ マイミクのリスト表示]]== |
| − | [[mixi アプリ]] | + | [[mixi アプリ]] | |
===マイミクのリストを表示するサンプル=== | ===マイミクのリストを表示するサンプル=== | ||
[[File:0799_mixi_app_mymx.jpg]] | [[File:0799_mixi_app_mymx.jpg]] | ||
| 19行目: | 19行目: | ||
<Module> | <Module> | ||
<ModulePrefs title="list_friends"> | <ModulePrefs title="list_friends"> | ||
| − | < | + | <[[R]]equire feature="opensocial-0.8"/> |
</ModulePrefs> | </ModulePrefs> | ||
<Content type="html"> | <Content type="html"> | ||
| 26行目: | 26行目: | ||
// 閲覧者の友人コレクション取得要求 | // 閲覧者の友人コレクション取得要求 | ||
function request() { | function request() { | ||
| − | var idspec = opensocial.newIdSpec({ "userId" : " | + | var idspec = opensocial.newIdSpec({ "userId" : "V[[IE]]WER", "groupId" : "FR[[IE]]NDS" }); |
| − | var req = opensocial. | + | var req = opensocial.newData[[R]]equest(); |
| − | req.add(req. | + | req.add(req.newFetchPeople[[R]]equest(idspec), "friends"); |
req.send(response); | req.send(response); | ||
} | } | ||
// 閲覧者の友人コレクション取得応答 | // 閲覧者の友人コレクション取得応答 | ||
| − | function response( | + | function response(data[[R]]esponse) { |
| − | var friends = | + | var friends = data[[R]]esponse.get("friends").getData(); |
| − | document.getElementById("friend_list"). | + | document.getElementById("friend_list").inner[[HTML]] = printFriendsList(friends); |
} | } | ||
// 閲覧者の友人リスト表示 | // 閲覧者の友人リスト表示 | ||
2020年2月16日 (日) 04:29時点における最新版
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 = "<table border='1'>";
html += "<tr><th>Image</th><th>NickName</th></tr>";
friends.each( function(friend) {
html += "<tr>";
html += "<td><img src='" + friend.getField("thumbnailUrl") + "'></td>";
html += "<td><a href='" + friend.getField("profileUrl") + "' target='_blank'>" + friend.getDisplayName() + "</a></td>";
html += "</tr>";
});
html += "</table>";
return html;
}
gadgets.util.registerOnLoadHandler(request);
</script>
<div id="friend_list"/>
]]>
</Content>
</Module>
© 2006 矢木浩人