My favorites | Sign in
Project Home Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Hello, Friends!">
<Require feature="opensocial-0.8" />
<Require feature="minimessage" />
</ModulePrefs>
<Content type="html"><![CDATA[

<h1>Hello, Friends!</h1>

<dl>

<dt>マイミクを招待</dt>
<dd>
<div>
<input id="invite" type="button" value="マイミクを招待"/>
</div>
</dd>

<dt>メッセージ送信</dt>
<dd>
<div>
<input id="title" type="text"/><br/>
<textarea id="body"></textarea><br/>
<input id="send" type="button" value="送信"/>
</div>
</dd>

<dt>カウントアップ(<span id="counter">0</span>)</dt>
<dd>
<div>
<input id="countup" type="button" value="カウントアップ"/>
</div>
</dd>

<dt>マイミク一覧</dt>
<dd>
<div id="wrapper" style="display:none;">
<div repeat="${people}" class="person">
<input type="radio" name="to" value="${Cur.id}"/>
<img alt="${Cur.displayName}" src="${Cur.thumbnailUrl}"/>
${Cur.nickname}(<span class="counter">未インストール</span>)
</div>
</div>
</dd>

</dl>
<div id="debug"></div>

<script type="text/javascript" src="http://scripts.lrlab.to/opensocial-jquery-1.3.2.5.min.js"></script>
<script type="text/javascript" src="http://scripts.lrlab.to/opensocial-jquery.templates-0.1.0.min.js"></script>
<script type="text/javascript" src="http://scripts.lrlab.to/opensocial-jquery.mixi-1.0.0.min.js"></script>
<script type="text/javascript" src="http://scripts.lrlab.to/opensocial-jquery.minimessage-1.0.0.min.js"></script>
<script type="text/javascript" src="http://feed.suz-lab.com/other/js/ext/prettyprint.js"></script>

<script type="text/javascript">

jQuery(function($) {
var owner_id = "";
var owner_counter = 0;

$('<span/>').text('Dismissible Message').minimessage();

// 自分の取得
$.getData("/people/@owner/@self", function(data) {
owner_id = data[0].id;
});

// マイミクの表示
$.getData("/people/@owner/@friends", function(data) {
$("#wrapper").render({ people: data }).show();
$.each(data, function(i, friend) {
if(friend.hasApp == "true") {
$.getData("/appdata/" + friend.id + "/@self", function(data) {
if(data[friend.id] != null && data[friend.id].counter != null) {
friend_counter = data[friend.id].counter;
$(".person .counter").eq(i).html(friend_counter);
}
});
}
});
});

// カウンターの表示
$.getData("/appdata/@viewer/@self", function(data) {
if(data[owner_id] != null && data[owner_id].counter != null) {
owner_counter = data[owner_id].counter;
$("#counter").html(owner_counter);
}
});

// マイミクの招待
$("#invite").click(function(){
$.invite("@friends", function(ids) {
$.each(ids, function(i, id) {
alert("「" + id + "」 を招待しました。");
});
});
});

// メッセージの送信
$("#send").click(function(){
$.postData("/messages/@viewer/@outbox", {
recipients: $("input:radio:checked").val(),
title : $("#title").val(),
body : $("#body").val()
}, function() {
alert("送信しました。");
});
});

// カウントアップ
$("#countup").click(function(){
$.postData("/appdata/@viewer/@self", {
counter: owner_counter + 1
}, function() {
owner_counter++;
$("#counter").html(owner_counter);
alert("カウントアップしました。");
});
});

// $.getFeed("http://feeds.feedburner.com/suz-lab-blog", function(data) {
// alert(data.Title);
// $("#debug").html(prettyPrint(data));
// });

});

</script>
]]></Content>
</Module>

Change log

r149 by suz...@suz-lab.com on Feb 1, 2010   Diff
とりあえずリリース
Go to: 
Sign in to write a code review

Older revisions

r147 by suz...@suz-lab.com on Jan 26, 2010   Diff
フィードの取得
r146 by suz...@suz-lab.com on Jan 26, 2010   Diff
ObjectInput/OutputStream関係
r145 by suz...@suz-lab.com on Jan 25, 2010   Diff
カウンター。
All revisions of this file

File info

Size: 3949 bytes, 132 lines

File properties

svn:mime-type
text/plain
Powered by Google Project Hosting