-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjeopardy.xsl
241 lines (205 loc) · 8.47 KB
/
jeopardy.xsl
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="utf-8" indent="yes" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>JEOPARDY!</title>
<style>
:root {
--grades: <xsl:value-of select="count(/jeopardy/points)"/>;
--categories: <xsl:value-of select="count(/jeopardy/category)"/>;
--header_height: 5%;
}
</style>
<script>
<!-- for XSLT 2 this could be simple, but this is for XSLT 1.0: -->
<xsl:variable name="max_points">
<xsl:for-each select="/jeopardy/points">
<xsl:sort select="." data-type="number" order="descending"/>
<xsl:if test="position() = 1"><xsl:value-of select="." /></xsl:if>
</xsl:for-each>
</xsl:variable>
var max_points = <xsl:copy-of select="$max_points" />
</script>
<link rel="stylesheet" href="jeopardy.css"/>
<script src="jquery.min.js"></script>
<script src="jeopardy.js" ></script>
<script type="text/javascript" src="confetti.js"></script>
<script type="text/javascript" src="gamepadtest.js"></script>
</head>
<body onload="init();">
<div id="gameplay">
<table id="tableau">
<tr class="table-row" >
<td>
<!-- give the surrounding tag an attribute:-->
<xsl:attribute name="colspan">
<xsl:value-of select="count(/jeopardy/category)"/>;
</xsl:attribute>
<table id="title-tableau">
<tr class="table-row" id="categories">
<xsl:for-each select="/jeopardy/category">
<th class="table-cell">
<xsl:value-of select="@title" />
</th>
</xsl:for-each>
</tr>
</table>
</td>
</tr>
<xsl:for-each select="/jeopardy/points">
<tr class="table-row" id="question-row">
<!--
Now put the points value into a variable, in order to be
able to access it inside the inner nested for-each
-->
<xsl:variable name="points">
<xsl:value-of select="./text()"/>
</xsl:variable>
<xsl:variable name="ipoints">
<xsl:number />
</xsl:variable>
<xsl:for-each select="/jeopardy/category">
<td class="table-cell">
<!-- give the surrounding tag an attribute:-->
<xsl:attribute name="data-points">
<xsl:copy-of select="$points" />
</xsl:attribute>
<div class="points"><xsl:copy-of select="$points" /></div>
<div class="clue">
<xsl:copy-of select="riddle[0 + $ipoints]/clue/node()"/>
</div>
<div class="solution">
<xsl:copy-of select="riddle[0 + $ipoints]/solution/node()"/>
</div>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</div>
<div id="daily-double-modal" class="modal-wrapper">
<h1>Double Jeopardy!</h1>
<p>
Einsatz:
<span id="daily-double-amount" contenteditable="true">999</span>
</p>
<div id="daily-double-team">
</div>
</div>
<div class="symbol-box">
</div>
<div id="teams-modal" class="modal-wrapper">
<div class="team solved-by-team-1" id="team1">
<h3 class="name" contenteditable="true">Team 1</h3>
<h3 class="score" contenteditable="true">0</h3>
<div class="score-control">
<span class="plus">+</span>
<span class="minus">-</span>
</div>
</div>
<div class="team solved-by-team-2" id="team2">
<h3 class="name" contenteditable="true">Team 2</h3>
<h3 class="score" contenteditable="true">0</h3>
<div class="score-control">
<span class="plus">+</span>
<span class="minus">-</span>
</div>
</div>
<div class="team solved-by-team-3" id="team3">
<h3 class="name" contenteditable="true">Team 3</h3>
<h3 class="score" contenteditable="true">0</h3>
<div class="score-control">
<span class="plus">+</span>
<span class="minus">-</span>
</div>
</div>
<div class="team solved-by-team-4" id="team4">
<h3 class="name" contenteditable="true">Team 4</h3>
<h3 class="score" contenteditable="true">0</h3>
<div class="score-control">
<span class="plus">+</span>
<span class="minus">-</span>
</div>
</div>
<div class="team solved-by-team-5" id="team5">
<h3 class="name" contenteditable="true">Team 5</h3>
<h3 class="score" contenteditable="true">0</h3>
<div class="score-control">
<span class="plus">+</span>
<span class="minus">-</span>
</div>
</div>
<div class="team solved-by-team-6" id="team6">
<h3 class="name" contenteditable="true">Team 6</h3>
<h3 class="score" contenteditable="true">0</h3>
<div class="score-control">
<span class="plus">+</span>
<span class="minus">-</span>
</div>
</div>
</div>
<div id="riddle-modal" class="modal-wrapper">
<table id="riddle-modal-table">
<tr id="riddle-title">
<td id="category-points-title"></td>
<td id="continue-button">Zurück <kbd>ESC</kbd></td>
<td id="solution-button">
Lösung zeigen <kbd>Leertaste</kbd>.
Werten für <kbd>1</kbd> <kbd>2</kbd> ...
+<kbd>Ctrl</kbd> für Abzug.
</td>
</tr>
<tr>
<td class="riddle-inner" colspan="3">
</td>
</tr>
</table>
</div>
<div id="category-intro-modal" class="modal-wrapper">
</div>
<div id="winner-modal" class="modal-wrapper">
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none meet" viewBox="0 -30 300 300" id="podium">
<polygon points="0,300 300,300 300,200 200,200 200,0 100,0 100,100 0,100" id="podium-front" />
<polygon points="0,100 100,100 100,70 30,70" id="podium-platform" />
<polygon points="100,0 200,0 175,-30 125,-30" id="podium-platform" />
<polygon points="300,200 200,200 200,170 270,170" id="podium-platform" />
</svg>
<div id="winner-team-rank1"><h1 style="color:white;">Rank1</h1></div>
<div id="winner-team-rank2"><h1 style="color:white;">Rank2</h1></div>
<div id="winner-team-rank3"><h1 style="color:white;">Rank3</h1></div>
<canvas id="confetti" width="1" height="1"></canvas>
</div>
<div id="options-modal" class="modal-wrapper">
<div>
<h1>JEOPARDY!</h1>
<p>
<select>
<option value="1">1 Team</option>
<option value="2">2 Teams</option>
<option value="3">3 Teams</option>
<option value="4" selected="true">4 Teams</option>
<option value="5">5 Teams</option>
<option value="6">6 Teams</option>
</select>
<input class="submit" type="button" id="submit" value="Anwenden" onclick="modal.hideOptions()" />
<script>
if(window.navigator.platform.indexOf("Mac") == 0){
$('#fullscreen, #mac').show();
} else if(window.navigator.platform.indexOf("Win") == 0){
$('#fullscreen, #windows').show();
}
</script>
</p>
</div>
</div>
<div id="player-color-visualisation">
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>