Initial version of statistics and ELO rating. Donated by Martin Rexa
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5 <#if user = doc.game.@currentPlayer>
8 ${bundle("Waiting", doc.game.@currentPlayer?string)}
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
12 <#if user != doc.game.@currentPlayer >
13 <meta http-equiv="REFRESH" content="60;URL=/games/${doc.game.id.@id}">
15 <#if format?? && format="small">
16 <meta name="viewport" content="width = 200" />
18 <meta name="viewport" content="width = 460" />
20 <script type="text/javascript">
21 function paintFence() {
22 var fifth = fieldSize / 10;
23 var x = (document.getElementById("column").value.charCodeAt(0) - 64) * fieldSize;
24 var y = fieldSize * 9 - (document.getElementById("row").value) * fieldSize;
27 if (document.getElementById("direction").value.charAt(0) == 'H') {
28 dx = fieldSize - 2 * fifth;
32 dy = fieldSize - 2 * fifth;
34 var fenceDiv = document.getElementById("fence");
35 fenceDiv.style.position="absolute";
36 fenceDiv.style.left = (x - dx) +"px";
37 fenceDiv.style.top = (y - dy) +"px";
38 fenceDiv.style.width = (dx * 2) +"px";
39 fenceDiv.style.height = (dy * 2) +"px";
40 fenceDiv.style.backgroundColor = 'black';
41 fenceDiv.style.visibility = 'visible';
43 function deltas(dir) {
47 if (dir == 'N') r.y = 1;
48 if (dir == 'S') r.y = -1;
49 if (dir == 'E') r.x = 1;
50 if (dir == 'W') r.x = -1;
53 <#if board.currentPlayer??>
54 function paintPlayer() {
55 var fifth = fieldSize / 5;
56 var m1 = deltas(document.getElementById("pdir1").value.charAt(0));
57 var m2 = deltas(document.getElementById("pdir2").value.charAt(0));
60 x : m1.x + m2.x + playerPos.x,
61 y : m1.y + m2.y + playerPos.y
63 var fenceDiv = document.getElementById("player");
64 fenceDiv.style.position="absolute";
65 fenceDiv.style.left = (pos.x * fieldSize + fifth) +"px";
66 fenceDiv.style.top = ((8 - pos.y) * fieldSize + fifth) +"px";
67 fenceDiv.style.width = (fieldSize - fifth * 2) +"px";
68 fenceDiv.style.height = (fieldSize - fifth * 2) +"px";
69 fenceDiv.style.backgroundColor = 'black';
70 fenceDiv.style.visibility = 'visible';
72 var fieldSize=<#if format?? && format="small">20<#else>50</#if>;
74 x: ${board.currentPlayer.column},
75 y: ${board.currentPlayer.row}
78 function paintPlayer() {
83 <body bgcolor="white">
84 <h3><a href="/">${bundle.TITLE_PLAIN}</a></h3>
88 <#if who = doc.game.id.@white>
89 <#if doc.game.id.@status = "whiteWon" >
91 <#elseif doc.game.id.@status = "whiteMove" && who = doc.game.@currentPlayer>
95 <#if who = doc.game.id.@black>
96 <#if doc.game.id.@status = "blackWon" >
98 <#elseif doc.game.id.@status = "blackMove" && who = doc.game.@currentPlayer>
106 <b>${bundle.MOVENUMBER}: </b> ${(doc.game.@currentMove?number / 2 + 1)?string("0")}<br>
107 <b>${bundle.WHITE}:</b> <@status doc.game.id.@white/> ${bundle("FENCES_LEFT", board.players[0].fences)}<br>
108 <b>${bundle.BLACK}:</b> <@status doc.game.id.@black/> ${bundle("FENCES_LEFT", board.players[1].fences)}<br>
112 <#if (doc.game.@currentMove?number > 0)>
113 <a href="/games/${doc.game.id.@id}?move=${doc.game.@currentMove?number - 1}">${bundle.PREVIOUS}</a>
117 <a href="/games/${doc.game.id.@id}"">${bundle.LATEST}</a>
118 <#if (doc.game.@currentMove?number < doc.game.moves.*?size)>
119 <a href="/games/${doc.game.id.@id}?move=${doc.game.@currentMove?number + 1}">${bundle.NEXT}</a>
127 <span style="color: red">${message}</span>
131 <#assign play = false>
133 <#if doc.game.id.@status = "whiteMove" || doc.game.id.@status = "blackMove" >
134 <#assign play = user = doc.game.@currentPlayer>
137 <form action="/games/${doc.game.id.@id}/move">
138 <input type="hidden" name="type" value="fence" readonly="readonly"/>
139 <select name="column" id="column" onchange="paintFence()">
140 <option value="A">A</option>
141 <option value="B">B</option>
142 <option value="C">C</option>
143 <option value="D">D</option>
144 <option value="E">E</option>
145 <option value="F">F</option>
146 <option value="G">G</option>
147 <option value="H">H</option>
149 <select name="row" id="row" onchange="paintFence()">
150 <option value="1">1</option>
151 <option value="2">2</option>
152 <option value="3">3</option>
153 <option value="4">4</option>
154 <option value="5">5</option>
155 <option value="6">6</option>
156 <option value="7">7</option>
157 <option value="8">8</option>
159 <select name="direction" id="direction" onchange="paintFence()">
160 <option value="H">${bundle.H}</option>
161 <option value="V">${bundle.V}</option>
163 <input type="submit" value="${bundle.PLACE}" />
165 <form action="/games/${doc.game.id.@id}/move">
166 <input type="hidden" name="type" value="move" readonly="readonly"/>
167 <select id="pdir1" name="direction" onchange="paintPlayer()">
168 <option value="E">${bundle.E}</option>
169 <option value="W">${bundle.W}</option>
170 <option value ="N" <#if doc.game.id.@status = "whiteMove">selected="true"</#if>>${bundle.N}</option>
171 <option value ="S" <#if doc.game.id.@status = "blackMove">selected="true"</#if>>${bundle.S}</option>
173 <select id="pdir2" name="direction-next" onchange="paintPlayer()">
175 <option value="E">${bundle.E}</option>
176 <option value="W">${bundle.W}</option>
177 <option value="N">${bundle.N}</option>
178 <option value="S">${bundle.S}</option>
180 <input type="submit" value="${bundle.MOVE}" />
184 <#if format?? && format = "text">
185 <pre>${textPicture}</pre>
187 <a href="/games/${doc.game.id.@id}?format=small">${bundle.BOARD_SMALL}</a>
188 <a href="/games/${doc.game.id.@id}?format=image">${bundle.BOARD_IMAGE}</a>
190 <#elseif format?? && format = "small">
192 <div style="position: relative; height:180px;">
193 <img style="position: absolute; left: 0; right: 0;"
194 width="180" height="180 "
195 src="/games/${doc.game.id.@id}.png?fieldSize=20<#if doc.game.@currentMove??>&move=${doc.game.@currentMove}</#if>"
196 alt="${bundle.BOARD_TEXT}"
198 <div id="fence" style="position: absolute; visibility: hidden; font-size: 0px;line-height:0px;"></div>
199 <div id="player" style="position: absolute; visibility: hidden; font-size: 0px;line-height:0px;"></div>
202 ${bundle.BOARD_SMALL}
203 <a href="/games/${doc.game.id.@id}?format=image">${bundle.BOARD_IMAGE}</a>
204 <a href="/games/${doc.game.id.@id}?format=text">${bundle.BOARD_TEXT}</a>
206 <div style="position: relative; height:450px;">
207 <img style="position: absolute; left: 0; right: 0;"
208 width="450" height="450"
209 src="/games/${doc.game.id.@id}.png<#if doc.game.@currentMove??>?move=${doc.game.@currentMove}</#if>"
210 alt="${bundle.BOARD_TEXT}"
212 <div id="fence" style="position: absolute; left: 0; right: 0;"></div>
213 <div id="player" style="position: absolute; left: 0; right: 0;"></div>
216 <a href="/games/${doc.game.id.@id}?format=small">${bundle.BOARD_SMALL}</a>
217 ${bundle.BOARD_IMAGE}
218 <a href="/games/${doc.game.id.@id}?format=text">${bundle.BOARD_TEXT}</a>
222 <form action="/games/${doc.game.id.@id}/move">
223 <input type="hidden" name="type" value="resign" readonly="readonly"/>
224 <input type="submit" value="${bundle.RESIGN}" />
228 <#macro printMove item>
229 <#if item.@index = doc.game.@currentMove>
232 <a href="/games/${doc.game.id.@id}?move=${item.@index}">${item.@move}</a>
236 <h3><a href="/openings/${bCode}">${bundle.OPENINGS}</a></h3>
238 <h3><a href="/games/${doc.game.id.@id}?move=0">${bundle.MOVES}</a></h3>
243 <th>${bundle.MOVENUMBER}</th>
244 <th>${doc.game.id.@white}</th>
245 <th>${doc.game.id.@black}</th>
250 <#list doc.game.moves.* as item>
252 <#if item.@index?number % 2 = 1>
253 <#assign index = index + 1>
254 <tr><td>${index}</td><td><@printMove item/></td>
256 <td><@printMove item/></td></tr>
262 <h3>${bundle.TALK}</h3>
265 <#list doc.game.moves.item.comment as item>
266 <li><b>${item.@who}</b>: ${item}</li>
270 <form action="/games/${doc.game.id.@id}/comment">
271 <textarea rows="2" cols="80" name="comment"></textarea>
272 <input type="submit"/>
276 ${bundle("copyright", version)}