-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
228 lines (224 loc) · 10.1 KB
/
index.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
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
<!DOCTYPE html>
<html lang="pl" data-bs-theme="dark">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Skat</title>
<link rel="stylesheet" href="bootstrap.min.css" type="text/css" />
<style type="text/css">
@font-face {
font-family: 'Card Characters';
src: url("card.ttf");
}
@font-face {
font-family: 'Capsa';
font-style: normal;
src: url("Capsa-Roman.otf");
}
@font-face {
font-family: 'Capsa';
font-style: italic;
src: url("Capsa-Italic.otf");
}
* {
font-family: 'Capsa';
}
.card-text {
font-family: 'Card Characters';
font-size: 36px;
}
.card-text-red {
color: #ff0000;
}
#step-1, #step-2, #step-3, #step-4 {
font-size: 20px;
}
</style>
</head>
<body class="d-flex flex-column min-vh-100">
<main role="main" class="container">
<div id="step-1">
<!--p class="card-text card-text-red">{}[] HSDC</p-->
<div class="d-flex justify-content-center" style="margin-bottom: 10px; margin-top: 30px;">
<input type="checkbox" class="btn-check" id="i-jc" />
<label class="btn card-text" for="i-jc">J]</label>
<input type="checkbox" class="btn-check" id="i-js" />
<label class="btn card-text" for="i-js">J}</label>
<input type="checkbox" class="btn-check" id="i-jh" />
<label class="btn card-text card-text-red" for="i-jh">J{</label>
<input type="checkbox" class="btn-check" id="i-jd" />
<label class="btn card-text card-text-red" for="i-jd">J[</label>
</div>
<div class="d-flex justify-content-center">
<input type="checkbox" class="btn-check" id="i-a" />
<label class="btn card-text" for="i-a">A</label>
<input type="checkbox" class="btn-check" id="i-t" />
<label class="btn card-text" for="i-t">=</label>
<input type="checkbox" class="btn-check" id="i-k" />
<label class="btn card-text" for="i-k">K</label>
<input type="checkbox" class="btn-check" id="i-q" />
<label class="btn card-text" for="i-q">Q</label>
<input type="checkbox" class="btn-check" id="i-9" />
<label class="btn card-text" for="i-9">9</label>
<input type="checkbox" class="btn-check" id="i-8" />
<label class="btn card-text" for="i-8">8</label>
<input type="checkbox" class="btn-check" id="i-7" />
<label class="btn card-text" for="i-7">7</label>
</div>
</div>
<div id="step-2" style="display: none; margin-top: 30px;" class="text-center">
<input class="form-check-input" type="radio" name="suit" id="s-gr" checked="checked" />
<label class="form-check-label" for="s-gr">Grand</label><br /><br />
<input class="btn-check" type="radio" name="suit" id="s-c" />
<label class="btn card-text" for="s-c">]</label>
<input class="btn-check" type="radio" name="suit" id="s-s" />
<label class="btn card-text" for="s-s">}</label>
<input class="btn-check" type="radio" name="suit" id="s-h" />
<label class="btn card-text card-text-red" for="s-h">{</label>
<input class="btn-check" type="radio" name="suit" id="s-d" />
<label class="btn card-text card-text-red" for="s-d">[</label>
</div>
<div id="step-3" style="display: none; margin-top: 30px;" class="text-center">
<input class="form-check-input" type="checkbox" value="" id="a-h" onchange="handChange();" />
<label class="form-check-label" for="a-h">z ręki</label><br />
<input class="form-check-input" type="checkbox" value="" id="a-schneider-a" onchange="scaChange();" />
<label class="form-check-label" for="a-schneider-a">schneider (≤ 30 pkt.) ogłoszony</label><br />
<input class="form-check-input" type="checkbox" value="" id="a-schwarz-a" onchange="saChange();" />
<label class="form-check-label" for="a-schwarz-a">schwarz (bez lew) ogłoszony</label><br />
<input class="form-check-input" type="checkbox" value="" id="a-ouvert" disabled="" />
<label class="form-check-label" for="a-ouvert"><i>ouvert</i></label>
<hr />
<input class="form-check-input" type="checkbox" value="" id="a-schneider" />
<label class="form-check-label" for="a-schneider">schneider (≤ 30 pkt.)</label><br />
<input class="form-check-input" type="checkbox" value="" id="a-schwarz" onchange="sChange();" />
<label class="form-check-label" for="a-schwarz">schwarz (bez lew)</label><br />
</div>
<div id="step-4" style="display: none; margin-top: 30px;" class="text-center">
<p>Wynik:</p><span id="score" style="font-size: 64px;">324</span>
</div>
</main>
<footer class="fixed-bottom" style="margin-bottom: 10px;">
<div class="container">
<button style="width: 50%;" class="btn btn-outline" onclick="prevStep();">← Wróć</button><button style="width: 50%;" class="btn btn-outline" onclick="nextStep();">Dalej →</button>
</div></footer>
<script src="bootstrap.bundle.min.js" type="text/javascript"></script>
<script type="text/javascript">
var step = 1, Trumps = ["i-jc", "i-js", "i-jh", "i-jd", "i-a", "i-t", "i-k", "i-q", "i-9", "i-8", "i-7"];
function g(x) { return document.getElementById(x); }
function ic(x) { return g(x).checked; }
function c(x) { g(x).checked = true; }
function u(x) { g(x).checked = false; }
function d(x) { g(x).disabled = true; }
function ud(x) { u(x); d(x); }
function e(x) { g(x).disabled = false; }
function cd(x) { c(x); d(x); }
function hide(element) {
g(element).style.display = "none";
}
function processStep() {
if (step == 1) {
hide("step-2");
hide("step-3");
g("step-1").style.display = "";
hide("step-4");
} else if (step == 2) {
hide("step-1");
hide("step-3");
g("step-2").style.display = "block";
hide("step-4");
} else if (step == 3) {
hide("step-1");
hide("step-2");
g("step-3").style.display = "block";
hide("step-4");
} else if (step == 4) {
hide("step-1");
hide("step-2");
hide("step-3");
g("step-4").style.display = "block";
}
}
function prevStep() {
if (step != 1) {
step--;
processStep();
}
}
function nextStep() {
if (step != 4) {
step++;
processStep();
}
if (step == 4)
calculate();
}
function handChange() {
if (!ic("a-h")) {
ud("a-schneider-a");
ud("a-schwarz-a");
ud("a-ouvert");
} else {
e("a-schneider-a");
e("a-schwarz-a");
e("a-ouvert");
}
scaChange();
saChange();
sChange();
}
function saChange() {
if (ic("a-schwarz-a")) {
cd("a-schneider-a");
cd("a-schneider");
cd("a-schwarz");
e("a-ouvert");
} else {
if (ic("a-h"))
e("a-schneider-a");
e("a-schneider");
e("a-schwarz");
d("a-ouvert");
}
}
function sChange() {
if (ic("a-schwarz"))
cd("a-schneider");
else
e("a-schneider");
}
function scaChange() {
if (ic("a-schneider-a"))
cd("a-schneider");
else
e("a-schneider");
}
function calculate() {
var score = 1;
for (i = 0; i < 11; i++) {
if (ic(Trumps[i])) score++;
else break;
}
if (!ic("i-jc")) {
score++;
for (i = 1; i < 11; i++) {
if (!ic(Trumps[i])) score++;
else break;
}
}
if (ic("a-h")) score++;
if (ic("a-schneider")) score++;
if (ic("a-schwarz")) score++;
if (ic("a-schneider-a")) score++;
if (ic("a-schwarz-a")) score++;
if (ic("a-ouvert")) score++;
if (ic("s-c")) score *= 12;
else if (ic("s-s")) score *= 11;
else if (ic("s-h")) score *= 10;
else if (ic("s-d")) score *= 9;
else if (ic("s-gr")) score *= 24;
g("score").innerText = score.toString();
}
handChange();
</script>
</body>
</html>