-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreversi.html
127 lines (123 loc) · 3.36 KB
/
reversi.html
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
<head>
<title>reversi</title>
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="#">Reversi</a>
<ul class="nav pull-right">
<li>{{loginButtons align="right"}}</li>
</ul>
</div>
</div>
<div>
{{> board}}
{{> gameStatus}}
{{> gameControls}}
</div>
</body>
<template name="board">
<div id="grid"></div>
</template>
<template name="gameStatus">
{{# if showStatus }}
{{#if status.results }}
<p class={{status.mood}}>{{status.results}}</p>
{{/if}}
<div class="row">
<div class="span2 text-center">
{{#if status.darkMove }}
<div style="border: dashed 1px red; border-radius: 10px;">
{{else}}
<div style="border: dashed 1px white; border-radius: 10px;">
{{/if}}
<p class="lead">
<svg width="24" height="24">
<circle cx="12" cy="12" r="10" fill="black" stroke="black" stroke-width="2"/>
</svg>
{{ status.darkScore }}
</p>
<span class="label label-inverse">
{{ status.darkPlayer }}
</span>
</div>
</div>
<div class="span2 text-center">
{{#if status.lightMove }}
<div style="border: dashed 1px red; border-radius: 10px;">
{{else}}
<div style="border: dashed 1px white; border-radius: 10px;">
{{/if}}
<p class="lead">
<svg width="24" height="24">
<circle cx="12" cy="12" r="10" fill="white" stroke="blue" stroke-width="2"/>
</svg>
{{ status.lightScore }}
</p>
<span class="label label-info">
{{ status.lightPlayer }}
</span>
</div>
</div>
</div>
{{/if}}
</template>
<template name="gameControls">
<br />
<div class="row">
<div class="span5">
{{#if loggedIn }}
{{#if inGame}}
{{#if afterGame}}
<button type="button" class="btn btn-success" id="closeGame">Quit game</button>
{{else}}
<button type="button" class="btn btn-danger" id="giveUpButton">Give up</button>
{{/if}}
{{else}}
{{#if askedForAcceptance}}
<form class="form-horizontal" id="askedToPlay">
<legend>Asked to play with</legend>
<div class="control-group">
<select>
{{#each askedForAcceptance}}
<option>{{ this }}</option>
{{/each}}
</select>
<button type="button" class="btn btn-success" id="acceptGame">Ok, go!</button>
</div>
</form>
{{/if}}
{{#if noGame}}
<form class="form-horizontal" id="createGame">
<legend>Create game</legend>
<div class="control-group">
<select>
<option selected disabled>Select an opponent</option>
{{#each opponents }}
<option>{{ this }}</option>
{{/each}}
</select>
</div>
<div class="control-group">
<button type="button" class="btn btn-inverse" id="playForDark">Play for dark side</button>
<button type="button" class="btn btn-default" id="playForLight">Play for light side</button>
</div>
</form>
{{else}}
{{#if waitingAcceptance}}
<div class="well">
<p class="text-info">
Waiting for acceptance by <strong>{{ waitingAcceptance.opponent }}</strong>
</p>
<button type="button" class="btn btn-danger" id="cancelWaiting">Cancel</button>
</div>
{{/if}}
{{/if}}
{{/if}}
{{else}}
Log in to play!
{{/if}}
</div>
</div>
</template>