forked from loddit/sudoku
/
sudoku.html
174 lines (159 loc) · 3.87 KB
/
sudoku.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<head>
<title>Sudoku</title>
<link href='http://fonts.googleapis.com/css?family=Quantico:700' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<div id="wrapper">
<h1 id="logo">SUDOKU</h1>
<div id="subtitle">
a multiplayer sudoku
<br/>
powered by
<a href="http://meteor.com/" title="Meteor" >Meteor</a>
</div>
{{> game}}
</div>
</body>
<template name="game">
<div id="main">
{{#if ready}}
{{> status}}
{{else}}
<div id="status"></div>
{{/if}}
{{> rows}}
{{> sudoku}}
{{> cols}}
</div>
{{#if ready}}
{{> sidebar}}
{{/if}}
{{> chatroom}}
</template>
<template name="cols">
<ul id="cols">
{{#each numbers}}
{{> position}}
{{/each}}
</ul>
</template>
<template name="rows">
<ul id="rows">
{{#each letters}}
{{> position}}
{{/each}}
</ul>
</template>
<template name="position">
<li>{{valueOf}}</li>
</template>
<template name="status">
<div id="status">
{{#if is_finish}}
<span id="congratulation"> Congratulation!</span>
<div class="hidden">
{{record}}
</div>
{{/if}}
{{#if has_players }}
<div class="hidden">
{{server_time}}
{{start_timer}}
</div>
<span id="timer">{{slogan}}</span><span id="record"></span>
{{else}}
<div class="hidden">
{{load_game_hash}}
{{stop_timer}}
</div>
<span id="waiting">Waiting for players</span>
{{/if}}
<span id="game_id"></span>
</div>
</template>
<template name="sidebar">
<div id="sidebar">
{{> rank}}
{{> dashboard}}
</div>
</template>
<template name="dashboard">
<div id="dashboard">
{{#if has_current_player }}
<form id="restart">
<input type="submit" class="{{#if restarting}}restarting{{/if}}" {{#if disabled}}disabled{{/if}} value="{{#if restarting}}Restarting... {{else}}Restart require {{/if}} {{counter}}/{{condition}}">
</form>
{{else}}
<form id="join">
<input id="name" name="name" value="{{player_name}}" placeholder="Your Name" />
<br/>
<input type="submit" value="Join Game !">
</form>
{{/if}}
<div id="info">
<a href="http://goo.gl/TPSCR" title="how to play">How to play</a>
|
<a href="http://goo.gl/MwCzf" title="游戏说明">游戏说明</a>
</div>
</div>
</template>
<template name="sudoku">
<div id="sudoku">
{{#each grids}}
{{>grid}}
{{/each}}
</div>
</template>
<template name="grid">
<input class='grid {{#if is_error}}error{{/if}}' type="text" pattern="[0-9]*" data-col='{{col}}' data-row='{{row}}' data-block='{{block}}' {{disabled}} value='{{number}}' style="color:{{color}}" maxlength="1" />
</template>
<template name="rank">
{{#if players}}
<table id="rank">
<thead>
<tr>
<td>Player</td>
<td>Score</td>
</tr>
</thead>
<tbody>
{{#each players}}
{{> player}}
{{/each}}
</tbody>
</table>
{{/if}}
</template>
<template name="player">
<tr style="color:{{color}}" class="player {{#if online}}online{{else}}offline{{/if}}">
<td>
{{#if is_current_player}}
<span class="current_player_marker"> > </span>
{{/if}}
{{name}}
</td>
<td>{{score}}</td>
</tr>
</template>
<template name="chatroom">
<div id="chatroom">
<h4>Chatroom:</h4>
{{> say}}
{{#each messages}}
{{> message}}
{{/each}}
</div>
</template>
<template name="message">
<p class="message" style="color:{{player.color}}" >
{{player.name}}: {{content}}
</p>
</template>
<template name="say">
<form id="say">
{{#if has_current_player }}
<input id="content" name="content" value="" placeholder="Send message"/>
{{/if}}
</form>
</template>