forked from ruxkor/jpoker
-
Notifications
You must be signed in to change notification settings - Fork 3
/
jpoker-opensocial.xml
118 lines (118 loc) · 5.18 KB
/
jpoker-opensocial.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="jpoker" width="800" height="600">
<Require feature="opensocial-0.8"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jpoker sample application</title>
<script language="JavaScript" type="text/javascript" src="/jpoker/jquery/jquery-1.2.6.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/jquery/ui/ui.core.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/jquery/ui/ui.draggable.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/jquery/ui/ui.resizable.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/jquery/ui/ui.dialog.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/jquery/ui/ui.slider.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/jquery.ajaxQueue.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/jquery.cookie.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/jquery.gettext.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/jquery.strftime.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/jquery.form.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/jquery.tablesorter.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/jquery.tablesorter.pager.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/printstacktrace.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/json2.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/jquery.jpoker.js"></script>
<script language="JavaScript" type="text/javascript" src="/jpoker/js/mockup.js"></script>
<script type="text/javascript">
var restURL = "http://" + document.location.host + "/POKER_REST";
var jQueryAjax = $.ajax;
var server;
$.jpoker.verbose = 6;
$.jpoker.doReconnectAlways = true;
$.ajax = function(options) {
var params = {};
var postData = {
packet: options.data
};
params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
params[gadgets.io.RequestParameters.POST_DATA] = gadgets.io.encodeValues(postData);
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
params[gadgets.io.RequestParameters.REFRESH_INTERVAL] = 0;
params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
params[gadgets.io.RequestParameters.HEADERS] = { Cookie: document.cookie };
var callback = function(result) {
if (result.errors.length > 0) {
if (result.errors[0] != "Error 404") {
$.ajax = jQueryAjax;
server.error(result.errors);
}
} else {
options.success(result.data);
}
};
gadgets.io.makeRequest(options.url, callback, params);
};
$.jpoker.plugins.table.callback.display_done = function(element) {
var req = opensocial.newDataRequest();
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.GENDER];
req.add(req.newFetchPersonRequest("VIEWER", params), "viewer");
req.send(function(resp) {
var viewerResp = resp.get("viewer");
var viewer = viewerResp.getData();
$(element).addClass(viewer.getField(opensocial.Person.Field.GENDER).key);
});
};
$.jpoker.plugins.player.callback.display_done = function(element, player) {
var req = opensocial.newDataRequest();
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.GENDER];
req.add(req.newFetchPersonRequest(player.serial, params), "player");
req.send(function(resp) {
var viewerResp = resp.get("player");
var viewer = viewerResp.getData();
$(element).addClass(viewer.getField(opensocial.Person.Field.GENDER).key);
});
};
gadgets.util.registerOnLoadHandler(function() {
server = $.jpoker.serverCreate({ url: restURL });
server.spawnTable = function(server, packet) {
$("#table").empty().jpoker("table", restURL, packet.game_id, packet.name);
$("#table-link").click();
};
$("#lobby").empty().jpoker("tableList", restURL);
$("#lobby-link").click(function() {
$("#table").hide();
$("#lobby").show();
});
$("#table-link").click(function() {
$("#lobby").hide();
$("#table").show();
});
});
</script>
<link href="/jpoker/css/jpoker.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.jpoker_table.MALE .jpoker_ptable_game_background {
background-color: #00ffff;
}
.jpoker_table.FEMALE .jpoker_ptable_game_background {
background-color: #ff00ff;
}
.jpoker_table .jpoker_player_seat.MALE .jpoker_name {
background-color:#00ffff;
}
.jpoker_table .jpoker_player_seat.FEMALE .jpoker_name {
background-color:#ff00ff;
}
</style>
<ul id="menu">
<li><a href="#" id="lobby-link">lobby</a></li>
<li><a href="#" id="table-link">table</a></li>
</ul>
<div id="table"></div>
<div id="lobby"></div>
]]>
</Content>
</Module>