-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
346 lines (253 loc) · 10.1 KB
/
index.php
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Two rooms and a boom wizard</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
.red{
background-color: #ffaa99;
}
.blue{
background-color: #99f4ff;
}
.gray{
background-color: #ccc;
}
.purple{
background-color: #cc99ff;
}
.green{
background-color: #72b272;
}
#result{
min-height: 400px;
}
</style>
<script>
function SetGame(number){
switch( number){
case 'sm1':
$('#lessten .toggle').prop('checked', false).change();
$('#bury').prop('checked', true).change();
break;
case 'sm2':
$('#lessten .toggle').prop('checked', false).change();
$('#extra').prop('checked', true).change();
break;
case 'md1':
$('#moreten .toggle').prop('checked', false).change();
$('#spy').prop('checked', true).change();
$('#agent').prop('checked', true).change();
break;
case 'md2':
$('#moreten .toggle').prop('checked', false).change();
$('#secondary').prop('checked', true).change();
$('#privatewin').prop('checked', true).change();
break;
case 'md3':
$('#moreten .toggle').prop('checked', false).change();
$('#cardswap').prop('checked', true).change();
$('#instantwins').prop('checked', true).change();
break;
case 'md4':
$('#moreten .toggle').prop('checked', false).change();
$('#spy').prop('checked', true).change();
$('#agent').prop('checked', true).change();
$('#reveal').prop('checked', true).change();
break;
case 'lg1':
$('#more15 .toggle').prop('checked', false).change();
$('#enemies').prop('checked', true).change();
$('#friends').prop('checked', true).change();
break;
case 'lg2':
$('#more15 .toggle').prop('checked', false).change();
$('#leeches').prop('checked', true).change();
$('#haters').prop('checked', true).change();
break;
case 'lg3':
$('#more15 .toggle').prop('checked', false).change();
$('#leeches').prop('checked', true).change();
$('#haters').prop('checked', true).change();
$('#enemies').prop('checked', true).change();
$('#friends').prop('checked', true).change();
break;
}
UpdateForm();
}
function UpdateForm(){
if ( $("#players option:selected").val() < 10){
$("#moreten").css('display', 'none');
}
else{
$("#moreten").css('display', 'block');
}
if ( $("#players option:selected").val() < 15){
$("#more15").css('display', 'none');
}
else{
$("#more15").css('display', 'block');
}
if ( $("#firstgame").prop('checked')){
$("#advancedcardsblock").css('display', 'none');
}
else{
$("#advancedcardsblock").css('display', 'block');
}
$("#result").html("Loading...");
var data = $("#form").serializeArray();
$.post( "data.php", { action: "json", formdata: data } )
.done(function( data ) {
$("#result").html(data);
});
}
</script>
</head>
<body>
<?
/**
* This function output a yes/no toggle for selecting cards
* @param [type] $label [description]
* @param [type] $field [description]
* @param string $default [description]
* @param string $additional [description]
* @return [type] [description]
*/
function yesnotoggle($label, $field, $default = 'yes', $additional = ''){
$content = '<div class="form-group">
<label class="col-sm-2 col-md-2 control-label">'.$label.'</label>
<div class="col-sm-1 col-md-1">
<input type="checkbox" class="toggle" data-toggle="toggle" name="'.$field.'" id="'.$field.'" onChange="UpdateForm(); return false;">';
$content .= '
</div>';
if ( $additional){
$content .= '<div class="col-sm-4 col-md-2">'. $additional . '</div>';
}
$content .= '</div>
';
return $content;
}
?>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h1>Two rooms and a boom card wizard</h1>
<p>You can use this simple wizard to help you pick which cards to use in your <a href="http://www.tuesdayknightgames.com/tworoomsandaboom" target="_blank">Two Rooms and a boom</a> games</p>
<form class="form-horizontal" id="form">
<? ####################### number of players ########################## ?>
<div class="form-group">
<label class="col-sm-2 col-md-2 control-label">Number of Players:</label>
<div class="col-sm-2 col-md-1">
<select class="form-control" name="players" id="players" onChange="UpdateForm();">
<?php
for( $i = 6; $i <= 30; $i++){
echo '<option value="'.$i.'">'.$i.' players</option>';
}
?>
</select>
</div>
</div>
<?
echo yesnotoggle('First Game:', 'firstgame');
echo '<div style="display: none;" id="advancedcardsblock">';
echo '
<div class="panel panel-default" id="lessten">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">Base Options</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse">
<div class="panel-body">';
echo '<p>Pre-Set Games: ';
echo '<a href="#" onClick="SetGame(\'sm1\'); return false;" class="btn btn-primary">Bury</a> ';
echo '<a href="#" onClick="SetGame(\'sm2\'); return false;" class="btn btn-primary">Extra Conditions</a>';
echo '</p>';
echo yesnotoggle('Bury a card:', 'bury', 'no', 'Will add alternates');
echo yesnotoggle('Drunk:', 'drunk', 'no', 'Will add 1 additional card');
echo yesnotoggle('Extra conditions:', 'extra', 'no', 'Will add Doctor/Engineer');
echo ' </div>
</div>
</div>';
echo '<div style="display: none;" id="moreten">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse10">Recommended for 10 players or more</a>
</h4>
</div>
<div id="collapse10" class="panel-collapse collapse">
<div class="panel-body">';
echo '<p>Pre-Set Games: ';
echo '<a href="#" onClick="SetGame(\'md1\'); return false;" class="btn btn-primary">Privacy Pack</a> ';
echo '<a href="#" onClick="SetGame(\'md2\'); return false;" class="btn btn-primary">Special Wins</a> ';
echo '<a href="#" onClick="SetGame(\'md3\'); return false;" class="btn btn-primary">Share Surprises</a> ';
echo '<a href="#" onClick="SetGame(\'md4\'); return false;" class="btn btn-primary">Psychological Game (16 players min)</a>';
echo '</p>';
echo yesnotoggle('Zombie:', 'zombie', 'no');
echo yesnotoggle('Spy and Coy:', 'spy', 'no');
echo yesnotoggle('Agent and Shy guy:', 'agent', 'no');
echo yesnotoggle('Ambassadors:', 'ambassadors', 'no');
echo yesnotoggle('Traveling Goals:', 'traveling', 'no', 'Will add Agoraphobe/Traveller');
echo yesnotoggle('instant wins:', 'instantwins', 'no', 'Will add Dr. Boom/Tuesday Knight');
echo yesnotoggle('Secondary Win:', 'secondary', 'no', 'Will add Bomb-bot/Queen');
echo yesnotoggle('Private Win:', 'privatewin', 'no', 'Will add Clone/Robot');
echo yesnotoggle('Relationship Cards:', 'relationship', 'no', 'Will add Cupid/Eris');
echo yesnotoggle('Reveal Pack:', 'reveal', 'no', 'Will add Criminal, Dealer and Psychologists');
echo yesnotoggle('Card Swap:', 'cardswap', 'no', 'Will add Hot Potato/Leprechaun');
echo ' </div>
</div>
</div>';
echo '</div>';
echo '<div style="display: none;" id="more15">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse15">Recommended for 15 players or more</a>
</h4>
</div>
<div id="collapse15" class="panel-collapse collapse">
<div class="panel-body">';
echo '<p>Pre-Set Games: ';
echo '<a href="#" onClick="SetGame(\'lg1\'); return false;" class="btn btn-primary">Dual Pairs</a> ';
echo '<a href="#" onClick="SetGame(\'lg2\'); return false;" class="btn btn-primary">Leeches and Haters</a> ';
echo '<a href="#" onClick="SetGame(\'lg3\'); return false;" class="btn btn-primary">Super Gray</a> ';
echo '</p>';
echo yesnotoggle('Leeches:', 'leeches', 'no', 'Will add Intern/Victim');
echo yesnotoggle('Haters:', 'haters', 'no', 'Will add Rival/Survivor');
echo yesnotoggle('Pairs of Enemies:', 'enemies', 'no', 'Will add Wife/Mistress and Moby/Ahab');
echo yesnotoggle('Pairs of Friends:', 'friends', 'no', 'Will add Romeo/Juliet, Butler/Maid');
echo ' </div>
</div>
</div>';
////////////////////////////////////////////////////////////
echo '</div>';
?>
</div>
</div>
</div>
<div class="row" ><div class="col-sm-12" id="result">
</div>
</div>
<p>This page was made by <a href="http://www.frenette.info" target="_blank">Martin-Pierre Frenette</a>, in two hours on May 30th and 31st 2016. No data is saved anywhere other than in the access logs.</p>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
<script>UpdateForm();</script>
</body>
</html>